From 90175db2d36c89684e751db6a3b28ba4fe230ee3 Mon Sep 17 00:00:00 2001 From: Ian Lucas Date: Tue, 29 Oct 2024 13:30:15 -0400 Subject: [PATCH] chore: Fix Spike UI redeem bug. Update sdk test signers to add upgrader and remove reward --- .../DeployAndLoadLiquidMultiTokenVault.s.sol | 4 +- packages/sdk/test/src/utils/test-signer.ts | 16 +-- .../app/vault/_components/ViewSection.tsx | 5 +- .../nextjs/contracts/deployedContracts.ts | 124 ++++++++++++++++-- 4 files changed, 126 insertions(+), 23 deletions(-) diff --git a/packages/contracts/test/test/script/DeployAndLoadLiquidMultiTokenVault.s.sol b/packages/contracts/test/test/script/DeployAndLoadLiquidMultiTokenVault.s.sol index da78e1b8..a8ea06e1 100644 --- a/packages/contracts/test/test/script/DeployAndLoadLiquidMultiTokenVault.s.sol +++ b/packages/contracts/test/test/script/DeployAndLoadLiquidMultiTokenVault.s.sol @@ -191,9 +191,9 @@ contract DeployAndLoadLiquidMultiTokenVault is DeployLiquidMultiTokenVault { //(0) 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000 ETH) - owner //(1) 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (10000 ETH) - operator //(2) 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC (10000 ETH) - custody (vault->custody->vault) -//(3) 0x90F79bf6EB2c4f870365E785982E1f101E93b906 (10000 ETH) - treasury +//(3) 0x90F79bf6EB2c4f870365E785982E1f101E93b906 (10000 ETH) - upgrader //(4) 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 (10000 ETH) - deployer -//(5) 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc (10000 ETH) - rewards +//(5) 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc (10000 ETH) - treasury //(6) 0x976EA74026E726554dB657fA54763abd0C3a0aa9 (10000 ETH) - asset manager //(7) 0x14dC79964da2C08b23698B3D3cc7Ca32193d9955 (10000 ETH) - alice //(8) 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f (10000 ETH) - bob diff --git a/packages/sdk/test/src/utils/test-signer.ts b/packages/sdk/test/src/utils/test-signer.ts index abf18670..be931c94 100644 --- a/packages/sdk/test/src/utils/test-signer.ts +++ b/packages/sdk/test/src/utils/test-signer.ts @@ -35,9 +35,9 @@ export class TestSigners { private _admin: TestSigner; private _operator: TestSigner; private _custodian: TestSigner; - private _treasury: TestSigner; + private _upgrader: TestSigner; private _deployer: TestSigner; - private _rewardVault: TestSigner; + private _treasury: TestSigner; private _assetManager: TestSigner; private _alice: TestSigner; private _bob: TestSigner; @@ -47,9 +47,9 @@ export class TestSigners { this._admin = new TestSigner(0, provider); this._operator = new TestSigner(1, provider); this._custodian = new TestSigner(2, provider); - this._treasury = new TestSigner(3, provider); + this._upgrader = new TestSigner(3, provider); this._deployer = new TestSigner(4, provider); - this._rewardVault = new TestSigner(5, provider); + this._treasury = new TestSigner(5, provider); this._assetManager = new TestSigner(6, provider); this._alice = new TestSigner(7, provider); this._bob = new TestSigner(8, provider); @@ -68,16 +68,16 @@ export class TestSigners { return this._custodian; } - get treasury(): TestSigner { - return this._treasury; + get upgrader(): TestSigner { + return this._upgrader; } get deployer(): TestSigner { return this._deployer; } - get rewardVault(): TestSigner { - return this._rewardVault; + get treasury(): TestSigner { + return this._treasury; } get assetManager(): TestSigner { diff --git a/spikes/spike-liquid-stone/packages/nextjs/app/vault/_components/ViewSection.tsx b/spikes/spike-liquid-stone/packages/nextjs/app/vault/_components/ViewSection.tsx index c4a2c124..ab65f690 100644 --- a/spikes/spike-liquid-stone/packages/nextjs/app/vault/_components/ViewSection.tsx +++ b/spikes/spike-liquid-stone/packages/nextjs/app/vault/_components/ViewSection.tsx @@ -179,8 +179,9 @@ const ViewSection = () => { return; } - if (assetAmount < assetsToRedeem) { - notification.error("Sorry! No enough balance in the vault."); + if (parseFloat(assetAmount) < parseFloat(assetsToRedeem)) { + const errorMsg = "Sorry! Not enough balance in the vault. " + assetAmount + " < " + assetsToRedeem; + notification.error(errorMsg); return; } diff --git a/spikes/spike-liquid-stone/packages/nextjs/contracts/deployedContracts.ts b/spikes/spike-liquid-stone/packages/nextjs/contracts/deployedContracts.ts index f5e2896e..8f20da23 100644 --- a/spikes/spike-liquid-stone/packages/nextjs/contracts/deployedContracts.ts +++ b/spikes/spike-liquid-stone/packages/nextjs/contracts/deployedContracts.ts @@ -1028,6 +1028,24 @@ ], "stateMutability": "view" }, + { + "type": "function", + "name": "cancelRequestUnlock", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + }, + { + "name": "requestId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, { "type": "function", "name": "claimableDepositRequest", @@ -1980,7 +1998,7 @@ "internalType": "address" }, { - "name": "", + "name": "controller", "type": "address", "internalType": "address" } @@ -2124,7 +2142,7 @@ "internalType": "uint256" }, { - "name": "", + "name": "controller", "type": "address", "internalType": "address" }, @@ -2693,6 +2711,31 @@ ], "anonymous": false }, + { + "type": "event", + "name": "CancelRedeemRequest", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "requestId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, { "type": "event", "name": "CurrentPeriodRateChanged", @@ -3383,7 +3426,7 @@ }, { "type": "error", - "name": "LiquidContinuousMultiTokenVault__ControllerMismatch", + "name": "LiquidContinuousMultiTokenVault__ControllerNotSender", "inputs": [ { "name": "sender", @@ -3440,6 +3483,22 @@ } ] }, + { + "type": "error", + "name": "LiquidContinuousMultiTokenVault__UnAuthorized", + "inputs": [ + { + "name": "sender", + "type": "address", + "internalType": "address" + }, + { + "name": "authorizedOwner", + "type": "address", + "internalType": "address" + } + ] + }, { "type": "error", "name": "LiquidContinuousMultiTokenVault__UnlockPeriodMismatch", @@ -3705,7 +3764,7 @@ }, { "type": "error", - "name": "TimelockAsyncUnlock__UnlockBeforeDepositPeriod", + "name": "TimelockAsyncUnlock__UnlockBeforeCurrentPeriod", "inputs": [ { "name": "caller", @@ -3718,7 +3777,7 @@ "internalType": "address" }, { - "name": "depositPeriod", + "name": "currentPeriod", "type": "uint256", "internalType": "uint256" }, @@ -3731,7 +3790,7 @@ }, { "type": "error", - "name": "TimelockAsyncUnlock__UnlockBeforeUnlockPeriod", + "name": "TimelockAsyncUnlock__UnlockBeforeDepositPeriod", "inputs": [ { "name": "caller", @@ -3744,7 +3803,7 @@ "internalType": "address" }, { - "name": "currentPeriod", + "name": "depositPeriod", "type": "uint256", "internalType": "uint256" }, @@ -4472,6 +4531,24 @@ ], "stateMutability": "view" }, + { + "type": "function", + "name": "cancelRequestUnlock", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + }, + { + "name": "requestId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, { "type": "function", "name": "currentPeriod", @@ -4822,6 +4899,31 @@ "outputs": [], "stateMutability": "payable" }, + { + "type": "event", + "name": "CancelRedeemRequest", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "requestId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, { "type": "event", "name": "Initialized", @@ -4987,7 +5089,7 @@ }, { "type": "error", - "name": "TimelockAsyncUnlock__UnlockBeforeDepositPeriod", + "name": "TimelockAsyncUnlock__UnlockBeforeCurrentPeriod", "inputs": [ { "name": "caller", @@ -5000,7 +5102,7 @@ "internalType": "address" }, { - "name": "depositPeriod", + "name": "currentPeriod", "type": "uint256", "internalType": "uint256" }, @@ -5013,7 +5115,7 @@ }, { "type": "error", - "name": "TimelockAsyncUnlock__UnlockBeforeUnlockPeriod", + "name": "TimelockAsyncUnlock__UnlockBeforeDepositPeriod", "inputs": [ { "name": "caller", @@ -5026,7 +5128,7 @@ "internalType": "address" }, { - "name": "currentPeriod", + "name": "depositPeriod", "type": "uint256", "internalType": "uint256" },