ETH Price: $3,252.40 (+1.65%)
 

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

Transaction Hash
Method
Block
From
To
Forward Eth1449636012025-12-12 7:52:592 hrs ago1765525979IN
0x87a26566...989E3F56E
0.0191 ETH0.0000000196180.00013926
Forward Eth1449635612025-12-12 7:51:392 hrs ago1765525899IN
0x87a26566...989E3F56E
0.019 ETH0.0000000240.00017716
Forward Eth1449579472025-12-12 4:44:315 hrs ago1765514671IN
0x87a26566...989E3F56E
0.012 ETH0.0000000127290.00007785
Forward ERC201449567982025-12-12 4:06:135 hrs ago1765512373IN
0x87a26566...989E3F56E
0 ETH0.0000001201290.00010035
Forward Eth1449567112025-12-12 4:03:195 hrs ago1765512199IN
0x87a26566...989E3F56E
0.00122 ETH0.0000000150170.00010035
Forward ERC201449561662025-12-12 3:45:096 hrs ago1765511109IN
0x87a26566...989E3F56E
0 ETH0.0000000228410.00010037
Forward Eth1449473762025-12-11 22:52:0911 hrs ago1765493529IN
0x87a26566...989E3F56E
0.002689888380468 ETH0.0000000509190.00010043
Forward ERC201449449682025-12-11 21:31:5312 hrs ago1765488713IN
0x87a26566...989E3F56E
0 ETH0.0000001002610.00010074
Forward Eth1449446092025-12-11 21:19:5512 hrs ago1765487995IN
0x87a26566...989E3F56E
0.0501 ETH0.0000000219160.0001382
Forward ERC201449396912025-12-11 18:35:5915 hrs ago1765478159IN
0x87a26566...989E3F56E
0 ETH0.0000000540010.00010036
Forward Eth1449338622025-12-11 15:21:4118 hrs ago1765466501IN
0x87a26566...989E3F56E
0.019 ETH0.0000001239880.00100073
Forward ERC201449337782025-12-11 15:18:5318 hrs ago1765466333IN
0x87a26566...989E3F56E
0 ETH0.0000001536450.00025189
Forward Eth1449325002025-12-11 14:36:1719 hrs ago1765463777IN
0x87a26566...989E3F56E
0.0099 ETH0.0000000582060.00042347
Forward Eth1449294442025-12-11 12:54:2521 hrs ago1765457665IN
0x87a26566...989E3F56E
0.10084041350175 ETH0.0000000130340.00000037
Forward ERC201449284012025-12-11 12:19:3921 hrs ago1765455579IN
0x87a26566...989E3F56E
0 ETH0.0000001952630.001
Forward ERC201449275752025-12-11 11:52:0722 hrs ago1765453927IN
0x87a26566...989E3F56E
0 ETH0.0000000238450.00010035
Forward Eth1449269632025-12-11 11:31:4322 hrs ago1765452703IN
0x87a26566...989E3F56E
0.085401880199793 ETH0.000000005840.00000036
Forward ERC201449171192025-12-11 6:03:3527 hrs ago1765433015IN
0x87a26566...989E3F56E
0 ETH0.0000000974670.00010047
Forward Eth1449138902025-12-11 4:15:5729 hrs ago1765426557IN
0x87a26566...989E3F56E
0.010212218371159 ETH0.0000001222160.00100085
Forward ERC201449051232025-12-10 23:23:4334 hrs ago1765409023IN
0x87a26566...989E3F56E
0 ETH0.0000001343310.00010048
Forward Eth1449031512025-12-10 22:17:5935 hrs ago1765405079IN
0x87a26566...989E3F56E
0.015 ETH0.000000017480.00010299
Forward Eth1449028312025-12-10 22:07:1935 hrs ago1765404439IN
0x87a26566...989E3F56E
0.07 ETH0.0000000173060.00010384
Forward ERC201449010992025-12-10 21:09:3536 hrs ago1765400975IN
0x87a26566...989E3F56E
0 ETH0.0000003000840.00033055
Forward ERC201449003352025-12-10 20:44:0737 hrs ago1765399447IN
0x87a26566...989E3F56E
0 ETH0.0000001706580.00010435
Forward ERC201448945922025-12-10 17:32:4140 hrs ago1765387961IN
0x87a26566...989E3F56E
0 ETH0.0000000877520.00010074
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
1449636012025-12-12 7:52:592 hrs ago1765525979
0x87a26566...989E3F56E
0.0190809 ETH
1449636012025-12-12 7:52:592 hrs ago1765525979
0x87a26566...989E3F56E
0.0000191 ETH
1449635612025-12-12 7:51:392 hrs ago1765525899
0x87a26566...989E3F56E
0.018981 ETH
1449635612025-12-12 7:51:392 hrs ago1765525899
0x87a26566...989E3F56E
0.000019 ETH
1449579472025-12-12 4:44:315 hrs ago1765514671
0x87a26566...989E3F56E
0.011988 ETH
1449579472025-12-12 4:44:315 hrs ago1765514671
0x87a26566...989E3F56E
0.000012 ETH
1449567112025-12-12 4:03:195 hrs ago1765512199
0x87a26566...989E3F56E
0.00121878 ETH
1449567112025-12-12 4:03:195 hrs ago1765512199
0x87a26566...989E3F56E
0.00000122 ETH
1449473762025-12-11 22:52:0911 hrs ago1765493529
0x87a26566...989E3F56E
0.002687198492088 ETH
1449473762025-12-11 22:52:0911 hrs ago1765493529
0x87a26566...989E3F56E
0.00000268988838 ETH
1449446092025-12-11 21:19:5512 hrs ago1765487995
0x87a26566...989E3F56E
0.0500499 ETH
1449446092025-12-11 21:19:5512 hrs ago1765487995
0x87a26566...989E3F56E
0.0000501 ETH
1449338622025-12-11 15:21:4118 hrs ago1765466501
0x87a26566...989E3F56E
0.018981 ETH
1449338622025-12-11 15:21:4118 hrs ago1765466501
0x87a26566...989E3F56E
0.000019 ETH
1449325002025-12-11 14:36:1719 hrs ago1765463777
0x87a26566...989E3F56E
0.0098901 ETH
1449325002025-12-11 14:36:1719 hrs ago1765463777
0x87a26566...989E3F56E
0.0000099 ETH
1449294442025-12-11 12:54:2521 hrs ago1765457665
0x87a26566...989E3F56E
0.100739573088248 ETH
1449294442025-12-11 12:54:2521 hrs ago1765457665
0x87a26566...989E3F56E
0.000100840413501 ETH
1449269632025-12-11 11:31:4322 hrs ago1765452703
0x87a26566...989E3F56E
0.085316478319594 ETH
1449269632025-12-11 11:31:4322 hrs ago1765452703
0x87a26566...989E3F56E
0.000085401880199 ETH
1449138902025-12-11 4:15:5729 hrs ago1765426557
0x87a26566...989E3F56E
0.010202006152788 ETH
1449138902025-12-11 4:15:5729 hrs ago1765426557
0x87a26566...989E3F56E
0.000010212218371 ETH
1449031512025-12-10 22:17:5935 hrs ago1765405079
0x87a26566...989E3F56E
0.014985 ETH
1449031512025-12-10 22:17:5935 hrs ago1765405079
0x87a26566...989E3F56E
0.000015 ETH
1449028312025-12-10 22:07:1935 hrs ago1765404439
0x87a26566...989E3F56E
0.06993 ETH
View All Internal Transactions

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MayanForwarderWithReferrer

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 200 runs

