ETH Price: $3,063.52 (-7.27%)
Gas: 11 Gwei

Contract

0x2e71B2688019ebdFDdE5A45e6921aaebb15b25fb
 

Multichain Info

1 address found via
Transaction Hash
Method
Block
From
To
Value
Emergency Withdr...201601812024-06-24 7:53:5910 days ago1719215639IN
0x2e71B268...bb15b25fb
0.00001 ETH0.000709215.56262716
Withdraw201601642024-06-24 7:50:3510 days ago1719215435IN
0x2e71B268...bb15b25fb
0.00001 ETH0.000775596.07357809
Withdraw195883452024-04-05 8:26:5990 days ago1712305619IN
0x2e71B268...bb15b25fb
0.00741279 ETH0.0023551415.59182245
Withdraw194333342024-03-14 12:45:47112 days ago1710420347IN
0x2e71B268...bb15b25fb
0.02899372 ETH0.0078956352.27996558
Withdraw192648292024-02-19 22:45:11136 days ago1708382711IN
0x2e71B268...bb15b25fb
0.01579718 ETH0.005086833.67360509
Withdraw192003812024-02-10 21:30:11145 days ago1707600611IN
0x2e71B268...bb15b25fb
0.01840965 ETH0.0063199341.83671607
Withdraw191457482024-02-03 5:28:11152 days ago1706938091IN
0x2e71B268...bb15b25fb
0.00651726 ETH0.0020698413.70411323
Withdraw190641662024-01-22 18:53:35164 days ago1705949615IN
0x2e71B268...bb15b25fb
0.00756681 ETH0.0021470614.21537785
Withdraw189877542024-01-12 2:10:35174 days ago1705025435IN
0x2e71B268...bb15b25fb
0.00753395 ETH0.0023595115.62202251
Withdraw188797712023-12-27 21:50:35190 days ago1703713835IN
0x2e71B268...bb15b25fb
0.01432515 ETH0.0046727430.93014317
Withdraw186684542023-11-28 6:51:47219 days ago1701154307IN
0x2e71B268...bb15b25fb
0.01162429 ETH0.0039395526.07907516
Withdraw186512162023-11-25 20:53:35222 days ago1700945615IN
0x2e71B268...bb15b25fb
0.01650816 ETH0.006939245.93250832
Withdraw186381412023-11-24 0:56:47223 days ago1700787407IN
0x2e71B268...bb15b25fb
0.01095521 ETH0.0023978515.87331693
Withdraw186247062023-11-22 3:48:59225 days ago1700624939IN
0x2e71B268...bb15b25fb
0.01338151 ETH0.0046447930.7549415
Withdraw185976792023-11-18 8:55:47229 days ago1700297747IN
0x2e71B268...bb15b25fb
0.00856739 ETH0.0027339918.09852056
Withdraw185877262023-11-16 23:28:47231 days ago1700177327IN
0x2e71B268...bb15b25fb
0.01250967 ETH0.0039281326.00139976
Withdraw185848272023-11-16 13:44:47231 days ago1700142287IN
0x2e71B268...bb15b25fb
0.01351643 ETH0.0046366930.70132233
Withdraw185557122023-11-12 12:04:23235 days ago1699790663IN
0x2e71B268...bb15b25fb
0.01534566 ETH0.0045877830.37023162
Withdraw185496322023-11-11 15:38:11236 days ago1699717091IN
0x2e71B268...bb15b25fb
0.01765706 ETH0.006104740.40869386
Withdraw185061782023-11-05 13:43:23242 days ago1699191803IN
0x2e71B268...bb15b25fb
0.01229314 ETH0.004207927.85326716
Withdraw185048902023-11-05 9:23:11242 days ago1699176191IN
0x2e71B268...bb15b25fb
0.00700787 ETH0.0021686314.35477896
Withdraw185036982023-11-05 5:22:59242 days ago1699161779IN
0x2e71B268...bb15b25fb
0.00683685 ETH0.0021141113.99392789
Withdraw185026002023-11-05 1:41:11242 days ago1699148471IN
0x2e71B268...bb15b25fb
0.00685363 ETH0.0022754215.06283729
Withdraw185008492023-11-04 19:47:11243 days ago1699127231IN
0x2e71B268...bb15b25fb
0.00635738 ETH0.0021457614.20341996
Withdraw184995842023-11-04 15:32:35243 days ago1699111955IN
0x2e71B268...bb15b25fb
0.00831937 ETH0.0026719317.68764063
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To Value
201601812024-06-24 7:53:5910 days ago1719215639
0x2e71B268...bb15b25fb
0.00001 ETH
201601642024-06-24 7:50:3510 days ago1719215435
0x2e71B268...bb15b25fb
0.00001 ETH
195883452024-04-05 8:26:5990 days ago1712305619
0x2e71B268...bb15b25fb
0.00741279 ETH
194333342024-03-14 12:45:47112 days ago1710420347
0x2e71B268...bb15b25fb
0.02899372 ETH
192648292024-02-19 22:45:11136 days ago1708382711
0x2e71B268...bb15b25fb
0.01579718 ETH
192003812024-02-10 21:30:11145 days ago1707600611
0x2e71B268...bb15b25fb
0.01840965 ETH
191457482024-02-03 5:28:11152 days ago1706938091
0x2e71B268...bb15b25fb
0.00651726 ETH
190641662024-01-22 18:53:35164 days ago1705949615
0x2e71B268...bb15b25fb
0.00756681 ETH
189877542024-01-12 2:10:35174 days ago1705025435
0x2e71B268...bb15b25fb
0.00753395 ETH
188797712023-12-27 21:50:35190 days ago1703713835
0x2e71B268...bb15b25fb
0.01432515 ETH
186684542023-11-28 6:51:47219 days ago1701154307
0x2e71B268...bb15b25fb
0.01162429 ETH
186512162023-11-25 20:53:35222 days ago1700945615
0x2e71B268...bb15b25fb
0.01650816 ETH
186381412023-11-24 0:56:47223 days ago1700787407
0x2e71B268...bb15b25fb
0.01095521 ETH
186247062023-11-22 3:48:59225 days ago1700624939
0x2e71B268...bb15b25fb
0.01338151 ETH
185976792023-11-18 8:55:47229 days ago1700297747
0x2e71B268...bb15b25fb
0.00856739 ETH
185877262023-11-16 23:28:47231 days ago1700177327
0x2e71B268...bb15b25fb
0.01250967 ETH
185848272023-11-16 13:44:47231 days ago1700142287
0x2e71B268...bb15b25fb
0.01351643 ETH
185557122023-11-12 12:04:23235 days ago1699790663
0x2e71B268...bb15b25fb
0.01534566 ETH
185496322023-11-11 15:38:11236 days ago1699717091
0x2e71B268...bb15b25fb
0.01765706 ETH
185061782023-11-05 13:43:23242 days ago1699191803
0x2e71B268...bb15b25fb
0.01229314 ETH
185048902023-11-05 9:23:11242 days ago1699176191
0x2e71B268...bb15b25fb
0.00700787 ETH
185036982023-11-05 5:22:59242 days ago1699161779
0x2e71B268...bb15b25fb
0.00683685 ETH
185026002023-11-05 1:41:11242 days ago1699148471
0x2e71B268...bb15b25fb
0.00685363 ETH
185008492023-11-04 19:47:11243 days ago1699127231
0x2e71B268...bb15b25fb
0.00635738 ETH
184995842023-11-04 15:32:35243 days ago1699111955
0x2e71B268...bb15b25fb
0.00831937 ETH
View All Internal Transactions
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x9ABAd589...f74666fBE
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
CrossFarmingVault

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 99999 runs

