From 06196e6d9efdd6e0d5f8006d9953036d5db22c16 Mon Sep 17 00:00:00 2001 From: Lasse Herskind <16536249+LHerskind@users.noreply.github.com> Date: Tue, 2 Nov 2021 13:10:54 +0000 Subject: [PATCH 1/5] fix: Introduce dynamic domain separator --- contracts/stake/StakedTokenV2.sol | 32 +++++++++++++----------- contracts/stake/StakedTokenV3.sol | 16 ------------ test/StakedAaveV2/delegation.spec.ts | 37 ++++++++++++++++++++++++++++ test/StakedAaveV2/permit.spec.ts | 34 +++++++++++++++++++++++++ 4 files changed, 89 insertions(+), 30 deletions(-) diff --git a/contracts/stake/StakedTokenV2.sol b/contracts/stake/StakedTokenV2.sol index f8bbbcb..81b62d4 100644 --- a/contracts/stake/StakedTokenV2.sol +++ b/contracts/stake/StakedTokenV2.sol @@ -56,7 +56,7 @@ contract StakedTokenV2 is mapping(address => uint256) internal _propositionPowerSnapshotsCounts; mapping(address => address) internal _propositionPowerDelegates; - bytes32 public DOMAIN_SEPARATOR; + bytes32 internal UNUSED_STORAGE_PLACEHOLDER; // old DOMAIN_SEPARATOR; bytes public constant EIP712_REVISION = bytes('1'); bytes32 internal constant EIP712_DOMAIN = keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'); @@ -99,23 +99,27 @@ contract StakedTokenV2 is /** * @dev Called by the proxy contract **/ - function initialize() external virtual initializer { + function initialize() external virtual initializer {} + + function DOMAIN_SEPARATOR() public view returns (bytes32) { uint256 chainId; //solium-disable-next-line + assembly { chainId := chainid() } - DOMAIN_SEPARATOR = keccak256( - abi.encode( - EIP712_DOMAIN, - keccak256(bytes(name())), - keccak256(EIP712_REVISION), - chainId, - address(this) - ) - ); + return + keccak256( + abi.encode( + EIP712_DOMAIN, + keccak256(bytes(name())), + keccak256(EIP712_REVISION), + chainId, + address(this) + ) + ); } function stake(address onBehalfOf, uint256 amount) external virtual override { @@ -371,7 +375,7 @@ contract StakedTokenV2 is bytes32 digest = keccak256( abi.encodePacked( '\x19\x01', - DOMAIN_SEPARATOR, + DOMAIN_SEPARATOR(), keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, currentValidNonce, deadline)) ) ); @@ -479,7 +483,7 @@ contract StakedTokenV2 is bytes32 structHash = keccak256( abi.encode(DELEGATE_BY_TYPE_TYPEHASH, delegatee, uint256(delegationType), nonce, expiry) ); - bytes32 digest = keccak256(abi.encodePacked('\x19\x01', DOMAIN_SEPARATOR, structHash)); + bytes32 digest = keccak256(abi.encodePacked('\x19\x01', DOMAIN_SEPARATOR(), structHash)); address signatory = ecrecover(digest, v, r, s); require(signatory != address(0), 'INVALID_SIGNATURE'); require(nonce == _nonces[signatory]++, 'INVALID_NONCE'); @@ -505,7 +509,7 @@ contract StakedTokenV2 is bytes32 s ) public { bytes32 structHash = keccak256(abi.encode(DELEGATE_TYPEHASH, delegatee, nonce, expiry)); - bytes32 digest = keccak256(abi.encodePacked('\x19\x01', DOMAIN_SEPARATOR, structHash)); + bytes32 digest = keccak256(abi.encodePacked('\x19\x01', DOMAIN_SEPARATOR(), structHash)); address signatory = ecrecover(digest, v, r, s); require(signatory != address(0), 'INVALID_SIGNATURE'); require(nonce == _nonces[signatory]++, 'INVALID_NONCE'); diff --git a/contracts/stake/StakedTokenV3.sol b/contracts/stake/StakedTokenV3.sol index ca3f5c2..af721f6 100644 --- a/contracts/stake/StakedTokenV3.sol +++ b/contracts/stake/StakedTokenV3.sol @@ -137,22 +137,6 @@ contract StakedTokenV3 is StakedTokenV2, IStakedTokenV3, RoleManager { maxSlashablePercentage <= PercentageMath.PERCENTAGE_FACTOR, 'INVALID_SLASHING_PERCENTAGE' ); - uint256 chainId; - - //solium-disable-next-line - assembly { - chainId := chainid() - } - - DOMAIN_SEPARATOR = keccak256( - abi.encode( - EIP712_DOMAIN, - keccak256(bytes(super.name())), - keccak256(EIP712_REVISION), - chainId, - address(this) - ) - ); if (REVISION() == 1) { _name = name; diff --git a/test/StakedAaveV2/delegation.spec.ts b/test/StakedAaveV2/delegation.spec.ts index efa3405..55b8139 100644 --- a/test/StakedAaveV2/delegation.spec.ts +++ b/test/StakedAaveV2/delegation.spec.ts @@ -740,6 +740,43 @@ makeSuite('StakedAaveV2. Power Delegations', (testEnv: TestEnv) => { ).to.be.revertedWith('INVALID_NONCE'); }); + it('User 1 should not be able to delegate with bad chainid', async () => { + const { + users: [, user1, user2], + stakedAaveV2, + } = testEnv; + + // Prepare params to sign message + const { chainId } = await DRE.ethers.provider.getNetwork(); + if (!chainId) { + fail("Current network doesn't have CHAIN ID"); + } + const nonce = (await stakedAaveV2._nonces(user1.address)).toString(); + const expiration = MAX_UINT_AMOUNT; + const msgParams = buildDelegateByTypeParams( + chainId, + stakedAaveV2.address, + user2.address, + '0', + nonce, + expiration + ); + const ownerPrivateKey = require('../../test-wallets').accounts[1].secretKey; + if (!ownerPrivateKey) { + throw new Error('INVALID_OWNER_PK'); + } + + const { v, r, s } = getSignatureFromTypedData(ownerPrivateKey, msgParams); + + // Transmit message via delegateByTypeBySig. + // Signature don't recover address 0, so will fail due to nonce. + await expect( + stakedAaveV2 + .connect(user1.signer) + .delegateByTypeBySig(user2.address, '0', nonce, expiration, v, r, s) + ).to.be.revertedWith('INVALID_NONCE'); + }); + it('User 1 should not be able to delegate if signature expired', async () => { const { users: [, user1, user2], diff --git a/test/StakedAaveV2/permit.spec.ts b/test/StakedAaveV2/permit.spec.ts index 6cd97aa..6b10f27 100644 --- a/test/StakedAaveV2/permit.spec.ts +++ b/test/StakedAaveV2/permit.spec.ts @@ -149,6 +149,40 @@ makeSuite('StakedAaveV2. Permit', (testEnv: TestEnv) => { expect((await stakedAaveV2._nonces(owner)).toNumber()).to.be.equal(2); }); + it('Tries to submit a permit with invalid chainid', async () => { + const { deployer, users, stakedAaveV2 } = testEnv; + const owner = deployer.address; + const spender = users[1].address; + + const { chainId } = await DRE.ethers.provider.getNetwork(); + if (!chainId) { + fail("Current network doesn't have CHAIN ID"); + } + const deadline = MAX_UINT_AMOUNT; + const nonce = 1000; + const permitAmount = '0'; + const msgParams = buildPermitParams( + chainId + 1, + stakedAaveV2.address, + owner, + spender, + nonce, + deadline, + permitAmount + ); + + const ownerPrivateKey = require('../../test-wallets').accounts[0].secretKey; + if (!ownerPrivateKey) { + throw new Error('INVALID_OWNER_PK'); + } + + const { v, r, s } = getSignatureFromTypedData(ownerPrivateKey, msgParams); + + await expect( + stakedAaveV2.connect(users[1].signer).permit(owner, spender, permitAmount, deadline, v, r, s) + ).to.be.revertedWith('INVALID_SIGNATURE'); + }); + it('Tries to submit a permit with invalid nonce', async () => { const { deployer, users, stakedAaveV2 } = testEnv; const owner = deployer.address; From e2b327c44b365fe378b6bec452b235f5ff38c89f Mon Sep 17 00:00:00 2001 From: Lasse Herskind <16536249+LHerskind@users.noreply.github.com> Date: Tue, 2 Nov 2021 13:22:53 +0000 Subject: [PATCH 2/5] fix: Add additional check for reward accrual --- test/StakedAaveV3/gov-proposal.spec.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/test/StakedAaveV3/gov-proposal.spec.ts b/test/StakedAaveV3/gov-proposal.spec.ts index 095e4f1..ca6c1a4 100644 --- a/test/StakedAaveV3/gov-proposal.spec.ts +++ b/test/StakedAaveV3/gov-proposal.spec.ts @@ -125,12 +125,6 @@ makeSuite('Governance proposal for updating staked aave', (testEnv: TestEnv) => await user4.signer.sendTransaction({ to: abptSigner._address, value: parseEther('10') }); - console.log( - `Bal: ${formatUnits( - await abpt.connect(abptSigner).balanceOf(abptSigner._address) - )}, Bal: ${formatUnits(await stakedAbpt.connect(abptSigner).balanceOf(abptSigner._address))}` - ); - await abpt.connect(abptSigner).approve(stakedAbpt.address, MAX_UINT_AMOUNT); await stakedAbpt.connect(abptSigner).stake(abptSigner._address, parseUnits('100')); }); @@ -423,6 +417,7 @@ makeSuite('Governance proposal for updating staked aave', (testEnv: TestEnv) => .connect(user3.signer) .getUserAssetData(user3.address, stakedAave.address); + const aaveBalanceBefore = await aaveToken.connect(user3.signer).balanceOf(user3.address); const alreadyClaimable = await stakedAave .connect(user3.signer) .stakerRewardsToClaim(user3.address); @@ -433,7 +428,10 @@ makeSuite('Governance proposal for updating staked aave', (testEnv: TestEnv) => const expectedRewards = alreadyClaimable.add(getRewards(userBalance, indexFinal, userIndex)); expect(await aaveToken.connect(user3.signer).balanceOf(user3.address)).to.be.eq( - expectedRewards + aaveBalanceBefore.add(expectedRewards) + ); + expect(await aaveToken.connect(user3.signer).balanceOf(user3.address)).to.be.gt( + aaveBalanceBefore ); }); @@ -456,5 +454,8 @@ makeSuite('Governance proposal for updating staked aave', (testEnv: TestEnv) => expect(await aaveToken.connect(abptSigner).balanceOf(abptSigner._address)).to.be.eq( aaveBalanceBefore.add(expectedRewards) ); + expect(await aaveToken.connect(abptSigner).balanceOf(abptSigner._address)).to.be.gt( + aaveBalanceBefore + ); }); }); From fa3654ea75f1c9dfa69128dd3307be4a87f0f1f0 Mon Sep 17 00:00:00 2001 From: Lasse Herskind <16536249+LHerskind@users.noreply.github.com> Date: Wed, 3 Nov 2021 16:51:07 +0000 Subject: [PATCH 3/5] fix: Use cached `DOMAIN_SEPARATOR` when same chain id as initialize --- contracts/stake/StakedTokenV2.sol | 34 ++++++++++++++++++++++++++----- contracts/stake/StakedTokenV3.sol | 15 ++++++++++++++ 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/contracts/stake/StakedTokenV2.sol b/contracts/stake/StakedTokenV2.sol index 81b62d4..8baca84 100644 --- a/contracts/stake/StakedTokenV2.sol +++ b/contracts/stake/StakedTokenV2.sol @@ -56,7 +56,7 @@ contract StakedTokenV2 is mapping(address => uint256) internal _propositionPowerSnapshotsCounts; mapping(address => address) internal _propositionPowerDelegates; - bytes32 internal UNUSED_STORAGE_PLACEHOLDER; // old DOMAIN_SEPARATOR; + bytes32 internal CACHED_DOMAIN_SEPARATOR; // old DOMAIN_SEPARATOR; bytes public constant EIP712_REVISION = bytes('1'); bytes32 internal constant EIP712_DOMAIN = keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'); @@ -66,6 +66,8 @@ contract StakedTokenV2 is /// @dev owner => next valid nonce to submit with permit() mapping(address => uint256) public _nonces; + uint256 internal immutable CACHED_CHAIN_ID; + event Staked(address indexed from, address indexed onBehalfOf, uint256 amount); event Redeem(address indexed from, address indexed to, uint256 amount); @@ -94,22 +96,44 @@ contract StakedTokenV2 is REWARDS_VAULT = rewardsVault; _aaveGovernance = ITransferHook(governance); ERC20._setupDecimals(decimals); + + uint256 chainId; + //solium-disable-next-line + assembly { + chainId := chainid() + } + CACHED_CHAIN_ID = chainId; } /** * @dev Called by the proxy contract **/ - function initialize() external virtual initializer {} + function initialize() external virtual initializer { + uint256 chainId; + //solium-disable-next-line + assembly { + chainId := chainid() + } + CACHED_DOMAIN_SEPARATOR = keccak256( + abi.encode( + EIP712_DOMAIN, + keccak256(bytes(name())), + keccak256(EIP712_REVISION), + chainId, + address(this) + ) + ); + } function DOMAIN_SEPARATOR() public view returns (bytes32) { uint256 chainId; - //solium-disable-next-line - assembly { chainId := chainid() } - + if (chainId == CACHED_CHAIN_ID) { + return CACHED_DOMAIN_SEPARATOR; + } return keccak256( abi.encode( diff --git a/contracts/stake/StakedTokenV3.sol b/contracts/stake/StakedTokenV3.sol index af721f6..71d4dd8 100644 --- a/contracts/stake/StakedTokenV3.sol +++ b/contracts/stake/StakedTokenV3.sol @@ -144,6 +144,21 @@ contract StakedTokenV3 is StakedTokenV2, IStakedTokenV3, RoleManager { _setupDecimals(decimals); } + uint256 chainId; + //solium-disable-next-line + assembly { + chainId := chainid() + } + CACHED_DOMAIN_SEPARATOR = keccak256( + abi.encode( + EIP712_DOMAIN, + keccak256(bytes(super.name())), + keccak256(EIP712_REVISION), + chainId, + address(this) + ) + ); + address[] memory adminsAddresses = new address[](3); uint256[] memory adminsRoles = new uint256[](3); From 5845ec2f67304439ddeac4993dd9699d03f0135c Mon Sep 17 00:00:00 2001 From: Lasse Herskind <16536249+LHerskind@users.noreply.github.com> Date: Wed, 3 Nov 2021 17:28:03 +0000 Subject: [PATCH 4/5] fix: Fix tests for chainId and remove comment --- contracts/stake/StakedTokenV2.sol | 2 +- test/StakedAaveV2/delegation.spec.ts | 4 ++-- test/StakedAaveV2/permit.spec.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/stake/StakedTokenV2.sol b/contracts/stake/StakedTokenV2.sol index 8baca84..9a01959 100644 --- a/contracts/stake/StakedTokenV2.sol +++ b/contracts/stake/StakedTokenV2.sol @@ -56,7 +56,7 @@ contract StakedTokenV2 is mapping(address => uint256) internal _propositionPowerSnapshotsCounts; mapping(address => address) internal _propositionPowerDelegates; - bytes32 internal CACHED_DOMAIN_SEPARATOR; // old DOMAIN_SEPARATOR; + bytes32 internal CACHED_DOMAIN_SEPARATOR; bytes public constant EIP712_REVISION = bytes('1'); bytes32 internal constant EIP712_DOMAIN = keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'); diff --git a/test/StakedAaveV2/delegation.spec.ts b/test/StakedAaveV2/delegation.spec.ts index 55b8139..01a86f7 100644 --- a/test/StakedAaveV2/delegation.spec.ts +++ b/test/StakedAaveV2/delegation.spec.ts @@ -754,7 +754,7 @@ makeSuite('StakedAaveV2. Power Delegations', (testEnv: TestEnv) => { const nonce = (await stakedAaveV2._nonces(user1.address)).toString(); const expiration = MAX_UINT_AMOUNT; const msgParams = buildDelegateByTypeParams( - chainId, + chainId + 1, stakedAaveV2.address, user2.address, '0', @@ -768,7 +768,7 @@ makeSuite('StakedAaveV2. Power Delegations', (testEnv: TestEnv) => { const { v, r, s } = getSignatureFromTypedData(ownerPrivateKey, msgParams); - // Transmit message via delegateByTypeBySig. + // Transmit message via delegateByTypeBySig. // Signature don't recover address 0, so will fail due to nonce. await expect( stakedAaveV2 diff --git a/test/StakedAaveV2/permit.spec.ts b/test/StakedAaveV2/permit.spec.ts index 6b10f27..e84255e 100644 --- a/test/StakedAaveV2/permit.spec.ts +++ b/test/StakedAaveV2/permit.spec.ts @@ -159,7 +159,7 @@ makeSuite('StakedAaveV2. Permit', (testEnv: TestEnv) => { fail("Current network doesn't have CHAIN ID"); } const deadline = MAX_UINT_AMOUNT; - const nonce = 1000; + const nonce = (await stakedAaveV2._nonces(owner)).toNumber(); const permitAmount = '0'; const msgParams = buildPermitParams( chainId + 1, From 104b4324e56bac677f324ce5baaa23a4e5b151ee Mon Sep 17 00:00:00 2001 From: Lasse Herskind <16536249+LHerskind@users.noreply.github.com> Date: Wed, 3 Nov 2021 18:22:02 +0000 Subject: [PATCH 5/5] fix: Remove dead code + params from StakedTokenV3 initialize --- .../proposals/StakeTokenUpgradeProposal.sol | 26 +++------ contracts/stake/StakedTokenV3.sol | 11 +--- test/StakedAaveV3/gov-proposal.spec.ts | 54 ++++++++++--------- test/StakedAaveV3/shutdown.spec.ts | 7 +-- test/StakedAaveV3/stakedAave-V3.spec.ts | 7 +-- 5 files changed, 39 insertions(+), 66 deletions(-) diff --git a/contracts/proposals/StakeTokenUpgradeProposal.sol b/contracts/proposals/StakeTokenUpgradeProposal.sol index 8694ead..6e81aac 100644 --- a/contracts/proposals/StakeTokenUpgradeProposal.sol +++ b/contracts/proposals/StakeTokenUpgradeProposal.sol @@ -29,42 +29,28 @@ contract StakeTokenUpgradeProposalExecutor { function execute() external { _upgradeStakedAave(); - _upgradeStakedAbp(); + _upgradeStakedAbpt(); } function _upgradeStakedAave() internal { - string memory name = 'Staked AAVE'; - string memory symbol = 'stkAAVE'; - uint8 decimals = 18; - bytes memory params = abi.encodeWithSignature( - 'initialize(address,address,address,uint256,string,string,uint8)', + 'initialize(address,address,address,uint256)', SLASHING_ADMIN, COOLDOWN_PAUSE_ADMIN, CLAIM_HELPER, - MAX_SLASHABLE_PERCENTAGE, - name, - symbol, - decimals + MAX_SLASHABLE_PERCENTAGE ); STAKED_AAVE_TOKEN_PROXY.upgradeToAndCall(NEW_STAKED_AAVE_TOKEN_IMPLEMENTATION, params); } - function _upgradeStakedAbp() internal { - string memory name = 'Staked Aave Balance Pool Token'; - string memory symbol = 'stkABPT'; - uint8 decimals = 18; - + function _upgradeStakedAbpt() internal { bytes memory params = abi.encodeWithSignature( - 'initialize(address,address,address,uint256,string,string,uint8)', + 'initialize(address,address,address,uint256)', SLASHING_ADMIN, COOLDOWN_PAUSE_ADMIN, CLAIM_HELPER, - MAX_SLASHABLE_PERCENTAGE, - name, - symbol, - decimals + MAX_SLASHABLE_PERCENTAGE ); STAKED_ABP_TOKEN_PROXY.upgradeToAndCall(NEW_STAKED_ABP_TOKEN_IMPLEMENTATION, params); diff --git a/contracts/stake/StakedTokenV3.sol b/contracts/stake/StakedTokenV3.sol index 71d4dd8..300ced7 100644 --- a/contracts/stake/StakedTokenV3.sol +++ b/contracts/stake/StakedTokenV3.sol @@ -128,22 +128,13 @@ contract StakedTokenV3 is StakedTokenV2, IStakedTokenV3, RoleManager { address slashingAdmin, address cooldownPauseAdmin, address claimHelper, - uint256 maxSlashablePercentage, - string calldata name, - string calldata symbol, - uint8 decimals + uint256 maxSlashablePercentage ) external initializer { require( maxSlashablePercentage <= PercentageMath.PERCENTAGE_FACTOR, 'INVALID_SLASHING_PERCENTAGE' ); - if (REVISION() == 1) { - _name = name; - _symbol = symbol; - _setupDecimals(decimals); - } - uint256 chainId; //solium-disable-next-line assembly { diff --git a/test/StakedAaveV3/gov-proposal.spec.ts b/test/StakedAaveV3/gov-proposal.spec.ts index ca6c1a4..f393105 100644 --- a/test/StakedAaveV3/gov-proposal.spec.ts +++ b/test/StakedAaveV3/gov-proposal.spec.ts @@ -27,14 +27,14 @@ import { SelfdestructTransfer__factory, StakedAaveV3__factory, StakedAbptV3, + StakedAbptV3__factory, StakeTokenUpgradeProposalExecutor__factory, } from '../../types'; -import { formatUnits, parseEther, parseUnits } from '@ethersproject/units'; +import { parseEther, parseUnits } from '@ethersproject/units'; import { expect } from 'chai'; import { ethers } from 'ethers'; import { getRewards } from '../DistributionManager/data-helpers/base-math'; import { eEthereumNetwork } from '../../helpers/types'; -import { StakedBptV3__factory } from '../../types/factories/StakedBptV3__factory'; const STAKED_AAVE_PROXY = '0x4da27a545c0c5B758a6BA100e3a049001de870f5'; const STAKED_ABPT_PROXY = '0xa1116930326D21fB917d5A27F1E9943A9595fb47'; @@ -101,7 +101,7 @@ makeSuite('Governance proposal for updating staked aave', (testEnv: TestEnv) => aaveToken = StakedAaveV3__factory.connect(AAVE_TOKEN, await DRE.ethers.getSigners()[0]); abpt = Ierc20__factory.connect(AAVE_BALANCER_POOL_TOKEN, await DRE.ethers.getSigners()[0]); stakedAave = StakedAaveV3__factory.connect(STAKED_AAVE_PROXY, await DRE.ethers.getSigners()[0]); - stakedAbpt = StakedBptV3__factory.connect(STAKED_ABPT_PROXY, await DRE.ethers.getSigners()[0]); + stakedAbpt = StakedAbptV3__factory.connect(STAKED_ABPT_PROXY, await DRE.ethers.getSigners()[0]); }); it('User stakes aave before upgrade', async () => { @@ -149,9 +149,12 @@ makeSuite('Governance proposal for updating staked aave', (testEnv: TestEnv) => ).deployed(); await waitForTx( - await stakedAaveImplementation[ - 'initialize(address,address,address,uint256,string,string,uint8)' - ](SHORT_EXECUTOR, SHORT_EXECUTOR, SHORT_EXECUTOR, '3000', 'Staked AAVE', 'stkAAVE', 18) + await stakedAaveImplementation['initialize(address,address,address,uint256)']( + SHORT_EXECUTOR, + SHORT_EXECUTOR, + SHORT_EXECUTOR, + '3000' + ) ); }); @@ -162,7 +165,7 @@ makeSuite('Governance proposal for updating staked aave', (testEnv: TestEnv) => const emissionManager = await stakedAave.connect(deployer).EMISSION_MANAGER(); stakedAbptImplementation = await ( - await new StakedBptV3__factory(deployer).deploy( + await new StakedAbptV3__factory(deployer).deploy( AAVE_BALANCER_POOL_TOKEN, aaveToken.address, COOLDOWN_SECONDS, @@ -175,16 +178,11 @@ makeSuite('Governance proposal for updating staked aave', (testEnv: TestEnv) => ).deployed(); await waitForTx( - await stakedAbptImplementation[ - 'initialize(address,address,address,uint256,string,string,uint8)' - ]( + await stakedAbptImplementation['initialize(address,address,address,uint256)']( SHORT_EXECUTOR, SHORT_EXECUTOR, SHORT_EXECUTOR, - '3000', - 'Staked Aave Balance Pool Token', - 'stkABPT', - 18 + '3000' ) ); }); @@ -308,8 +306,8 @@ makeSuite('Governance proposal for updating staked aave', (testEnv: TestEnv) => ); const populatedAaveTx = await stakedAave.populateTransaction[ - 'initialize(address,address,address,uint256,string,string,uint8)' - ](SHORT_EXECUTOR, SHORT_EXECUTOR, SHORT_EXECUTOR, 3000, 'Staked AAVE', 'stkAAVE', 18); + 'initialize(address,address,address,uint256)' + ](SHORT_EXECUTOR, SHORT_EXECUTOR, SHORT_EXECUTOR, 3000); const aaveCalldata = populatedAaveTx.data ? populatedAaveTx.data : '0x'; await waitForTx( @@ -334,16 +332,8 @@ makeSuite('Governance proposal for updating staked aave', (testEnv: TestEnv) => ); const populatedBptTx = await stakedAbpt.populateTransaction[ - 'initialize(address,address,address,uint256,string,string,uint8)' - ]( - SHORT_EXECUTOR, - SHORT_EXECUTOR, - SHORT_EXECUTOR, - '3000', - 'Staked Aave Balance Pool Token', - 'stkABPT', - 18 - ); + 'initialize(address,address,address,uint256)' + ](SHORT_EXECUTOR, SHORT_EXECUTOR, SHORT_EXECUTOR, '3000'); const abptCalldata = populatedBptTx.data ? populatedBptTx.data : '0x'; await waitForTx( @@ -408,6 +398,18 @@ makeSuite('Governance proposal for updating staked aave', (testEnv: TestEnv) => ); }); + it('Check names, symbol and decimal after upgrade', async () => { + const { deployer } = testEnv; + expect(await stakedAave.connect(deployer.signer).name()).to.be.eq('Staked Aave'); + expect(await stakedAave.connect(deployer.signer).symbol()).to.be.eq('stkAAVE'); + expect(await stakedAave.connect(deployer.signer).decimals()).to.be.eq(18); + expect(await stakedAbpt.connect(deployer.signer).name()).to.be.eq( + 'Staked Aave Balance Pool Token' + ); + expect(await stakedAbpt.connect(deployer.signer).symbol()).to.be.eq('stkABPT'); + expect(await stakedAbpt.connect(deployer.signer).decimals()).to.be.eq(18); + }); + it('Check accrual after update of staked aave token', async () => { const { users: [, , , user3], diff --git a/test/StakedAaveV3/shutdown.spec.ts b/test/StakedAaveV3/shutdown.spec.ts index cc12d47..fba3794 100644 --- a/test/StakedAaveV3/shutdown.spec.ts +++ b/test/StakedAaveV3/shutdown.spec.ts @@ -66,14 +66,11 @@ makeSuite('StakedAave V3 emergency', (testEnv: TestEnv) => { //initialize the stake instance await waitForTx( - await stakeV3['initialize(address,address,address,uint256,string,string,uint8)']( + await stakeV3['initialize(address,address,address,uint256)']( users[0].address, users[1].address, users[2].address, - '2000', - 'Staked AAVE', - 'stkAAVE', - 18 + '2000' ) ); diff --git a/test/StakedAaveV3/stakedAave-V3.spec.ts b/test/StakedAaveV3/stakedAave-V3.spec.ts index 0c8dbc8..a1de05e 100644 --- a/test/StakedAaveV3/stakedAave-V3.spec.ts +++ b/test/StakedAaveV3/stakedAave-V3.spec.ts @@ -59,14 +59,11 @@ makeSuite('StakedAave V3 slashing tests', (testEnv: TestEnv) => { //initialize the stake instance await waitForTx( - await stakeV3['initialize(address,address,address,uint256,string,string,uint8)']( + await stakeV3['initialize(address,address,address,uint256)']( users[0].address, users[1].address, users[2].address, - '2000', - 'Staked AAVE', - 'stkAAVE', - 18 + '2000' ) );