mirror of
https://github.com/logos-messaging/logos-messaging-rlnv2-contract.git
synced 2026-01-09 09:23:09 +00:00
Add tests for TestStableToken
This commit is contained in:
parent
e39e8f4886
commit
95a175b8a8
@ -763,6 +763,39 @@ contract WakuRlnV2Test is Test {
|
||||
}
|
||||
}
|
||||
|
||||
function test__TestStableToken__OnlyOwnerCanMint() external {
|
||||
address nonOwner = vm.addr(1);
|
||||
uint256 mintAmount = 1000 ether;
|
||||
|
||||
vm.prank(nonOwner);
|
||||
vm.expectRevert("Only owner can mint");
|
||||
token.mint(nonOwner, mintAmount);
|
||||
}
|
||||
|
||||
function test__TestStableToken__OwnerMintsTransfersAndRegisters() external {
|
||||
address recipient = vm.addr(2);
|
||||
uint256 idCommitment = 3;
|
||||
uint32 membershipRateLimit = w.minMembershipRateLimit();
|
||||
(, uint256 price) = w.priceCalculator().calculate(membershipRateLimit);
|
||||
|
||||
// Owner (test contract) mints tokens to recipient
|
||||
token.mint(recipient, price);
|
||||
assertEq(token.balanceOf(recipient), price);
|
||||
|
||||
// Recipient uses tokens to register
|
||||
vm.startPrank(recipient);
|
||||
token.approve(address(w), price);
|
||||
w.register(idCommitment, membershipRateLimit, noIdCommitmentsToErase);
|
||||
vm.stopPrank();
|
||||
|
||||
// Verify registration succeeded
|
||||
assertTrue(w.isInMembershipSet(idCommitment));
|
||||
(,,,, uint32 fetchedMembershipRateLimit, uint32 index, address holder,) = w.memberships(idCommitment);
|
||||
assertEq(fetchedMembershipRateLimit, membershipRateLimit);
|
||||
assertEq(holder, recipient);
|
||||
assertEq(index, 0);
|
||||
}
|
||||
|
||||
function test__Upgrade() external {
|
||||
address testImpl = address(new WakuRlnV2());
|
||||
bytes memory data = abi.encodeCall(WakuRlnV2.initialize, (address(0), 100, 1, 10, 10 minutes, 4 minutes));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user