Skip to content

Commit

Permalink
Escape
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyewwww committed Jan 8, 2024
1 parent ad9d148 commit cbf06f9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions contracts/GasSavingPool/impl/GSPFunding.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ contract GSPFunding is GSPVault {
// But May Happen,reserve >0 But totalSupply = 0
if (totalSupply == 0) {
// case 1. initial supply
require(quoteBalance > 0, "ZERO_QUOTE_AMOUNT");
// The shares will be minted to user
shares = quoteBalance < DecimalMath.mulFloor(baseBalance, _I_)
? DecimalMath.divFloor(quoteBalance, _I_)
Expand Down
10 changes: 10 additions & 0 deletions test/GSPVault.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,16 @@ contract TestGSPVault is Test {
vm.stopPrank();
vm.startPrank(USER);
dai.transfer(address(gsp), BASE_RESERVE);
vm.expectRevert("ZERO_QUOTE_AMOUNT");
gsp.buyShares(USER);
}

function testBugShareNotEnough() public {
deal(DAI, USER, 1);
deal(USDC, USER, 1);
vm.startPrank(USER);
dai.transfer(address(gsp), 1);
usdc.transfer(address(gsp), 1);
vm.expectRevert("MINT_AMOUNT_NOT_ENOUGH");
gsp.buyShares(USER);
}
Expand Down

0 comments on commit cbf06f9

Please sign in to comment.