{ "language": "Solidity", "sources": { "contracts/optimism_bridge/AnteOptimismBridgeAssetBalanceTest.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport {AnteTest} from \"../AnteTest.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/// @title Optimism Bridge on Ethereum doesn't lose significant asset balance\n/// @notice Ante Test to check if main Optimism Bridge contract on Eth mainnet\n/// loses 90% of its top asset holdings (as of test deployment)\ncontract AnteOptimismBridgeAssetBalanceTest is AnteTest(\n \"Optimism Bridge doesn't lose 90% of any of its top assets on Eth Mainnet\"\n) {\n // As of 2022-12-04, the top assets on the L1 side of the bridge are ETH,\n // USDC, USDT, and WBTC, representing 92.5% of value stored on the L1 side\n // https://etherscan.io/address/0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1\n address public constant OPTIMISM_MAIN_BRIDGE = 0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1;\n // https://etherscan.io/address/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\n IERC20 public constant USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);\n // https://etherscan.io/address/0xdAC17F958D2ee523a2206206994597C13D831ec7\n IERC20 public constant USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n // https://etherscan.io/address/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599\n IERC20 public constant WBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);\n\n uint256 public immutable ethBalanceAtDeploy;\n uint256 public immutable usdcBalanceAtDeploy;\n uint256 public immutable usdtBalanceAtDeploy;\n uint256 public immutable wbtcBalanceAtDeploy;\n\n constructor() {\n protocolName = \"Optimism Bridge\";\n testedContracts = [OPTIMISM_MAIN_BRIDGE];\n\n ethBalanceAtDeploy = OPTIMISM_MAIN_BRIDGE.balance;\n usdcBalanceAtDeploy = USDC.balanceOf(OPTIMISM_MAIN_BRIDGE);\n usdtBalanceAtDeploy = USDT.balanceOf(OPTIMISM_MAIN_BRIDGE);\n wbtcBalanceAtDeploy = WBTC.balanceOf(OPTIMISM_MAIN_BRIDGE);\n }\n\n /// @notice checks balance of top 4 assets on Optimism Bridge doesn't drop\n /// @return true if bridge has more than 10% of the original asset balance\n /// at time of test deploy across all checked assets\n function checkTestPasses() external view override returns (bool) {\n return\n OPTIMISM_MAIN_BRIDGE.balance * 10 > ethBalanceAtDeploy &&\n USDC.balanceOf(OPTIMISM_MAIN_BRIDGE) * 10 > usdcBalanceAtDeploy &&\n USDT.balanceOf(OPTIMISM_MAIN_BRIDGE) * 10 > usdtBalanceAtDeploy &&\n WBTC.balanceOf(OPTIMISM_MAIN_BRIDGE) * 10 > wbtcBalanceAtDeploy;\n }\n}\n" }, "contracts/AnteTest.sol": { "content": "// SPDX-License-Identifier: GPL-3.0-only\n\n// ┏━━━┓━━━━━┏┓━━━━━━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━━━━━\n// ┃┏━┓┃━━━━┏┛┗┓━━━━━━━━┃┏━━┛━━━━━━━━━━━━━━━━━━━━━━━\n// ┃┗━┛┃┏━┓━┗┓┏┛┏━━┓━━━━┃┗━━┓┏┓┏━┓━┏━━┓━┏━┓━┏━━┓┏━━┓\n// ┃┏━┓┃┃┏┓┓━┃┃━┃┏┓┃━━━━┃┏━━┛┣┫┃┏┓┓┗━┓┃━┃┏┓┓┃┏━┛┃┏┓┃\n// ┃┃ ┃┃┃┃┃┃━┃┗┓┃┃━┫━┏┓━┃┃━━━┃┃┃┃┃┃┃┗┛┗┓┃┃┃┃┃┗━┓┃┃━┫\n// ┗┛ ┗┛┗┛┗┛━┗━┛┗━━┛━┗┛━┗┛━━━┗┛┗┛┗┛┗━━━┛┗┛┗┛┗━━┛┗━━┛\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\npragma solidity >=0.7.0;\n\nimport \"./interfaces/IAnteTest.sol\";\n\n/// @title Ante V0.5 Ante Test smart contract\n/// @notice Abstract inheritable contract that supplies syntactic sugar for writing Ante Tests\n/// @dev Usage: contract YourAnteTest is AnteTest(\"String descriptor of test\") { ... }\nabstract contract AnteTest is IAnteTest {\n /// @inheritdoc IAnteTest\n address public override testAuthor;\n /// @inheritdoc IAnteTest\n string public override testName;\n /// @inheritdoc IAnteTest\n string public override protocolName;\n /// @inheritdoc IAnteTest\n address[] public override testedContracts;\n\n /// @dev testedContracts and protocolName are optional parameters which should\n /// be set in the constructor of your AnteTest\n /// @param _testName The name of the Ante Test\n constructor(string memory _testName) {\n testAuthor = msg.sender;\n testName = _testName;\n }\n\n /// @notice Returns the testedContracts array of addresses\n /// @return The list of tested contracts as an array of addresses\n function getTestedContracts() external view returns (address[] memory) {\n return testedContracts;\n }\n\n /// @inheritdoc IAnteTest\n function checkTestPasses() external virtual override returns (bool) {}\n}\n" }, "@openzeppelin/contracts/token/ERC20/IERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" }, "contracts/interfaces/IAnteTest.sol": { "content": "// SPDX-License-Identifier: GPL-3.0-only\n\n// ┏━━━┓━━━━━┏┓━━━━━━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━━━━━\n// ┃┏━┓┃━━━━┏┛┗┓━━━━━━━━┃┏━━┛━━━━━━━━━━━━━━━━━━━━━━━\n// ┃┗━┛┃┏━┓━┗┓┏┛┏━━┓━━━━┃┗━━┓┏┓┏━┓━┏━━┓━┏━┓━┏━━┓┏━━┓\n// ┃┏━┓┃┃┏┓┓━┃┃━┃┏┓┃━━━━┃┏━━┛┣┫┃┏┓┓┗━┓┃━┃┏┓┓┃┏━┛┃┏┓┃\n// ┃┃ ┃┃┃┃┃┃━┃┗┓┃┃━┫━┏┓━┃┃━━━┃┃┃┃┃┃┃┗┛┗┓┃┃┃┃┃┗━┓┃┃━┫\n// ┗┛ ┗┛┗┛┗┛━┗━┛┗━━┛━┗┛━┗┛━━━┗┛┗┛┗┛┗━━━┛┗┛┗┛┗━━┛┗━━┛\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\npragma solidity >=0.7.0;\n\n/// @title The interface for the Ante V0.5 Ante Test\n/// @notice The Ante V0.5 Ante Test wraps test logic for verifying fundamental invariants of a protocol\ninterface IAnteTest {\n /// @notice Returns the author of the Ante Test\n /// @dev This overrides the auto-generated getter for testAuthor as a public var\n /// @return The address of the test author\n function testAuthor() external view returns (address);\n\n /// @notice Returns the name of the protocol the Ante Test is testing\n /// @dev This overrides the auto-generated getter for protocolName as a public var\n /// @return The name of the protocol in string format\n function protocolName() external view returns (string memory);\n\n /// @notice Returns a single address in the testedContracts array\n /// @dev This overrides the auto-generated getter for testedContracts [] as a public var\n /// @param i The array index of the address to return\n /// @return The address of the i-th element in the list of tested contracts\n function testedContracts(uint256 i) external view returns (address);\n\n /// @notice Returns the name of the Ante Test\n /// @dev This overrides the auto-generated getter for testName as a public var\n /// @return The name of the Ante Test in string format\n function testName() external view returns (string memory);\n\n /// @notice Function containing test logic to inspect the protocol invariant\n /// @dev This should usually return True\n /// @return A single bool indicating if the Ante Test passes/fails\n function checkTestPasses() external returns (bool);\n}\n" } }, "settings": { "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} } }