forked from balancer/balancer-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TBPoolBalance.sol
34 lines (29 loc) · 1.34 KB
/
TBPoolBalance.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
import "../crytic-export/flattening/BPool.sol";
import "./MyToken.sol";
import "./CryticInterface.sol";
contract TBPoolBalance is BPool, CryticInterface {
MyToken public token;
uint internal initial_token_balance = uint(-1);
constructor() public{
// Create a new token with initial_token_balance as total supply.
// After the token is created, each user defined in CryticInterface
// (crytic_owner, crytic_user and crytic_attacker) receives 1/3 of
// the initial balance
token = new MyToken(initial_token_balance, address(this));
// Bind the token with the minimal balance/weights
bind(address(token), MIN_BALANCE, MIN_WEIGHT);
// Enable public swap
setPublicSwap(true);
}
function echidna_attacker_token_balance() public returns(bool){
// An attacker cannot obtain more tokens than its initial balance
return token.balanceOf(crytic_attacker) == initial_token_balance/3; //initial balance of crytic_attacker
}
function echidna_pool_record_balance() public returns (bool) {
// If the token was unbinded, avoid revert and return true
if (this.getNumTokens() == 0)
return true;
// The token balance should not be out-of-sync
return (token.balanceOf(address(this)) >= this.getBalance(address(token)));
}
}