Skip to content

Commit

Permalink
chore: add assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
tringuyenskymavis committed Nov 5, 2024
1 parent bcd9fce commit 5dbcc0b
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,39 @@ contract Migration__20241105_UpgradeRNSCommissionMainnet is Migration {
internal
logFn("_validateSendMoneyFromSenders_NonZeroRonAmount")
{
bool sent;
vm.deal(address(_auction), 100 ether);
vm.prank(address(_auction));
address(_rnsCommission).call{ value: 100 ether }("");
(sent,) = address(_rnsCommission).call{ value: 100 ether }("");
assertTrue(sent);

vm.deal(address(_controller), 100 ether);
vm.prank(address(_controller));
address(_rnsCommission).call{ value: 100 ether }("");
(sent,) = address(_rnsCommission).call{ value: 100 ether }("");
assertTrue(sent);

assertEq(address(_rnsCommission).balance, 0 ether);

address randomAddr = makeAddr("random address");
vm.deal(address(randomAddr), 100 ether);
vm.prank(randomAddr);
address(_rnsCommission).call{ value: 100 ether }("");
(sent,) = address(_rnsCommission).call{ value: 100 ether }("");
assertTrue(sent);

assertEq(address(_rnsCommission).balance, 100 ether);
}

function _validateSendMoneyFromSenders_ZeroRonAmount() internal logFn("_validateSendMoneyFromSenders_ZeroRonAmount") {
bool sent;
uint256 balanceBefore = address(_rnsCommission).balance;

vm.prank(address(_auction));
address(_rnsCommission).call{ value: 0 }("");
(sent,) = address(_rnsCommission).call{ value: 0 }("");
assertTrue(sent);

vm.prank(address(_controller));
address(_rnsCommission).call{ value: 0 }("");
(sent,) = address(_rnsCommission).call{ value: 0 }("");
assertTrue(sent);

assertEq(address(_rnsCommission).balance, balanceBefore);
}
Expand Down

0 comments on commit 5dbcc0b

Please sign in to comment.