diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index 2c2ae477..9620d810 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -23,11 +23,7 @@ jobs: # Compile the code - name: Compile, adjust uniswap library hash and recompile again - run: | - ./scripts/uni-adjust/adjust-point.sh - ./node_modules/.bin/hardhat compile - ./scripts/uni-adjust/adjust-pair.sh - ./node_modules/.bin/hardhat compile + run: npm run compile # Run tests and deploy script(s) - name: Run tests diff --git a/Dockerfile b/Dockerfile index e7fd8ceb..59909a54 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,6 @@ ADD . /code ENV NODE_OPTIONS=--openssl-legacy-provider RUN yarn -RUN npx hardhat compile +RUN npm run compile CMD [ "npx", "hardhat", "node", "--hostname", "0.0.0.0" ] diff --git a/contracts/Depository.sol b/contracts/Depository.sol index 9d01c313..08eca624 100644 --- a/contracts/Depository.sol +++ b/contracts/Depository.sol @@ -9,9 +9,9 @@ import "./interfaces/IErrors.sol"; import "./interfaces/ITreasury.sol"; import "./interfaces/ITokenomics.sol"; - /// @title Bond Depository - Smart contract for OLA Bond Depository /// @author AL +/// @author Aleksandr Kuperman - contract Depository is IErrors, Ownable { using SafeERC20 for IERC20; @@ -100,10 +100,10 @@ contract Depository is IErrors, Ownable { } // Calculate the payout in OLA tokens based on the LP pair with the discount factor (DF) calculation - uint256 _epoch = block.number / ITokenomics(tokenomics).epochLen(); + uint256 epoch = block.number / ITokenomics(tokenomics).epochLen(); // df uint with defined decimals - payout = ITokenomics(tokenomics).calculatePayoutFromLP(token, tokenAmount, _epoch); - + payout = ITokenomics(tokenomics).calculatePayoutFromLP(token, tokenAmount, epoch); + // Check for the sufficient supply if (payout > product.supply) { revert ProductSupplyLow(token, productId, payout, product.supply); @@ -124,6 +124,10 @@ contract Depository is IErrors, Ownable { // Take into account this bond in current epoch ITokenomics(tokenomics).usedBond(payout); + // Uniswap allowance implementation does not revert with the accurate message, check before SafeMath is engaged + if (product.token.allowance(msg.sender, address(this)) < tokenAmount) { + revert InsufficientAllowance(product.token.allowance((msg.sender), address(this)), tokenAmount); + } // Transfer tokens to the depository product.token.safeTransferFrom(msg.sender, address(this), tokenAmount); // Approve treasury for the specified token amount diff --git a/contracts/Dispenser.sol b/contracts/Dispenser.sol index 6c9bf430..1a23101a 100644 --- a/contracts/Dispenser.sol +++ b/contracts/Dispenser.sol @@ -15,6 +15,7 @@ import "./interfaces/ITokenomics.sol"; /// @title Dispenser - Smart contract for rewards /// @author AL +/// @author Aleksandr Kuperman - contract Dispenser is IErrors, IStructs, Ownable, Pausable, ReentrancyGuard { using SafeERC20 for IERC20; diff --git a/contracts/Tokenomics.sol b/contracts/Tokenomics.sol index edc4d44a..d5c26639 100644 --- a/contracts/Tokenomics.sol +++ b/contracts/Tokenomics.sol @@ -11,8 +11,10 @@ import "./interfaces/IStructs.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; + /// @title Tokenomics - Smart contract for store/interface for key tokenomics params /// @author AL +/// @author Aleksandr Kuperman - contract Tokenomics is IErrors, IStructs, Ownable { using FixedPoint for *; @@ -488,16 +490,16 @@ contract Tokenomics is IErrors, IStructs, Ownable { // @dev Calculates the amount of OLA tokens based on LP (see the doc for explanation of price computation). Any can do it /// @param token Token address. /// @param tokenAmount Token amount. - /// @param _epoch epoch number + /// @param epoch epoch number /// @return resAmount Resulting amount of OLA tokens. - function calculatePayoutFromLP(address token, uint256 tokenAmount, uint _epoch) external view + function calculatePayoutFromLP(address token, uint256 tokenAmount, uint256 epoch) external view returns (uint256 resAmount) { uint256 df; PointEcomonics memory _PE; // avoid start checkpoint from calculatePayoutFromLP - uint256 _epochC = _epoch + 1; - for (uint256 i = _epochC; i > 0; i--) { + uint256 epochC = epoch + 1; + for (uint256 i = epochC; i > 0; i--) { _PE = mapEpochEconomics[i-1]; // if current point undefined, so calculatePayoutFromLP called before mined tx(checkpoint) if(_PE.exists) { @@ -545,6 +547,7 @@ contract Tokenomics is IErrors, IStructs, Ownable { balance1 -= amount1; uint256 reserveIn = (token0 == ola) ? balance1 : balance0; uint256 reserveOut = (token0 == ola) ? balance0 : balance1; + amountOLA = amountOLA + getAmountOut(amountPairForOLA, reserveIn, reserveOut); // The resulting DF amount cannot be bigger than the maximum possible one @@ -584,10 +587,10 @@ contract Tokenomics is IErrors, IStructs, Ownable { } /// @dev get Point by epoch - /// @param _epoch number of a epoch + /// @param epoch number of a epoch /// @return _PE raw point - function getPoint(uint256 _epoch) public view returns (PointEcomonics memory _PE) { - _PE = mapEpochEconomics[_epoch]; + function getPoint(uint256 epoch) public view returns (PointEcomonics memory _PE) { + _PE = mapEpochEconomics[epoch]; } /// @dev Get last epoch Point. @@ -597,10 +600,10 @@ contract Tokenomics is IErrors, IStructs, Ownable { } // decode a uq112x112 into a uint with 18 decimals of precision (cycle into the past), INITIAL_DF if not exist - function getDF(uint256 _epoch) public view returns (uint256 df) { + function getDF(uint256 epoch) public view returns (uint256 df) { PointEcomonics memory _PE; - uint256 _epochC = _epoch + 1; - for (uint256 i = _epochC; i > 0; i--) { + uint256 epochC = epoch + 1; + for (uint256 i = epochC; i > 0; i--) { _PE = mapEpochEconomics[i-1]; // if current point undefined, so getDF called before mined tx(checkpoint) if(_PE.exists) { diff --git a/contracts/Treasury.sol b/contracts/Treasury.sol index 6f134332..9f552ec8 100644 --- a/contracts/Treasury.sol +++ b/contracts/Treasury.sol @@ -12,6 +12,7 @@ import "./interfaces/IStructs.sol"; /// @title Treasury - Smart contract for managing OLA Treasury /// @author AL +/// @author Aleksandr Kuperman - contract Treasury is IErrors, IStructs, Ownable, ReentrancyGuard { using SafeERC20 for IERC20; diff --git a/contracts/governance/VotingEscrow.sol b/contracts/governance/VotingEscrow.sol index 390724bf..07afcb36 100644 --- a/contracts/governance/VotingEscrow.sol +++ b/contracts/governance/VotingEscrow.sol @@ -41,7 +41,7 @@ more than `MAXTIME` (4 years). //# When new types are added - the whole contract is changed //# The check() method is modifying to be able to use caching //# for individual wallet addresses -interface SmartWalletChecker { +interface IChecker { function check(address account) external returns (bool); } @@ -116,9 +116,8 @@ contract VotingEscrow is Ownable, ReentrancyGuard, ERC20VotesCustom { string public symbol; string public version; - // Checker for whitelisted (smart contract) wallets which are allowed to deposit + // Smart wallet contract checker address for whitelisted (smart contract) wallets which are allowed to deposit // The goal is to prevent tokenizing the escrow - address public futureSmartWalletChecker; address public smartWalletChecker; /// @dev Contract constructor @@ -151,25 +150,19 @@ contract VotingEscrow is Ownable, ReentrancyGuard, ERC20VotesCustom { } /// @dev Set an external contract to check for approved smart contract wallets - /// @param account Address of Smart contract checker - function commitSmartWalletChecker(address account) external onlyOwner { - futureSmartWalletChecker = account; + /// @param checker Address of Smart contract checker + function changeSmartWalletChecker(address checker) external onlyOwner { + smartWalletChecker = checker; } - - /// @dev Apply setting external contract to check approved smart contract wallets - function applySmartWalletChecker() external onlyOwner { - smartWalletChecker = futureSmartWalletChecker; - } - - /// @dev Check if the call is from a whitelisted smart contract, revert if not /// @param account Address to be checked function assertNotContract(address account) internal { if (account != tx.origin) { - address checker = smartWalletChecker; - require(checker != address(0) && SmartWalletChecker(checker).check(account), - "SC depositors not allowed"); + // TODO Implement own smart contract checker or use one from oracle-dev + if (smartWalletChecker != address(0)) { + require(IChecker(smartWalletChecker).check(account), "SC depositors not allowed"); + } } } diff --git a/contracts/interfaces/IErrors.sol b/contracts/interfaces/IErrors.sol index 2e6c0c31..3517f2c0 100644 --- a/contracts/interfaces/IErrors.sol +++ b/contracts/interfaces/IErrors.sol @@ -167,6 +167,11 @@ interface IErrors { /// @param expected Expected amount. error WrongAmount(uint256 provided, uint256 expected); + /// @dev Insufficient token allowance. + /// @param provided Provided amount. + /// @param expected Minimum expected amount. + error InsufficientAllowance(uint256 provided, uint256 expected); + /// @dev Incorrect deposit provided for the registration activation. /// @param sent Sent amount. /// @param expected Expected amount. diff --git a/package.json b/package.json index 08ec100f..e90c62fd 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "compile": "./scripts/uni-adjust/adjust-point.sh && ./node_modules/.bin/hardhat compile && ./scripts/uni-adjust/adjust-pair.sh && ./node_modules/.bin/hardhat compile" }, "repository": { "type": "git", diff --git a/scripts/uni-adjust/adjust-pair.sh b/scripts/uni-adjust/adjust-pair.sh index d0953d5b..7e49743b 100755 --- a/scripts/uni-adjust/adjust-pair.sh +++ b/scripts/uni-adjust/adjust-pair.sh @@ -3,12 +3,10 @@ FILE="node_modules/@uniswap/v2-periphery/contracts/libraries/UniswapV2Library.so x=$(npx hardhat run scripts/uni-adjust/adjust.js) case "$(uname -s)" in Darwin) - echo 'Mac OS X' sed -i.bu "s/96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f/$x/g" $FILE ;; Linux) - echo 'Linux' sed -i "s/96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f/$x/g" $FILE ;; diff --git a/scripts/uni-adjust/adjust-point.sh b/scripts/uni-adjust/adjust-point.sh index 2c0d0281..5bd2226d 100755 --- a/scripts/uni-adjust/adjust-point.sh +++ b/scripts/uni-adjust/adjust-point.sh @@ -2,7 +2,6 @@ FILE="./node_modules/@uniswap/lib/contracts/libraries/BitMath.sol" case "$(uname -s)" in Darwin) - echo 'Mac OS X' sed -i.bu "s/uint128(-1)/type(uint128).max/g" $FILE sed -i.bu "s/uint64(-1)/type(uint64).max/g" $FILE sed -i.bu "s/uint32(-1)/type(uint32).max/g" $FILE @@ -11,7 +10,6 @@ case "$(uname -s)" in ;; Linux) - echo 'Linux' sed -i "s/uint128(-1)/type(uint128).max/g" $FILE sed -i "s/uint64(-1)/type(uint64).max/g" $FILE sed -i "s/uint32(-1)/type(uint32).max/g" $FILE @@ -28,7 +26,6 @@ FILE="./node_modules/@uniswap/lib/contracts/libraries/FixedPoint.sol" rm -rf $FILE case "$(uname -s)" in Darwin) - echo 'Mac OS X' cat << 'EOF' > ./node_modules/@uniswap/lib/contracts/libraries/FixedPoint.sol // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.4.0; @@ -185,7 +182,6 @@ library FixedPoint { EOF ;; Linux) - echo 'Linux' cat << EOF > ./node_modules/@uniswap/lib/contracts/libraries/FixedPoint.sol // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.4.0; @@ -351,7 +347,6 @@ FILE="./node_modules/@uniswap/lib/contracts/libraries/FullMath.sol" rm -rf $FILE case "$(uname -s)" in Darwin) - echo 'Mac OS X' cat << 'EOF' >> ./node_modules/@uniswap/lib/contracts/libraries/FullMath.sol // SPDX-License-Identifier: CC-BY-4.0 pragma solidity >=0.4.0; @@ -413,7 +408,6 @@ EOF ;; Linux) - echo 'Linux' cat << 'EOF' >> ./node_modules/@uniswap/lib/contracts/libraries/FullMath.sol // SPDX-License-Identifier: CC-BY-4.0 pragma solidity >=0.4.0; diff --git a/test/integration/TokenomicsLoop.js b/test/integration/TokenomicsLoop.js index f887657d..ce91a1ce 100644 --- a/test/integration/TokenomicsLoop.js +++ b/test/integration/TokenomicsLoop.js @@ -48,8 +48,8 @@ describe("Tokenomics integration", async () => { const maxThreshold = 1; const name = "service name"; const description = "service description"; - const milETHBalance = ethers.utils.parseEther("1000000"); - const regServiceRevenue = milETHBalance; + const hundredETHBalance = ethers.utils.parseEther("100"); + const regServiceRevenue = hundredETHBalance; const agentId = 1; const agentParams = [1, regBond]; const serviceId = 1; diff --git a/test/unit/tokenomics/depository/Depository.js b/test/unit/tokenomics/depository/Depository.js index 6ba1c57f..038ef504 100644 --- a/test/unit/tokenomics/depository/Depository.js +++ b/test/unit/tokenomics/depository/Depository.js @@ -3,12 +3,14 @@ const { ethers, network } = require("hardhat"); const { expect } = require("chai"); describe("Depository LP", async () => { - const LARGE_APPROVAL = "100000000000000000000000000000000"; - // const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; - // Initial mint for ola and DAI (40,000) - const initialMint = "40000000000000000000000"; + const decimals = "0".repeat(18); + // 1 million token + const LARGE_APPROVAL = "1" + "0".repeat(6) + decimals; + // Initial mint for OLA and DAI (40,000) + const initialMint = "4" + "0".repeat(4) + decimals; // Increase timestamp by amount determined by `offset` const AddressZero = "0x" + "0".repeat(40); + const E18 = 1 + "0".repeat(18); let deployer, alice, bob; let erc20Token; @@ -18,6 +20,7 @@ describe("Depository LP", async () => { let componentRegistry; let agentRegistry; let serviceRegistry; + let router; let dai; let ola; @@ -28,9 +31,10 @@ describe("Depository LP", async () => { let tokenomics; let epochLen = 100; - let supply = "10000000000000000000000"; // 10,000 + // 5,000 + let supplyProductOLA = "5" + "0".repeat(3) + decimals; - let vesting = 60 * 60 *24; + let vesting = 60 * 60 * 24; let timeToConclusion = 60 * 60 * 24; let conclusion; @@ -97,7 +101,7 @@ describe("Depository LP", async () => { // Deploy Router02 const Router = await ethers.getContractFactory("UniswapV2Router02"); - const router = await Router.deploy(factory.address, weth.address); + router = await Router.deploy(factory.address, weth.address); await router.deployed(); // console.log("Uniswap router02 deployed to:", router.address); @@ -118,10 +122,11 @@ describe("Depository LP", async () => { // console.log("balance dai for deployer:",(await dai.balanceOf(deployer.address))); // Add liquidity - const amountola = await ola.balanceOf(deployer.address); - const minAmountola = "50000000000"; - const amountDAI = "10000000000000000000000"; - const minAmountDAI = "1000000000000000000000"; + //const amountOLA = await ola.balanceOf(deployer.address); + const amountOLA = "5" + "0".repeat(3) + decimals; + const minAmountOLA = "5" + "0".repeat(2) + decimals; + const amountDAI = "1" + "0".repeat(4) + decimals; + const minAmountDAI = "1" + "0".repeat(3) + decimals; const deadline = Date.now() + 1000; const toAddress = deployer.address; await ola.approve(router.address, LARGE_APPROVAL); @@ -131,28 +136,31 @@ describe("Depository LP", async () => { dai.address, ola.address, amountDAI, - amountola, + amountOLA, minAmountDAI, - minAmountola, + minAmountOLA, toAddress, deadline ); - // console.log("deployer LP balance:",await pairODAI.balanceOf(deployer.address)); - // console.log("LP total supply:",await pairODAI.totalSupply()); - await pairODAI.connect(deployer).transfer(bob.address,"35355339059326876"); - // console.log("balance LP for bob:",(await pairODAI.balanceOf(bob.address))); + // console.log("deployer LP balance:", await pairODAI.balanceOf(deployer.address)); + // console.log("LP total supplyProductOLA:", await pairODAI.totalSupply()); + // send half of the balance from deployer + const amountTo = new ethers.BigNumber.from(await pairODAI.balanceOf(deployer.address)).div(2); + await pairODAI.connect(deployer).transfer(bob.address, amountTo); + // console.log("balance LP for bob:", (await pairODAI.balanceOf(bob.address))); + // console.log("deployer LP new balance:", await pairODAI.balanceOf(deployer.address)); await ola.connect(alice).approve(depository.address, LARGE_APPROVAL); await dai.connect(bob).approve(depository.address, LARGE_APPROVAL); await pairODAI.connect(bob).approve(depository.address, LARGE_APPROVAL); - await dai.connect(alice).approve(depository.address, supply); + await dai.connect(alice).approve(depository.address, supplyProductOLA); await treasury.enableToken(pairODAI.address); await depository.create( pairODAI.address, - supply, + supplyProductOLA, vesting ); @@ -164,7 +172,6 @@ describe("Depository LP", async () => { expect(await depository.isActive(pairODAI.address, bid)).to.equal(true); }); - // ok test 10-03-22 it("should conclude in correct amount of time", async () => { let [, , , concludes] = await depository.getProduct(pairODAI.address, bid); // console.log(concludes,conclusion); @@ -174,24 +181,24 @@ describe("Depository LP", async () => { expect(Number(concludes)).to.be.greaterThan(lowerBound); expect(Number(concludes)).to.be.lessThan(upperBound); }); - // ok test 10-03-22 + it("should return IDs of all products", async () => { // create a second bond await depository.create( pairODAI.address, - supply, + supplyProductOLA, vesting ); let [first, second] = await depository.getActiveProductsForToken(pairODAI.address); expect(Number(first)).to.equal(0); expect(Number(second)).to.equal(1); }); - // ok test 10-03-22 + it("should update IDs of products", async () => { // create a second bond await depository.create( pairODAI.address, - supply, + supplyProductOLA, vesting ); // close the first bond @@ -199,47 +206,118 @@ describe("Depository LP", async () => { [first] = await depository.getActiveProductsForToken(pairODAI.address); expect(Number(first)).to.equal(1); }); - // ok test 10-03-22 + it("should include ID in live products for quote token", async () => { [id] = await depository.getActiveProductsForToken(pairODAI.address); expect(Number(id)).to.equal(bid); }); - // ok test 10-03-22 + it("should allow a deposit", async () => { - let dp = await treasury.depository(); - // console.log("depository.address:",depository.address); - // console.log("treasury allow deposit:",dp); - expect(dp).to.equal(depository.address); - let bamount = (await pairODAI.balanceOf(bob.address)); - let amount = bamount/4; - // console.log("bob LP:%s depoist:%s",bamount,amount); + await ola.approve(router.address, LARGE_APPROVAL); + await dai.approve(router.address, LARGE_APPROVAL); + + const bamount = (await pairODAI.balanceOf(bob.address)); await depository .connect(bob) - .deposit(pairODAI.address, bid, amount, bob.address); + .deposit(pairODAI.address, bid, bamount, bob.address); expect(Array(await depository.getPendingBonds(bob.address)).length).to.equal(1); + const res = await depository.getBondStatus(bob.address,0); + // 2500 * 1.1 = 2750 * e18 = 2.75 * e21 + expect(Number(res.payout)).to.equal(2.75e+21); }); - // ok test 11-03-22 + + it("should not allow a deposit with insufficient allowance", async () => { + let amount = (await pairODAI.balanceOf(deployer.address)); + await expect( + depository.connect(deployer).deposit(pairODAI.address, bid, amount, deployer.address) + ).to.be.revertedWith("InsufficientAllowance"); + }); + it("should not allow a deposit greater than max payout", async () => { - let amount = (await pairODAI.balanceOf(deployer.address)); + const amountTo = new ethers.BigNumber.from(await pairODAI.balanceOf(bob.address)); + // Transfer all LP tokens back to deployer + await pairODAI.connect(bob).transfer(deployer.address, amountTo); + const amount = (await pairODAI.balanceOf(deployer.address)); + // console.log("LP token in:",amount); + + const totalSupply = (await pairODAI.totalSupply()); + // Calculate payout based on the amount of LP + const token0address = (await pairODAI.token0()); + const token1address = (await pairODAI.token1()); + const token0 = await ethers.getContractAt("ERC20Token", token0address); + const token1 = await ethers.getContractAt("ERC20Token", token1address); + + // Get the balances of tokens in LP + let balance0 = (await token0.balanceOf(pairODAI.address)); + let balance1 = (await token1.balanceOf(pairODAI.address)); + // console.log("token0",token0.address); + // console.log("token1",token1.address); + // console.log("balance0",balance0); + // console.log("balance1",balance1); + // console.log("ola token",ola.address); + // console.log("totalSupply LP",totalSupply); + + // Token fractions based on the LP tokens amount and total supply + const amount0 = ethers.BigNumber.from(amount).mul(balance0).div(totalSupply); + const amount1 = ethers.BigNumber.from(amount).mul(balance1).div(totalSupply); + // console.log("token0 amount ref LP",amount0); + // console.log("token1 amount ref LP",amount1); + + // This is equivalent to removing the liquidity + let amountOLA = amount1; + balance0 = balance0.sub(amount0); + balance1 = balance1.sub(amount1); + // console.log("balance0",balance0); + // console.log("balance1",balance1); + + // This is the equivalent of a swap operation to calculate additional OLA + const reserveIn = balance0; + const reserveOut = balance1; + let amountIn = amount0; + // console.log("amountIn",amountIn); + // amountOLA = amountOLA + getAmountOut(amountPairForOLA, reserveIn, reserveOut); + + // We use this tutorial to correctly calculate the in-out amounts: + // https://ethereum.org/en/developers/tutorials/uniswap-v2-annotated-code/#why-v2 + const amountInWithFee = amountIn.mul(997); + const numerator = amountInWithFee.div(reserveOut); + const denominator = (reserveIn.mul(1000)).add(amountInWithFee); + const amountOut = numerator.div(denominator); + amountOLA = amountOLA.add(amountOut); + // console.log("amountInWithFee",amountInWithFee); + // console.log("numerator",numerator); + // console.log("denominator",denominator); + // console.log("delta amountOut:",amountOut); + // console.log("sutotal amountOLA:",amountOLA); + const payout = await tokenomics.calculatePayoutFromLP(pairODAI.address, amount, 0); + const df = await tokenomics.getDF(0); + + // Payouts with direct calculation and via DF must be equal + expect(amountOLA.mul(df).div(E18)).to.equal(payout); + // console.log("payout direclty", payout); + // console.log("payout via df", amountOLA.mul(df).div(E18)); + + // Trying to deposit the amount that would result in an overflow payout for the LP supply + await pairODAI.connect(deployer).approve(depository.address, LARGE_APPROVAL); + await expect( depository.connect(deployer).deposit(pairODAI.address, bid, amount, deployer.address) ).to.be.revertedWith("ProductSupplyLow"); }); - // ok test 11-03-22 + it("should not redeem before vested", async () => { let balance = await ola.balanceOf(bob.address); let bamount = (await pairODAI.balanceOf(bob.address)); - let amount = bamount/4; // console.log("bob LP:%s depoist:%s",bamount,amount); await depository .connect(bob) - .deposit(pairODAI.address, bid, amount, bob.address); + .deposit(pairODAI.address, bid, bamount, bob.address); await depository.connect(bob).redeemAll(bob.address); expect(await ola.balanceOf(bob.address)).to.equal(balance); }); // ok test 11-03-22 it("should redeem after vested", async () => { - let amount = (await pairODAI.balanceOf(bob.address))/4; + let amount = (await pairODAI.balanceOf(bob.address)); let [expectedPayout,,] = await depository .connect(bob) .callStatic.deposit(pairODAI.address, bid, amount, bob.address); diff --git a/test/unit/tokenomics/tokens/OLA.test.js b/test/unit/tokenomics/tokens/OLA.js similarity index 100% rename from test/unit/tokenomics/tokens/OLA.test.js rename to test/unit/tokenomics/tokens/OLA.js