Skip to content

Commit

Permalink
fix: vm.prank() must be call just before contract call, else it is ig…
Browse files Browse the repository at this point in the history
…nored
  • Loading branch information
ncoquelet committed Dec 10, 2024
1 parent c77507c commit 2b82de0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions onchain/solidity_contracts/test/Vault.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ contract ABTCVaultTest is Test {
}

function testSetWrappedBTCTokenUnauthorized() public {
vm.prank(user1);
vm.expectRevert(
abi.encodeWithSelector(
AccessControlUnauthorizedAccount.selector,
user1,
vault.ADMIN_ROLE()
)
);
vm.prank(user1);
vault.setWrappedBTCToken(address(wbtc), true, 1e18, block.timestamp);
}

Expand Down Expand Up @@ -144,14 +144,14 @@ contract ABTCVaultTest is Test {

function testMintUnauthorized() public {
uint256 mintAmount = 100 * 1e18;
vm.prank(user1);
vm.expectRevert(
abi.encodeWithSelector(
AccessControlUnauthorizedAccount.selector,
user1,
vault.MINTER_ROLE()
)
);
vm.prank(user1);
vault.mint(user2, mintAmount);
}

Expand All @@ -165,14 +165,14 @@ contract ABTCVaultTest is Test {
function testBurnUnauthorized() public {
uint256 mintAmount = 100 * 1e18;
vault.mint(user1, mintAmount);
vm.prank(user1);
vm.expectRevert(
abi.encodeWithSelector(
AccessControlUnauthorizedAccount.selector,
user1,
vault.MINTER_ROLE()
)
);
vm.prank(user1);
vault.burn(user1, mintAmount);
}

Expand All @@ -182,14 +182,14 @@ contract ABTCVaultTest is Test {
}

function testPauseUnauthorized() public {
vm.prank(user1);
vm.expectRevert(
abi.encodeWithSelector(
AccessControlUnauthorizedAccount.selector,
user1,
vault.PAUSER_ROLE()
)
);
vm.prank(user1);
vault.pause();
}

Expand Down

0 comments on commit 2b82de0

Please sign in to comment.