Other Settings:
default evmVersion
File 1 of 13 : CrossFarmingVault.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "sgn-v2-contracts/contracts/message/interfaces/IMessageBus.sol";
import "./interfaces/IMessage.sol";
import "./libraries/DataTypes.sol";

/// @title A vault contract deployed on EVM chain, users can stake LP token from EVM liquidity pool
/// to participate MasterchefV2 farm pools(BSC chain), get native CAKE reward.
contract CrossFarmingVault is Ownable, Pausable, ReentrancyGuard {
    using SafeERC20 for IERC20;

    struct UserInfo {
        uint256 amount; // user deposit original LP token amount.
        uint256 lastActionTime;
    }

    struct PoolInfo {
        IERC20 lpToken;
        uint256 mcv2PoolId; // pool id in Pancakeswap MastercherV2 farms.
        uint256 totalAmount; // total staked LP token amount.
    }

    // Info of each pool.
    PoolInfo[] public poolInfo;

    // cross farming sender contract's messagebus contract.
    address public messageBus;
    // cross farming sender contract deployed on other EVM chain(not bsc chain)
    // which send cross-chain msg to celer messagebus deployed on EVM chain.
    address public immutable CROSS_FARMING_SENDER;
    // cross farming receiver contract deployed on BSC chain
    // which receive cross-chain msg from celer messagebus deployed on BSC chain.
    address public immutable CROSS_FARMING_RECEIVER;
    // the operator for fallbackwithdraw/deposit operation.
    address public operator;
    // BSC chain ID
    uint64 public immutable BSC_CHAIN_ID;

    // whether LP tokend added to pool
    mapping(IERC20 => bool) public exists;
    // deposit records (account => (pid => (nonce => amount))
    /// @notice this is just for 'deposit' function, make sure operator fallbackDeposit amount
    /// exactly match original deposit amount, in withdraw related function should not consider this.
    mapping(address => mapping(uint256 => mapping(uint64 => uint256))) public deposits;
    // MCV2 pool 1:1 vault pool
    mapping(uint256 => uint256) public poolMapping;
    // white list masterchefv2 pool id. function 'add' mcv2 pool id should be in the list.
    mapping(uint256 => bool) public whitelistPool;
    // (pid => (account => UserInfo))
    mapping(uint256 => mapping(address => UserInfo)) public userInfo;
    /// @notice used nonce (user => (pid => (nonce => bool)))
    mapping(address => mapping(uint256 => mapping(uint64 => bool))) public usedNonce;

    event Pause();
    event Unpause();
    event AddedWhiteListPool(uint256 pid);
    event AddedPool(address indexed lpToken, uint256 mockPoolId);
    event OperatorUpdated(address indexed newOperator, address indexed oldOperator);
    event Deposit(address indexed sender, uint256 pid, uint256 amount, uint64 nonce);
    event Withdraw(address indexed sender, uint256 pid, uint256 amount, uint64 nonce);
    event EmergencyWithdraw(address indexed sender, uint256 pid, uint256 amount, uint64 nonce);
    event AckWithdraw(address indexed sender, uint256 pid, uint256 amount, uint64 nonce);
    event FallbackDeposit(address indexed sender, uint256 pid, uint256 amount, uint64 nonce);
    event FallbackWithdraw(address indexed sender, uint256 pid, uint256 amount, uint64 nonce);
    event AckEmergencyWithdraw(address indexed sender, uint256 pid, uint256 amount, uint64 nonce);

    /**
     * @param _operator: a priviledged user for fallback operation.
     * @param _sender: cross farming sender contract on EVM chain
     * @param _receiver: cross farming receiver contract on BSC
     * @param _chainId: BSC chain ID
     */
    constructor(
        address _operator,
        address _sender,
        address _receiver,
        uint64 _chainId
    ) {
        operator = _operator;
        CROSS_FARMING_SENDER = _sender;
        CROSS_FARMING_RECEIVER = _receiver;
        BSC_CHAIN_ID = _chainId;

        // set messageBus
        messageBus = IMessage(CROSS_FARMING_SENDER).messageBus();

        // dummpy pool, poolInfo index increase from 1.
        poolInfo.push(PoolInfo({lpToken: IERC20(address(0)), mcv2PoolId: 0, totalAmount: 0}));
    }

    modifier onlySender() {
        require(msg.sender == CROSS_FARMING_SENDER, "not cross farming sender");
        _;
    }

    modifier onlyOperator() {
        require(msg.sender == operator, "not fallback operator");
        _;
    }

    modifier onlyNotUsedNonce(
        address _user,
        uint256 _pid,
        uint64 _nonce
    ) {
        require(!usedNonce[_user][_pid][_nonce], "used nonce");
        _;
    }

    modifier notContract() {
        require(!_isContract(msg.sender), "contract not allowed");
        require(msg.sender == tx.origin, "proxy contract not allowed");
        _;
    }

    /**
     * @notice Add available MasterchefV2 farm pool id for cross-farming.
     * @param _mcv2Pid MasterchefV2 pool id array.
     */
    function addWhiteListPool(uint256 _mcv2Pid) public onlyOwner {
        require(!whitelistPool[_mcv2Pid], "Added mcv2 pool id");
        whitelistPool[_mcv2Pid] = true;

        emit AddedWhiteListPool(_mcv2Pid);
    }

    /**
     * @notice Add lp token and pool id corresponding to masterchefv2 farm pool.
     * @dev same token can't be added repeatedly
     * @param _lpToken lp token address.
     * @param _mcv2PoolId pool id in masterchefv2 farm pool, must be in whitelist pools.
     */
    function add(IERC20 _lpToken, uint256 _mcv2PoolId) public onlyOwner {
        require(!exists[_lpToken], "Existed token");
        require(whitelistPool[_mcv2PoolId], "Not whitelist pool");
        require(poolMapping[_mcv2PoolId] == 0, "MCV2 pool already matched");
        require(_lpToken.balanceOf(address(this)) >= 0, "Not ERC20 token");

        // add poolInfo
        poolInfo.push(PoolInfo({lpToken: _lpToken, mcv2PoolId: _mcv2PoolId, totalAmount: 0}));

        // update mappping
        exists[_lpToken] = true;
        poolMapping[_mcv2PoolId] = poolInfo.length - 1;

        emit AddedPool(address(_lpToken), _mcv2PoolId);
    }

    /**
     * @notice deposit funds into current vault.
     * @dev only possible when contract not paused.
     * @param _pid lp token pool id in vault contract.
     * @param _amount deposit token amount.
     */
    function deposit(uint256 _pid, uint256 _amount) external payable nonReentrant whenNotPaused notContract {
        require(_amount > 0, "Nothing to deposit");

        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];

        uint256 before = pool.lpToken.balanceOf(address(this));
        pool.lpToken.safeTransferFrom(msg.sender, address(this), _amount);
        _amount = pool.lpToken.balanceOf(address(this)) - before;

        uint64 nonce = IMessage(CROSS_FARMING_SENDER).nonces(msg.sender, pool.mcv2PoolId);
        // encode message
        bytes memory message = encodeMessage(
            msg.sender,
            pool.mcv2PoolId,
            _amount,
            DataTypes.MessageTypes.Deposit,
            nonce
        );

        // send message
        (bool success, ) = CROSS_FARMING_SENDER.call{value: msg.value}(
            abi.encodeWithSignature("sendFarmMessage(bytes)", message)
        );

        require(success, "send deposit farm message failed");

        // update poolInfo
        pool.totalAmount = pool.totalAmount + _amount;
        // update userInfo
        user.amount = user.amount + _amount;
        user.lastActionTime = block.timestamp;
        // save deposit record
        deposits[msg.sender][_pid][nonce] = _amount;

        // deposit don't need to mark nonce used

        emit Deposit(msg.sender, _pid, _amount, nonce);
    }

    /**
     * @notice withdraw funds from vault.
     * @dev just send 'withdraw' message to MasterchefV2 pool on BSC chain. don't transfer LP token to user,
     * after withdraw on Masterchef pool success and send ack message back, 'ackWithdraw' will finally transfer token back.
     * @notice only possible when contract not paused.
     * @param _pid lp token pool id in vault contract.
     * @param _amount withdraw token amount.
     */
    function withdraw(uint256 _pid, uint256 _amount) external payable nonReentrant notContract whenNotPaused {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];

        require(user.amount >= _amount && _amount > 0, "withdraw: Insufficient amount");

        // encode farming message
        uint64 nonce = IMessage(CROSS_FARMING_SENDER).nonces(msg.sender, pool.mcv2PoolId);

        bytes memory message = encodeMessage(
            msg.sender,
            pool.mcv2PoolId,
            _amount,
            DataTypes.MessageTypes.Withdraw,
            nonce
        );

        // send message
        (bool success, ) = CROSS_FARMING_SENDER.call{value: msg.value}(
            abi.encodeWithSignature("sendFarmMessage(bytes)", message)
        );

        require(success, "send withdraw farm message failed");

        // don't do any state change, will do it at ackWithdraw

        emit Withdraw(msg.sender, _pid, _amount, nonce);
    }

    /**
     * @notice withdraw funds from vault.
     * @dev just send 'emergencyWithdraw' message to MasterchefV2 pool on BSC chain. don't transfer LP token to user,
     * after emergencyWithdraw on Masterchef pool success and send ack message back, 'ackEmergencyWithdraw' will finally transfer token back.
     * @notice only be called when contract not paused, emergencyWithdraw only mean withdraw from Masterchef don't care about CAKE reward.
     * @param _pid lp token pool id in vault contract.
     */
    function emergencyWithdraw(uint256 _pid) external payable nonReentrant notContract whenNotPaused {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];

        uint256 amount = user.amount;
        require(amount > 0, "No fund left");

        // encode farming message
        uint64 nonce = IMessage(CROSS_FARMING_SENDER).nonces(msg.sender, pool.mcv2PoolId);

        bytes memory message = encodeMessage(
            msg.sender,
            pool.mcv2PoolId,
            amount,
            DataTypes.MessageTypes.EmergencyWithdraw,
            nonce
        );

        // send farming message
        (bool success, ) = CROSS_FARMING_SENDER.call{value: msg.value}(
            abi.encodeWithSignature("sendFarmMessage(bytes)", message)
        );

        require(success, "send emergencyWithdraw farm message failed");

        // don't do any state change, will do it at ackEmergencyWithdraw

        emit EmergencyWithdraw(msg.sender, _pid, amount, nonce);
    }

    /**
     * @notice only called by cross-chain sender contract. withdraw token in specific pool.
     * @param _user user address.
     * @param _mcv2pid lp token pool id in mcv2 farm pool.
     * @param _amount withdraw token amount.
     * @param _nonce withdraw tx nonce from BSC chain.
     */
    function ackWithdraw(
        address _user,
        uint256 _mcv2pid,
        uint256 _amount,
        uint64 _nonce
    ) external nonReentrant onlySender {
        uint256 pid = poolMapping[_mcv2pid];
        require(!usedNonce[_user][pid][_nonce], "used nonce");

        PoolInfo storage pool = poolInfo[pid];
        UserInfo storage user = userInfo[pid][_user];

        // check by ack amount
        require(user.amount >= _amount && _amount > 0, "ackWithdraw: Insufficient amount");

        // update poolInfo
        pool.totalAmount = pool.totalAmount - _amount;
        // update userInfo
        user.amount -= _amount;
        user.lastActionTime = block.timestamp;

        // mark nonce used
        usedNonce[_user][pid][_nonce] = true;

        // transfer LP token
        IERC20(pool.lpToken).safeTransfer(_user, _amount);

        emit AckWithdraw(_user, pid, _amount, _nonce);
    }

    /**
     * @notice only called by cross-chain sender contract. withdraw all staked token in specific pool.
     * @param _user user address.
     * @param _mcv2pid lp token pool id in mcv2 farm pool.
     * @param _nonce withdraw tx nonce from BSC chain.
     */
    function ackEmergencyWithdraw(
        address _user,
        uint256 _mcv2pid,
        uint64 _nonce
    ) external nonReentrant onlySender {
        uint256 pid = poolMapping[_mcv2pid];
        require(!usedNonce[_user][pid][_nonce], "used nonce");

        PoolInfo storage pool = poolInfo[pid];
        UserInfo storage user = userInfo[pid][_user];

        uint256 withdrawAmount = user.amount;

        // totalAmount > withdrawAmount
        pool.totalAmount -= withdrawAmount;
        // update userInfo
        user.amount = 0;
        user.lastActionTime = block.timestamp;
        // mark nonce used
        usedNonce[_user][pid][_nonce] = true;

        // transfer token
        IERC20(pool.lpToken).safeTransfer(_user, withdrawAmount);

        emit AckEmergencyWithdraw(_user, pid, withdrawAmount, _nonce);
    }

    /**
     * @dev called by operator when user deposit success on source chain(EVM chain) but failed on dest chain(BSC chain).
     * please make sure 'fallbackDeposit' called on BSC chain first.
     * @param _user user address.
     * @param _pid pool id in current vault, not mcv2 pid.
     * @param _amount fallbackDeposit withdraw token amount.
     * @param _nonce failed nonce.
     */
    function fallbackDeposit(
        address _user,
        uint256 _pid,
        uint256 _amount,
        uint64 _nonce
    ) external onlyOperator onlyNotUsedNonce(_user, _pid, _nonce) {
        // double check
        require(deposits[_user][_pid][_nonce] == _amount, "withdraw amount not match staking record");

        _fallback(_user, _pid, _amount, _nonce);

        emit FallbackDeposit(_user, _pid, _amount, _nonce);
    }

    /**
     * @notice only called by operator when below scenarios happened:
     * case 1: if withdraw/emergencywithdraw success on source chain(EVM) and withdraw on proxy contract success
     * on EVM chain, but failed to send Ack msg back to EVM chain, only call this function.
     *
     * case 2: if withdraw/emergencywithdraw success on source chain(EVM), but failed to withdraw on proxy contract(maybe msg
     * failed to deliver to BSC chain or other issues), please make sure call 'fallbackWithdraw' on receiver contract on BSC chain first,
     * then call this function
     *
     * @param _user user address.
     * @param _pid pool id in current vault, not mcv2 pool id.
     * @param _amount fallbackwithdraw token amount.
     * @param _nonce failed nonce.
     */
    function fallbackWithdraw(
        address _user,
        uint256 _pid,
        uint256 _amount,
        uint64 _nonce
    ) external onlyOperator onlyNotUsedNonce(_user, _pid, _nonce) {
        _fallback(_user, _pid, _amount, _nonce);

        emit FallbackWithdraw(_user, _pid, _amount, _nonce);
    }

    function _fallback(
        address _user,
        uint256 _pid,
        uint256 _amount,
        uint64 _nonce
    ) internal {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_user];
        // check fallback amount
        require(user.amount >= _amount && _amount > 0, "fallback: Insufficient amount");

        // update poolInfo
        pool.totalAmount = pool.totalAmount - _amount;
        // update userInfo
        user.amount -= _amount;
        user.lastActionTime = block.timestamp;

        // mark nonce used
        usedNonce[_user][_pid][_nonce] = true;

        // transfer LP token back
        IERC20(pool.lpToken).safeTransfer(_user, _amount);
    }

    // set fallbackwithdraw operator
    function setOperator(address _operator) external onlyOwner {
        require(_operator != address(0), "Operator can't be zero address");
        address temp = operator;
        operator = _operator;

        emit OperatorUpdated(operator, temp);
    }

    function poolLength() external view returns (uint256) {
        return poolInfo.length;
    }

    /**
     * @notice utility interface for FE to calc routing message fee charged by celer.
     * @param _message encoded cross-farm  message
     */
    function calcFee(bytes calldata _message) external view returns (uint256) {
        return IMessageBus(messageBus).calcFee(_message);
    }

    /**
     * @notice utility interface for FE to encode cross-farming message.
     * @param _account cross-farm user account.
     * @param _pid MasterchefV2 farm pool id.
     * @param _amount the input token amount.
     * @param _msgType farm message type.
     * @param _nonce user nonce.
     */
    function encodeMessage(
        address _account,
        uint256 _pid,
        uint256 _amount,
        DataTypes.MessageTypes _msgType,
        uint64 _nonce
    ) public view returns (bytes memory) {
        return
            abi.encode(
                DataTypes.CrossFarmRequest({
                    receiver: CROSS_FARMING_RECEIVER,
                    dstChainId: BSC_CHAIN_ID,
                    nonce: _nonce,
                    account: _account,
                    amount: _amount,
                    pid: _pid,
                    msgType: _msgType
                })
            );
    }

    /**
     * @notice Triggers stopped state
     * @dev Only possible when contract not paused.
     */
    function pause() external onlyOwner {
        _pause();
        emit Pause();
    }

    /**
     * @notice Returns to normal state
     * @dev Only possible when contract is paused.
     */
    function unpause() external onlyOwner {
        _unpause();
        emit Unpause();
    }

    function _isContract(address addr) internal view returns (bool) {
        uint256 size;
        assembly {
            size := extcodesize(addr)
        }
        return size > 0;
    }
}

