From 45ad2e93bab7735932aa6fac4f25cf2c59df60f4 Mon Sep 17 00:00:00 2001 From: Jeroen Offerijns Date: Fri, 20 Dec 2024 13:10:57 +0100 Subject: [PATCH 1/4] Fix reserve value in NAV management --- .../src/pages/NavManagement/NavManagementAssetTable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx b/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx index 078dc5f63..7468745b8 100644 --- a/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx +++ b/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx @@ -162,7 +162,7 @@ export function NavManagementAssetTable({ poolId }: { poolId: string }) { { assetId: '0', name: 'Onchain reserve', - quantity: pool.nav.reserve.toString(), + quantity: pool.reserve.total.toString(), price: CurrencyBalance.fromFloat(1, pool.currency.decimals).toString(), }, { From 8d32b1e1f09171da377cf0a9e4d01fafabfa2824 Mon Sep 17 00:00:00 2001 From: Jeroen Offerijns Date: Fri, 20 Dec 2024 13:29:17 +0100 Subject: [PATCH 2/4] Fix remark attestation content --- .../src/pages/NavManagement/NavManagementAssetTable.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx b/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx index 7468745b8..09649d9ed 100644 --- a/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx +++ b/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx @@ -258,7 +258,10 @@ export function NavManagementAssetTable({ poolId }: { poolId: string }) { return api.tx.oraclePriceFeed.feed(feed, CurrencyBalance.fromFloat(f.value, 18)) }), api.tx.oraclePriceCollection.updateCollection(poolId), - api.tx.remarks.remark([{ Named: attestationHash }], api.tx.loans.updatePortfolioValuation(poolId)), + api.tx.remarks.remark( + [{ Named: `attestation:${poolId}:${attestationHash}` }], + api.tx.loans.updatePortfolioValuation(poolId) + ), api.tx.utility.batch(updateTokenPricesTxs), ] From 2b7fba124ef5c31e031e3860a6e7fa503e97d36e Mon Sep 17 00:00:00 2001 From: Jeroen Offerijns Date: Fri, 20 Dec 2024 13:37:00 +0100 Subject: [PATCH 3/4] Add signature type --- .../src/pages/NavManagement/NavManagementAssetTable.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx b/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx index 09649d9ed..e392e9b5d 100644 --- a/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx +++ b/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx @@ -200,7 +200,7 @@ export function NavManagementAssetTable({ poolId }: { poolId: string }) { }, } - let signature: { hash: string; publicKey: string } | null = null + let signature: { hash: string; publicKey: string; type: 'evm' | 'substrate' } | null = null try { const message = JSON.stringify(attestation.portfolio) if (provider) { @@ -208,7 +208,7 @@ export function NavManagementAssetTable({ poolId }: { poolId: string }) { const sig = await signer.signMessage(message) const hash = keccak256(toUtf8Bytes(`\x19Ethereum Signed Message:\n${message.length}${message}`)) const recoveredPubKey = SigningKey.recoverPublicKey(hash, sig) - signature = { hash: sig, publicKey: recoveredPubKey } + signature = { hash: sig, publicKey: recoveredPubKey, type: 'evm' } } else if (substrate.selectedAccount?.address && substrate?.selectedWallet?.signer?.signRaw) { const { address } = substrate.selectedAccount const { signature: sig } = await substrate.selectedWallet.signer.signRaw({ @@ -216,12 +216,13 @@ export function NavManagementAssetTable({ poolId }: { poolId: string }) { data: stringToHex(message), type: 'bytes', }) - signature = { hash: sig, publicKey: addressToHex(address) } + signature = { hash: sig, publicKey: addressToHex(address), type: 'substrate' } } } catch {} if (!signature) return null attestation.signature = signature + console.log(attestation) try { const result = await firstValueFrom(cent.metadata.pinJson(attestation)) return result.ipfsHash From d9c414222c636243d9df67fca50ceb16d76d2f51 Mon Sep 17 00:00:00 2001 From: Jeroen Offerijns Date: Fri, 20 Dec 2024 13:38:02 +0100 Subject: [PATCH 4/4] Remove console.log --- .../src/pages/NavManagement/NavManagementAssetTable.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx b/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx index e392e9b5d..e92dab612 100644 --- a/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx +++ b/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx @@ -222,7 +222,6 @@ export function NavManagementAssetTable({ poolId }: { poolId: string }) { if (!signature) return null attestation.signature = signature - console.log(attestation) try { const result = await firstValueFrom(cent.metadata.pinJson(attestation)) return result.ipfsHash