Other Settings:
london EvmVersion
// SPDX-License-Identifier: Apache 2
pragma solidity ^0.8.19;

import "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";

import "./interfaces/IMayanForwarderWithReferrer.sol";

string constant MayanForwarderWithReferrerVersion = "MayanForwarderWithReferrer-0.0.1";

/// @title MayanForwarderWithReferrer
/// @author Wormhole Project Contributors.
/// @notice The MayanForwarderWithReferrer contract is a shim contract that initiates a forward
///         or swap using the Mayan Forwarder contract and passes a fee to the specified referrer.
contract MayanForwarderWithReferrer is IMayanForwarderWithReferrer {
    string public constant VERSION = MayanForwarderWithReferrerVersion;
    address public immutable mayanForwarder;

    constructor(address _mayanForwarder) {
        assert(_mayanForwarder != address(0));
        mayanForwarder = _mayanForwarder;
    }

    // ==================== External Interface ===============================================

    function forwardEth(bytes calldata forwarderData, FeeArgs calldata feeArgs) external payable {
        // Don't need to custody the tokens in this contract.

        // Transfer the fee to the referrer.
        if (feeArgs.fee > 0) {
            (bool transferSuccessful,) = payable(feeArgs.payee).call{value: feeArgs.fee}("");
            if (!transferSuccessful) {
                revert FeeTransferFailed(feeArgs.fee);
            }
        }

        // Initiate the forward.
        (bool success,) = mayanForwarder.call{value: msg.value - feeArgs.fee}(forwarderData);
        require(success, "mayan forwarder call failed");

        // Refund any excess value.
        _refundBalance(msg.sender);
    }

    function forwardERC20(bytes calldata forwarderData, address tokenIn, uint256 amountIn, FeeArgs calldata feeArgs)
        external
        payable
    {
        // Custody the tokens in this contract.
        amountIn = _custodyTokens(tokenIn, amountIn);

        // Transfer the fee to the referrer.
        if (feeArgs.fee > 0) {
            if (amountIn < feeArgs.fee) {
                revert FeeTooLarge(amountIn, feeArgs.fee);
            }

            SafeERC20.safeTransfer(IERC20(tokenIn), feeArgs.payee, feeArgs.fee);
        }

        // Approve the forwarder to spend the tokens.
        _maxApproveIfNeeded(tokenIn, mayanForwarder, amountIn);

        // Initiate the forward.
        (bool success,) = mayanForwarder.call{value: msg.value}(forwarderData);
        require(success, "mayan forwarder call failed");

        // Refund any excess value.
        _refundBalance(msg.sender);
    }

    // necessary for receiving native assets
    receive() external payable {}

    // ==================== Internal Functions ==============================================

    function _custodyTokens(address token, uint256 amount) internal returns (uint256) {
        // query own token balance before transfer
        uint256 balanceBefore = _getBalance(token);

        // deposit tokens
        SafeERC20.safeTransferFrom(IERC20(token), msg.sender, address(this), amount);

        // return the balance difference
        return _getBalance(token) - balanceBefore;
    }

    function _getBalance(address token) internal view returns (uint256 balance) {
        // fetch the specified token balance for this contract
        (, bytes memory queriedBalance) =
            token.staticcall(abi.encodeWithSelector(IERC20.balanceOf.selector, address(this)));
        balance = abi.decode(queriedBalance, (uint256));
    }

    function _refundBalance(address refundAddress) internal {
        uint256 currentBalance = address(this).balance;
        if (currentBalance > 0) {
            (bool refundSuccessful,) = payable(refundAddress).call{value: currentBalance}("");
            if (!refundSuccessful) {
                revert RefundFailed(currentBalance);
            }
        }
    }

    /// @dev This is based on what is in the MayanForwarder contract here: https://github.com/mayan-finance/swap-bridge/blob/main/src/MayanForwarder.sol
    function _maxApproveIfNeeded(address tokenAddr, address spender, uint256 amount) internal {
        IERC20 token = IERC20(tokenAddr);
        uint256 currentAllowance = token.allowance(address(this), spender);
        if (currentAllowance < amount) {
            SafeERC20.safeApprove(token, spender, 0);
            SafeERC20.safeApprove(token, spender, type(uint256).max);
        }
    }
}