File 2 of 13 : IMessage.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

interface IMessage {
    function nonces(address account, uint256 pid) external returns (uint64);

    function messageBus() external returns (address);
}

File 3 of 13 : DataTypes.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

library DataTypes {
    enum MessageTypes {
        Deposit,
        Withdraw,
        EmergencyWithdraw
    }

    struct CrossFarmRequest {
        address receiver;
        uint64 dstChainId;
        uint64 nonce;
        address account;
        uint256 pid;
        uint256 amount;
        MessageTypes msgType;
    }
}

File 4 of 13 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^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() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        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 {
        _transferOwnership(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");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 5 of 13 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 6 of 13 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 7 of 13 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^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() {
        _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 making 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;
    }
}

File 8 of 13 : IMessageBus.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.0;

import "../libraries/MsgDataTypes.sol";

interface IMessageBus {
    function liquidityBridge() external view returns (address);

    function pegBridge() external view returns (address);

    function pegBridgeV2() external view returns (address);

    function pegVault() external view returns (address);

    function pegVaultV2() external view returns (address);

    /**
     * @notice Calculates the required fee for the message.
     * @param _message Arbitrary message bytes to be decoded by the destination app contract.
     @ @return The required fee.
     */
    function calcFee(bytes calldata _message) external view returns (uint256);

