Skip to content

Commit

Permalink
add retroactive airdrop linear releases contract
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-D-Ant committed Oct 26, 2022
1 parent 824a1d2 commit 91b522e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
1 change: 0 additions & 1 deletion contracts/RetroactiveAirdropLock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ contract RetroactiveAirdropLock is Adminable{

function lockedAmount(address beneficiary) public view returns (uint256){
ReleaseVar memory releaseVar = releaseVars[beneficiary];
require(endTime >= block.timestamp, 'locked end');
return releaseVar.amount.mul(endTime - releaseVar.lastUpdateTime)
.div(endTime - startTime);
}
Expand Down
18 changes: 9 additions & 9 deletions test/LTimePoolTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -634,25 +634,25 @@ contract("LPoolDelegator", async accounts => {

accountSnapshot = await erc20Pool.getAccountSnapshot(accounts[0]);
assert.equal(accountSnapshot[0], 0);
approxPrecisionAssertPrint("balanceOf", '9999665144596864000000', (await testToken.balanceOf(accounts[0])).toString(), 8);
approxPrecisionAssertPrint("Check borrow rate", '1585489599', await erc20Pool.borrowRatePerBlock(), 8);
approxPrecisionAssertPrint("balanceOf", '9999665144596864000000', (await testToken.balanceOf(accounts[0])).toString(), 7);
approxPrecisionAssertPrint("Check borrow rate", '1585489599', await erc20Pool.borrowRatePerBlock(), 7);
assert.equal(toETH(await erc20Pool.supplyRatePerBlock()), 0);
assert.equal((await erc20Pool.exchangeRateStored()).toString(), 1e18);
approxPrecisionAssertPrint("reserves", '334855403136000000', reserves.toString(), 8);
approxPrecisionAssertPrint("reserves", '334855403136000000', reserves.toString(), 7);

//reduce reserves
await erc20Pool.reduceReserves(accounts[1], '34855403136000000');
let reservesAfterReduce = await erc20Pool.totalReserves();
approxPrecisionAssertPrint("reservesAfterReduce", '300000000000000000', reservesAfterReduce.toString(), 8);
approxPrecisionAssertPrint("Check borrow rate", '1585489599', (await erc20Pool.borrowRatePerBlock()).toString(), 8);
approxPrecisionAssertPrint("reservesAfterReduce", '300000000000000000', reservesAfterReduce.toString(), 7);
approxPrecisionAssertPrint("Check borrow rate", '1585489599', (await erc20Pool.borrowRatePerBlock()).toString(), 7);
assert.equal(toETH(await erc20Pool.supplyRatePerBlock()), 0);
assert.equal((await erc20Pool.exchangeRateStored()).toString(), 1e18);
approxPrecisionAssertPrint("balanceOf", '34855403136000000', (await testToken.balanceOf(accounts[1])).toString(), 8);
approxPrecisionAssertPrint("cash", '300000000000000000', (await erc20Pool.getCash()).toString(), 8);
approxPrecisionAssertPrint("balanceOf", '34855403136000000', (await testToken.balanceOf(accounts[1])).toString(), 7);
approxPrecisionAssertPrint("cash", '300000000000000000', (await erc20Pool.getCash()).toString(), 7);
// add reserves
await erc20Pool.addReserves('100000000000000000');
approxPrecisionAssertPrint("totalReserves", '400000000000000000', (await erc20Pool.totalReserves()).toString(), 8);
approxPrecisionAssertPrint("cash", '400000000000000000', (await erc20Pool.getCash()).toString(), 8);
approxPrecisionAssertPrint("totalReserves", '400000000000000000', (await erc20Pool.totalReserves()).toString(), 7);
approxPrecisionAssertPrint("cash", '400000000000000000', (await erc20Pool.getCash()).toString(), 7);

})

Expand Down

0 comments on commit 91b522e

Please sign in to comment.