Skip to content

Commit

Permalink
chore: set up mocked tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
0xteddybear committed Oct 25, 2024
1 parent 71391c2 commit 95e57d1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.15;

import {BalanceClaimerSetup} from '../setup/BalanceClaimer.t.sol';
import {BalanceClaimerSetup} from "../setup/BalanceClaimer.t.sol";

contract BalanceClaimerProperties is BalanceClaimerSetup {
/// @custom:property-id 1
/// @custom:property foo
function property_foo() external view {
}
/// @custom:property-id 5
/// @custom:property for each token, token.balanceOf(L1StandardBridge) == initialBalance - sum of claims
function property_tokenBalancesSum() external view {
for (uint256 i = 0; i < supportedTokens.length; i++) {
// TODO: subtract claimed balances
assert(supportedTokens[i].balanceOf(address(l1StandardBridge)) == INITIAL_BALANCE);
}
}

/// @custom:property-id 6
/// @custom:property OptimismPortal.balance == initialBalance - sum of claims
function property_ethBalancesSum() external view {
// TODO: subtract claimed balances
assert(address(optimismPortal).balance == INITIAL_BALANCE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,24 @@ import {L1ChugSplashProxy} from "contracts/legacy/L1ChugSplashProxy.sol";
import {L2OutputOracle} from "contracts/L1/L2OutputOracle.sol";
import {SystemConfig} from "contracts/L1/SystemConfig.sol";
import {Proxy} from "contracts/universal/Proxy.sol";
import {WinddownConstants} from "scripts/winddown-upgrade/WinddownConstants.sol";
import {IERC20} from "forge-std/interfaces/IERC20.sol";
import {MockERC20} from "forge-std/mocks/MockERC20.sol";

import {CommonBase} from "forge-std/Base.sol";

contract BalanceClaimerSetup is CommonBase {

contract FuzzERC20 is MockERC20 {
function mint(address _to, uint256 _amount) public {
_mint(_to, _amount);
}
}

contract BalanceClaimerSetup is CommonBase{
uint256 internal constant INITIAL_BALANCE = 100000e18;
L1StandardBridge internal l1StandardBridge;
OptimismPortal internal optimismPortal;
BalanceClaimer internal balanceClaimer;
IERC20[] internal supportedTokens;

constructor() {
Proxy balanceClaimerProxy = new Proxy(address(this));
Expand All @@ -31,8 +41,7 @@ contract BalanceClaimerSetup is CommonBase {
_balanceClaimer: address(balanceClaimerProxy)
});
// Get the proxies for L1StandardBridge and OptimismPortal
L1ChugSplashProxy l1StandardBridgeProxy =
new L1ChugSplashProxy(address(this));
L1ChugSplashProxy l1StandardBridgeProxy = new L1ChugSplashProxy(address(this));
Proxy optimismPortalProxy = new Proxy(address(this));

BalanceClaimer balanceClaimerImpl = new BalanceClaimer();
Expand All @@ -53,6 +62,14 @@ contract BalanceClaimerSetup is CommonBase {
optimismPortal = OptimismPortal(payable(optimismPortalProxy));
l1StandardBridge = L1StandardBridge(payable(l1StandardBridgeProxy));
balanceClaimer = BalanceClaimer(address(balanceClaimerProxy));

for (uint256 i = 0; i < 4; i++) {
FuzzERC20 token = new FuzzERC20();
token.initialize("name", "symbol", i == 0 ? 6 : 18);
token.mint(address(l1StandardBridge), INITIAL_BALANCE);
supportedTokens.push(token);
}
vm.deal(address(optimismPortal), INITIAL_BALANCE);
}

/// @custom:prop-id 0
Expand Down

0 comments on commit 95e57d1

Please sign in to comment.