    /**
     * @notice Sends a message to an app on another chain via MessageBus without an associated transfer.
     * A fee is charged in the native gas token.
     * @param _receiver The address of the destination app contract.
     * @param _dstChainId The destination chain ID.
     * @param _message Arbitrary message bytes to be decoded by the destination app contract.
     */
    function sendMessage(
        address _receiver,
        uint256 _dstChainId,
        bytes calldata _message
    ) external payable;

    /**
     * @notice Sends a message associated with a transfer to an app on another chain via MessageBus without an associated transfer.
     * A fee is charged in the native token.
     * @param _receiver The address of the destination app contract.
     * @param _dstChainId The destination chain ID.
     * @param _srcBridge The bridge contract to send the transfer with.
     * @param _srcTransferId The transfer ID.
     * @param _dstChainId The destination chain ID.
     * @param _message Arbitrary message bytes to be decoded by the destination app contract.
     */
    function sendMessageWithTransfer(
        address _receiver,
        uint256 _dstChainId,
        address _srcBridge,
        bytes32 _srcTransferId,
        bytes calldata _message
    ) external payable;

    /**
     * @notice Withdraws message fee in the form of native gas token.
     * @param _account The address receiving the fee.
     * @param _cumulativeFee The cumulative fee credited to the account. Tracked by SGN.
     * @param _sigs The list of signatures sorted by signing addresses in ascending order. A withdrawal must be
     * signed-off by +2/3 of the sigsVerifier's current signing power to be delivered.
     * @param _signers The sorted list of signers.
     * @param _powers The signing powers of the signers.
     */
    function withdrawFee(
        address _account,
        uint256 _cumulativeFee,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external;

    /**
     * @notice Execute a message with a successful transfer.
     * @param _message Arbitrary message bytes originated from and encoded by the source app contract
     * @param _transfer The transfer info.
     * @param _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by
     * +2/3 of the sigsVerifier's current signing power to be delivered.
     * @param _signers The sorted list of signers.
     * @param _powers The signing powers of the signers.
     */
    function executeMessageWithTransfer(
        bytes calldata _message,
        MsgDataTypes.TransferInfo calldata _transfer,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external payable;

    /**
     * @notice Execute a message with a refunded transfer.
     * @param _message Arbitrary message bytes originated from and encoded by the source app contract
     * @param _transfer The transfer info.
     * @param _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by
     * +2/3 of the sigsVerifier's current signing power to be delivered.
     * @param _signers The sorted list of signers.
     * @param _powers The signing powers of the signers.
     */
    function executeMessageWithTransferRefund(
        bytes calldata _message, // the same message associated with the original transfer
        MsgDataTypes.TransferInfo calldata _transfer,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external payable;

    /**
     * @notice Execute a message not associated with a transfer.
     * @param _message Arbitrary message bytes originated from and encoded by the source app contract
     * @param _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by
     * +2/3 of the sigsVerifier's current signing power to be delivered.
     * @param _signers The sorted list of signers.
     * @param _powers The signing powers of the signers.
     */
    function executeMessage(
        bytes calldata _message,
        MsgDataTypes.RouteInfo calldata _route,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external payable;
}

File 9 of 13 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.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 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'
        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) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 10 of 13 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^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 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) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 11 of 13 : MsgDataTypes.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.9;

library MsgDataTypes {
    // bridge operation type at the sender side (src chain)
    enum BridgeSendType {
        Null,
        Liquidity,
        PegDeposit,
        PegBurn,
        PegV2Deposit,
        PegV2Burn,
        PegV2BurnFrom
    }

    // bridge operation type at the receiver side (dst chain)
    enum TransferType {
        Null,
        LqRelay, // relay through liquidity bridge
        LqWithdraw, // withdraw from liquidity bridge
        PegMint, // mint through pegged token bridge
        PegWithdraw, // withdraw from original token vault
        PegV2Mint, // mint through pegged token bridge v2
        PegV2Withdraw // withdraw from original token vault v2
    }

    enum MsgType {
        MessageWithTransfer,
        MessageOnly
    }

    enum TxStatus {
        Null,
        Success,
        Fail,
        Fallback,
        Pending // transient state within a transaction
    }

    struct TransferInfo {
        TransferType t;
        address sender;
        address receiver;
        address token;
        uint256 amount;
        uint64 wdseq; // only needed for LqWithdraw (refund)
        uint64 srcChainId;
        bytes32 refId;
        bytes32 srcTxHash; // src chain msg tx hash
    }

    struct RouteInfo {
        address sender;
        address receiver;
        uint64 srcChainId;
        bytes32 srcTxHash; // src chain msg tx hash
    }

    struct MsgWithTransferExecutionParams {
        bytes message;
        TransferInfo transfer;
        bytes[] sigs;
        address[] signers;
        uint256[] powers;
    }

    struct BridgeTransferParams {
        bytes request;
        bytes[] sigs;
        address[] signers;
        uint256[] powers;
    }
}

File 12 of 13 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 13 of 13 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 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");

        (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");

        (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");

        (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");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal 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
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 99999
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"address","name":"_sender","type":"address"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint64","name":"_chainId","type":"uint64"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"nonce","type":"uint64"}],"name":"AckEmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"nonce","type":"uint64"}],"name":"AckWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lpToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"mockPoolId","type":"uint256"}],"name":"AddedPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"pid","type":"uint256"}],"name":"AddedWhiteListPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"nonce","type":"uint64"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"nonce","type":"uint64"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"nonce","type":"uint64"}],"name":"FallbackDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"nonce","type":"uint64"}],"name":"FallbackWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newOperator","type":"address"},{"indexed":true,"internalType":"address","name":"oldOperator","type":"address"}],"name":"OperatorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"nonce","type":"uint64"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"BSC_CHAIN_ID","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CROSS_FARMING_RECEIVER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CROSS_FARMING_SENDER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_mcv2pid","type":"uint256"},{"internalType":"uint64","name":"_nonce","type":"uint64"}],"name":"ackEmergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_mcv2pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint64","name":"_nonce","type":"uint64"}],"name":"ackWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_lpToken","type":"address"},{"internalType":"uint256","name":"_mcv2PoolId","type":"uint256"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mcv2Pid","type":"uint256"}],"name":"addWhiteListPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_message","type":"bytes"}],"name":"calcFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint64","name":"","type":"uint64"}],"name":"deposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"enum DataTypes.MessageTypes","name":"_msgType","type":"uint8"},{"internalType":"uint64","name":"_nonce","type":"uint64"}],"name":"encodeMessage","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint64","name":"_nonce","type":"uint64"}],"name":"fallbackDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint64","name":"_nonce","type":"uint64"}],"name":"fallbackWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"messageBus","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"mcv2PoolId","type":"uint256"},{"internalType":"uint256","name":"totalAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolMapping","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint64","name":"","type":"uint64"}],"name":"usedNonce","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"lastActionTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"whitelistPool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"}]

