-
Notifications
You must be signed in to change notification settings - Fork 9
add multisig proxy example #525
Comments
Hi @ryanleecode! We are trying to model the multisig/proxy flow using CAPI. Would be great to get some help on it! DiagramPseudo code// 1. Create pure proxies by Alice
const stashProxy = await ALICE.proxy.createPure().signAndSend()
const aliceProxy = await ALICE.proxy.createPure().signAndSend()
const bobProxy = await ALICE.proxy.createPure().signAndSend()
const charlieProxy = await ALICE.proxy.createPure().signAndSend()
// 2. Get multisig address
const MULTISIG = Rune
.resolve({
signatories: [aliceProxy, bobProxy, charlieProxy],
threshold: 2,
})
.as(MultisigRune, client)
// 3. Top up proxies and multisig
await Balances
.transfer({
value: 2_000_000_000_000n,
dest: MultiAddress.Id(MULTISIG.address),
})
.signed({ sender: ALICE })
.sent()
.logStatus("Existential deposit:")
.finalized()
.run()
await Balances
.transfer({
value: 2_000_000_000_000n,
dest: stashProxy,
})
.signed({ sender: ALICE })
.sent()
.logStatus("Existential deposit:")
.finalized()
.run()
// ... repeat for: aliceProxy, bobProxy, charlieProxy
// 4. Set up proxies according to the diagram
await ALICE.proxy(stashProxy).addProxy(MULTISIG).signAndSend()
await ALICE.proxy(bobProxy).addProxy(BOB).signAndSend()
await ALICE.proxy(charlieProxy).addProxy(CHARLIE).signAndSend()
await ALICE.proxy(stashProxy).removeProxy(ALICE).signAndSend()
await ALICE.proxy(bobProxy).removeProxy(ALICE).signAndSend()
await ALICE.proxy(charlieProxy).removeProxy(ALICE).signAndSend()
// 5. Perform voting
// The to-be proposed and approved call
const sendFundsToDaveFromStashProxy = MULTISIG.proxy(stashProxy).extrinsic(
Balances.transferKeepAlive({
dest: DAVE.address,
value: 1_230_000_000_000n,
})
)
// Submit a proposal to dispatch the call
await MULTISIG
.ratify({ call: sendFundsToDaveFromStashProxy, sender: aliceProxy })
.signed({ sender: ALICE.proxy(aliceProxy)
.sent()
.logStatus("Proposal:")
.finalized()
.run()
// Send the approve and execute if final approval
await MULTISIG
.ratify({ call: sendFundsToDaveFromStashProxy, sender: charlieProxy })
.signed({ sender: CHARLIE.proxy(charlieProxy)})
.sent()
.logStatus("Approval:")
.finalized()
.run()
// Dave received funds from STASH
console.log("Dave final balance:", await System.Account.entry([DAVE.publicKey]).run()) // await getBalance(DAVE) ? Extrinsics
Polkadot.js app (visualisation) |
I'll try to describe the flow we're trying to achieve with API. Alice wants to configure the future multisig by adding Bob and Charlie as signatories with proxies and setting a signatory threshold. Alice wants to create Pure Proxy that will become the "stash" in the multisig setup and attach the multisig setup to the stash. (check the Diagram above) In that case Alice has to create 4 pure proxies: It will be awesome if we introduce batch transaction to reduce the amount of Alice's signs. First Alice construct a list of proxies to batch
Then Alice can create a multisig
Then Alice can top up all created proxies at once
Now Alice could assign proxies according to the diagram
Then Alice could unregister a proxy account.
We could make additional funds transfer into the multisig account And the Bob (or anyone else) through his proxy could submit a proposal to dispatch the call from multsig
and then we could initialize rest multisig flow (details are here
Overall:This flow is similar to the @tamrai's flow. The only principal difference is that we need to use batch calls whenever we could because current scenario will require around ~14 approvals from Alice and that might be a bit boring process from UI perspective. Using |
@karl-kallavus is it possible to send funds to all pure-proxy accounts and multisig all at once, like on the diagram below? See number 4. |
Great! I wanted to keep it simple at the beginning as a Capi example, but batch transactions are definitely something desired especially from the UX perspective! @Goranch3 Yes. We can send same existential deposits to proxies and maybe a more configured deposit to the Stash (bank). |
@ryanleecode not sure this is true. a pureProxy address should behave the same way as any other address, meaning if you send funds to it after it was reaped it should be restored on-chain |
yeah forget what i said. just a bug on myside 😄 |
What is the point of |
IIRC |
closed by #661 |
Add an example that utilizes a mutlisig behind a proxy. the example should be able to change who can access the proxy and thus also access the mutlisg.
The text was updated successfully, but these errors were encountered: