diff --git a/contracts/mainnet/mstable/events.sol b/contracts/mainnet/connectors/mstable/events.sol similarity index 100% rename from contracts/mainnet/mstable/events.sol rename to contracts/mainnet/connectors/mstable/events.sol diff --git a/contracts/mainnet/mstable/helpers.sol b/contracts/mainnet/connectors/mstable/helpers.sol similarity index 77% rename from contracts/mainnet/mstable/helpers.sol rename to contracts/mainnet/connectors/mstable/helpers.sol index f98c9688..8100d0a1 100644 --- a/contracts/mainnet/mstable/helpers.sol +++ b/contracts/mainnet/connectors/mstable/helpers.sol @@ -1,7 +1,7 @@ pragma solidity ^0.7.6; -import { DSMath } from "../common/math.sol"; -import { Basic } from "../common/basic.sol"; +import { DSMath } from "../../common/math.sol"; +import { Basic } from "../../common/basic.sol"; abstract contract Helpers is DSMath, Basic { address internal constant mUsdToken = diff --git a/contracts/mainnet/mstable/interface.sol b/contracts/mainnet/connectors/mstable/interface.sol similarity index 100% rename from contracts/mainnet/mstable/interface.sol rename to contracts/mainnet/connectors/mstable/interface.sol diff --git a/contracts/mainnet/mstable/main.sol b/contracts/mainnet/connectors/mstable/main.sol similarity index 82% rename from contracts/mainnet/mstable/main.sol rename to contracts/mainnet/connectors/mstable/main.sol index 5e938501..05080c3d 100644 --- a/contracts/mainnet/mstable/main.sol +++ b/contracts/mainnet/connectors/mstable/main.sol @@ -8,7 +8,7 @@ pragma solidity ^0.7.6; import { Helpers } from "./helpers.sol"; import { Events } from "./events.sol"; import { IMasset, ISavingsContractV2, IBoostedSavingsVault, IFeederPool } from "./interface.sol"; -import { TokenInterface } from "../common/interfaces.sol"; +import { TokenInterface } from "../../common/interfaces.sol"; abstract contract mStableResolver is Events, Helpers { // @@ -17,51 +17,38 @@ abstract contract mStableResolver is Events, Helpers { ****************************************/ /** - * @dev Deposit to Save via mUSD + * @dev Deposit to Save via mUSD or bAsset * @notice Deposits token supported by mStable to Save * @param _token Address of token to deposit * @param _amount Amount of token to deposit + * @param _minOut Minimum amount of token to mint/deposit, equal to _amount if mUSD * @return _eventName Event name * @return _eventParam Event parameters */ - function deposit(address _token, uint256 _amount) - external - returns (string memory _eventName, bytes memory _eventParam) - { - return _deposit(_token, _amount, imUsdToken); - } - - /** - * @dev Deposit to Save via bAsset - * @notice Deposits token, requires _minOut for minting - * @param _token Address of token to deposit - * @param _amount Amount of token to deposit - * @param _minOut Minimum amount of token to mint - * @return _eventName Event name - * @return _eventParam Event parameters - */ - - function depositViaMint( + function deposit( address _token, uint256 _amount, uint256 _minOut ) external returns (string memory _eventName, bytes memory _eventParam) { // - require( - IMasset(mUsdToken).bAssetIndexes(_token) != 0, - "Token not a bAsset" - ); + uint256 mintedAmount = _amount; - approve(TokenInterface(_token), mUsdToken, _amount); - uint256 mintedAmount = IMasset(mUsdToken).mint( - _token, - _amount, - _minOut, - address(this) - ); + // Check if needs to be minted first + if (IMasset(mUsdToken).bAssetIndexes(_token) != 0) { + // mint first + approve(TokenInterface(_token), mUsdToken, _amount); + mintedAmount = IMasset(mUsdToken).mint( + _token, + _amount, + _minOut, + address(this) + ); + } else { + require(mintedAmount >= _minOut, "mintedAmount < _minOut"); + } - return _deposit(_token, mintedAmount, mUsdToken); + return _deposit(_token, mintedAmount, imUsdToken); } /** @@ -100,54 +87,36 @@ abstract contract mStableResolver is Events, Helpers { } /** - * @dev Withdraw from Save to mUSD + * @dev Withdraw from Save to mUSD or bAsset * @notice Withdraws from Save Vault to mUSD + * @param _token Address of token to withdraw * @param _credits Credits to withdraw + * @param _minOut Minimum amount of token to withdraw * @return _eventName Event name * @return _eventParam Event parameters */ - function withdraw(uint256 _credits) - external - returns (string memory _eventName, bytes memory _eventParam) - { - uint256 amountWithdrawn = _withdraw(_credits); - - _eventName = "LogWithdraw()"; - _eventParam = abi.encode(mUsdToken, amountWithdrawn, imUsdToken); - } - - /** - * @dev Withdraw from Save to bAsset - * @notice Withdraws from Save Vault to bAsset - * @param _token bAsset to withdraw to - * @param _credits Credits to withdraw - * @param _minOut Minimum amount of token to mint - * @return _eventName Event name - * @return _eventParam Event parameters - */ - - function withdrawViaRedeem( + function withdraw( address _token, uint256 _credits, uint256 _minOut ) external returns (string memory _eventName, bytes memory _eventParam) { - // - require( - IMasset(mUsdToken).bAssetIndexes(_token) != 0, - "Token not a bAsset" - ); - uint256 amountWithdrawn = _withdraw(_credits); - uint256 amountRedeemed = IMasset(mUsdToken).redeem( - _token, - amountWithdrawn, - _minOut, - address(this) - ); - _eventName = "LogRedeem()"; - _eventParam = abi.encode(mUsdToken, amountRedeemed, _token); + // Check if needs to be redeemed + if (IMasset(mUsdToken).bAssetIndexes(_token) != 0) { + amountWithdrawn = IMasset(mUsdToken).redeem( + _token, + amountWithdrawn, + _minOut, + address(this) + ); + } else { + require(amountWithdrawn >= _minOut, "amountWithdrawn < _minOut"); + } + + _eventName = "LogWithdraw()"; + _eventParam = abi.encode(mUsdToken, amountWithdrawn, imUsdToken); } /** diff --git a/contracts/polygon/connectors/mstable/main.sol b/contracts/polygon/connectors/mstable/main.sol index 532a98e9..4e69d843 100644 --- a/contracts/polygon/connectors/mstable/main.sol +++ b/contracts/polygon/connectors/mstable/main.sol @@ -17,51 +17,38 @@ abstract contract PmStableResolver is Events, Helpers { ****************************************/ /** - * @dev Deposit to Save via mUSD + * @dev Deposit to Save via mUSD or bAsset * @notice Deposits token supported by mStable to Save * @param _token Address of token to deposit * @param _amount Amount of token to deposit + * @param _minOut Minimum amount of token to mint/deposit, equal to _amount if mUSD * @return _eventName Event name * @return _eventParam Event parameters */ - function deposit(address _token, uint256 _amount) - external - returns (string memory _eventName, bytes memory _eventParam) - { - return _deposit(_token, _amount, imUsdToken); - } - - /** - * @dev Deposit to Save via bAsset - * @notice Deposits token, requires _minOut for minting - * @param _token Address of token to deposit - * @param _amount Amount of token to deposit - * @param _minOut Minimum amount of token to mint - * @return _eventName Event name - * @return _eventParam Event parameters - */ - - function depositViaMint( + function deposit( address _token, uint256 _amount, uint256 _minOut ) external returns (string memory _eventName, bytes memory _eventParam) { // - require( - IMasset(mUsdToken).bAssetIndexes(_token) != 0, - "Token not a bAsset" - ); + uint256 mintedAmount = _amount; - approve(TokenInterface(_token), mUsdToken, _amount); - uint256 mintedAmount = IMasset(mUsdToken).mint( - _token, - _amount, - _minOut, - address(this) - ); + // Check if needs to be minted first + if (IMasset(mUsdToken).bAssetIndexes(_token) != 0) { + // mint first + approve(TokenInterface(_token), mUsdToken, _amount); + mintedAmount = IMasset(mUsdToken).mint( + _token, + _amount, + _minOut, + address(this) + ); + } else { + require(mintedAmount >= _minOut, "mintedAmount < _minOut"); + } - return _deposit(_token, mintedAmount, mUsdToken); + return _deposit(_token, mintedAmount, imUsdToken); } /** @@ -100,54 +87,36 @@ abstract contract PmStableResolver is Events, Helpers { } /** - * @dev Withdraw from Save to mUSD + * @dev Withdraw from Save to mUSD or bAsset * @notice Withdraws from Save Vault to mUSD + * @param _token Address of token to withdraw * @param _credits Credits to withdraw + * @param _minOut Minimum amount of token to withdraw * @return _eventName Event name * @return _eventParam Event parameters */ - function withdraw(uint256 _credits) - external - returns (string memory _eventName, bytes memory _eventParam) - { - uint256 amountWithdrawn = _withdraw(_credits); - - _eventName = "LogWithdraw()"; - _eventParam = abi.encode(mUsdToken, amountWithdrawn, imUsdToken); - } - - /** - * @dev Withdraw from Save to bAsset - * @notice Withdraws from Save Vault to bAsset - * @param _token bAsset to withdraw to - * @param _credits Credits to withdraw - * @param _minOut Minimum amount of token to mint - * @return _eventName Event name - * @return _eventParam Event parameters - */ - - function withdrawViaRedeem( + function withdraw( address _token, uint256 _credits, uint256 _minOut ) external returns (string memory _eventName, bytes memory _eventParam) { - // - require( - IMasset(mUsdToken).bAssetIndexes(_token) != 0, - "Token not a bAsset" - ); - uint256 amountWithdrawn = _withdraw(_credits); - uint256 amountRedeemed = IMasset(mUsdToken).redeem( - _token, - amountWithdrawn, - _minOut, - address(this) - ); - _eventName = "LogRedeem()"; - _eventParam = abi.encode(mUsdToken, amountRedeemed, _token); + // Check if needs to be redeemed + if (IMasset(mUsdToken).bAssetIndexes(_token) != 0) { + amountWithdrawn = IMasset(mUsdToken).redeem( + _token, + amountWithdrawn, + _minOut, + address(this) + ); + } else { + require(amountWithdrawn >= _minOut, "amountWithdrawn < _minOut"); + } + + _eventName = "LogWithdraw()"; + _eventParam = abi.encode(mUsdToken, amountWithdrawn, imUsdToken); } /** @@ -367,7 +336,6 @@ abstract contract PmStableResolver is Events, Helpers { returns (uint256 amountWithdrawn) { // 1. Withdraw from Vault - // approve(TokenInterface(imUsdVault), imUsdToken, _credits); IStakingRewardsWithPlatformToken(imUsdVault).withdraw(_credits); // 2. Withdraw from Save diff --git a/test/mainnet/mstable/mstable.test.ts b/test/mainnet/mstable/mstable.test.ts index 99222b42..53bb6dfc 100644 --- a/test/mainnet/mstable/mstable.test.ts +++ b/test/mainnet/mstable/mstable.test.ts @@ -118,14 +118,15 @@ describe("MStable", async () => { }); it("Should deposit mUSD to Vault successfully", async () => { const depositAmount = simpleToExactAmount(100); + const minOut = depositAmount; - await executeAndAssertDeposit("deposit", mUsdToken, depositAmount, dsaWallet0, wallet0); + await executeAndAssertDeposit("deposit", mUsdToken, depositAmount, dsaWallet0, wallet0, [minOut]); }); it("Should deposit DAI to Vault successfully (mUSD bAsset)", async () => { const depositAmount = simpleToExactAmount(100); const minOut = calcMinOut(depositAmount, 0.02); - await executeAndAssertDeposit("depositViaMint", daiToken, depositAmount, dsaWallet0, wallet0, [minOut]); + await executeAndAssertDeposit("deposit", daiToken, depositAmount, dsaWallet0, wallet0, [minOut]); }); it("Should deposit alUSD to Vault successfully (via Feeder Pool)", async () => { const depositAmount = simpleToExactAmount(100); @@ -136,66 +137,25 @@ describe("MStable", async () => { }); it("Should withdraw from Vault to mUSD", async () => { const withdrawAmount = simpleToExactAmount(100); + const minOut = simpleToExactAmount(1); - await executeAndAssertWithdraw("withdraw", mUsdToken, withdrawAmount, dsaWallet0, wallet0, [withdrawAmount]); + await executeAndAssertWithdraw("withdraw", mUsdToken, withdrawAmount, dsaWallet0, wallet0, [minOut]); }); it("Should withdraw from Vault to DAI (mUSD bAsset)", async () => { const withdrawAmount = simpleToExactAmount(100); const minOut = simpleToExactAmount(1); - const daiBalanceBefore = await daiToken.balanceOf(dsaWallet0.address); - console.log("DAI balance before: ", toEther(daiBalanceBefore)); - - const imUsdVaultBalanceBefore = await imUsdVault.balanceOf(dsaWallet0.address); - console.log("imUSD Vault balance before: ", toEther(imUsdVaultBalanceBefore)); - - const spells = [ - { - connector: connectorName, - method: "withdrawViaRedeem", - args: [daiToken.address, withdrawAmount, minOut] - } - ]; - - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), DEAD_ADDRESS); - - const imUsdVaultBalanceAfter = await imUsdVault.balanceOf(dsaWallet0.address); - console.log("imUSD Vault balance after: ", toEther(imUsdVaultBalanceAfter)); - - const daiBalanceAfter = await daiToken.balanceOf(dsaWallet0.address); - console.log("DAI balance after: ", toEther(daiBalanceAfter)); - - expect(imUsdVaultBalanceAfter).to.be.eq(imUsdVaultBalanceBefore.sub(withdrawAmount)); - expect(daiBalanceAfter).to.gt(daiBalanceBefore); + await executeAndAssertWithdraw("withdraw", mUsdToken, withdrawAmount, dsaWallet0, wallet0, [minOut]); }); it("Should withdraw from Vault to alUSD (via Feeder Pool)", async () => { const withdrawAmount = simpleToExactAmount(100); const minOut = simpleToExactAmount(1); + const path = getToken("alUSD").feederPool; - const alusdBalanceBefore = await alusdToken.balanceOf(dsaWallet0.address); - console.log("Balance before: ", toEther(alusdBalanceBefore)); - - const imUsdVaultBalanceBefore = await imUsdVault.balanceOf(dsaWallet0.address); - console.log("imUSD Vault balance before: ", toEther(imUsdVaultBalanceBefore)); - - const spells = [ - { - connector: connectorName, - method: "withdrawViaSwap", - args: [alusdToken.address, withdrawAmount, minOut, getToken("alUSD").feederPool] - } - ]; - - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), DEAD_ADDRESS); - - const imUsdVaultBalanceAfter = await imUsdVault.balanceOf(dsaWallet0.address); - console.log("imUSD Vault balance after: ", toEther(imUsdVaultBalanceAfter)); - - const alusdBalanceAfter = await alusdToken.balanceOf(dsaWallet0.address); - console.log("alUSD balance after: ", toEther(alusdBalanceAfter)); - - expect(imUsdVaultBalanceAfter).to.be.eq(imUsdVaultBalanceBefore.sub(withdrawAmount)); - expect(alusdBalanceAfter).to.gt(alusdBalanceBefore); + await executeAndAssertWithdraw("withdrawViaSwap", alusdToken, withdrawAmount, dsaWallet0, wallet0, [ + minOut, + path + ]); }); it("Should claim Rewards", async () => { const mtaBalanceBefore = await mtaToken.balanceOf(dsaWallet0.address); diff --git a/test/mainnet/mstable/mstable.utils.ts b/test/mainnet/mstable/mstable.utils.ts index 6f51be22..2614bff8 100644 --- a/test/mainnet/mstable/mstable.utils.ts +++ b/test/mainnet/mstable/mstable.utils.ts @@ -104,14 +104,14 @@ export const executeAndAssertDeposit = async ( export const executeAndAssertWithdraw = async ( method: string, - tokenFrom: IERC20Minimal, + tokenTo: IERC20Minimal, withdrawAmount: BigNumber, dsaWallet0: Contract, wallet0: Wallet, args: any[] ) => { - const mUsdBalanceBefore = await tokenFrom.balanceOf(dsaWallet0.address); - console.log("Balance before: ", toEther(mUsdBalanceBefore)); + const tokenToBalanceBefore = await tokenTo.balanceOf(dsaWallet0.address); + console.log("Balance before: ", toEther(tokenToBalanceBefore)); const imUsdVaultBalanceBefore = await imUsdVault.balanceOf(dsaWallet0.address); console.log("imUSD Vault balance before: ", toEther(imUsdVaultBalanceBefore)); @@ -120,7 +120,7 @@ export const executeAndAssertWithdraw = async ( { connector: connectorName, method, - args + args: [tokenTo.address, withdrawAmount, ...(args ? args : [])] } ]; @@ -129,9 +129,9 @@ export const executeAndAssertWithdraw = async ( const imUsdVaultBalanceAfter = await imUsdVault.balanceOf(dsaWallet0.address); console.log("imUSD Vault balance after: ", toEther(imUsdVaultBalanceAfter)); - const mUsdBalanceAfter = await tokenFrom.balanceOf(dsaWallet0.address); - console.log("Balance after: ", toEther(mUsdBalanceAfter)); + const tokenToBalanceAfter = await tokenTo.balanceOf(dsaWallet0.address); + console.log("Balance after: ", toEther(tokenToBalanceAfter)); expect(imUsdVaultBalanceAfter).to.be.eq(imUsdVaultBalanceBefore.sub(withdrawAmount)); - expect(mUsdBalanceAfter).to.gt(mUsdBalanceBefore); + expect(tokenToBalanceAfter).to.gt(tokenToBalanceBefore); }; diff --git a/test/polygon/mstable/mstable.test.ts b/test/polygon/mstable/mstable.test.ts index adf56dbb..2198e288 100644 --- a/test/polygon/mstable/mstable.test.ts +++ b/test/polygon/mstable/mstable.test.ts @@ -118,14 +118,15 @@ describe("MStable", async () => { }); it("Should deposit mUSD to Vault successfully", async () => { const depositAmount = simpleToExactAmount(100); + const minOut = depositAmount; - await executeAndAssertDeposit("deposit", mUsdToken, depositAmount, dsaWallet0, wallet0); + await executeAndAssertDeposit("deposit", mUsdToken, depositAmount, dsaWallet0, wallet0, [minOut]); }); it("Should deposit DAI to Vault successfully (mUSD bAsset)", async () => { const depositAmount = simpleToExactAmount(100); const minOut = calcMinOut(depositAmount, 0.02); - await executeAndAssertDeposit("depositViaMint", daiToken, depositAmount, dsaWallet0, wallet0, [minOut]); + await executeAndAssertDeposit("deposit", daiToken, depositAmount, dsaWallet0, wallet0, [minOut]); }); it("Should deposit FRAX to Vault successfully (via Feeder Pool)", async () => { const depositAmount = simpleToExactAmount(100); @@ -136,66 +137,25 @@ describe("MStable", async () => { }); it("Should withdraw from Vault to mUSD", async () => { const withdrawAmount = simpleToExactAmount(100); + const minOut = simpleToExactAmount(1); - await executeAndAssertWithdraw("withdraw", mUsdToken, withdrawAmount, dsaWallet0, wallet0, [withdrawAmount]); + await executeAndAssertWithdraw("withdraw", mUsdToken, withdrawAmount, dsaWallet0, wallet0, [minOut]); }); it("Should withdraw from Vault to DAI (mUSD bAsset)", async () => { const withdrawAmount = simpleToExactAmount(100); const minOut = simpleToExactAmount(1); - const daiBalanceBefore = await daiToken.balanceOf(dsaWallet0.address); - console.log("DAI balance before: ", toEther(daiBalanceBefore)); - - const imUsdVaultBalanceBefore = await imUsdVault.balanceOf(dsaWallet0.address); - console.log("imUSD Vault balance before: ", toEther(imUsdVaultBalanceBefore)); - - const spells = [ - { - connector: connectorName, - method: "withdrawViaRedeem", - args: [daiToken.address, withdrawAmount, minOut] - } - ]; - - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), DEAD_ADDRESS); - - const imUsdVaultBalanceAfter = await imUsdVault.balanceOf(dsaWallet0.address); - console.log("imUSD Vault balance after: ", toEther(imUsdVaultBalanceAfter)); - - const daiBalanceAfter = await daiToken.balanceOf(dsaWallet0.address); - console.log("DAI balance after: ", toEther(daiBalanceAfter)); - - expect(imUsdVaultBalanceAfter).to.be.eq(imUsdVaultBalanceBefore.sub(withdrawAmount)); - expect(daiBalanceAfter).to.gt(daiBalanceBefore); + await executeAndAssertWithdraw("withdraw", mUsdToken, withdrawAmount, dsaWallet0, wallet0, [minOut]); }); it("Should withdraw from Vault to FRAX (via Feeder Pool)", async () => { const withdrawAmount = simpleToExactAmount(100); const minOut = simpleToExactAmount(1); + const path = getToken("FRAX").feederPool; - const fraxBalanceBefore = await fraxToken.balanceOf(dsaWallet0.address); - console.log("FRAX balance before: ", toEther(fraxBalanceBefore)); - - const imUsdVaultBalanceBefore = await imUsdVault.balanceOf(dsaWallet0.address); - console.log("imUSD Vault balance before: ", toEther(imUsdVaultBalanceBefore)); - - const spells = [ - { - connector: connectorName, - method: "withdrawViaSwap", - args: [fraxToken.address, withdrawAmount, minOut, getToken("FRAX").feederPool] - } - ]; - - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), DEAD_ADDRESS); - - const imUsdVaultBalanceAfter = await imUsdVault.balanceOf(dsaWallet0.address); - console.log("imUSD Vault balance after: ", toEther(imUsdVaultBalanceAfter)); - - const fraxBalanceAfter = await fraxToken.balanceOf(dsaWallet0.address); - console.log("FRAX balance after: ", toEther(fraxBalanceAfter)); - - expect(imUsdVaultBalanceAfter).to.be.eq(imUsdVaultBalanceBefore.sub(withdrawAmount)); - expect(fraxBalanceAfter).to.gt(fraxBalanceBefore); + await executeAndAssertWithdraw("withdrawViaSwap", fraxToken, withdrawAmount, dsaWallet0, wallet0, [ + minOut, + path + ]); }); it("Should claim Rewards", async () => { const mtaBalanceBefore = await mtaToken.balanceOf(dsaWallet0.address); diff --git a/test/polygon/mstable/mstable.utils.ts b/test/polygon/mstable/mstable.utils.ts index 6f51be22..2614bff8 100644 --- a/test/polygon/mstable/mstable.utils.ts +++ b/test/polygon/mstable/mstable.utils.ts @@ -104,14 +104,14 @@ export const executeAndAssertDeposit = async ( export const executeAndAssertWithdraw = async ( method: string, - tokenFrom: IERC20Minimal, + tokenTo: IERC20Minimal, withdrawAmount: BigNumber, dsaWallet0: Contract, wallet0: Wallet, args: any[] ) => { - const mUsdBalanceBefore = await tokenFrom.balanceOf(dsaWallet0.address); - console.log("Balance before: ", toEther(mUsdBalanceBefore)); + const tokenToBalanceBefore = await tokenTo.balanceOf(dsaWallet0.address); + console.log("Balance before: ", toEther(tokenToBalanceBefore)); const imUsdVaultBalanceBefore = await imUsdVault.balanceOf(dsaWallet0.address); console.log("imUSD Vault balance before: ", toEther(imUsdVaultBalanceBefore)); @@ -120,7 +120,7 @@ export const executeAndAssertWithdraw = async ( { connector: connectorName, method, - args + args: [tokenTo.address, withdrawAmount, ...(args ? args : [])] } ]; @@ -129,9 +129,9 @@ export const executeAndAssertWithdraw = async ( const imUsdVaultBalanceAfter = await imUsdVault.balanceOf(dsaWallet0.address); console.log("imUSD Vault balance after: ", toEther(imUsdVaultBalanceAfter)); - const mUsdBalanceAfter = await tokenFrom.balanceOf(dsaWallet0.address); - console.log("Balance after: ", toEther(mUsdBalanceAfter)); + const tokenToBalanceAfter = await tokenTo.balanceOf(dsaWallet0.address); + console.log("Balance after: ", toEther(tokenToBalanceAfter)); expect(imUsdVaultBalanceAfter).to.be.eq(imUsdVaultBalanceBefore.sub(withdrawAmount)); - expect(mUsdBalanceAfter).to.gt(mUsdBalanceBefore); + expect(tokenToBalanceAfter).to.gt(tokenToBalanceBefore); };