Skip to content

Commit

Permalink
Merge branch 'main' into createx-poc
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Aug 5, 2024
2 parents 5b84119 + d4910bf commit 98e0483
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion v2/pkg/zrc20.t.sol/zrc20test.go

Large diffs are not rendered by default.

16 changes: 11 additions & 5 deletions v2/test/ZRC20.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,17 @@ contract ZRC20Test is Test, ZRC20Errors {

function testWithdrawGasFee() public {
vm.prank(fungibleModule);
uint256 gasLimit = 10;
uint256 protocolFlatFee = 10;

zrc20.updateGasLimit(10);

vm.prank(fungibleModule);
zrc20.updateProtocolFlatFee(10);

(address gasZRC20, uint256 gasFee) = zrc20.withdrawGasFee();
assertEq(address(zrc20), gasZRC20);
assertEq(20, gasFee);
assertEq(gasLimit + protocolFlatFee, gasFee);
}

function testWithdrawGasFeeFailsIfGasCoinNotSetForChainId() public {
Expand All @@ -169,11 +172,14 @@ contract ZRC20Test is Test, ZRC20Errors {
}

function testWithdraw() public {
uint256 gasLimit = 10;
uint256 protocolFlatFee = 10;

vm.prank(fungibleModule);
zrc20.updateGasLimit(10);
zrc20.updateGasLimit(gasLimit);

vm.prank(fungibleModule);
zrc20.updateProtocolFlatFee(10);
zrc20.updateProtocolFlatFee(protocolFlatFee);

uint256 balanceStart = zrc20.balanceOf(owner);
assertEq(100_000, balanceStart);
Expand All @@ -186,10 +192,10 @@ contract ZRC20Test is Test, ZRC20Errors {
zrc20.withdraw(abi.encodePacked(addr1), 50_000);

uint256 fungibleModuleBalanceAfter = zrc20.balanceOf(fungibleModule);
assertEq(fungibleModuleBalanceStart + 20, fungibleModuleBalanceAfter);
assertEq(fungibleModuleBalanceStart + gasLimit + protocolFlatFee, fungibleModuleBalanceAfter);

uint256 balanceAfter = zrc20.balanceOf(owner);
assertEq(50_000 - 20, balanceAfter);
assertEq(50_000 - gasLimit - protocolFlatFee, balanceAfter);
uint256 totalSupplyAfter = zrc20.totalSupply();
assertEq(50_000, totalSupplyAfter);
}
Expand Down

0 comments on commit 98e0483

Please sign in to comment.