Latest 25 from a total of 1,003,634 transactions
| Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Send | 396252882 | 9 days ago | IN | 0 ETH | 0.00000088 | ||||
| Distribute | 395512891 | 11 days ago | IN | 0 ETH | 0.00000073 | ||||
| Send | 394666762 | 14 days ago | IN | 0 ETH | 0.00000194 | ||||
| Send | 393948859 | 16 days ago | IN | 0 ETH | 0.00000121 | ||||
| Commit Transfers | 393694226 | 17 days ago | IN | 0 ETH | 0.00000147 | ||||
| Send | 393688800 | 17 days ago | IN | 0 ETH | 0.00000087 | ||||
| Distribute | 391264278 | 24 days ago | IN | 0 ETH | 0.00000056 | ||||
| Distribute | 391262632 | 24 days ago | IN | 0 ETH | 0.00000073 | ||||
| Send | 391251798 | 24 days ago | IN | 0 ETH | 0.00000087 | ||||
| Send | 390233061 | 27 days ago | IN | 0 ETH | 0.00000301 | ||||
| Send | 387320010 | 35 days ago | IN | 0 ETH | 0.00000089 | ||||
| Send | 385227624 | 41 days ago | IN | 0 ETH | 0.00000089 | ||||
| Send | 384255220 | 44 days ago | IN | 0 ETH | 0.00000157 | ||||
| Send | 383149924 | 47 days ago | IN | 0 ETH | 0.0000009 | ||||
| Distribute | 382817458 | 48 days ago | IN | 0 ETH | 0.00000302 | ||||
| Send | 381899914 | 51 days ago | IN | 0 ETH | 0.00002484 | ||||
| Send | 381445878 | 52 days ago | IN | 0 ETH | 0.00000088 | ||||
| Send | 381091469 | 53 days ago | IN | 0 ETH | 0.00000087 | ||||
| Send | 379235709 | 59 days ago | IN | 0 ETH | 0.00000088 | ||||
| Send | 379234982 | 59 days ago | IN | 0 ETH | 0.00000088 | ||||
| Send | 379123275 | 59 days ago | IN | 0 ETH | 0.00000088 | ||||
| Send | 379121096 | 59 days ago | IN | 0 ETH | 0.00000089 | ||||
| Bond Withdrawal ... | 375437924 | 70 days ago | IN | 0 ETH | 0.00000322 | ||||
| Distribute | 373273787 | 76 days ago | IN | 0 ETH | 0.0000027 | ||||
| Commit Transfers | 372981879 | 77 days ago | IN | 0 ETH | 0.00000466 |
Latest 25 internal transactions (View All)
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 72086572 | 967 days ago | 0 ETH | ||||
| 72086572 | 967 days ago | 0 ETH | ||||
| 72086455 | 967 days ago | 0 ETH | ||||
| 72086455 | 967 days ago | 0 ETH | ||||
| 72086442 | 967 days ago | 0 ETH | ||||
| 72086442 | 967 days ago | 0 ETH | ||||
| 72086327 | 967 days ago | 0 ETH | ||||
| 72086327 | 967 days ago | 0 ETH | ||||
| 72086327 | 967 days ago | 0 ETH | ||||
| 72086327 | 967 days ago | 0 ETH | ||||
| 72086323 | 967 days ago | 0 ETH | ||||
| 72086323 | 967 days ago | 0 ETH | ||||
| 72086323 | 967 days ago | 0 ETH | ||||
| 72086323 | 967 days ago | 0 ETH | ||||
| 72086207 | 967 days ago | 0 ETH | ||||
| 72086207 | 967 days ago | 0 ETH | ||||
| 72085870 | 967 days ago | 0 ETH | ||||
| 72085870 | 967 days ago | 0 ETH | ||||
| 72085772 | 967 days ago | 0 ETH | ||||
| 72085772 | 967 days ago | 0 ETH | ||||
| 72085743 | 967 days ago | 0 ETH | ||||
| 72085743 | 967 days ago | 0 ETH | ||||
| 72085662 | 967 days ago | 0 ETH | ||||
| 72085662 | 967 days ago | 0 ETH | ||||
| 72085637 | 967 days ago | 0 ETH |
Latest 25 Deposits
Cross-Chain Transactions
Loading...
Loading
Contract Name:
L2_ArbitrumBridge
Compiler Version
v0.6.12+commit.27d51765
Optimization Enabled:
Yes with 50000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "../interfaces/arbitrum/messengers/IArbSys.sol";
import "./L2_Bridge.sol";
/**
* @dev An L2_Bridge for Arbitrum - https://developer.offchainlabs.com/
*/
contract L2_ArbitrumBridge is L2_Bridge {
IArbSys public messenger;
constructor (
IArbSys _messenger,
address l1Governance,
HopBridgeToken hToken,
address l1BridgeAddress,
uint256[] memory activeChainIds,
address[] memory bonders
)
public
L2_Bridge(
l1Governance,
hToken,
l1BridgeAddress,
activeChainIds,
bonders
)
{
messenger = _messenger;
}
function _sendCrossDomainMessage(bytes memory message) internal override {
messenger.sendTxToL1(
l1BridgeAddress,
message
);
}
function _verifySender(address expectedSender) internal override {
require(msg.sender == expectedSender, "L2_ARB_BRG: Caller is not the expected sender");
}
/**
* @dev Allows the L1 Bridge to set the messenger
* @param _messenger The new messenger address
*/
function setMessenger(IArbSys _messenger) external onlyGovernance {
messenger = _messenger;
}
}// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.4.21 <0.7.0;
interface IArbSys {
function sendTxToL1(address destAddr, bytes calldata calldataForL1) external payable;
}// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./Bridge.sol";
import "./HopBridgeToken.sol";
import "../libraries/Lib_MerkleTree.sol";
interface I_L2_AmmWrapper {
function attemptSwap(address recipient, uint256 amount, uint256 amountOutMin, uint256 deadline) external;
}
/**
* @dev The L2_Bridge is responsible for aggregating pending Transfers into TransferRoots. Each newly
* createdTransferRoot is then sent to the L1_Bridge. The L1_Bridge may be the TransferRoot's final
* destination or the L1_Bridge may forward the TransferRoot to it's destination L2_Bridge.
*/
abstract contract L2_Bridge is Bridge {
using SafeERC20 for IERC20;
address public l1Governance;
HopBridgeToken public immutable hToken;
address public l1BridgeAddress;
address public l1BridgeCaller;
I_L2_AmmWrapper public ammWrapper;
mapping(uint256 => bool) public activeChainIds;
uint256 public minimumForceCommitDelay = 4 hours;
uint256 public maxPendingTransfers = 128;
uint256 public minBonderBps = 2;
uint256 public minBonderFeeAbsolute = 0;
mapping(uint256 => bytes32[]) public pendingTransferIdsForChainId;
mapping(uint256 => uint256) public pendingAmountForChainId;
mapping(uint256 => uint256) public lastCommitTimeForChainId;
uint256 public transferNonceIncrementer;
bytes32 private immutable NONCE_DOMAIN_SEPARATOR;
event TransfersCommitted (
uint256 indexed destinationChainId,
bytes32 indexed rootHash,
uint256 totalAmount,
uint256 rootCommittedAt
);
event TransferSent (
bytes32 indexed transferId,
uint256 indexed chainId,
address indexed recipient,
uint256 amount,
bytes32 transferNonce,
uint256 bonderFee,
uint256 index,
uint256 amountOutMin,
uint256 deadline
);
event TransferFromL1Completed (
address indexed recipient,
uint256 amount,
uint256 amountOutMin,
uint256 deadline,
address indexed relayer,
uint256 relayerFee
);
modifier onlyL1Bridge {
_verifySender(l1BridgeCaller);
_;
}
constructor (
address _l1Governance,
HopBridgeToken _hToken,
address _l1BridgeAddress,
uint256[] memory _activeChainIds,
address[] memory bonders
)
public
Bridge(bonders)
{
l1Governance = _l1Governance;
hToken = _hToken;
l1BridgeAddress = _l1BridgeAddress;
for (uint256 i = 0; i < _activeChainIds.length; i++) {
activeChainIds[_activeChainIds[i]] = true;
}
NONCE_DOMAIN_SEPARATOR = keccak256("L2_Bridge v1.0");
}
/* ========== Virtual functions ========== */
function _sendCrossDomainMessage(bytes memory message) internal virtual;
function _verifySender(address expectedSender) internal virtual;
/* ========== Public/External functions ========== */
/**
* @notice _amount is the total amount the user wants to send including the Bonder fee
* @dev Send hTokens to another supported layer-2 or to layer-1 to be redeemed for the underlying asset.
* @param chainId The chainId of the destination chain
* @param recipient The address receiving funds at the destination
* @param amount The amount being sent
* @param bonderFee The amount distributed to the Bonder at the destination. This is subtracted from the `amount`.
* @param amountOutMin The minimum amount received after attempting to swap in the destination
* AMM market. 0 if no swap is intended.
* @param deadline The deadline for swapping in the destination AMM market. 0 if no
* swap is intended.
*/
function send(
uint256 chainId,
address recipient,
uint256 amount,
uint256 bonderFee,
uint256 amountOutMin,
uint256 deadline
)
external
{
require(amount > 0, "L2_BRG: Must transfer a non-zero amount");
require(amount >= bonderFee, "L2_BRG: Bonder fee cannot exceed amount");
require(activeChainIds[chainId], "L2_BRG: chainId is not supported");
uint256 minBonderFeeRelative = amount.mul(minBonderBps).div(10000);
// Get the max of minBonderFeeRelative and minBonderFeeAbsolute
uint256 minBonderFee = minBonderFeeRelative > minBonderFeeAbsolute ? minBonderFeeRelative : minBonderFeeAbsolute;
require(bonderFee >= minBonderFee, "L2_BRG: bonderFee must meet minimum requirements");
bytes32[] storage pendingTransfers = pendingTransferIdsForChainId[chainId];
if (pendingTransfers.length >= maxPendingTransfers) {
_commitTransfers(chainId);
}
hToken.burn(msg.sender, amount);
bytes32 transferNonce = getNextTransferNonce();
transferNonceIncrementer++;
bytes32 transferId = getTransferId(
chainId,
recipient,
amount,
transferNonce,
bonderFee,
amountOutMin,
deadline
);
uint256 transferIndex = pendingTransfers.length;
pendingTransfers.push(transferId);
pendingAmountForChainId[chainId] = pendingAmountForChainId[chainId].add(amount);
emit TransferSent(
transferId,
chainId,
recipient,
amount,
transferNonce,
bonderFee,
transferIndex,
amountOutMin,
deadline
);
}
/**
* @dev Aggregates all pending Transfers to the `destinationChainId` and sends them to the
* L1_Bridge as a TransferRoot.
* @param destinationChainId The chainId of the TransferRoot's destination chain
*/
function commitTransfers(uint256 destinationChainId) external {
uint256 minForceCommitTime = lastCommitTimeForChainId[destinationChainId].add(minimumForceCommitDelay);
require(minForceCommitTime < block.timestamp || getIsBonder(msg.sender), "L2_BRG: Only Bonder can commit before min delay");
lastCommitTimeForChainId[destinationChainId] = block.timestamp;
_commitTransfers(destinationChainId);
}
/**
* @dev Mints new hTokens for the recipient and optionally swaps them in the AMM market.
* @param recipient The address receiving funds
* @param amount The amount being distributed
* @param amountOutMin The minimum amount received after attempting to swap in the destination
* AMM market. 0 if no swap is intended.
* @param deadline The deadline for swapping in the AMM market. 0 if no
* swap is intended.
* @param relayer The address of the relayer.
* @param relayerFee The amount distributed to the relayer. This is subtracted from the `amount`.
*/
function distribute(
address recipient,
uint256 amount,
uint256 amountOutMin,
uint256 deadline,
address relayer,
uint256 relayerFee
)
external
onlyL1Bridge
nonReentrant
{
_distribute(recipient, amount, amountOutMin, deadline, relayer, relayerFee);
emit TransferFromL1Completed(
recipient,
amount,
amountOutMin,
deadline,
relayer,
relayerFee
);
}
/**
* @dev Allows the Bonder to bond an individual withdrawal and swap it in the AMM for the
* canonical token on behalf of the user.
* @param recipient The address receiving the Transfer
* @param amount The amount being transferred including the `_bonderFee`
* @param transferNonce Used to avoid transferId collisions
* @param bonderFee The amount paid to the address that withdraws the Transfer
* @param amountOutMin The minimum amount received after attempting to swap in the
* AMM market. 0 if no swap is intended.
* @param deadline The deadline for swapping in the AMM market. 0 if no
* swap is intended.
*/
function bondWithdrawalAndDistribute(
address recipient,
uint256 amount,
bytes32 transferNonce,
uint256 bonderFee,
uint256 amountOutMin,
uint256 deadline
)
external
onlyBonder
requirePositiveBalance
nonReentrant
{
bytes32 transferId = getTransferId(
getChainId(),
recipient,
amount,
transferNonce,
bonderFee,
amountOutMin,
deadline
);
_bondWithdrawal(transferId, amount);
_markTransferSpent(transferId);
_distribute(recipient, amount, amountOutMin, deadline, msg.sender, bonderFee);
}
/**
* @dev Allows the L1 Bridge to set a TransferRoot
* @param rootHash The Merkle root of the TransferRoot
* @param totalAmount The total amount being transferred in the TransferRoot
*/
function setTransferRoot(bytes32 rootHash, uint256 totalAmount) external onlyL1Bridge {
_setTransferRoot(rootHash, totalAmount);
}
/* ========== Helper Functions ========== */
function _commitTransfers(uint256 destinationChainId) internal {
bytes32[] storage pendingTransfers = pendingTransferIdsForChainId[destinationChainId];
require(pendingTransfers.length > 0, "L2_BRG: Must commit at least 1 Transfer");
bytes32 rootHash = Lib_MerkleTree.getMerkleRoot(pendingTransfers);
uint256 totalAmount = pendingAmountForChainId[destinationChainId];
uint256 rootCommittedAt = block.timestamp;
emit TransfersCommitted(destinationChainId, rootHash, totalAmount, rootCommittedAt);
bytes memory confirmTransferRootMessage = abi.encodeWithSignature(
"confirmTransferRoot(uint256,bytes32,uint256,uint256,uint256)",
getChainId(),
rootHash,
destinationChainId,
totalAmount,
rootCommittedAt
);
pendingAmountForChainId[destinationChainId] = 0;
delete pendingTransferIdsForChainId[destinationChainId];
_sendCrossDomainMessage(confirmTransferRootMessage);
}
function _distribute(
address recipient,
uint256 amount,
uint256 amountOutMin,
uint256 deadline,
address feeRecipient,
uint256 fee
)
internal
{
if (fee > 0) {
hToken.mint(feeRecipient, fee);
}
uint256 amountAfterFee = amount.sub(fee);
if (amountOutMin == 0 && deadline == 0) {
hToken.mint(recipient, amountAfterFee);
} else {
hToken.mint(address(this), amountAfterFee);
hToken.approve(address(ammWrapper), amountAfterFee);
ammWrapper.attemptSwap(recipient, amountAfterFee, amountOutMin, deadline);
}
}
/* ========== Override Functions ========== */
function _transferFromBridge(address recipient, uint256 amount) internal override {
hToken.mint(recipient, amount);
}
function _transferToBridge(address from, uint256 amount) internal override {
hToken.burn(from, amount);
}
function _requireIsGovernance() internal override {
_verifySender(l1Governance);
}
/* ========== External Config Management Functions ========== */
function setL1Governance(address _l1Governance) external onlyGovernance {
l1Governance = _l1Governance;
}
function setAmmWrapper(I_L2_AmmWrapper _ammWrapper) external onlyGovernance {
ammWrapper = _ammWrapper;
}
function setL1BridgeAddress(address _l1BridgeAddress) external onlyGovernance {
l1BridgeAddress = _l1BridgeAddress;
}
function setL1BridgeCaller(address _l1BridgeCaller) external onlyGovernance {
l1BridgeCaller = _l1BridgeCaller;
}
function addActiveChainIds(uint256[] calldata chainIds) external onlyGovernance {
for (uint256 i = 0; i < chainIds.length; i++) {
activeChainIds[chainIds[i]] = true;
}
}
function removeActiveChainIds(uint256[] calldata chainIds) external onlyGovernance {
for (uint256 i = 0; i < chainIds.length; i++) {
activeChainIds[chainIds[i]] = false;
}
}
function setMinimumForceCommitDelay(uint256 _minimumForceCommitDelay) external onlyGovernance {
minimumForceCommitDelay = _minimumForceCommitDelay;
}
function setMaxPendingTransfers(uint256 _maxPendingTransfers) external onlyGovernance {
maxPendingTransfers = _maxPendingTransfers;
}
function setHopBridgeTokenOwner(address newOwner) external onlyGovernance {
hToken.transferOwnership(newOwner);
}
function setMinimumBonderFeeRequirements(uint256 _minBonderBps, uint256 _minBonderFeeAbsolute) external onlyGovernance {
require(_minBonderBps <= 10000, "L2_BRG: minBonderBps must not exceed 10000");
minBonderBps = _minBonderBps;
minBonderFeeAbsolute = _minBonderFeeAbsolute;
}
/* ========== Public Getters ========== */
function getNextTransferNonce() public view returns (bytes32) {
return keccak256(abi.encodePacked(NONCE_DOMAIN_SEPARATOR, getChainId(), transferNonceIncrementer));
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "./Accounting.sol";
import "../libraries/Lib_MerkleTree.sol";
/**
* @dev Bridge extends the accounting system and encapsulates the logic that is shared by both the
* L1 and L2 Bridges. It allows to TransferRoots to be set by parent contracts and for those
* TransferRoots to be withdrawn against. It also allows the bonder to bond and withdraw Transfers
* directly through `bondWithdrawal` and then settle those bonds against their TransferRoot once it
* has been set.
*/
abstract contract Bridge is Accounting {
using Lib_MerkleTree for bytes32;
struct TransferRoot {
uint256 total;
uint256 amountWithdrawn;
uint256 createdAt;
}
/* ========== Events ========== */
event Withdrew(
bytes32 indexed transferId,
address indexed recipient,
uint256 amount,
bytes32 transferNonce
);
event WithdrawalBonded(
bytes32 indexed transferId,
uint256 amount
);
event WithdrawalBondSettled(
address indexed bonder,
bytes32 indexed transferId,
bytes32 indexed rootHash
);
event MultipleWithdrawalsSettled(
address indexed bonder,
bytes32 indexed rootHash,
uint256 totalBondsSettled
);
event TransferRootSet(
bytes32 indexed rootHash,
uint256 totalAmount
);
/* ========== State ========== */
mapping(bytes32 => TransferRoot) private _transferRoots;
mapping(bytes32 => bool) private _spentTransferIds;
mapping(address => mapping(bytes32 => uint256)) private _bondedWithdrawalAmounts;
uint256 constant RESCUE_DELAY = 8 weeks;
constructor(address[] memory bonders) public Accounting(bonders) {}
/* ========== Public Getters ========== */
/**
* @dev Get the hash that represents an individual Transfer.
* @param chainId The id of the destination chain
* @param recipient The address receiving the Transfer
* @param amount The amount being transferred including the `_bonderFee`
* @param transferNonce Used to avoid transferId collisions
* @param bonderFee The amount paid to the address that withdraws the Transfer
* @param amountOutMin The minimum amount received after attempting to swap in the destination
* AMM market. 0 if no swap is intended.
* @param deadline The deadline for swapping in the destination AMM market. 0 if no
* swap is intended.
*/
function getTransferId(
uint256 chainId,
address recipient,
uint256 amount,
bytes32 transferNonce,
uint256 bonderFee,
uint256 amountOutMin,
uint256 deadline
)
public
pure
returns (bytes32)
{
return keccak256(abi.encode(
chainId,
recipient,
amount,
transferNonce,
bonderFee,
amountOutMin,
deadline
));
}
/**
* @notice getChainId can be overridden by subclasses if needed for compatibility or testing purposes.
* @dev Get the current chainId
* @return chainId The current chainId
*/
function getChainId() public virtual view returns (uint256 chainId) {
this; // Silence state mutability warning without generating any additional byte code
assembly {
chainId := chainid()
}
}
/**
* @dev Get the TransferRoot id for a given rootHash and totalAmount
* @param rootHash The Merkle root of the TransferRoot
* @param totalAmount The total of all Transfers in the TransferRoot
* @return The calculated transferRootId
*/
function getTransferRootId(bytes32 rootHash, uint256 totalAmount) public pure returns (bytes32) {
return keccak256(abi.encodePacked(rootHash, totalAmount));
}
/**
* @dev Get the TransferRoot for a given rootHash and totalAmount
* @param rootHash The Merkle root of the TransferRoot
* @param totalAmount The total of all Transfers in the TransferRoot
* @return The TransferRoot with the calculated transferRootId
*/
function getTransferRoot(bytes32 rootHash, uint256 totalAmount) public view returns (TransferRoot memory) {
return _transferRoots[getTransferRootId(rootHash, totalAmount)];
}
/**
* @dev Get the amount bonded for the withdrawal of a transfer
* @param bonder The Bonder of the withdrawal
* @param transferId The Transfer's unique identifier
* @return The amount bonded for a Transfer withdrawal
*/
function getBondedWithdrawalAmount(address bonder, bytes32 transferId) external view returns (uint256) {
return _bondedWithdrawalAmounts[bonder][transferId];
}
/**
* @dev Get the spent status of a transfer ID
* @param transferId The transfer's unique identifier
* @return True if the transferId has been spent
*/
function isTransferIdSpent(bytes32 transferId) external view returns (bool) {
return _spentTransferIds[transferId];
}
/* ========== User/Relayer External Functions ========== */
/**
* @notice Can be called by anyone (recipient or relayer)
* @dev Withdraw a Transfer from its destination bridge
* @param recipient The address receiving the Transfer
* @param amount The amount being transferred including the `_bonderFee`
* @param transferNonce Used to avoid transferId collisions
* @param bonderFee The amount paid to the address that withdraws the Transfer
* @param amountOutMin The minimum amount received after attempting to swap in the destination
* AMM market. 0 if no swap is intended. (only used to calculate `transferId` in this function)
* @param deadline The deadline for swapping in the destination AMM market. 0 if no
* swap is intended. (only used to calculate `transferId` in this function)
* @param rootHash The Merkle root of the TransferRoot
* @param transferRootTotalAmount The total amount being transferred in a TransferRoot
* @param transferIdTreeIndex The index of the transferId in the Merkle tree
* @param siblings The siblings of the transferId in the Merkle tree
* @param totalLeaves The total number of leaves in the Merkle tree
*/
function withdraw(
address recipient,
uint256 amount,
bytes32 transferNonce,
uint256 bonderFee,
uint256 amountOutMin,
uint256 deadline,
bytes32 rootHash,
uint256 transferRootTotalAmount,
uint256 transferIdTreeIndex,
bytes32[] calldata siblings,
uint256 totalLeaves
)
external
nonReentrant
{
bytes32 transferId = getTransferId(
getChainId(),
recipient,
amount,
transferNonce,
bonderFee,
amountOutMin,
deadline
);
require(
rootHash.verify(
transferId,
transferIdTreeIndex,
siblings,
totalLeaves
)
, "BRG: Invalid transfer proof");
bytes32 transferRootId = getTransferRootId(rootHash, transferRootTotalAmount);
_addToAmountWithdrawn(transferRootId, amount);
_fulfillWithdraw(transferId, recipient, amount, uint256(0));
emit Withdrew(transferId, recipient, amount, transferNonce);
}
/**
* @dev Allows the bonder to bond individual withdrawals before their TransferRoot has been committed.
* @param recipient The address receiving the Transfer
* @param amount The amount being transferred including the `_bonderFee`
* @param transferNonce Used to avoid transferId collisions
* @param bonderFee The amount paid to the address that withdraws the Transfer
*/
function bondWithdrawal(
address recipient,
uint256 amount,
bytes32 transferNonce,
uint256 bonderFee
)
external
onlyBonder
requirePositiveBalance
nonReentrant
{
bytes32 transferId = getTransferId(
getChainId(),
recipient,
amount,
transferNonce,
bonderFee,
0,
0
);
_bondWithdrawal(transferId, amount);
_fulfillWithdraw(transferId, recipient, amount, bonderFee);
}
/**
* @dev Refunds the Bonder's stake from a bonded withdrawal and counts that withdrawal against
* its TransferRoot.
* @param bonder The Bonder of the withdrawal
* @param transferId The Transfer's unique identifier
* @param rootHash The Merkle root of the TransferRoot
* @param transferRootTotalAmount The total amount being transferred in a TransferRoot
* @param transferIdTreeIndex The index of the transferId in the Merkle tree
* @param siblings The siblings of the transferId in the Merkle tree
* @param totalLeaves The total number of leaves in the Merkle tree
*/
function settleBondedWithdrawal(
address bonder,
bytes32 transferId,
bytes32 rootHash,
uint256 transferRootTotalAmount,
uint256 transferIdTreeIndex,
bytes32[] calldata siblings,
uint256 totalLeaves
)
external
{
require(
rootHash.verify(
transferId,
transferIdTreeIndex,
siblings,
totalLeaves
)
, "BRG: Invalid transfer proof");
bytes32 transferRootId = getTransferRootId(rootHash, transferRootTotalAmount);
uint256 amount = _bondedWithdrawalAmounts[bonder][transferId];
require(amount > 0, "L2_BRG: transferId has no bond");
_bondedWithdrawalAmounts[bonder][transferId] = 0;
_addToAmountWithdrawn(transferRootId, amount);
_addCredit(bonder, amount);
emit WithdrawalBondSettled(bonder, transferId, rootHash);
}
/**
* @dev Refunds the Bonder for all withdrawals that they bonded in a TransferRoot.
* @param bonder The address of the Bonder being refunded
* @param transferIds All transferIds in the TransferRoot in order
* @param totalAmount The totalAmount of the TransferRoot
*/
function settleBondedWithdrawals(
address bonder,
// transferIds _must_ be calldata or it will be mutated by Lib_MerkleTree.getMerkleRoot
bytes32[] calldata transferIds,
uint256 totalAmount
)
external
{
bytes32 rootHash = Lib_MerkleTree.getMerkleRoot(transferIds);
bytes32 transferRootId = getTransferRootId(rootHash, totalAmount);
uint256 totalBondsSettled = 0;
for(uint256 i = 0; i < transferIds.length; i++) {
uint256 transferBondAmount = _bondedWithdrawalAmounts[bonder][transferIds[i]];
if (transferBondAmount > 0) {
totalBondsSettled = totalBondsSettled.add(transferBondAmount);
_bondedWithdrawalAmounts[bonder][transferIds[i]] = 0;
}
}
_addToAmountWithdrawn(transferRootId, totalBondsSettled);
_addCredit(bonder, totalBondsSettled);
emit MultipleWithdrawalsSettled(bonder, rootHash, totalBondsSettled);
}
/* ========== External TransferRoot Rescue ========== */
/**
* @dev Allows governance to withdraw the remaining amount from a TransferRoot after the rescue delay has passed.
* @param rootHash the Merkle root of the TransferRoot
* @param originalAmount The TransferRoot's recorded total
* @param recipient The address receiving the remaining balance
*/
function rescueTransferRoot(bytes32 rootHash, uint256 originalAmount, address recipient) external onlyGovernance {
bytes32 transferRootId = getTransferRootId(rootHash, originalAmount);
TransferRoot memory transferRoot = getTransferRoot(rootHash, originalAmount);
require(transferRoot.createdAt != 0, "BRG: TransferRoot not found");
assert(transferRoot.total == originalAmount);
uint256 rescueDelayEnd = transferRoot.createdAt.add(RESCUE_DELAY);
require(block.timestamp >= rescueDelayEnd, "BRG: TransferRoot cannot be rescued before the Rescue Delay");
uint256 remainingAmount = transferRoot.total.sub(transferRoot.amountWithdrawn);
_addToAmountWithdrawn(transferRootId, remainingAmount);
_transferFromBridge(recipient, remainingAmount);
}
/* ========== Internal Functions ========== */
function _markTransferSpent(bytes32 transferId) internal {
require(!_spentTransferIds[transferId], "BRG: The transfer has already been withdrawn");
_spentTransferIds[transferId] = true;
}
function _addToAmountWithdrawn(bytes32 transferRootId, uint256 amount) internal {
TransferRoot storage transferRoot = _transferRoots[transferRootId];
require(transferRoot.total > 0, "BRG: Transfer root not found");
uint256 newAmountWithdrawn = transferRoot.amountWithdrawn.add(amount);
require(newAmountWithdrawn <= transferRoot.total, "BRG: Withdrawal exceeds TransferRoot total");
transferRoot.amountWithdrawn = newAmountWithdrawn;
}
function _setTransferRoot(bytes32 rootHash, uint256 totalAmount) internal {
bytes32 transferRootId = getTransferRootId(rootHash, totalAmount);
require(_transferRoots[transferRootId].total == 0, "BRG: Transfer root already set");
require(totalAmount > 0, "BRG: Cannot set TransferRoot totalAmount of 0");
_transferRoots[transferRootId] = TransferRoot(totalAmount, 0, block.timestamp);
emit TransferRootSet(rootHash, totalAmount);
}
function _bondWithdrawal(bytes32 transferId, uint256 amount) internal {
require(_bondedWithdrawalAmounts[msg.sender][transferId] == 0, "BRG: Withdrawal has already been bonded");
_addDebit(msg.sender, amount);
_bondedWithdrawalAmounts[msg.sender][transferId] = amount;
emit WithdrawalBonded(transferId, amount);
}
/* ========== Private Functions ========== */
/// @dev Completes the Transfer, distributes the Bonder fee and marks the Transfer as spent.
function _fulfillWithdraw(
bytes32 transferId,
address recipient,
uint256 amount,
uint256 bonderFee
) private {
_markTransferSpent(transferId);
_transferFromBridge(recipient, amount.sub(bonderFee));
if (bonderFee > 0) {
_transferFromBridge(msg.sender, bonderFee);
}
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @dev Hop Bridge Tokens or "hTokens" are layer-2 tokens that represent a deposit in the L1_Bridge
* contract. Each Hop Bridge Token is a regular ERC20 that can be minted and burned by the L2_Bridge
* that owns it.
*/
contract HopBridgeToken is ERC20, Ownable {
constructor (
string memory name,
string memory symbol,
uint8 decimals
)
public
ERC20(name, symbol)
{
_setupDecimals(decimals);
}
/**
* @dev Mint new hToken for the account
* @param account The account being minted for
* @param amount The amount being minted
*/
function mint(address account, uint256 amount) external onlyOwner {
_mint(account, amount);
}
/**
* @dev Burn hToken from the account
* @param account The account being burned from
* @param amount The amount being burned
*/
function burn(address account, uint256 amount) external onlyOwner {
_burn(account, amount);
}
}// SPDX-License-Identifier: MIT
pragma solidity >0.5.0 <0.8.0;
/**
* @title Lib_MerkleTree
* @author River Keefer
*/
library Lib_MerkleTree {
/**********************
* Internal Functions *
**********************/
/**
* Calculates a merkle root for a list of 32-byte leaf hashes. WARNING: If the number
* of leaves passed in is not a power of two, it pads out the tree with zero hashes.
* If you do not know the original length of elements for the tree you are verifying,
* then this may allow empty leaves past _elements.length to pass a verification check down the line.
* Note that the _elements argument is modified, therefore it must not be used again afterwards
* @param _elements Array of hashes from which to generate a merkle root.
* @return Merkle root of the leaves, with zero hashes for non-powers-of-two (see above).
*/
function getMerkleRoot(
bytes32[] memory _elements
)
internal
pure
returns (
bytes32
)
{
require(
_elements.length > 0,
"Lib_MerkleTree: Must provide at least one leaf hash."
);
if (_elements.length == 1) {
return _elements[0];
}
uint256[16] memory defaults = [
0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563,
0x633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d,
0x890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d,
0x3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd8,
0xecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da,
0xdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da5,
0x617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d7,
0x292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead,
0xe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e10,
0x7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f82,
0xe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e83636516,
0x3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c,
0xad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e,
0xa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab,
0x4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c862,
0x2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf10
];
// Reserve memory space for our hashes.
bytes memory buf = new bytes(64);
// We'll need to keep track of left and right siblings.
bytes32 leftSibling;
bytes32 rightSibling;
// Number of non-empty nodes at the current depth.
uint256 rowSize = _elements.length;
// Current depth, counting from 0 at the leaves
uint256 depth = 0;
// Common sub-expressions
uint256 halfRowSize; // rowSize / 2
bool rowSizeIsOdd; // rowSize % 2 == 1
while (rowSize > 1) {
halfRowSize = rowSize / 2;
rowSizeIsOdd = rowSize % 2 == 1;
for (uint256 i = 0; i < halfRowSize; i++) {
leftSibling = _elements[(2 * i) ];
rightSibling = _elements[(2 * i) + 1];
assembly {
mstore(add(buf, 32), leftSibling )
mstore(add(buf, 64), rightSibling)
}
_elements[i] = keccak256(buf);
}
if (rowSizeIsOdd) {
leftSibling = _elements[rowSize - 1];
rightSibling = bytes32(defaults[depth]);
assembly {
mstore(add(buf, 32), leftSibling)
mstore(add(buf, 64), rightSibling)
}
_elements[halfRowSize] = keccak256(buf);
}
rowSize = halfRowSize + (rowSizeIsOdd ? 1 : 0);
depth++;
}
return _elements[0];
}
/**
* Verifies a merkle branch for the given leaf hash. Assumes the original length
* of leaves generated is a known, correct input, and does not return true for indices
* extending past that index (even if _siblings would be otherwise valid.)
* @param _root The Merkle root to verify against.
* @param _leaf The leaf hash to verify inclusion of.
* @param _index The index in the tree of this leaf.
* @param _siblings Array of sibline nodes in the inclusion proof, starting from depth 0 (bottom of the tree).
* @param _totalLeaves The total number of leaves originally passed into.
* @return Whether or not the merkle branch and leaf passes verification.
*/
function verify(
bytes32 _root,
bytes32 _leaf,
uint256 _index,
bytes32[] memory _siblings,
uint256 _totalLeaves
)
internal
pure
returns (
bool
)
{
require(
_totalLeaves > 0,
"Lib_MerkleTree: Total leaves must be greater than zero."
);
require(
_index < _totalLeaves,
"Lib_MerkleTree: Index out of bounds."
);
require(
_siblings.length == _ceilLog2(_totalLeaves),
"Lib_MerkleTree: Total siblings does not correctly correspond to total leaves."
);
bytes32 computedRoot = _leaf;
for (uint256 i = 0; i < _siblings.length; i++) {
if ((_index & 1) == 1) {
computedRoot = keccak256(
abi.encodePacked(
_siblings[i],
computedRoot
)
);
} else {
computedRoot = keccak256(
abi.encodePacked(
computedRoot,
_siblings[i]
)
);
}
_index >>= 1;
}
return _root == computedRoot;
}
/*********************
* Private Functions *
*********************/
/**
* Calculates the integer ceiling of the log base 2 of an input.
* @param _in Unsigned input to calculate the log.
* @return ceil(log_base_2(_in))
*/
function _ceilLog2(
uint256 _in
)
private
pure
returns (
uint256
)
{
require(
_in > 0,
"Lib_MerkleTree: Cannot compute ceil(log_2) of 0."
);
if (_in == 1) {
return 0;
}
// Find the highest set bit (will be floor(log_2)).
// Borrowed with <3 from https://github.com/ethereum/solidity-examples
uint256 val = _in;
uint256 highest = 0;
for (uint256 i = 128; i >= 1; i >>= 1) {
if (val & (uint(1) << i) - 1 << i != 0) {
highest += i;
val >>= i;
}
}
// Increment by one if this is not a perfect logarithm.
if ((uint(1) << highest) != _in) {
highest += 1;
}
return highest;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
/**
* @dev Accounting is an abstract contract that encapsulates the most critical logic in the Hop contracts.
* The accounting system works by using two balances that can only increase `_credit` and `_debit`.
* A bonder's available balance is the total credit minus the total debit. The contract exposes
* two external functions that allows a bonder to stake and unstake and exposes two internal
* functions to its child contracts that allow the child contract to add to the credit
* and debit balance. In addition, child contracts can override `_additionalDebit` to account
* for any additional debit balance in an alternative way. Lastly, it exposes a modifier,
* `requirePositiveBalance`, that can be used by child contracts to ensure the bonder does not
* use more than its available stake.
*/
abstract contract Accounting is ReentrancyGuard {
using SafeMath for uint256;
mapping(address => bool) private _isBonder;
mapping(address => uint256) private _credit;
mapping(address => uint256) private _debit;
event Stake (
address indexed account,
uint256 amount
);
event Unstake (
address indexed account,
uint256 amount
);
event BonderAdded (
address indexed newBonder
);
event BonderRemoved (
address indexed previousBonder
);
/* ========== Modifiers ========== */
modifier onlyBonder {
require(_isBonder[msg.sender], "ACT: Caller is not bonder");
_;
}
modifier onlyGovernance {
_requireIsGovernance();
_;
}
/// @dev Used by parent contract to ensure that the Bonder is solvent at the end of the transaction.
modifier requirePositiveBalance {
_;
require(getCredit(msg.sender) >= getDebitAndAdditionalDebit(msg.sender), "ACT: Not enough available credit");
}
/// @dev Sets the Bonder addresses
constructor(address[] memory bonders) public {
for (uint256 i = 0; i < bonders.length; i++) {
require(_isBonder[bonders[i]] == false, "ACT: Cannot add duplicate bonder");
_isBonder[bonders[i]] = true;
emit BonderAdded(bonders[i]);
}
}
/* ========== Virtual functions ========== */
/**
* @dev The following functions are overridden in L1_Bridge and L2_Bridge
*/
function _transferFromBridge(address recipient, uint256 amount) internal virtual;
function _transferToBridge(address from, uint256 amount) internal virtual;
function _requireIsGovernance() internal virtual;
/**
* @dev This function can be optionally overridden by a parent contract to track any additional
* debit balance in an alternative way.
*/
function _additionalDebit(address /*bonder*/) internal view virtual returns (uint256) {
this; // Silence state mutability warning without generating any additional byte code
return 0;
}
/* ========== Public/external getters ========== */
/**
* @dev Check if address is a Bonder
* @param maybeBonder The address being checked
* @return true if address is a Bonder
*/
function getIsBonder(address maybeBonder) public view returns (bool) {
return _isBonder[maybeBonder];
}
/**
* @dev Get the Bonder's credit balance
* @param bonder The owner of the credit balance being checked
* @return The credit balance for the Bonder
*/
function getCredit(address bonder) public view returns (uint256) {
return _credit[bonder];
}
/**
* @dev Gets the debit balance tracked by `_debit` and does not include `_additionalDebit()`
* @param bonder The owner of the debit balance being checked
* @return The debit amount for the Bonder
*/
function getRawDebit(address bonder) external view returns (uint256) {
return _debit[bonder];
}
/**
* @dev Get the Bonder's total debit
* @param bonder The owner of the debit balance being checked
* @return The Bonder's total debit balance
*/
function getDebitAndAdditionalDebit(address bonder) public view returns (uint256) {
return _debit[bonder].add(_additionalDebit(bonder));
}
/* ========== Bonder external functions ========== */
/**
* @dev Allows the Bonder to deposit tokens and increase its credit balance
* @param bonder The address being staked on
* @param amount The amount being staked
*/
function stake(address bonder, uint256 amount) external payable nonReentrant {
require(_isBonder[bonder] == true, "ACT: Address is not bonder");
_transferToBridge(msg.sender, amount);
_addCredit(bonder, amount);
emit Stake(bonder, amount);
}
/**
* @dev Allows the caller to withdraw any available balance and add to their debit balance
* @param amount The amount being unstaked
*/
function unstake(uint256 amount) external requirePositiveBalance nonReentrant {
_addDebit(msg.sender, amount);
_transferFromBridge(msg.sender, amount);
emit Unstake(msg.sender, amount);
}
/**
* @dev Add Bonder to allowlist
* @param bonder The address being added as a Bonder
*/
function addBonder(address bonder) external onlyGovernance {
require(_isBonder[bonder] == false, "ACT: Address is already bonder");
_isBonder[bonder] = true;
emit BonderAdded(bonder);
}
/**
* @dev Remove Bonder from allowlist
* @param bonder The address being removed as a Bonder
*/
function removeBonder(address bonder) external onlyGovernance {
require(_isBonder[bonder] == true, "ACT: Address is not bonder");
_isBonder[bonder] = false;
emit BonderRemoved(bonder);
}
/* ========== Internal functions ========== */
function _addCredit(address bonder, uint256 amount) internal {
_credit[bonder] = _credit[bonder].add(amount);
}
function _addDebit(address bonder, uint256 amount) internal {
_debit[bonder] = _debit[bonder].add(amount);
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor () internal {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../../utils/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_) public {
_name = name_;
_symbol = symbol_;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal virtual {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}{
"optimizer": {
"enabled": true,
"runs": 50000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract IArbSys","name":"_messenger","type":"address"},{"internalType":"address","name":"l1Governance","type":"address"},{"internalType":"contract HopBridgeToken","name":"hToken","type":"address"},{"internalType":"address","name":"l1BridgeAddress","type":"address"},{"internalType":"uint256[]","name":"activeChainIds","type":"uint256[]"},{"internalType":"address[]","name":"bonders","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newBonder","type":"address"}],"name":"BonderAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousBonder","type":"address"}],"name":"BonderRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"bonder","type":"address"},{"indexed":true,"internalType":"bytes32","name":"rootHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"totalBondsSettled","type":"uint256"}],"name":"MultipleWithdrawalsSettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Stake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"deadline","type":"uint256"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":false,"internalType":"uint256","name":"relayerFee","type":"uint256"}],"name":"TransferFromL1Completed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"rootHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"totalAmount","type":"uint256"}],"name":"TransferRootSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transferId","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"chainId","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"transferNonce","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"bonderFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"TransferSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"indexed":true,"internalType":"bytes32","name":"rootHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"totalAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rootCommittedAt","type":"uint256"}],"name":"TransfersCommitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Unstake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"bonder","type":"address"},{"indexed":true,"internalType":"bytes32","name":"transferId","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"rootHash","type":"bytes32"}],"name":"WithdrawalBondSettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transferId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawalBonded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transferId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"transferNonce","type":"bytes32"}],"name":"Withdrew","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"activeChainIds","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"chainIds","type":"uint256[]"}],"name":"addActiveChainIds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"bonder","type":"address"}],"name":"addBonder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ammWrapper","outputs":[{"internalType":"contract I_L2_AmmWrapper","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"transferNonce","type":"bytes32"},{"internalType":"uint256","name":"bonderFee","type":"uint256"}],"name":"bondWithdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"transferNonce","type":"bytes32"},{"internalType":"uint256","name":"bonderFee","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"bondWithdrawalAndDistribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"destinationChainId","type":"uint256"}],"name":"commitTransfers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"address","name":"relayer","type":"address"},{"internalType":"uint256","name":"relayerFee","type":"uint256"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"bonder","type":"address"},{"internalType":"bytes32","name":"transferId","type":"bytes32"}],"name":"getBondedWithdrawalAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getChainId","outputs":[{"internalType":"uint256","name":"chainId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"bonder","type":"address"}],"name":"getCredit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"bonder","type":"address"}],"name":"getDebitAndAdditionalDebit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"maybeBonder","type":"address"}],"name":"getIsBonder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNextTransferNonce","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"bonder","type":"address"}],"name":"getRawDebit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"transferNonce","type":"bytes32"},{"internalType":"uint256","name":"bonderFee","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"getTransferId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"rootHash","type":"bytes32"},{"internalType":"uint256","name":"totalAmount","type":"uint256"}],"name":"getTransferRoot","outputs":[{"components":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"amountWithdrawn","type":"uint256"},{"internalType":"uint256","name":"createdAt","type":"uint256"}],"internalType":"struct Bridge.TransferRoot","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"rootHash","type":"bytes32"},{"internalType":"uint256","name":"totalAmount","type":"uint256"}],"name":"getTransferRootId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"hToken","outputs":[{"internalType":"contract HopBridgeToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transferId","type":"bytes32"}],"name":"isTransferIdSpent","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l1BridgeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l1BridgeCaller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l1Governance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lastCommitTimeForChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPendingTransfers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"messenger","outputs":[{"internalType":"contract IArbSys","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minBonderBps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minBonderFeeAbsolute","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumForceCommitDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pendingAmountForChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"pendingTransferIdsForChainId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"chainIds","type":"uint256[]"}],"name":"removeActiveChainIds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"bonder","type":"address"}],"name":"removeBonder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"rootHash","type":"bytes32"},{"internalType":"uint256","name":"originalAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"rescueTransferRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"bonderFee","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"send","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract I_L2_AmmWrapper","name":"_ammWrapper","type":"address"}],"name":"setAmmWrapper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"setHopBridgeTokenOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_l1BridgeAddress","type":"address"}],"name":"setL1BridgeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_l1BridgeCaller","type":"address"}],"name":"setL1BridgeCaller","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_l1Governance","type":"address"}],"name":"setL1Governance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxPendingTransfers","type":"uint256"}],"name":"setMaxPendingTransfers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IArbSys","name":"_messenger","type":"address"}],"name":"setMessenger","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minBonderBps","type":"uint256"},{"internalType":"uint256","name":"_minBonderFeeAbsolute","type":"uint256"}],"name":"setMinimumBonderFeeRequirements","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minimumForceCommitDelay","type":"uint256"}],"name":"setMinimumForceCommitDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"rootHash","type":"bytes32"},{"internalType":"uint256","name":"totalAmount","type":"uint256"}],"name":"setTransferRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"bonder","type":"address"},{"internalType":"bytes32","name":"transferId","type":"bytes32"},{"internalType":"bytes32","name":"rootHash","type":"bytes32"},{"internalType":"uint256","name":"transferRootTotalAmount","type":"uint256"},{"internalType":"uint256","name":"transferIdTreeIndex","type":"uint256"},{"internalType":"bytes32[]","name":"siblings","type":"bytes32[]"},{"internalType":"uint256","name":"totalLeaves","type":"uint256"}],"name":"settleBondedWithdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"bonder","type":"address"},{"internalType":"bytes32[]","name":"transferIds","type":"bytes32[]"},{"internalType":"uint256","name":"totalAmount","type":"uint256"}],"name":"settleBondedWithdrawals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"bonder","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"transferNonceIncrementer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"transferNonce","type":"bytes32"},{"internalType":"uint256","name":"bonderFee","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes32","name":"rootHash","type":"bytes32"},{"internalType":"uint256","name":"transferRootTotalAmount","type":"uint256"},{"internalType":"uint256","name":"transferIdTreeIndex","type":"uint256"},{"internalType":"bytes32[]","name":"siblings","type":"bytes32[]"},{"internalType":"uint256","name":"totalLeaves","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60c0604052613840600c556080600d556002600e556000600f553480156200002657600080fd5b5060405162004837380380620048378339810160408190526200004991620002d9565b84848484848080600160008190555060005b81518110156200016a57600160008383815181106200007657fe5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff1615620000c65760405162461bcd60e51b8152600401620000bd90620003f4565b60405180910390fd5b6001806000848481518110620000d857fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055508181815181106200012457fe5b60200260200101516001600160a01b03167f2cec73b7434d3b91198ad1a618f63e6a0761ce281af5ec9ec76606d948d03e2360405160405180910390a26001016200005b565b5050600780546001600160a01b038089166001600160a01b0319928316179092556001600160601b0319606088901b1660805260088054928716929091169190911790555060005b825181101562000201576001600b6000858481518110620001cf57fe5b6020908102919091018101518252810191909152604001600020805460ff1916911515919091179055600101620001b2565b50507fcd24e8e9844849186ed93126ac365bc3a49362579aee585431811ea50bd1694c60a0525050601480546001600160a01b0319166001600160a01b039990991698909817909755506200048995505050505050565b600082601f83011262000269578081fd5b8151620002806200027a8262000450565b62000429565b818152915060208083019084810181840286018201871015620002a257600080fd5b60005b84811015620002ce578151620002bb8162000470565b84529282019290820190600101620002a5565b505050505092915050565b60008060008060008060c08789031215620002f2578182fd5b8651620002ff8162000470565b80965050602080880151620003148162000470565b6040890151909650620003278162000470565b60608901519095506200033a8162000470565b60808901519094506001600160401b038082111562000357578485fd5b818a0191508a601f8301126200036b578485fd5b81516200037c6200027a8262000450565b81815284810190848601868402860187018f101562000399578889fd5b8895505b83861015620003bd5780518352600195909501949186019186016200039d565b5060a08d01519097509450505080831115620003d7578384fd5b5050620003e789828a0162000258565b9150509295509295509295565b6020808252818101527f4143543a2043616e6e6f7420616464206475706c696361746520626f6e646572604082015260600190565b6040518181016001600160401b03811182821017156200044857600080fd5b604052919050565b60006001600160401b0382111562000466578081fd5b5060209081020190565b6001600160a01b03811681146200048657600080fd5b50565b60805160601c60a05161435f620004d860003980610a2a525080611271528061155d5280611f7052806123a352806126cd5280612793528061283e52806128e55280612ae6525061435f6000f3fe6080604052600436106103345760003560e01c806398445caf116101b0578063cbd1642e116100ec578063e1825d0611610095578063f8398fa41161006f578063f8398fa4146108c7578063fc6e3b3b146108e7578063fd31c5ba146108fc578063ffa9286c1461091c57610334565b8063e1825d0614610872578063e40272d714610892578063e9cdfe51146108b257610334565b8063d2442783116100c6578063d24427831461081d578063d4e54c4714610832578063d5ef75511461085257610334565b8063cbd1642e146107b0578063cc29a306146107d0578063ce803b4f146107f057610334565b8063af215f9411610159578063bed93c8411610133578063bed93c8414610746578063c30352611461075b578063c7525dd314610770578063c97d172e1461079057610334565b8063af215f94146106e6578063af33ae6914610706578063b162717e1461072657610334565b8063a6bd1b331161018a578063a6bd1b3314610693578063a9fa4ed5146106b3578063adc9772e146106d357610334565b806398445caf146106335780639bf43028146106535780639f600a0b1461067357610334565b80633cb747bf1161027f5780635ab2a558116102285780638295f258116102025780638295f258146105c957806382c69f9d146105e95780638f658198146105fe578063960a7afa1461061357610334565b80635ab2a5581461057457806364c6fdb41461058957806366285967146105a957610334565b80634742bbfb116102595780634742bbfb146105145780635325937f1461053457806357344e6f1461055457610334565b80633cb747bf146104bd5780633d12a85a146104df5780633ef23f7f146104ff57610334565b80632e17de78116102e15780633408e470116102bb5780633408e4701461046657806335e2c4af1461047b5780633a7af6311461049057610334565b80632e17de7814610406578063302830ab1461042657806332b949a21461044657610334565b80630f7aadb7116103125780630f7aadb7146103a657806313948c76146103c657806323c452cd146103e657610334565b806304e6c2c014610339578063051e72161461035b5780630f5e09e714610386575b600080fd5b34801561034557600080fd5b5061035961035436600461331b565b61093c565b005b34801561036757600080fd5b50610370610a26565b60405161037d9190613883565b60405180910390f35b34801561039257600080fd5b506103706103a1366004613633565b610a81565b3480156103b257600080fd5b506103596103c13660046134c3565b610a93565b3480156103d257600080fd5b506103706103e136600461331b565b610bf4565b3480156103f257600080fd5b5061035961040136600461343e565b610c20565b34801561041257600080fd5b50610359610421366004613633565b610d32565b34801561043257600080fd5b50610370610441366004613391565b610e28565b34801561045257600080fd5b50610359610461366004613633565b610e60565b34801561047257600080fd5b50610370610ee6565b34801561048757600080fd5b50610370610eea565b34801561049c57600080fd5b506104b06104ab366004613633565b610ef0565b60405161037d9190613878565b3480156104c957600080fd5b506104d2610f05565b60405161037d919061376f565b3480156104eb57600080fd5b506103596104fa366004613478565b610f21565b34801561050b57600080fd5b506104d261103f565b34801561052057600080fd5b5061035961052f366004613633565b61105b565b34801561054057600080fd5b5061035961054f36600461331b565b611068565b34801561056057600080fd5b5061037061056f36600461331b565b61114a565b34801561058057600080fd5b506104d2611172565b34801561059557600080fd5b506103596105a436600461331b565b61118e565b3480156105b557600080fd5b506103596105c436600461331b565b6111dd565b3480156105d557600080fd5b506103596105e436600461331b565b61122c565b3480156105f557600080fd5b506103706112db565b34801561060a57600080fd5b506103706112e1565b34801561061f57600080fd5b5061037061062e36600461364b565b6112e7565b34801561063f57600080fd5b5061037061064e36600461364b565b61131a565b34801561065f57600080fd5b5061035961066e366004613633565b611348565b34801561067f57600080fd5b5061035961068e3660046135d3565b611355565b34801561069f57600080fd5b506103596106ae3660046136fc565b6113cd565b3480156106bf57600080fd5b506103596106ce36600461364b565b61169c565b6103596106e1366004613391565b6116eb565b3480156106f257600080fd5b506103706107013660046136a4565b6117fc565b34801561071257600080fd5b5061035961072136600461331b565b61183e565b34801561073257600080fd5b50610359610741366004613337565b61188d565b34801561075257600080fd5b50610370611a0a565b34801561076757600080fd5b50610370611a10565b34801561077c57600080fd5b5061035961078b3660046133bc565b611a16565b34801561079c57600080fd5b506104b06107ab366004613633565b611b9d565b3480156107bc57600080fd5b506103596107cb36600461366c565b611bb2565b3480156107dc57600080fd5b506103596107eb366004613576565b611ca9565b3480156107fc57600080fd5b5061081061080b36600461364b565b611d93565b60405161037d919061423a565b34801561082957600080fd5b506104d2611de8565b34801561083e57600080fd5b5061037061084d366004613633565b611e04565b34801561085e57600080fd5b506104b061086d36600461331b565b611e16565b34801561087e57600080fd5b5061035961088d36600461331b565b611e41565b34801561089e57600080fd5b506103596108ad36600461331b565b611e90565b3480156108be57600080fd5b506104d2611edf565b3480156108d357600080fd5b506103596108e23660046135d3565b611efb565b3480156108f357600080fd5b506104d2611f6e565b34801561090857600080fd5b5061035961091736600461364b565b611f92565b34801561092857600080fd5b5061037061093736600461331b565b611fbe565b610944611ff8565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602081905260409091205460ff161515146109b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613a59565b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811660008181526001602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055517f4234ba611d325b3ba434c4e1b037967b955b1274d4185ee9847b7491111a48ff9190a250565b60007f0000000000000000000000000000000000000000000000000000000000000000610a51610ee6565b601354604051602001610a6693929190613759565b60405160208183030381529060405280519060200120905090565b60116020526000908152604090205481565b60026000541415610ad0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906140ec565b60026000908155610aed610ae2610ee6565b8e8e8e8e8e8e6117fc565b9050610b3381868686808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508d95949392508891505061201c565b610b69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613e89565b6000610b7588886112e7565b9050610b81818e612186565b610b8e828f8f6000612226565b8d73ffffffffffffffffffffffffffffffffffffffff16827f9475cdbde5fc71fe2ccd413c82878ee54d061b9f74f9e2e1a03ff1178821502c8f8f604051610bd792919061374b565b60405180910390a350506001600055505050505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600360205260409020545b919050565b3360009081526001602052604090205460ff16610c69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613e52565b60026000541415610ca6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906140ec565b60026000908155610cc4610cb8610ee6565b868686866000806117fc565b9050610cd08185612252565b610cdc81868685612226565b506001600055610ceb33611fbe565b610cf43361114a565b1015610d2c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613dc0565b50505050565b60026000541415610d6f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906140ec565b6002600055610d7e3382612309565b610d883382612366565b3373ffffffffffffffffffffffffffffffffffffffff167f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd82604051610dce9190613883565b60405180910390a26001600055610de433611fbe565b610ded3361114a565b1015610e25576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613dc0565b50565b73ffffffffffffffffffffffffffffffffffffffff821660009081526006602090815260408083208484529091529020545b92915050565b600c546000828152601260205260408120549091610e7e9190612408565b905042811080610e925750610e9233611e16565b610ec8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a99061399f565b6000828152601260205260409020429055610ee28261244e565b5050565b4690565b600e5481565b60009081526005602052604090205460ff1690565b60145473ffffffffffffffffffffffffffffffffffffffff1681565b3360009081526001602052604090205460ff16610f6a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613e52565b60026000541415610fa7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906140ec565b60026000908155610fc4610fb9610ee6565b8888888888886117fc565b9050610fd08187612252565b610fd981612608565b610fe787878585338961268a565b506001600055610ff633611fbe565b610fff3361114a565b1015611037576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613dc0565b505050505050565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b611063611ff8565b600d55565b611070611ff8565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff16156110d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906138fa565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909217909155517f2cec73b7434d3b91198ad1a618f63e6a0761ce281af5ec9ec76606d948d03e239190a250565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090205490565b60085473ffffffffffffffffffffffffffffffffffffffff1681565b611196611ff8565b600a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6111e5611ff8565b601480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b611234611ff8565b6040517ff2fde38b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063f2fde38b906112a690849060040161376f565b600060405180830381600087803b1580156112c057600080fd5b505af11580156112d4573d6000803e3d6000fd5b5050505050565b60135481565b600c5481565b600082826040516020016112fc92919061374b565b60405160208183030381529060405280519060200120905092915050565b6010602052816000526040600020818154811061133357fe5b90600052602060002001600091509150505481565b611350611ff8565b600c55565b61135d611ff8565b60005b818110156113c8576000600b600085858581811061137a57fe5b6020908102929092013583525081019190915260400160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055600101611360565b505050565b60008411611407576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613ec0565b82841015611441576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906141dd565b6000868152600b602052604090205460ff16611489576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613f1d565b60006114ac6127106114a6600e5488612a0990919063ffffffff16565b90612a5d565b90506000600f5482116114c157600f546114c3565b815b9050808510156114ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613d06565b6000888152601060205260409020600d54815410611520576115208961244e565b6040517f9dc29fac00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690639dc29fac906115949033908b90600401613790565b600060405180830381600087803b1580156115ae57600080fd5b505af11580156115c2573d6000803e3d6000fd5b5050505060006115d0610a26565b601380546001019055905060006115ec8b8b8b858c8c8c6117fc565b83546001810185556000858152602080822083018490558e82526011905260409020549192509061161d908b612408565b601160008e8152602001908152602001600020819055508a73ffffffffffffffffffffffffffffffffffffffff168c837fe35dddd4ea75d7e9b3fe93af4f4e40e778c3da4074c9d93e7c6536f1e803c1eb8d878e878f8f604051611686969594939291906142c4565b60405180910390a4505050505050505050505050565b6116a4611ff8565b6127108211156116e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990614123565b600e91909155600f55565b60026000541415611728576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906140ec565b6002600090815573ffffffffffffffffffffffffffffffffffffffff831681526001602081905260409091205460ff16151514611791576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613a59565b61179b3382612aa9565b6117a58282612b1d565b8173ffffffffffffffffffffffffffffffffffffffff167febedb8b3c678666e7f36970bc8f57abf6d8fa2e828c0da91ea5b75bf68ed101a826040516117eb9190613883565b60405180910390a250506001600055565b60008787878787878760405160200161181b979695949392919061425b565b604051602081830303815290604052805190602001209050979650505050505050565b611846611ff8565b600980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60006118cb848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612b7a92505050565b905060006118d982846112e7565b90506000805b8581101561199d5773ffffffffffffffffffffffffffffffffffffffff881660009081526006602052604081208189898581811061191957fe5b9050602002013581526020019081526020016000205490506000811115611994576119448382612408565b73ffffffffffffffffffffffffffffffffffffffff8a16600090815260066020526040812091945090818a8a8681811061197a57fe5b905060200201358152602001908152602001600020819055505b506001016118df565b506119a88282612186565b6119b28782612b1d565b828773ffffffffffffffffffffffffffffffffffffffff167f78e830d08be9d5f957414c84d685c061ecbd8467be98b42ebb64f0118b57d2ff836040516119f99190613883565b60405180910390a350505050505050565b600d5481565b600f5481565b611a5a87858585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508c95949392508791505061201c565b611a90576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613e89565b6000611a9c87876112e7565b73ffffffffffffffffffffffffffffffffffffffff8a1660009081526006602090815260408083208c845290915290205490915080611b07576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a99061388c565b73ffffffffffffffffffffffffffffffffffffffff8a1660009081526006602090815260408083208c8452909152812055611b428282612186565b611b4c8a82612b1d565b87898b73ffffffffffffffffffffffffffffffffffffffff167f84eb21b24c31b27a3bc67dde4a598aad06db6e9415cd66544492b9616996143c60405160405180910390a450505050505050505050565b600b6020526000908152604090205460ff1681565b611bba611ff8565b6000611bc684846112e7565b9050611bd061325b565b611bda8585611d93565b9050806040015160001415611c1b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613931565b80518414611c2557fe5b6040810151600090611c3a906249d400612408565b905080421015611c76576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906139fc565b60208201518251600091611c8a9190612fb1565b9050611c968482612186565b611ca08582612366565b50505050505050565b600954611ccb9073ffffffffffffffffffffffffffffffffffffffff16612ff3565b60026000541415611d08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906140ec565b6002600055611d1b86868686868661268a565b8173ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167f320958176930804eb66c2343c7343fc0367dc16249590c0f195783bee199d09487878786604051611d7e94939291906142ec565b60405180910390a35050600160005550505050565b611d9b61325b565b60046000611da985856112e7565b81526020019081526020016000206040518060600160405290816000820154815260200160018201548152602001600282015481525050905092915050565b60095473ffffffffffffffffffffffffffffffffffffffff1681565b60126020526000908152604090205481565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090205460ff1690565b611e49611ff8565b600880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b611e98611ff8565b600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600a5473ffffffffffffffffffffffffffffffffffffffff1681565b611f03611ff8565b60005b818110156113c8576001600b6000858585818110611f2057fe5b6020908102929092013583525081019190915260400160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055600101611f06565b7f000000000000000000000000000000000000000000000000000000000000000081565b600954611fb49073ffffffffffffffffffffffffffffffffffffffff16612ff3565b610ee28282613042565b6000610e5a611fcc8361314a565b73ffffffffffffffffffffffffffffffffffffffff841660009081526003602052604090205490612408565b60075461201a9073ffffffffffffffffffffffffffffffffffffffff16612ff3565b565b6000808211612057576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613d63565b818410612090576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613b5b565b61209982613150565b8351146120d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613f52565b8460005b845181101561217957856001166001141561212e578481815181106120f757fe5b60200260200101518260405160200161211192919061374b565b60405160208183030381529060405280519060200120915061216d565b8185828151811061213b57fe5b602002602001015160405160200161215492919061374b565b6040516020818303038152906040528051906020012091505b600195861c95016120d6565b5090951495945050505050565b600082815260046020526040902080546121cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906138c3565b60018101546000906121de9084612408565b825490915081111561221c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a99061408f565b6001909101555050565b61222f84612608565b6122428361223d8484612fb1565b612366565b8015610d2c57610d2c3382612366565b336000908152600660209081526040808320858452909152902054156122a4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613fd5565b6122ae3382612309565b336000908152600660209081526040808320858452909152908190208290555182907f0c3d250c7831051e78aa6a56679e590374c7c424415ffe4aa474491def2fe705906122fd908490613883565b60405180910390a25050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600360205260409020546123399082612408565b73ffffffffffffffffffffffffffffffffffffffff90921660009081526003602052604090209190915550565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906340c10f19906123da9085908590600401613790565b600060405180830381600087803b1580156123f457600080fd5b505af1158015611037573d6000803e3d6000fd5b600082820183811015612447576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613968565b9392505050565b60008181526010602052604090208054612494576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990614032565b60006124ee828054806020026020016040519081016040528092919081815260200182805480156124e457602002820191906000526020600020905b8154815260200190600101908083116124d0575b5050505050612b7a565b60008481526011602052604090819020549051919250904290839086907ff52ad20d3b4f50d1c40901dfb95a9ce5270b2fc32694e5c668354721cd87aa749061253a908690869061374b565b60405180910390a3606061254c610ee6565b848785856040516024016125649594939291906142a1565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152918152602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fef6ebe5e0000000000000000000000000000000000000000000000000000000017905260008981526011825282812081905560109091529081209192506125ff919061327c565b611037816131ff565b60008181526005602052604090205460ff1615612651576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613afe565b600090815260056020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b8015612737576040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906340c10f19906127049085908590600401613790565b600060405180830381600087803b15801561271e57600080fd5b505af1158015612732573d6000803e3d6000fd5b505050505b60006127438683612fb1565b905084158015612751575083155b15612801576040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906340c10f19906127ca908a908590600401613790565b600060405180830381600087803b1580156127e457600080fd5b505af11580156127f8573d6000803e3d6000fd5b50505050611ca0565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906340c10f19906128759030908590600401613790565b600060405180830381600087803b15801561288f57600080fd5b505af11580156128a3573d6000803e3d6000fd5b5050600a546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000008116945063095ea7b3935061291f9216908590600401613790565b602060405180830381600087803b15801561293957600080fd5b505af115801561294d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129719190613613565b50600a546040517f676c5ef600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063676c5ef6906129ce908a9085908a908a90600401613845565b600060405180830381600087803b1580156129e857600080fd5b505af11580156129fc573d6000803e3d6000fd5b5050505050505050505050565b600082612a1857506000610e5a565b82820282848281612a2557fe5b0414612447576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613ca9565b6000808211612a98576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613ac7565b818381612aa157fe5b049392505050565b6040517f9dc29fac00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690639dc29fac906123da9085908590600401613790565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902054612b4d9082612408565b73ffffffffffffffffffffffffffffffffffffffff90921660009081526002602052604090209190915550565b600080825111612bb6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990614180565b815160011415612bdc5781600081518110612bcd57fe5b60200260200101519050610c1b565b612be461329a565b5060408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e0830152825183815280820184529192909190602082018180368337505085519192506000918291508180805b6001841115612f8d5750506002820460018084161460005b82811015612f09578a8160020281518110612eb057fe5b602002602001015196508a8160020260010181518110612ecc57fe5b6020026020010151955086602089015285604089015287805190602001208b8281518110612ef657fe5b6020908102919091010152600101612e99565b508015612f6c57896001850381518110612f1f57fe5b60200260200101519550878360108110612f3557fe5b602002015160001b945085602088015284604088015286805190602001208a8381518110612f5f57fe5b6020026020010181815250505b80612f78576000612f7b565b60015b60ff1682019350600190920191612e81565b89600081518110612f9a57fe5b602002602001015198505050505050505050919050565b600082821115612fed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613a90565b50900390565b3373ffffffffffffffffffffffffffffffffffffffff821614610e25576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613c15565b600061304e83836112e7565b60008181526004602052604090205490915015613097576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613c72565b600082116130d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613df5565b6040805160608101825283815260006020808301828152428486019081528684526004909252918490209251835590516001830155516002909101555183907fb33d2162aead99dab59e77a7a67ea025b776bf8ca8079e132afdf9b23e03bd429061313d908590613883565b60405180910390a2505050565b50600090565b600080821161318b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613bb8565b816001141561319c57506000610c1b565b81600060805b600181106131ea577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001821b01811b8316156131e25791821c91908101905b60011c6131a2565b506001811b8414612447576001019392505050565b6014546008546040517f928c169a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283169263928c169a926112a69291169085906004016137b6565b60405180606001604052806000815260200160008152602001600081525090565b5080546000825590600052602060002090810190610e2591906132b9565b6040518061020001604052806010906020820280368337509192915050565b5b808211156132ce57600081556001016132ba565b5090565b60008083601f8401126132e3578182fd5b50813567ffffffffffffffff8111156132fa578182fd5b602083019150836020808302850101111561331457600080fd5b9250929050565b60006020828403121561332c578081fd5b813561244781614307565b6000806000806060858703121561334c578283fd5b843561335781614307565b9350602085013567ffffffffffffffff811115613372578384fd5b61337e878288016132d2565b9598909750949560400135949350505050565b600080604083850312156133a3578182fd5b82356133ae81614307565b946020939093013593505050565b60008060008060008060008060e0898b0312156133d7578384fd5b88356133e281614307565b97506020890135965060408901359550606089013594506080890135935060a089013567ffffffffffffffff811115613419578384fd5b6134258b828c016132d2565b999c989b50969995989497949560c00135949350505050565b60008060008060808587031215613453578384fd5b843561345e81614307565b966020860135965060408601359560600135945092505050565b60008060008060008060c08789031215613490578182fd5b863561349b81614307565b9860208801359850604088013597606081013597506080810135965060a00135945092505050565b6000806000806000806000806000806000806101608d8f0312156134e5578384fd5b6134ef8d35614307565b8c359b5060208d01359a5060408d0135995060608d0135985060808d0135975060a08d0135965060c08d0135955060e08d013594506101008d0135935067ffffffffffffffff6101208e01351115613545578283fd5b6135568e6101208f01358f016132d2565b81945080935050506101408d013590509295989b509295989b509295989b565b60008060008060008060c0878903121561358e578384fd5b863561359981614307565b955060208701359450604087013593506060870135925060808701356135be81614307565b8092505060a087013590509295509295509295565b600080602083850312156135e5578182fd5b823567ffffffffffffffff8111156135fb578283fd5b613607858286016132d2565b90969095509350505050565b600060208284031215613624578081fd5b81518015158114612447578182fd5b600060208284031215613644578081fd5b5035919050565b6000806040838503121561365d578182fd5b50508035926020909101359150565b600080600060608486031215613680578081fd5b8335925060208401359150604084013561369981614307565b809150509250925092565b600080600080600080600060e0888a0312156136be578081fd5b8735965060208801356136d081614307565b96999698505050506040850135946060810135946080820135945060a0820135935060c0909101359150565b60008060008060008060c08789031215613714578384fd5b86359550602087013561372681614307565b95989597505050506040840135936060810135936080820135935060a0909101359150565b918252602082015260400190565b9283526020830191909152604082015260600190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b600073ffffffffffffffffffffffffffffffffffffffff8416825260206040818401528351806040850152825b818110156137ff578581018301518582016060015282016137e3565b818111156138105783606083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01692909201606001949350505050565b73ffffffffffffffffffffffffffffffffffffffff94909416845260208401929092526040830152606082015260800190565b901515815260200190565b90815260200190565b6020808252601e908201527f4c325f4252473a207472616e73666572496420686173206e6f20626f6e640000604082015260600190565b6020808252601c908201527f4252473a205472616e7366657220726f6f74206e6f7420666f756e6400000000604082015260600190565b6020808252601e908201527f4143543a204164647265737320697320616c726561647920626f6e6465720000604082015260600190565b6020808252601b908201527f4252473a205472616e73666572526f6f74206e6f7420666f756e640000000000604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252602f908201527f4c325f4252473a204f6e6c7920426f6e6465722063616e20636f6d6d6974206260408201527f65666f7265206d696e2064656c61790000000000000000000000000000000000606082015260800190565b6020808252603b908201527f4252473a205472616e73666572526f6f742063616e6e6f74206265207265736360408201527f756564206265666f726520746865205265736375652044656c61790000000000606082015260800190565b6020808252601a908201527f4143543a2041646472657373206973206e6f7420626f6e646572000000000000604082015260600190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b6020808252602c908201527f4252473a20546865207472616e736665722068617320616c726561647920626560408201527f656e2077697468647261776e0000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f7560408201527f6e64732e00000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526030908201527f4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206360408201527f65696c286c6f675f3229206f6620302e00000000000000000000000000000000606082015260800190565b6020808252602d908201527f4c325f4152425f4252473a2043616c6c6572206973206e6f742074686520657860408201527f7065637465642073656e64657200000000000000000000000000000000000000606082015260800190565b6020808252601e908201527f4252473a205472616e7366657220726f6f7420616c7265616479207365740000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60408201527f7700000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526030908201527f4c325f4252473a20626f6e646572466565206d757374206d656574206d696e6960408201527f6d756d20726571756972656d656e747300000000000000000000000000000000606082015260800190565b60208082526037908201527f4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d757360408201527f742062652067726561746572207468616e207a65726f2e000000000000000000606082015260800190565b6020808252818101527f4143543a204e6f7420656e6f75676820617661696c61626c6520637265646974604082015260600190565b6020808252602d908201527f4252473a2043616e6e6f7420736574205472616e73666572526f6f7420746f7460408201527f616c416d6f756e74206f66203000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f4143543a2043616c6c6572206973206e6f7420626f6e64657200000000000000604082015260600190565b6020808252601b908201527f4252473a20496e76616c6964207472616e736665722070726f6f660000000000604082015260600190565b60208082526027908201527f4c325f4252473a204d757374207472616e736665722061206e6f6e2d7a65726f60408201527f20616d6f756e7400000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4c325f4252473a20636861696e4964206973206e6f7420737570706f72746564604082015260600190565b6020808252604d908201527f4c69625f4d65726b6c65547265653a20546f74616c207369626c696e6773206460408201527f6f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f2060608201527f746f74616c206c65617665732e00000000000000000000000000000000000000608082015260a00190565b60208082526027908201527f4252473a205769746864726177616c2068617320616c7265616479206265656e60408201527f20626f6e64656400000000000000000000000000000000000000000000000000606082015260800190565b60208082526027908201527f4c325f4252473a204d75737420636f6d6d6974206174206c656173742031205460408201527f72616e7366657200000000000000000000000000000000000000000000000000606082015260800190565b6020808252602a908201527f4252473a205769746864726177616c2065786365656473205472616e7366657260408201527f526f6f7420746f74616c00000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252602a908201527f4c325f4252473a206d696e426f6e646572427073206d757374206e6f7420657860408201527f6365656420313030303000000000000000000000000000000000000000000000606082015260800190565b60208082526034908201527f4c69625f4d65726b6c65547265653a204d7573742070726f766964652061742060408201527f6c65617374206f6e65206c65616620686173682e000000000000000000000000606082015260800190565b60208082526027908201527f4c325f4252473a20426f6e646572206665652063616e6e6f742065786365656460408201527f20616d6f756e7400000000000000000000000000000000000000000000000000606082015260800190565b81518152602080830151908201526040918201519181019190915260600190565b96875273ffffffffffffffffffffffffffffffffffffffff95909516602087015260408601939093526060850191909152608084015260a083015260c082015260e00190565b948552602085019390935260408401919091526060830152608082015260a00190565b958652602086019490945260408501929092526060840152608083015260a082015260c00190565b93845260208401929092526040830152606082015260800190565b73ffffffffffffffffffffffffffffffffffffffff81168114610e2557600080fdfea2646970667358221220d43e1cbdce76c678f0ba445b8334f82bf4d7cecc7a19e4ffac65f8aff2bae7d664736f6c634300060c00330000000000000000000000000000000000000000000000000000000000000064000000000000000000000000067f305024b195383245a075737d16dbdb84990c000000000000000000000000da7c0de432a9346bb6e96ac74e3b61a36d8a77eb000000000000000000000000b8901acb165ed027e32754e0ffe830802919727f00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000002a6303e6b99d451df3566068ebb110708335658f0000000000000000000000009137a628546e2b1bc26f60a5d1262fb6d58ea44a
Deployed Bytecode
0x6080604052600436106103345760003560e01c806398445caf116101b0578063cbd1642e116100ec578063e1825d0611610095578063f8398fa41161006f578063f8398fa4146108c7578063fc6e3b3b146108e7578063fd31c5ba146108fc578063ffa9286c1461091c57610334565b8063e1825d0614610872578063e40272d714610892578063e9cdfe51146108b257610334565b8063d2442783116100c6578063d24427831461081d578063d4e54c4714610832578063d5ef75511461085257610334565b8063cbd1642e146107b0578063cc29a306146107d0578063ce803b4f146107f057610334565b8063af215f9411610159578063bed93c8411610133578063bed93c8414610746578063c30352611461075b578063c7525dd314610770578063c97d172e1461079057610334565b8063af215f94146106e6578063af33ae6914610706578063b162717e1461072657610334565b8063a6bd1b331161018a578063a6bd1b3314610693578063a9fa4ed5146106b3578063adc9772e146106d357610334565b806398445caf146106335780639bf43028146106535780639f600a0b1461067357610334565b80633cb747bf1161027f5780635ab2a558116102285780638295f258116102025780638295f258146105c957806382c69f9d146105e95780638f658198146105fe578063960a7afa1461061357610334565b80635ab2a5581461057457806364c6fdb41461058957806366285967146105a957610334565b80634742bbfb116102595780634742bbfb146105145780635325937f1461053457806357344e6f1461055457610334565b80633cb747bf146104bd5780633d12a85a146104df5780633ef23f7f146104ff57610334565b80632e17de78116102e15780633408e470116102bb5780633408e4701461046657806335e2c4af1461047b5780633a7af6311461049057610334565b80632e17de7814610406578063302830ab1461042657806332b949a21461044657610334565b80630f7aadb7116103125780630f7aadb7146103a657806313948c76146103c657806323c452cd146103e657610334565b806304e6c2c014610339578063051e72161461035b5780630f5e09e714610386575b600080fd5b34801561034557600080fd5b5061035961035436600461331b565b61093c565b005b34801561036757600080fd5b50610370610a26565b60405161037d9190613883565b60405180910390f35b34801561039257600080fd5b506103706103a1366004613633565b610a81565b3480156103b257600080fd5b506103596103c13660046134c3565b610a93565b3480156103d257600080fd5b506103706103e136600461331b565b610bf4565b3480156103f257600080fd5b5061035961040136600461343e565b610c20565b34801561041257600080fd5b50610359610421366004613633565b610d32565b34801561043257600080fd5b50610370610441366004613391565b610e28565b34801561045257600080fd5b50610359610461366004613633565b610e60565b34801561047257600080fd5b50610370610ee6565b34801561048757600080fd5b50610370610eea565b34801561049c57600080fd5b506104b06104ab366004613633565b610ef0565b60405161037d9190613878565b3480156104c957600080fd5b506104d2610f05565b60405161037d919061376f565b3480156104eb57600080fd5b506103596104fa366004613478565b610f21565b34801561050b57600080fd5b506104d261103f565b34801561052057600080fd5b5061035961052f366004613633565b61105b565b34801561054057600080fd5b5061035961054f36600461331b565b611068565b34801561056057600080fd5b5061037061056f36600461331b565b61114a565b34801561058057600080fd5b506104d2611172565b34801561059557600080fd5b506103596105a436600461331b565b61118e565b3480156105b557600080fd5b506103596105c436600461331b565b6111dd565b3480156105d557600080fd5b506103596105e436600461331b565b61122c565b3480156105f557600080fd5b506103706112db565b34801561060a57600080fd5b506103706112e1565b34801561061f57600080fd5b5061037061062e36600461364b565b6112e7565b34801561063f57600080fd5b5061037061064e36600461364b565b61131a565b34801561065f57600080fd5b5061035961066e366004613633565b611348565b34801561067f57600080fd5b5061035961068e3660046135d3565b611355565b34801561069f57600080fd5b506103596106ae3660046136fc565b6113cd565b3480156106bf57600080fd5b506103596106ce36600461364b565b61169c565b6103596106e1366004613391565b6116eb565b3480156106f257600080fd5b506103706107013660046136a4565b6117fc565b34801561071257600080fd5b5061035961072136600461331b565b61183e565b34801561073257600080fd5b50610359610741366004613337565b61188d565b34801561075257600080fd5b50610370611a0a565b34801561076757600080fd5b50610370611a10565b34801561077c57600080fd5b5061035961078b3660046133bc565b611a16565b34801561079c57600080fd5b506104b06107ab366004613633565b611b9d565b3480156107bc57600080fd5b506103596107cb36600461366c565b611bb2565b3480156107dc57600080fd5b506103596107eb366004613576565b611ca9565b3480156107fc57600080fd5b5061081061080b36600461364b565b611d93565b60405161037d919061423a565b34801561082957600080fd5b506104d2611de8565b34801561083e57600080fd5b5061037061084d366004613633565b611e04565b34801561085e57600080fd5b506104b061086d36600461331b565b611e16565b34801561087e57600080fd5b5061035961088d36600461331b565b611e41565b34801561089e57600080fd5b506103596108ad36600461331b565b611e90565b3480156108be57600080fd5b506104d2611edf565b3480156108d357600080fd5b506103596108e23660046135d3565b611efb565b3480156108f357600080fd5b506104d2611f6e565b34801561090857600080fd5b5061035961091736600461364b565b611f92565b34801561092857600080fd5b5061037061093736600461331b565b611fbe565b610944611ff8565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602081905260409091205460ff161515146109b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613a59565b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811660008181526001602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055517f4234ba611d325b3ba434c4e1b037967b955b1274d4185ee9847b7491111a48ff9190a250565b60007fcd24e8e9844849186ed93126ac365bc3a49362579aee585431811ea50bd1694c610a51610ee6565b601354604051602001610a6693929190613759565b60405160208183030381529060405280519060200120905090565b60116020526000908152604090205481565b60026000541415610ad0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906140ec565b60026000908155610aed610ae2610ee6565b8e8e8e8e8e8e6117fc565b9050610b3381868686808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508d95949392508891505061201c565b610b69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613e89565b6000610b7588886112e7565b9050610b81818e612186565b610b8e828f8f6000612226565b8d73ffffffffffffffffffffffffffffffffffffffff16827f9475cdbde5fc71fe2ccd413c82878ee54d061b9f74f9e2e1a03ff1178821502c8f8f604051610bd792919061374b565b60405180910390a350506001600055505050505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600360205260409020545b919050565b3360009081526001602052604090205460ff16610c69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613e52565b60026000541415610ca6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906140ec565b60026000908155610cc4610cb8610ee6565b868686866000806117fc565b9050610cd08185612252565b610cdc81868685612226565b506001600055610ceb33611fbe565b610cf43361114a565b1015610d2c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613dc0565b50505050565b60026000541415610d6f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906140ec565b6002600055610d7e3382612309565b610d883382612366565b3373ffffffffffffffffffffffffffffffffffffffff167f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd82604051610dce9190613883565b60405180910390a26001600055610de433611fbe565b610ded3361114a565b1015610e25576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613dc0565b50565b73ffffffffffffffffffffffffffffffffffffffff821660009081526006602090815260408083208484529091529020545b92915050565b600c546000828152601260205260408120549091610e7e9190612408565b905042811080610e925750610e9233611e16565b610ec8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a99061399f565b6000828152601260205260409020429055610ee28261244e565b5050565b4690565b600e5481565b60009081526005602052604090205460ff1690565b60145473ffffffffffffffffffffffffffffffffffffffff1681565b3360009081526001602052604090205460ff16610f6a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613e52565b60026000541415610fa7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906140ec565b60026000908155610fc4610fb9610ee6565b8888888888886117fc565b9050610fd08187612252565b610fd981612608565b610fe787878585338961268a565b506001600055610ff633611fbe565b610fff3361114a565b1015611037576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613dc0565b505050505050565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b611063611ff8565b600d55565b611070611ff8565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff16156110d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906138fa565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909217909155517f2cec73b7434d3b91198ad1a618f63e6a0761ce281af5ec9ec76606d948d03e239190a250565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090205490565b60085473ffffffffffffffffffffffffffffffffffffffff1681565b611196611ff8565b600a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6111e5611ff8565b601480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b611234611ff8565b6040517ff2fde38b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000da7c0de432a9346bb6e96ac74e3b61a36d8a77eb169063f2fde38b906112a690849060040161376f565b600060405180830381600087803b1580156112c057600080fd5b505af11580156112d4573d6000803e3d6000fd5b5050505050565b60135481565b600c5481565b600082826040516020016112fc92919061374b565b60405160208183030381529060405280519060200120905092915050565b6010602052816000526040600020818154811061133357fe5b90600052602060002001600091509150505481565b611350611ff8565b600c55565b61135d611ff8565b60005b818110156113c8576000600b600085858581811061137a57fe5b6020908102929092013583525081019190915260400160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055600101611360565b505050565b60008411611407576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613ec0565b82841015611441576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906141dd565b6000868152600b602052604090205460ff16611489576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613f1d565b60006114ac6127106114a6600e5488612a0990919063ffffffff16565b90612a5d565b90506000600f5482116114c157600f546114c3565b815b9050808510156114ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613d06565b6000888152601060205260409020600d54815410611520576115208961244e565b6040517f9dc29fac00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000da7c0de432a9346bb6e96ac74e3b61a36d8a77eb1690639dc29fac906115949033908b90600401613790565b600060405180830381600087803b1580156115ae57600080fd5b505af11580156115c2573d6000803e3d6000fd5b5050505060006115d0610a26565b601380546001019055905060006115ec8b8b8b858c8c8c6117fc565b83546001810185556000858152602080822083018490558e82526011905260409020549192509061161d908b612408565b601160008e8152602001908152602001600020819055508a73ffffffffffffffffffffffffffffffffffffffff168c837fe35dddd4ea75d7e9b3fe93af4f4e40e778c3da4074c9d93e7c6536f1e803c1eb8d878e878f8f604051611686969594939291906142c4565b60405180910390a4505050505050505050505050565b6116a4611ff8565b6127108211156116e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990614123565b600e91909155600f55565b60026000541415611728576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906140ec565b6002600090815573ffffffffffffffffffffffffffffffffffffffff831681526001602081905260409091205460ff16151514611791576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613a59565b61179b3382612aa9565b6117a58282612b1d565b8173ffffffffffffffffffffffffffffffffffffffff167febedb8b3c678666e7f36970bc8f57abf6d8fa2e828c0da91ea5b75bf68ed101a826040516117eb9190613883565b60405180910390a250506001600055565b60008787878787878760405160200161181b979695949392919061425b565b604051602081830303815290604052805190602001209050979650505050505050565b611846611ff8565b600980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60006118cb848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612b7a92505050565b905060006118d982846112e7565b90506000805b8581101561199d5773ffffffffffffffffffffffffffffffffffffffff881660009081526006602052604081208189898581811061191957fe5b9050602002013581526020019081526020016000205490506000811115611994576119448382612408565b73ffffffffffffffffffffffffffffffffffffffff8a16600090815260066020526040812091945090818a8a8681811061197a57fe5b905060200201358152602001908152602001600020819055505b506001016118df565b506119a88282612186565b6119b28782612b1d565b828773ffffffffffffffffffffffffffffffffffffffff167f78e830d08be9d5f957414c84d685c061ecbd8467be98b42ebb64f0118b57d2ff836040516119f99190613883565b60405180910390a350505050505050565b600d5481565b600f5481565b611a5a87858585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508c95949392508791505061201c565b611a90576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613e89565b6000611a9c87876112e7565b73ffffffffffffffffffffffffffffffffffffffff8a1660009081526006602090815260408083208c845290915290205490915080611b07576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a99061388c565b73ffffffffffffffffffffffffffffffffffffffff8a1660009081526006602090815260408083208c8452909152812055611b428282612186565b611b4c8a82612b1d565b87898b73ffffffffffffffffffffffffffffffffffffffff167f84eb21b24c31b27a3bc67dde4a598aad06db6e9415cd66544492b9616996143c60405160405180910390a450505050505050505050565b600b6020526000908152604090205460ff1681565b611bba611ff8565b6000611bc684846112e7565b9050611bd061325b565b611bda8585611d93565b9050806040015160001415611c1b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613931565b80518414611c2557fe5b6040810151600090611c3a906249d400612408565b905080421015611c76576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906139fc565b60208201518251600091611c8a9190612fb1565b9050611c968482612186565b611ca08582612366565b50505050505050565b600954611ccb9073ffffffffffffffffffffffffffffffffffffffff16612ff3565b60026000541415611d08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906140ec565b6002600055611d1b86868686868661268a565b8173ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167f320958176930804eb66c2343c7343fc0367dc16249590c0f195783bee199d09487878786604051611d7e94939291906142ec565b60405180910390a35050600160005550505050565b611d9b61325b565b60046000611da985856112e7565b81526020019081526020016000206040518060600160405290816000820154815260200160018201548152602001600282015481525050905092915050565b60095473ffffffffffffffffffffffffffffffffffffffff1681565b60126020526000908152604090205481565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090205460ff1690565b611e49611ff8565b600880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b611e98611ff8565b600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600a5473ffffffffffffffffffffffffffffffffffffffff1681565b611f03611ff8565b60005b818110156113c8576001600b6000858585818110611f2057fe5b6020908102929092013583525081019190915260400160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055600101611f06565b7f000000000000000000000000da7c0de432a9346bb6e96ac74e3b61a36d8a77eb81565b600954611fb49073ffffffffffffffffffffffffffffffffffffffff16612ff3565b610ee28282613042565b6000610e5a611fcc8361314a565b73ffffffffffffffffffffffffffffffffffffffff841660009081526003602052604090205490612408565b60075461201a9073ffffffffffffffffffffffffffffffffffffffff16612ff3565b565b6000808211612057576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613d63565b818410612090576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613b5b565b61209982613150565b8351146120d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613f52565b8460005b845181101561217957856001166001141561212e578481815181106120f757fe5b60200260200101518260405160200161211192919061374b565b60405160208183030381529060405280519060200120915061216d565b8185828151811061213b57fe5b602002602001015160405160200161215492919061374b565b6040516020818303038152906040528051906020012091505b600195861c95016120d6565b5090951495945050505050565b600082815260046020526040902080546121cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a9906138c3565b60018101546000906121de9084612408565b825490915081111561221c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a99061408f565b6001909101555050565b61222f84612608565b6122428361223d8484612fb1565b612366565b8015610d2c57610d2c3382612366565b336000908152600660209081526040808320858452909152902054156122a4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613fd5565b6122ae3382612309565b336000908152600660209081526040808320858452909152908190208290555182907f0c3d250c7831051e78aa6a56679e590374c7c424415ffe4aa474491def2fe705906122fd908490613883565b60405180910390a25050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600360205260409020546123399082612408565b73ffffffffffffffffffffffffffffffffffffffff90921660009081526003602052604090209190915550565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000da7c0de432a9346bb6e96ac74e3b61a36d8a77eb16906340c10f19906123da9085908590600401613790565b600060405180830381600087803b1580156123f457600080fd5b505af1158015611037573d6000803e3d6000fd5b600082820183811015612447576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613968565b9392505050565b60008181526010602052604090208054612494576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990614032565b60006124ee828054806020026020016040519081016040528092919081815260200182805480156124e457602002820191906000526020600020905b8154815260200190600101908083116124d0575b5050505050612b7a565b60008481526011602052604090819020549051919250904290839086907ff52ad20d3b4f50d1c40901dfb95a9ce5270b2fc32694e5c668354721cd87aa749061253a908690869061374b565b60405180910390a3606061254c610ee6565b848785856040516024016125649594939291906142a1565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152918152602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fef6ebe5e0000000000000000000000000000000000000000000000000000000017905260008981526011825282812081905560109091529081209192506125ff919061327c565b611037816131ff565b60008181526005602052604090205460ff1615612651576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613afe565b600090815260056020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b8015612737576040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000da7c0de432a9346bb6e96ac74e3b61a36d8a77eb16906340c10f19906127049085908590600401613790565b600060405180830381600087803b15801561271e57600080fd5b505af1158015612732573d6000803e3d6000fd5b505050505b60006127438683612fb1565b905084158015612751575083155b15612801576040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000da7c0de432a9346bb6e96ac74e3b61a36d8a77eb16906340c10f19906127ca908a908590600401613790565b600060405180830381600087803b1580156127e457600080fd5b505af11580156127f8573d6000803e3d6000fd5b50505050611ca0565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000da7c0de432a9346bb6e96ac74e3b61a36d8a77eb16906340c10f19906128759030908590600401613790565b600060405180830381600087803b15801561288f57600080fd5b505af11580156128a3573d6000803e3d6000fd5b5050600a546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000da7c0de432a9346bb6e96ac74e3b61a36d8a77eb8116945063095ea7b3935061291f9216908590600401613790565b602060405180830381600087803b15801561293957600080fd5b505af115801561294d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129719190613613565b50600a546040517f676c5ef600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063676c5ef6906129ce908a9085908a908a90600401613845565b600060405180830381600087803b1580156129e857600080fd5b505af11580156129fc573d6000803e3d6000fd5b5050505050505050505050565b600082612a1857506000610e5a565b82820282848281612a2557fe5b0414612447576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613ca9565b6000808211612a98576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613ac7565b818381612aa157fe5b049392505050565b6040517f9dc29fac00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000da7c0de432a9346bb6e96ac74e3b61a36d8a77eb1690639dc29fac906123da9085908590600401613790565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902054612b4d9082612408565b73ffffffffffffffffffffffffffffffffffffffff90921660009081526002602052604090209190915550565b600080825111612bb6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990614180565b815160011415612bdc5781600081518110612bcd57fe5b60200260200101519050610c1b565b612be461329a565b5060408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e0830152825183815280820184529192909190602082018180368337505085519192506000918291508180805b6001841115612f8d5750506002820460018084161460005b82811015612f09578a8160020281518110612eb057fe5b602002602001015196508a8160020260010181518110612ecc57fe5b6020026020010151955086602089015285604089015287805190602001208b8281518110612ef657fe5b6020908102919091010152600101612e99565b508015612f6c57896001850381518110612f1f57fe5b60200260200101519550878360108110612f3557fe5b602002015160001b945085602088015284604088015286805190602001208a8381518110612f5f57fe5b6020026020010181815250505b80612f78576000612f7b565b60015b60ff1682019350600190920191612e81565b89600081518110612f9a57fe5b602002602001015198505050505050505050919050565b600082821115612fed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613a90565b50900390565b3373ffffffffffffffffffffffffffffffffffffffff821614610e25576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613c15565b600061304e83836112e7565b60008181526004602052604090205490915015613097576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613c72565b600082116130d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613df5565b6040805160608101825283815260006020808301828152428486019081528684526004909252918490209251835590516001830155516002909101555183907fb33d2162aead99dab59e77a7a67ea025b776bf8ca8079e132afdf9b23e03bd429061313d908590613883565b60405180910390a2505050565b50600090565b600080821161318b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990613bb8565b816001141561319c57506000610c1b565b81600060805b600181106131ea577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001821b01811b8316156131e25791821c91908101905b60011c6131a2565b506001811b8414612447576001019392505050565b6014546008546040517f928c169a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283169263928c169a926112a69291169085906004016137b6565b60405180606001604052806000815260200160008152602001600081525090565b5080546000825590600052602060002090810190610e2591906132b9565b6040518061020001604052806010906020820280368337509192915050565b5b808211156132ce57600081556001016132ba565b5090565b60008083601f8401126132e3578182fd5b50813567ffffffffffffffff8111156132fa578182fd5b602083019150836020808302850101111561331457600080fd5b9250929050565b60006020828403121561332c578081fd5b813561244781614307565b6000806000806060858703121561334c578283fd5b843561335781614307565b9350602085013567ffffffffffffffff811115613372578384fd5b61337e878288016132d2565b9598909750949560400135949350505050565b600080604083850312156133a3578182fd5b82356133ae81614307565b946020939093013593505050565b60008060008060008060008060e0898b0312156133d7578384fd5b88356133e281614307565b97506020890135965060408901359550606089013594506080890135935060a089013567ffffffffffffffff811115613419578384fd5b6134258b828c016132d2565b999c989b50969995989497949560c00135949350505050565b60008060008060808587031215613453578384fd5b843561345e81614307565b966020860135965060408601359560600135945092505050565b60008060008060008060c08789031215613490578182fd5b863561349b81614307565b9860208801359850604088013597606081013597506080810135965060a00135945092505050565b6000806000806000806000806000806000806101608d8f0312156134e5578384fd5b6134ef8d35614307565b8c359b5060208d01359a5060408d0135995060608d0135985060808d0135975060a08d0135965060c08d0135955060e08d013594506101008d0135935067ffffffffffffffff6101208e01351115613545578283fd5b6135568e6101208f01358f016132d2565b81945080935050506101408d013590509295989b509295989b509295989b565b60008060008060008060c0878903121561358e578384fd5b863561359981614307565b955060208701359450604087013593506060870135925060808701356135be81614307565b8092505060a087013590509295509295509295565b600080602083850312156135e5578182fd5b823567ffffffffffffffff8111156135fb578283fd5b613607858286016132d2565b90969095509350505050565b600060208284031215613624578081fd5b81518015158114612447578182fd5b600060208284031215613644578081fd5b5035919050565b6000806040838503121561365d578182fd5b50508035926020909101359150565b600080600060608486031215613680578081fd5b8335925060208401359150604084013561369981614307565b809150509250925092565b600080600080600080600060e0888a0312156136be578081fd5b8735965060208801356136d081614307565b96999698505050506040850135946060810135946080820135945060a0820135935060c0909101359150565b60008060008060008060c08789031215613714578384fd5b86359550602087013561372681614307565b95989597505050506040840135936060810135936080820135935060a0909101359150565b918252602082015260400190565b9283526020830191909152604082015260600190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b600073ffffffffffffffffffffffffffffffffffffffff8416825260206040818401528351806040850152825b818110156137ff578581018301518582016060015282016137e3565b818111156138105783606083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01692909201606001949350505050565b73ffffffffffffffffffffffffffffffffffffffff94909416845260208401929092526040830152606082015260800190565b901515815260200190565b90815260200190565b6020808252601e908201527f4c325f4252473a207472616e73666572496420686173206e6f20626f6e640000604082015260600190565b6020808252601c908201527f4252473a205472616e7366657220726f6f74206e6f7420666f756e6400000000604082015260600190565b6020808252601e908201527f4143543a204164647265737320697320616c726561647920626f6e6465720000604082015260600190565b6020808252601b908201527f4252473a205472616e73666572526f6f74206e6f7420666f756e640000000000604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252602f908201527f4c325f4252473a204f6e6c7920426f6e6465722063616e20636f6d6d6974206260408201527f65666f7265206d696e2064656c61790000000000000000000000000000000000606082015260800190565b6020808252603b908201527f4252473a205472616e73666572526f6f742063616e6e6f74206265207265736360408201527f756564206265666f726520746865205265736375652044656c61790000000000606082015260800190565b6020808252601a908201527f4143543a2041646472657373206973206e6f7420626f6e646572000000000000604082015260600190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b6020808252602c908201527f4252473a20546865207472616e736665722068617320616c726561647920626560408201527f656e2077697468647261776e0000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f7560408201527f6e64732e00000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526030908201527f4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206360408201527f65696c286c6f675f3229206f6620302e00000000000000000000000000000000606082015260800190565b6020808252602d908201527f4c325f4152425f4252473a2043616c6c6572206973206e6f742074686520657860408201527f7065637465642073656e64657200000000000000000000000000000000000000606082015260800190565b6020808252601e908201527f4252473a205472616e7366657220726f6f7420616c7265616479207365740000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60408201527f7700000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526030908201527f4c325f4252473a20626f6e646572466565206d757374206d656574206d696e6960408201527f6d756d20726571756972656d656e747300000000000000000000000000000000606082015260800190565b60208082526037908201527f4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d757360408201527f742062652067726561746572207468616e207a65726f2e000000000000000000606082015260800190565b6020808252818101527f4143543a204e6f7420656e6f75676820617661696c61626c6520637265646974604082015260600190565b6020808252602d908201527f4252473a2043616e6e6f7420736574205472616e73666572526f6f7420746f7460408201527f616c416d6f756e74206f66203000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f4143543a2043616c6c6572206973206e6f7420626f6e64657200000000000000604082015260600190565b6020808252601b908201527f4252473a20496e76616c6964207472616e736665722070726f6f660000000000604082015260600190565b60208082526027908201527f4c325f4252473a204d757374207472616e736665722061206e6f6e2d7a65726f60408201527f20616d6f756e7400000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4c325f4252473a20636861696e4964206973206e6f7420737570706f72746564604082015260600190565b6020808252604d908201527f4c69625f4d65726b6c65547265653a20546f74616c207369626c696e6773206460408201527f6f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f2060608201527f746f74616c206c65617665732e00000000000000000000000000000000000000608082015260a00190565b60208082526027908201527f4252473a205769746864726177616c2068617320616c7265616479206265656e60408201527f20626f6e64656400000000000000000000000000000000000000000000000000606082015260800190565b60208082526027908201527f4c325f4252473a204d75737420636f6d6d6974206174206c656173742031205460408201527f72616e7366657200000000000000000000000000000000000000000000000000606082015260800190565b6020808252602a908201527f4252473a205769746864726177616c2065786365656473205472616e7366657260408201527f526f6f7420746f74616c00000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252602a908201527f4c325f4252473a206d696e426f6e646572427073206d757374206e6f7420657860408201527f6365656420313030303000000000000000000000000000000000000000000000606082015260800190565b60208082526034908201527f4c69625f4d65726b6c65547265653a204d7573742070726f766964652061742060408201527f6c65617374206f6e65206c65616620686173682e000000000000000000000000606082015260800190565b60208082526027908201527f4c325f4252473a20426f6e646572206665652063616e6e6f742065786365656460408201527f20616d6f756e7400000000000000000000000000000000000000000000000000606082015260800190565b81518152602080830151908201526040918201519181019190915260600190565b96875273ffffffffffffffffffffffffffffffffffffffff95909516602087015260408601939093526060850191909152608084015260a083015260c082015260e00190565b948552602085019390935260408401919091526060830152608082015260a00190565b958652602086019490945260408501929092526060840152608083015260a082015260c00190565b93845260208401929092526040830152606082015260800190565b73ffffffffffffffffffffffffffffffffffffffff81168114610e2557600080fdfea2646970667358221220d43e1cbdce76c678f0ba445b8334f82bf4d7cecc7a19e4ffac65f8aff2bae7d664736f6c634300060c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000067f305024b195383245a075737d16dbdb84990c000000000000000000000000da7c0de432a9346bb6e96ac74e3b61a36d8a77eb000000000000000000000000b8901acb165ed027e32754e0ffe830802919727f00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000002a6303e6b99d451df3566068ebb110708335658f0000000000000000000000009137a628546e2b1bc26f60a5d1262fb6d58ea44a
-----Decoded View---------------
Arg [0] : _messenger (address): 0x0000000000000000000000000000000000000064
Arg [1] : l1Governance (address): 0x067F305024b195383245A075737D16dbDb84990c
Arg [2] : hToken (address): 0xDa7c0de432a9346bB6e96aC74e3B61A36d8a77eB
Arg [3] : l1BridgeAddress (address): 0xb8901acB165ed027E32754E0FFe830802919727f
Arg [4] : activeChainIds (uint256[]): 1
Arg [5] : bonders (address[]): 0x2A6303e6b99d451Df3566068EBb110708335658f,0x9137a628546e2b1bc26F60A5D1262fb6D58eA44A
-----Encoded View---------------
11 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000064
Arg [1] : 000000000000000000000000067f305024b195383245a075737d16dbdb84990c
Arg [2] : 000000000000000000000000da7c0de432a9346bb6e96ac74e3b61a36d8a77eb
Arg [3] : 000000000000000000000000b8901acb165ed027e32754e0ffe830802919727f
Arg [4] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [9] : 0000000000000000000000002a6303e6b99d451df3566068ebb110708335658f
Arg [10] : 0000000000000000000000009137a628546e2b1bc26f60a5d1262fb6d58ea44a
Loading...
Loading
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| ARB | 100.00% | $3,433.36 | 1 | $3,433.36 |
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.