Skip to content

Commit

Permalink
Require initial deposit to be larger than 1e5 units
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenshively committed Aug 15, 2024
1 parent e384e90 commit 7fb2f8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/src/Lender.sol
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ contract Lender is Ledger {

// Mint shares, track rewards, and (if applicable) handle courier accounting
cache.totalSupply = _mint(beneficiary, shares, amount, cache.totalSupply, courierId);
require(cache.totalSupply > 1e5);
// Assume tokens are transferred
cache.lastBalance += amount;

Expand Down
3 changes: 2 additions & 1 deletion core/test/invariants/LenderHarness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ contract LenderHarness {
return;
}

uint256 amount = LENDER.convertToAssets(1) + 1;
uint256 amount = LENDER.convertToAssets(1e5 + 1) + 1;
MockERC20 mock = MockERC20(address(LENDER.asset()));
mock.mint(address(LENDER), amount);

Expand Down Expand Up @@ -163,6 +163,7 @@ contract LenderHarness {
/// @notice Deposits `amount` and sends new `shares` to `beneficiary`
function deposit(uint112 amount, address beneficiary) public returns (uint256 shares) {
amount = uint112(amount % (LENDER.maxDeposit(msg.sender) + 1));
if (amount <= 1e5) amount = 1e5 + 1;

ERC20 asset = LENDER.asset();
uint256 free = asset.balanceOf(address(LENDER)) - LENDER.lastBalance();
Expand Down

0 comments on commit 7fb2f8a

Please sign in to comment.