// 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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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");
        }
    }
}

// SPDX-License-Identifier: Apache 2
pragma solidity ^0.8.19;

struct FeeArgs {
    // The fee.
    uint256 fee;
    // To whom the fee should be paid (the "referrer").
    address payee;
}

interface IMayanForwarderWithReferrer {
    /// @notice Error when the fee is greater than the total amount.
    /// @dev Selector 0x359f998c.
    /// @param amountIn The amount passed in, which should include the fee.
    /// @param fee The fee amount.
    error FeeTooLarge(uint256 amountIn, uint256 fee);

    /// @notice Error when transferring the fee to the referrer fails.
    /// @dev Selector 0x7e802910.
    /// @param fee The fee amount.
    error FeeTransferFailed(uint256 fee);

    /// @notice Error when the refund to the sender fails.
    /// @dev Selector 0x2ca23714.
    /// @param refundAmount The refund amount.
    error RefundFailed(uint256 refundAmount);

    function forwardEth(bytes calldata forwarderData, FeeArgs calldata feeArgs) external payable;

    function forwardERC20(bytes calldata forwarderData, address tokenIn, uint256 amountIn, FeeArgs calldata feeArgs)
        external
        payable;
}

// 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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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
{
  "remappings": [
    "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_mayanForwarder","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"FeeTooLarge","type":"error"},{"inputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"FeeTransferFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"refundAmount","type":"uint256"}],"name":"RefundFailed","type":"error"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"forwarderData","type":"bytes"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"components":[{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"address","name":"payee","type":"address"}],"internalType":"struct FeeArgs","name":"feeArgs","type":"tuple"}],"name":"forwardERC20","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"forwarderData","type":"bytes"},{"components":[{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"address","name":"payee","type":"address"}],"internalType":"struct FeeArgs","name":"feeArgs","type":"tuple"}],"name":"forwardEth","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mayanForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a03461009457601f6109af38819003918201601f19168301916001600160401b038311848410176100995780849260209460405283398101031261009457516001600160a01b038116808203610094571561007e576080526040516108ff90816100b082396080518181816101750152818161049b01526105290152f35b634e487b7160e01b600052600160045260246000fd5b600080fd5b634e487b7160e01b600052604160045260246000fdfe608080604052600436101561001d575b50361561001b57600080fd5b005b600090813560e01c9081637f32a1841461051557508063fcaabe3b14610432578063fe2298b9146100af5763ffa1ad740361000f57346100ac57806003193601126100ac576100a86040805190610074818361058b565b602082527f4d6179616e466f727761726465725769746852656665727265722d302e302e31602083015251918291826105c3565b0390f35b80fd5b5060a03660031901126100ac5760043567ffffffffffffffff811161042e576100dc903690600401610558565b6024356001600160a01b038116929083810361042a57604036606319011261042a578061015061010e610155936106fc565b9161014b6040516323b872dd60e01b602082015233602482015230604482015260443560648201526064815261014560848261058b565b8861074c565b6106fc565b61064c565b92606435806103b2575b50604051636eb1769f60e11b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03811660248301529490602081604481865afa9081156103a7578791610371575b50106101fa575b846101ee81808787878160405192839283378101848152039134905af16101e861060c565b5061066f565b6101f7336106bb565b80f35b60405163095ea7b360e01b60208201526001600160a01b038516602482018190526000604480840191909152825292949193906102429061023c60648261058b565b8561074c565b604051636eb1769f60e11b81523060048201526001600160a01b0383166024820152600090602081604481895afa918215610365578092610330575b50506102cc576101ee946102c287959486956040519163095ea7b360e01b602084015260248301526000196044830152604482526102bd60648361058b565b61074c565b92509250926101c3565b60405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608490fd5b9091506020823d60201161035d575b8161034c6020938361058b565b810103126100ac575051388061027e565b3d915061033f565b604051903d90823e3d90fd5b90506020813d60201161039f575b8161038c6020938361058b565b8101031261039b5751386101bc565b8680fd5b3d915061037f565b6040513d89823e3d90fd5b808510610413576084356001600160a01b038116810361039b5760405163a9059cbb60e01b60208201526001600160a01b03909116602482015260448082019290925290815261040d9061040760648261058b565b8261074c565b3861015f565b630d67e66360e21b86526004859052602452604485fd5b8480fd5b5080fd5b5060603660031901126100ac578060043567ffffffffffffffff811161051257610460903690600401610558565b909190604036602319011261042e57602435806104c4575b9282916104886101ee953461064c565b91816040519283928337810184815203917f00000000000000000000000000000000000000000000000000000000000000005af16101e861060c565b909150836044356001600160a01b0381169081810361050e57828481938293505af16104ee61060c565b50156104fc57908391610478565b6307e8029160e41b8452600452602483fd5b8280fd5b50fd5b90503461042e578160031936011261042e577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b9181601f840112156105865782359167ffffffffffffffff8311610586576020838186019501011161058657565b600080fd5b90601f8019910116810190811067ffffffffffffffff8211176105ad57604052565b634e487b7160e01b600052604160045260246000fd5b91909160208152825180602083015260005b8181106105f6575060409293506000838284010152601f8019910116010190565b80602080928701015160408286010152016105d5565b3d15610647573d9067ffffffffffffffff82116105ad576040519161063b601f8201601f19166020018461058b565b82523d6000602084013e565b606090565b9190820391821161065957565b634e487b7160e01b600052601160045260246000fd5b1561067657565b60405162461bcd60e51b815260206004820152601b60248201527f6d6179616e20666f727761726465722063616c6c206661696c656400000000006044820152606490fd5b4790816106c6575050565b6000808084819460018060a01b03165af16106df61060c565b50156106e85750565b630b288dc560e21b60005260045260246000fd5b6000809160405160208101906370a0823160e01b82523060248201526024815261072760448261058b565b51915afa5061073461060c565b60208151918180820193849201010312610586575190565b6040805190926107b1926001600160a01b031690600090819061076f878661058b565b602085527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564602086015260208151910182855af16107ab61060c565b91610834565b8051806107bd57505050565b81602091810103126105865760200151801590811503610586576107de5750565b5162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b919290156108965750815115610848575090565b3b156108515790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156108a95750805190602001fd5b60405162461bcd60e51b81529081906108c590600483016105c3565b0390fdfea26469706673582212201b22e1e1e7afa6ad037871632ea7662253a567827746b16cbac28f6c22f919e664736f6c634300081c0033000000000000000000000000337685fdab40d39bd02028545a4ffa7d287cc3e2