Deployed Bytecode

0x6080604052600436106101d85760003560e01c8063715018a611610102578063b3ab15fb11610095578063f2fde38b11610064578063f2fde38b14610671578063f5d82b6b14610691578063f6a3d24e146106b1578063fc4e4741146106e157600080fd5b8063b3ab15fb146105e1578063deef77f614610601578063e270ff0914610631578063e2bbb1581461065e57600080fd5b80639ead7d55116100d15780639ead7d551461051a578063a1a227fa14610547578063a80ad65114610574578063aaa22c7f146105c157600080fd5b8063715018a6146104715780638456cb59146104865780638da5cb5b1461049b57806393f1a40b146104c657600080fd5b8063441a3e701161017a578063570ca73511610149578063570ca735146103a75780635c975abb146103d45780635ee85bca146104105780636bcbad1d1461043057600080fd5b8063441a3e701461032357806346ef383b146103365780635312ea8e146103745780635335dca21461038757600080fd5b80632107b18e116101b65780632107b18e146102ac57806324266a7e146102ce5780633f4ba83a146102ee5780633fa225981461030357600080fd5b8063081e3eda146101dd57806310655ad1146102015780631526fe271461025a575b600080fd5b3480156101e957600080fd5b506002545b6040519081526020015b60405180910390f35b34801561020d57600080fd5b506102357f0000000000000000000000000726a8c8206b9ec0afb788df5adb36a8aedb13c281565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101f8565b34801561026657600080fd5b5061027a61027536600461340b565b610715565b6040805173ffffffffffffffffffffffffffffffffffffffff90941684526020840192909252908201526060016101f8565b3480156102b857600080fd5b506102cc6102c736600461345c565b61075f565b005b3480156102da57600080fd5b506102cc6102e936600461345c565b6109e4565b3480156102fa57600080fd5b506102cc610b86565b34801561030f57600080fd5b506102cc61031e36600461340b565b610bc1565b6102cc6103313660046134a6565b610cb6565b34801561034257600080fd5b506101ee6103513660046134c8565b600660209081526000938452604080852082529284528284209052825290205481565b6102cc61038236600461340b565b611199565b34801561039357600080fd5b506101ee6103a236600461350a565b61165d565b3480156103b357600080fd5b506004546102359073ffffffffffffffffffffffffffffffffffffffff1681565b3480156103e057600080fd5b5060005474010000000000000000000000000000000000000000900460ff165b60405190151581526020016101f8565b34801561041c57600080fd5b506102cc61042b3660046134c8565b61170d565b34801561043c57600080fd5b5061040061044b3660046134c8565b600a60209081526000938452604080852082529284528284209052825290205460ff1681565b34801561047d57600080fd5b506102cc611a32565b34801561049257600080fd5b506102cc611a46565b3480156104a757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610235565b3480156104d257600080fd5b506105056104e136600461357c565b60096020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152016101f8565b34801561052657600080fd5b506101ee61053536600461340b565b60076020526000908152604090205481565b34801561055357600080fd5b506003546102359073ffffffffffffffffffffffffffffffffffffffff1681565b34801561058057600080fd5b506105a87f000000000000000000000000000000000000000000000000000000000000003881565b60405167ffffffffffffffff90911681526020016101f8565b3480156105cd57600080fd5b506102cc6105dc36600461345c565b611a81565b3480156105ed57600080fd5b506102cc6105fc3660046135ac565b611e29565b34801561060d57600080fd5b5061040061061c36600461340b565b60086020526000908152604090205460ff1681565b34801561063d57600080fd5b5061065161064c3660046135c9565b611f24565b6040516101f891906136a2565b6102cc61066c3660046134a6565b612013565b34801561067d57600080fd5b506102cc61068c3660046135ac565b612685565b34801561069d57600080fd5b506102cc6106ac3660046136b5565b61273c565b3480156106bd57600080fd5b506104006106cc3660046135ac565b60056020526000908152604090205460ff1681565b3480156106ed57600080fd5b506102357f0000000000000000000000008ea90ef07f37c77137453c7a1b72b7886d51ecfb81565b6002818154811061072557600080fd5b600091825260209091206003909102018054600182015460029092015473ffffffffffffffffffffffffffffffffffffffff909116925083565b60045473ffffffffffffffffffffffffffffffffffffffff1633146107e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f6e6f742066616c6c6261636b206f70657261746f72000000000000000000000060448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff84166000908152600a60209081526040808320868452825280832067ffffffffffffffff8516845290915290205484908490839060ff1615610898576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f75736564206e6f6e63650000000000000000000000000000000000000000000060448201526064016107dc565b73ffffffffffffffffffffffffffffffffffffffff87166000908152600660209081526040808320898452825280832067ffffffffffffffff881684529091529020548514610969576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f776974686472617720616d6f756e74206e6f74206d61746368207374616b696e60448201527f67207265636f726400000000000000000000000000000000000000000000000060648201526084016107dc565b61097587878787612b52565b604080518781526020810187905267ffffffffffffffff86169181019190915273ffffffffffffffffffffffffffffffffffffffff8816907f052e25d7fc6f3ab893c8c11c51a9d3b7145c3a630553fab7d62fbb2f4a04d080906060015b60405180910390a250505050505050565b60045473ffffffffffffffffffffffffffffffffffffffff163314610a65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f6e6f742066616c6c6261636b206f70657261746f72000000000000000000000060448201526064016107dc565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600a60209081526040808320868452825280832067ffffffffffffffff8516845290915290205484908490839060ff1615610b18576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f75736564206e6f6e63650000000000000000000000000000000000000000000060448201526064016107dc565b610b2487878787612b52565b604080518781526020810187905267ffffffffffffffff86169181019190915273ffffffffffffffffffffffffffffffffffffffff8816907f1ac1bf728d90d1ee5e3a0628d20db1a671a832fc578933dc8a366f14ac3eecd2906060016109d3565b610b8e612cd7565b610b96612d58565b6040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b610bc9612cd7565b60008181526008602052604090205460ff1615610c42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4164646564206d63763220706f6f6c206964000000000000000000000000000060448201526064016107dc565b6000818152600860205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055517f959087d542b50924af329bcfc4fa4ad292cbd16c16df03f3f6f30d14fdf98fe890610cab9083815260200190565b60405180910390a150565b60026001541415610d23576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107dc565b6002600155333b15610d91576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f636f6e7472616374206e6f7420616c6c6f77656400000000000000000000000060448201526064016107dc565b333214610dfa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f70726f787920636f6e7472616374206e6f7420616c6c6f77656400000000000060448201526064016107dc565b610e02612dd5565b600060028381548110610e1757610e176136e1565b6000918252602080832086845260098252604080852033865290925292208054600390920290920192508311801590610e505750600083115b610eb6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f77697468647261773a20496e73756666696369656e7420616d6f756e7400000060448201526064016107dc565b60018201546040517f502e1a1600000000000000000000000000000000000000000000000000000000815233600482015260248101919091526000907f0000000000000000000000008ea90ef07f37c77137453c7a1b72b7886d51ecfb73ffffffffffffffffffffffffffffffffffffffff169063502e1a1690604401602060405180830381600087803b158015610f4d57600080fd5b505af1158015610f61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f859190613710565b90506000610f9b33856001015487600186611f24565b905060007f0000000000000000000000008ea90ef07f37c77137453c7a1b72b7886d51ecfb73ffffffffffffffffffffffffffffffffffffffff163483604051602401610fe891906136a2565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1f967cb30000000000000000000000000000000000000000000000000000000017905251611069919061372d565b60006040518083038185875af1925050503d80600081146110a6576040519150601f19603f3d011682016040523d82523d6000602084013e6110ab565b606091505b505090508061113c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f73656e64207769746864726177206661726d206d657373616765206661696c6560448201527f640000000000000000000000000000000000000000000000000000000000000060648201526084016107dc565b604080518881526020810188905267ffffffffffffffff85169181019190915233907f0ced270061c38236c1c9e44608fcbc4252c8b32ce8e042047655f6866e63656f906060015b60405180910390a25050600180555050505050565b60026001541415611206576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107dc565b6002600155333b15611274576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f636f6e7472616374206e6f7420616c6c6f77656400000000000000000000000060448201526064016107dc565b3332146112dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f70726f787920636f6e7472616374206e6f7420616c6c6f77656400000000000060448201526064016107dc565b6112e5612dd5565b6000600282815481106112fa576112fa6136e1565b6000918252602080832085845260098252604080852033865290925292208054600390920290920192508061138b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f4e6f2066756e64206c656674000000000000000000000000000000000000000060448201526064016107dc565b60018301546040517f502e1a1600000000000000000000000000000000000000000000000000000000815233600482015260248101919091526000907f0000000000000000000000008ea90ef07f37c77137453c7a1b72b7886d51ecfb73ffffffffffffffffffffffffffffffffffffffff169063502e1a1690604401602060405180830381600087803b15801561142257600080fd5b505af1158015611436573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145a9190613710565b9050600061147033866001015485600286611f24565b905060007f0000000000000000000000008ea90ef07f37c77137453c7a1b72b7886d51ecfb73ffffffffffffffffffffffffffffffffffffffff1634836040516024016114bd91906136a2565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1f967cb3000000000000000000000000000000000000000000000000000000001790525161153e919061372d565b60006040518083038185875af1925050503d806000811461157b576040519150601f19603f3d011682016040523d82523d6000602084013e611580565b606091505b5050905080611611576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f73656e6420656d657267656e63795769746864726177206661726d206d65737360448201527f616765206661696c65640000000000000000000000000000000000000000000060648201526084016107dc565b604080518881526020810186905267ffffffffffffffff85169181019190915233907fda14fb873e870bfaf6bba2081beaf39ffa2f16fe8113efe09a5262528e3ac9ba90606001611184565b6003546040517f5335dca200000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff1690635335dca2906116b69086908690600401613749565b60206040518083038186803b1580156116ce57600080fd5b505afa1580156116e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117069190613796565b9392505050565b6002600154141561177a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107dc565b60026001553373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000008ea90ef07f37c77137453c7a1b72b7886d51ecfb161461181e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f6e6f742063726f7373206661726d696e672073656e646572000000000000000060448201526064016107dc565b60008281526007602090815260408083205473ffffffffffffffffffffffffffffffffffffffff87168452600a8352818420818552835281842067ffffffffffffffff861685529092529091205460ff16156118d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f75736564206e6f6e63650000000000000000000000000000000000000000000060448201526064016107dc565b6000600282815481106118eb576118eb6136e1565b6000918252602080832085845260098252604080852073ffffffffffffffffffffffffffffffffffffffff8b168652909252908320805460039390930290910160028101805491955091938392916119449084906137de565b909155505060008083554260018085019190915573ffffffffffffffffffffffffffffffffffffffff808a168352600a60209081526040808520898652825280852067ffffffffffffffff8b16865290915290922080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909117905583546119d091168883612e5a565b604080518581526020810183905267ffffffffffffffff87169181019190915273ffffffffffffffffffffffffffffffffffffffff8816907f0a4a1376f31b2f708dc10bf78f8e5a24fad6d0e7903b1053294c448e2fbf6d9890606001611184565b611a3a612cd7565b611a446000612f33565b565b611a4e612cd7565b611a56612fa8565b6040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b60026001541415611aee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107dc565b60026001553373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000008ea90ef07f37c77137453c7a1b72b7886d51ecfb1614611b92576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f6e6f742063726f7373206661726d696e672073656e646572000000000000000060448201526064016107dc565b60008381526007602090815260408083205473ffffffffffffffffffffffffffffffffffffffff88168452600a8352818420818552835281842067ffffffffffffffff861685529092529091205460ff1615611c4a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f75736564206e6f6e63650000000000000000000000000000000000000000000060448201526064016107dc565b600060028281548110611c5f57611c5f6136e1565b6000918252602080832085845260098252604080852073ffffffffffffffffffffffffffffffffffffffff8c16865290925292208054600390920290920192508511801590611cae5750600085115b611d14576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f61636b57697468647261773a20496e73756666696369656e7420616d6f756e7460448201526064016107dc565b848260020154611d2491906137de565b6002830155805485908290600090611d3d9084906137de565b90915550504260018083019190915573ffffffffffffffffffffffffffffffffffffffff8089166000908152600a60209081526040808320888452825280832067ffffffffffffffff8a168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169092179091558254611dc791168887612e5a565b604080518481526020810187905267ffffffffffffffff86169181019190915273ffffffffffffffffffffffffffffffffffffffff8816907f3ae48f036e4c2970217eb01910b43dc7c24f723ccdb6c60a98f7821822238cfc90606001611184565b611e31612cd7565b73ffffffffffffffffffffffffffffffffffffffff8116611eae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4f70657261746f722063616e2774206265207a65726f2061646472657373000060448201526064016107dc565b6004805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff00000000000000000000000000000000000000008316811790935560405191169182917ffbe5b6cbafb274f445d7fed869dc77a838d8243a22c460de156560e8857cad0390600090a35050565b60606040518060e001604052807f0000000000000000000000000726a8c8206b9ec0afb788df5adb36a8aedb13c273ffffffffffffffffffffffffffffffffffffffff1681526020017f000000000000000000000000000000000000000000000000000000000000003867ffffffffffffffff1681526020018367ffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff168152602001868152602001858152602001846002811115611fe757611fe76137f5565b9052604051611ff99190602001613824565b604051602081830303815290604052905095945050505050565b60026001541415612080576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107dc565b600260015561208d612dd5565b333b156120f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f636f6e7472616374206e6f7420616c6c6f77656400000000000000000000000060448201526064016107dc565b33321461215f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f70726f787920636f6e7472616374206e6f7420616c6c6f77656400000000000060448201526064016107dc565b600081116121c9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4e6f7468696e6720746f206465706f736974000000000000000000000000000060448201526064016107dc565b6000600283815481106121de576121de6136e1565b6000918252602080832086845260098252604080852033865290925281842060039390930201805491517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290945091929173ffffffffffffffffffffffffffffffffffffffff909116906370a082319060240160206040518083038186803b15801561227157600080fd5b505afa158015612285573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a99190613796565b83549091506122d09073ffffffffffffffffffffffffffffffffffffffff16333087613017565b82546040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561233857600080fd5b505afa15801561234c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123709190613796565b61237a91906137de565b60018401546040517f502e1a1600000000000000000000000000000000000000000000000000000000815233600482015260248101919091529094506000907f0000000000000000000000008ea90ef07f37c77137453c7a1b72b7886d51ecfb73ffffffffffffffffffffffffffffffffffffffff169063502e1a1690604401602060405180830381600087803b15801561241457600080fd5b505af1158015612428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244c9190613710565b9050600061246233866001015488600086611f24565b905060007f0000000000000000000000008ea90ef07f37c77137453c7a1b72b7886d51ecfb73ffffffffffffffffffffffffffffffffffffffff1634836040516024016124af91906136a2565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1f967cb30000000000000000000000000000000000000000000000000000000017905251612530919061372d565b60006040518083038185875af1925050503d806000811461256d576040519150601f19603f3d011682016040523d82523d6000602084013e612572565b606091505b50509050806125dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f73656e64206465706f736974206661726d206d657373616765206661696c656460448201526064016107dc565b8686600201546125ed91906138d5565b600287015584546125ff9088906138d5565b85554260018601553360008181526006602090815260408083208c8452825280832067ffffffffffffffff8816808552908352928190208b905580518c81529182018b90528101919091527fc76a5a51963804987703b97e8cb1963657727df31c42b9062b0e9967f45dbce39060600160405180910390a2505060018055505050505050565b61268d612cd7565b73ffffffffffffffffffffffffffffffffffffffff8116612730576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107dc565b61273981612f33565b50565b612744612cd7565b73ffffffffffffffffffffffffffffffffffffffff821660009081526005602052604090205460ff16156127d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f4578697374656420746f6b656e0000000000000000000000000000000000000060448201526064016107dc565b60008181526008602052604090205460ff1661284c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4e6f742077686974656c69737420706f6f6c000000000000000000000000000060448201526064016107dc565b600081815260076020526040902054156128c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4d43563220706f6f6c20616c7265616479206d6174636865640000000000000060448201526064016107dc565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8416906370a082319060240160206040518083038186803b15801561292a57600080fd5b505afa15801561293e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129629190613796565b10156129ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f4e6f7420455243323020746f6b656e000000000000000000000000000000000060448201526064016107dc565b6040805160608101825273ffffffffffffffffffffffffffffffffffffffff84811680835260208084018681526000858701818152600280546001808201835582855298517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace600390920291820180547fffffffffffffffffffffffff000000000000000000000000000000000000000016919099161790975592517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf870155517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad0909501949094559183526005905292902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016821790559054612af191906137de565b600082815260076020908152604091829020929092555182815273ffffffffffffffffffffffffffffffffffffffff8416917fc04f9b7ebfbd70ae3b961be0f6c72729428030bed6b0d44d5b65e63d74764149910160405180910390a25050565b600060028481548110612b6757612b676136e1565b6000918252602080832087845260098252604080852073ffffffffffffffffffffffffffffffffffffffff8b16865290925292208054600390920290920192508411801590612bb65750600084115b612c1c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f66616c6c6261636b3a20496e73756666696369656e7420616d6f756e7400000060448201526064016107dc565b838260020154612c2c91906137de565b6002830155805484908290600090612c459084906137de565b90915550504260018083019190915573ffffffffffffffffffffffffffffffffffffffff8088166000908152600a602090815260408083208a8452825280832067ffffffffffffffff89168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169092179091558254612ccf91168786612e5a565b505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611a44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107dc565b612d6061307b565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b60005474010000000000000000000000000000000000000000900460ff1615611a44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016107dc565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052612f2e9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526130ff565b505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b612fb0612dd5565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612dab3390565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526130759085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401612eac565b50505050565b60005474010000000000000000000000000000000000000000900460ff16611a44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016107dc565b6000613161826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661320b9092919063ffffffff16565b805190915015612f2e578080602001905181019061317f91906138ed565b612f2e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107dc565b606061321a8484600085613222565b949350505050565b6060824710156132b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107dc565b73ffffffffffffffffffffffffffffffffffffffff85163b613332576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107dc565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161335b919061372d565b60006040518083038185875af1925050503d8060008114613398576040519150601f19603f3d011682016040523d82523d6000602084013e61339d565b606091505b50915091506133ad8282866133b8565b979650505050505050565b606083156133c7575081611706565b8251156133d75782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107dc91906136a2565b60006020828403121561341d57600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461273957600080fd5b67ffffffffffffffff8116811461273957600080fd5b6000806000806080858703121561347257600080fd5b843561347d81613424565b93506020850135925060408501359150606085013561349b81613446565b939692955090935050565b600080604083850312156134b957600080fd5b50508035926020909101359150565b6000806000606084860312156134dd57600080fd5b83356134e881613424565b92506020840135915060408401356134ff81613446565b809150509250925092565b6000806020838503121561351d57600080fd5b823567ffffffffffffffff8082111561353557600080fd5b818501915085601f83011261354957600080fd5b81358181111561355857600080fd5b86602082850101111561356a57600080fd5b60209290920196919550909350505050565b6000806040838503121561358f57600080fd5b8235915060208301356135a181613424565b809150509250929050565b6000602082840312156135be57600080fd5b813561170681613424565b600080600080600060a086880312156135e157600080fd5b85356135ec81613424565b9450602086013593506040860135925060608601356003811061360e57600080fd5b9150608086013561361e81613446565b809150509295509295909350565b60005b8381101561364757818101518382015260200161362f565b838111156130755750506000910152565b6000815180845261367081602086016020860161362c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006117066020830184613658565b600080604083850312156136c857600080fd5b82356136d381613424565b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561372257600080fd5b815161170681613446565b6000825161373f81846020870161362c565b9190910192915050565b60208152816020820152818360408301376000818301604090810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160101919050565b6000602082840312156137a857600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000828210156137f0576137f06137af565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600060e08201905073ffffffffffffffffffffffffffffffffffffffff808451168352602084015167ffffffffffffffff80821660208601528060408701511660408601525050806060850151166060840152506080830151608083015260a083015160a083015260c0830151600381106138c8577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8060c08401525092915050565b600082198211156138e8576138e86137af565b500190565b6000602082840312156138ff57600080fd5b8151801515811461170657600080fdfea2646970667358221220331829150b37ca102ecf6e1f8236a079ba98517bb98d99629f557a088230b61f64736f6c63430008090033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ 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.