forked from crytic/properties
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathERC20MintableProperties.sol
34 lines (28 loc) · 1006 Bytes
/
ERC20MintableProperties.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.13;
import "../util/ERC20TestBase.sol";
abstract contract CryticERC20MintableProperties is CryticERC20Base {
constructor() {
isMintableOrBurnable = true;
}
// Should be modified if target contract's function name is not mint
function mint(address to, uint256 amount) public virtual;
////////////////////////////////////////
// Properties
// Minting tokens should update user balance and total supply
function test_ERC20_mintTokens(address target, uint256 amount) public {
uint256 balance_receiver = balanceOf(target);
uint256 supply = totalSupply();
this.mint(target, amount);
assertEq(
balanceOf(target),
balance_receiver + amount,
"Mint failed to update target balance"
);
assertEq(
totalSupply(),
supply + amount,
"Mint failed to update total supply"
);
}
}