Skip to content

Commit

Permalink
Merge pull request #136 from 1inch/feature/fix-wrapeprs
Browse files Browse the repository at this point in the history
[SC-1134] Fix AaveWrapperV3 and StataTokenWrapper
  • Loading branch information
zZoMROT authored Apr 9, 2024
2 parents c4b2fed + 726ff24 commit b486823
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion contracts/wrappers/AaveWrapperV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ contract AaveWrapperV3 is IWrapper {
for (uint256 i = 0; i < tokens.length; i++) {
(address aTokenAddress,,) = _LENDING_POOL.getReserveTokensAddresses(address(tokens[i]));
IERC20 aToken = IERC20(aTokenAddress);
if(aToken == IERC20(address(0))) revert NotRemovedMarket();
if(aToken != IERC20(address(0))) revert NotRemovedMarket();
delete aTokenToToken[aToken];
delete tokenToaToken[tokens[i]];
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/wrappers/StataTokenWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ contract StataTokenWrapper is IWrapper {
unchecked {
for (uint256 i = 0; i < tokens.length; i++) {
IERC20 stataToken = IERC20(FACTORY.getStaticAToken(address(tokens[i])));
if(stataToken == IERC20(address(0))) revert NotRemovedMarket();
if(stataToken != IERC20(address(0))) revert NotRemovedMarket();
delete stataTokenToToken[stataToken];
delete tokenToStataToken[tokens[i]];
}
Expand Down
10 changes: 5 additions & 5 deletions test/wrappers/AaveWrapperV3.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ describe('AaveWrapperV3', function () {
await expect(aaveWrapper.addMarkets([tokens.DAI, tokens.aDAIV1])).to.be.revertedWithCustomError(aaveWrapper, 'NotAddedMarket');
});

it('should correct remove market', async function () {
it('should correct remove market which not support by protocol', async function () {
const { aaveWrapper } = await loadFixture(initContracts);
await aaveWrapper.removeMarkets([tokens.DAI]);
await expect(aaveWrapper.wrap(tokens.DAI)).to.be.revertedWithCustomError(aaveWrapper, 'NotSupportedToken');
await aaveWrapper.removeMarkets([tokens.aDAIV1]);
await expect(aaveWrapper.wrap(tokens.aDAIV1)).to.be.revertedWithCustomError(aaveWrapper, 'NotSupportedToken');
});

it('should revert if removed market is incorrect', async function () {
it('should revert if removed market is supported by protocol', async function () {
const { aaveWrapper } = await loadFixture(initContracts);
await expect(aaveWrapper.removeMarkets([tokens.aDAIV1])).to.be.revertedWithCustomError(aaveWrapper, 'NotRemovedMarket');
await expect(aaveWrapper.removeMarkets([tokens.DAI])).to.be.revertedWithCustomError(aaveWrapper, 'NotRemovedMarket');
});

it('DAI -> aDAI', async function () {
Expand Down
10 changes: 5 additions & 5 deletions test/wrappers/StataTokenWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ describe('StataTokenWrapper', function () {
await expect(stataTokenWrapper.addMarkets([tokens.DAI, tokens.CHAI])).to.be.revertedWithCustomError(stataTokenWrapper, 'NotAddedMarket');
});

it('should correct remove market', async function () {
it('should correct remove market which not support by protocol', async function () {
const { stataTokenWrapper } = await loadFixture(initContracts);
await stataTokenWrapper.removeMarkets([tokens.USDC]);
await expect(stataTokenWrapper.wrap(tokens.USDC)).to.be.revertedWithCustomError(stataTokenWrapper, 'NotSupportedToken');
await stataTokenWrapper.removeMarkets([tokens.CHAI]);
await expect(stataTokenWrapper.wrap(tokens.CHAI)).to.be.revertedWithCustomError(stataTokenWrapper, 'NotSupportedToken');
});

it('should revert if removed market is incorrect', async function () {
it('should revert if removed market is supported by protocol', async function () {
const { stataTokenWrapper } = await loadFixture(initContracts);
await expect(stataTokenWrapper.removeMarkets([tokens.CHAI])).to.be.revertedWithCustomError(stataTokenWrapper, 'NotRemovedMarket');
await expect(stataTokenWrapper.removeMarkets([tokens.USDC])).to.be.revertedWithCustomError(stataTokenWrapper, 'NotRemovedMarket');
});

it('USDC -> stataUSDC', async function () {
Expand Down

0 comments on commit b486823

Please sign in to comment.