Deployed Bytecode

0x608080604052600436101561001d575b50361561001b57600080fd5b005b600090813560e01c9081637f32a1841461051557508063fcaabe3b14610432578063fe2298b9146100af5763ffa1ad740361000f57346100ac57806003193601126100ac576100a86040805190610074818361058b565b602082527f4d6179616e466f727761726465725769746852656665727265722d302e302e31602083015251918291826105c3565b0390f35b80fd5b5060a03660031901126100ac5760043567ffffffffffffffff811161042e576100dc903690600401610558565b6024356001600160a01b038116929083810361042a57604036606319011261042a578061015061010e610155936106fc565b9161014b6040516323b872dd60e01b602082015233602482015230604482015260443560648201526064815261014560848261058b565b8861074c565b6106fc565b61064c565b92606435806103b2575b50604051636eb1769f60e11b81523060048201527f000000000000000000000000337685fdab40d39bd02028545a4ffa7d287cc3e26001600160a01b03811660248301529490602081604481865afa9081156103a7578791610371575b50106101fa575b846101ee81808787878160405192839283378101848152039134905af16101e861060c565b5061066f565b6101f7336106bb565b80f35b60405163095ea7b360e01b60208201526001600160a01b038516602482018190526000604480840191909152825292949193906102429061023c60648261058b565b8561074c565b604051636eb1769f60e11b81523060048201526001600160a01b0383166024820152600090602081604481895afa918215610365578092610330575b50506102cc576101ee946102c287959486956040519163095ea7b360e01b602084015260248301526000196044830152604482526102bd60648361058b565b61074c565b92509250926101c3565b60405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608490fd5b9091506020823d60201161035d575b8161034c6020938361058b565b810103126100ac575051388061027e565b3d915061033f565b604051903d90823e3d90fd5b90506020813d60201161039f575b8161038c6020938361058b565b8101031261039b5751386101bc565b8680fd5b3d915061037f565b6040513d89823e3d90fd5b808510610413576084356001600160a01b038116810361039b5760405163a9059cbb60e01b60208201526001600160a01b03909116602482015260448082019290925290815261040d9061040760648261058b565b8261074c565b3861015f565b630d67e66360e21b86526004859052602452604485fd5b8480fd5b5080fd5b5060603660031901126100ac578060043567ffffffffffffffff811161051257610460903690600401610558565b909190604036602319011261042e57602435806104c4575b9282916104886101ee953461064c565b91816040519283928337810184815203917f000000000000000000000000337685fdab40d39bd02028545a4ffa7d287cc3e25af16101e861060c565b909150836044356001600160a01b0381169081810361050e57828481938293505af16104ee61060c565b50156104fc57908391610478565b6307e8029160e41b8452600452602483fd5b8280fd5b50fd5b90503461042e578160031936011261042e577f000000000000000000000000337685fdab40d39bd02028545a4ffa7d287cc3e26001600160a01b03168152602090f35b9181601f840112156105865782359167ffffffffffffffff8311610586576020838186019501011161058657565b600080fd5b90601f8019910116810190811067ffffffffffffffff8211176105ad57604052565b634e487b7160e01b600052604160045260246000fd5b91909160208152825180602083015260005b8181106105f6575060409293506000838284010152601f8019910116010190565b80602080928701015160408286010152016105d5565b3d15610647573d9067ffffffffffffffff82116105ad576040519161063b601f8201601f19166020018461058b565b82523d6000602084013e565b606090565b9190820391821161065957565b634e487b7160e01b600052601160045260246000fd5b1561067657565b60405162461bcd60e51b815260206004820152601b60248201527f6d6179616e20666f727761726465722063616c6c206661696c656400000000006044820152606490fd5b4790816106c6575050565b6000808084819460018060a01b03165af16106df61060c565b50156106e85750565b630b288dc560e21b60005260045260246000fd5b6000809160405160208101906370a0823160e01b82523060248201526024815261072760448261058b565b51915afa5061073461060c565b60208151918180820193849201010312610586575190565b6040805190926107b1926001600160a01b031690600090819061076f878661058b565b602085527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564602086015260208151910182855af16107ab61060c565b91610834565b8051806107bd57505050565b81602091810103126105865760200151801590811503610586576107de5750565b5162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b919290156108965750815115610848575090565b3b156108515790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156108a95750805190602001fd5b60405162461bcd60e51b81529081906108c590600483016105c3565b0390fdfea26469706673582212201b22e1e1e7afa6ad037871632ea7662253a567827746b16cbac28f6c22f919e664736f6c634300081c0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000337685fdab40d39bd02028545a4ffa7d287cc3e2

-----Decoded View---------------
Arg [0] : _mayanForwarder (address): 0x337685fdaB40D39bd02028545a4FfA7D287cC3E2

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000337685fdab40d39bd02028545a4ffa7d287cc3e2


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.