Skip to content

Commit

Permalink
Add exrtinsic to update member in liquidity pools
Browse files Browse the repository at this point in the history
  • Loading branch information
sophialittlejohn committed Aug 23, 2023
1 parent 4777512 commit 81f359c
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions onboarding-api/src/utils/networks/centrifuge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,38 @@ export const addCentInvestorToMemberList = async (wallet: Request['wallet'], poo
{ Pool: poolId },
{ PoolRole: { TrancheInvestor: [trancheId, OneHundredYearsFromNow] } }
)
const proxiedSubmittable = api.tx.proxy.proxy(pureProxyAddress, undefined, submittable)
const batchSubmittable = [proxiedSubmittable]
// give the investor PODReadAccess if they issuer enabled it
if (!hasPodReadAccess && metadata?.onboarding?.podReadAccess) {
const podSubmittable = api.tx.permissions.add(
{ PoolRole: 'InvestorAdmin' },
walletAddress,
{ Pool: poolId },
{ PoolRole: 'PODReadAccess' }
)
const proxiedSubmittable = api.tx.proxy.proxy(pureProxyAddress, undefined, submittable)
const proxiedPodSubmittable = api.tx.proxy.proxy(pureProxyAddress, undefined, podSubmittable)
const batchSubmittable = api.tx.utility.batchAll([proxiedPodSubmittable, proxiedSubmittable])
return batchSubmittable.signAndSend(signer)
batchSubmittable.push(proxiedPodSubmittable)
}
const proxiedSubmittable = api.tx.proxy.proxy(pureProxyAddress, undefined, submittable)
return proxiedSubmittable.signAndSend(signer)
// add investor to liquidity pools if they are investing on any domain other than centrifuge
if (wallet.network === 'evm') {
console.log('submitting updateMember extrinsic')
const updateMemberSubmittable = api.tx.connectors.updateMember(
poolId,
trancheId,
{
EVM: [wallet.chainId, wallet.address],
},
OneHundredYearsFromNow
)
const proxiedUpdateMemberSubmittable = api.tx.proxy.proxy(
pureProxyAddress,
undefined,
updateMemberSubmittable
)
batchSubmittable.push(proxiedUpdateMemberSubmittable)
}
return api.tx.utility.batchAll(batchSubmittable).signAndSend(signer)
}),
combineLatestWith(api),
takeWhile(([{ events, isFinalized }, api]) => {
Expand Down

0 comments on commit 81f359c

Please sign in to comment.