Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Commit

Permalink
fix: virtual multisig
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanleecode committed Mar 9, 2023
1 parent dca6dd5 commit 5594f9f
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions patterns/multisig/VirtualMultisigRune.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,29 @@ export class VirtualMultisigRune<out U, out C extends Chain = Chain>
.dbgStatus("Existential deposits:")
.finalized()

const ownershipSwapCalls2 = Rune
.tuple([deployer, memberAccountIds, memberProxies, stashProxy, multisig.address])
.map(([deployer, memberAccountIds, memberProxies, stashProxy, multisigAddress]) =>
Rune.array([
...replaceDelegateCalls(
chain,
MultiAddress.Id(stashProxy),
deployer.address,
multisigAddress,
),
...memberProxies.flatMap((proxy, i) =>
replaceDelegateCalls(
chain,
MultiAddress.Id(proxy),
deployer.address,
MultiAddress.Id(memberAccountIds[i]!),
)
),
])
)
.into(MetaRune)
.flat()

const ownershipSwapCalls = Rune
.tuple([deployer, memberAccountIds, memberProxies, stashProxy, multisig.address])
.map(([deployer, memberAccountIds, memberProxies, stashProxy, multisigAddress]) =>
Expand All @@ -231,8 +254,16 @@ export class VirtualMultisigRune<out U, out C extends Chain = Chain>
),
// TODO: ensure that this supports other address types / revisit source of deployer accountId
...memberProxies
.filter((_, i) => !equals(memberAccountIds[i]!, deployer.address.value!))
.flatMap((proxy, i) =>
.map((proxy, i) => [proxy, i] as const)
.filter(([_, i]) => {
console.log(
hex.encode(memberAccountIds[i]!),
hex.encode(deployer.address.value!),
!equals(memberAccountIds[i]!, deployer.address.value!),
)
return !equals(memberAccountIds[i]!, deployer.address.value!)
})
.flatMap(([proxy, i]) =>
replaceDelegateCalls(
chain,
MultiAddress.Id(proxy),
Expand Down

0 comments on commit 5594f9f

Please sign in to comment.