Skip to content

Commit

Permalink
test exchange rate bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
arr00 committed Nov 17, 2023
1 parent 6ff5042 commit e655518
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/authorities/SellPartyCardsAuthority.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,40 @@ contract SellPartyCardsAuthorityTest is SetupPartyHelper {
);
}

function testSellPartyCards_precision_upperPrice() public {
SellPartyCardsAuthority.FixedMembershipSaleOpts memory opts = SellPartyCardsAuthority
.FixedMembershipSaleOpts({
pricePerMembership: 10 ether,
votingPowerPerMembership: 10, // pricePerMembership/votingPowerPerMembership <= 1e18
totalMembershipsForSale: 30,
fundingSplitBps: 0,
fundingSplitRecipient: payable(address(0)),
duration: 100,
gateKeeper: IGateKeeper(address(0)),
gateKeeperId: bytes12(0)
});

vm.prank(address(party));
sellPartyCardsAuthority.createFixedMembershipSale(opts);
}

function testSellPartyCards_precision_lowerPrice() public {
SellPartyCardsAuthority.FixedMembershipSaleOpts memory opts = SellPartyCardsAuthority
.FixedMembershipSaleOpts({
pricePerMembership: 1,
votingPowerPerMembership: 10 ether, // votingPowerPerMembership/pricePerMembership can be much greater than 1e18
totalMembershipsForSale: 30,
fundingSplitBps: 0,
fundingSplitRecipient: payable(address(0)),
duration: 100,
gateKeeper: IGateKeeper(address(0)),
gateKeeperId: bytes12(0)
});

vm.prank(address(party));
sellPartyCardsAuthority.createFixedMembershipSale(opts);
}

function _createNewFixedSale() internal returns (uint256) {
SellPartyCardsAuthority.FixedMembershipSaleOpts memory opts = SellPartyCardsAuthority
.FixedMembershipSaleOpts({
Expand Down

0 comments on commit e655518

Please sign in to comment.