POL Price: $0.123978 (-2.23%)
 

More Info

Private Name Tags

Multichain Info

Transaction Hash
Block
From
To
Forward Eth821020392026-01-25 6:54:1046 mins ago1769324050IN
0x87a26566...989E3F56E
10 POL0.0228240634.5086121
Forward Eth821020202026-01-25 6:53:3247 mins ago1769324012IN
0x87a26566...989E3F56E
10 POL0.0085982734.77141895
Forward ERC20820992222026-01-25 5:20:162 hrs ago1769318416IN
0x87a26566...989E3F56E
0 POL0.0099416345.84971702
Forward ERC20820958802026-01-25 3:28:524 hrs ago1769311732IN
0x87a26566...989E3F56E
0 POL0.0181597798.84590592
Forward ERC20820908202026-01-25 0:40:127 hrs ago1769301612IN
0x87a26566...989E3F56E
0 POL0.06430664136.97769782
Forward ERC20820875042026-01-24 22:49:408 hrs ago1769294980IN
0x87a26566...989E3F56E
0 POL0.0068571538.36897954
Forward ERC20820853522026-01-24 21:37:5610 hrs ago1769290676IN
0x87a26566...989E3F56E
0 POL0.0694644931.98678967
Forward ERC20820852032026-01-24 21:32:5810 hrs ago1769290378IN
0x87a26566...989E3F56E
0 POL0.0134845131.91864678
Forward Eth820800482026-01-24 18:41:0812 hrs ago1769280068IN
0x87a26566...989E3F56E
39.43465286 POL0.0169089834
Forward ERC20820795662026-01-24 18:25:0413 hrs ago1769279104IN
0x87a26566...989E3F56E
0 POL0.0208698834
Forward ERC20820786082026-01-24 17:53:0813 hrs ago1769277188IN
0x87a26566...989E3F56E
0 POL0.0071683539
Forward Eth820781842026-01-24 17:39:0014 hrs ago1769276340IN
0x87a26566...989E3F56E
103.53506781 POL0.0620009997.90022846
Forward Eth820753902026-01-24 16:05:5215 hrs ago1769270752IN
0x87a26566...989E3F56E
11 POL0.30379499689.3011236
Forward Eth820748232026-01-24 15:46:5815 hrs ago1769269618IN
0x87a26566...989E3F56E
15,683.179 POL1.26611288483.01395485
Forward Eth820747432026-01-24 15:44:1815 hrs ago1769269458IN
0x87a26566...989E3F56E
15,702 POL0.92839545487.95811559
Forward Eth820747282026-01-24 15:43:4815 hrs ago1769269428IN
0x87a26566...989E3F56E
15,701.13945032 POL0.9224661482.4280475
Forward Eth820746742026-01-24 15:42:0015 hrs ago1769269320IN
0x87a26566...989E3F56E
15,692.07634401 POL1.04839209505.84427137
Forward ERC20820647842026-01-24 10:12:2021 hrs ago1769249540IN
0x87a26566...989E3F56E
0 POL0.0481078297
Forward ERC20820625212026-01-24 8:56:5422 hrs ago1769245014IN
0x87a26566...989E3F56E
0 POL0.08320216132.87344286
Forward ERC20820611782026-01-24 8:12:0823 hrs ago1769242328IN
0x87a26566...989E3F56E
0 POL0.03763783204.79833833
Forward ERC20820548552026-01-24 4:41:2226 hrs ago1769229682IN
0x87a26566...989E3F56E
0 POL0.0302459895.49274152
Forward ERC20820476642026-01-24 0:41:4030 hrs ago1769215300IN
0x87a26566...989E3F56E
0 POL0.22600001317.48887418
Forward ERC20820442092026-01-23 22:46:3032 hrs ago1769208390IN
0x87a26566...989E3F56E
0 POL0.12895024277.05853827
Forward ERC20820441992026-01-23 22:46:1032 hrs ago1769208370IN
0x87a26566...989E3F56E
0 POL0.23672667274.9745299
Forward ERC20820441792026-01-23 22:45:3032 hrs ago1769208330IN
0x87a26566...989E3F56E
0 POL0.09439431285.88050479
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
821020392026-01-25 6:54:1046 mins ago1769324050
0x87a26566...989E3F56E
9.99 POL
821020392026-01-25 6:54:1046 mins ago1769324050
0x87a26566...989E3F56E
0.01 POL
821020202026-01-25 6:53:3247 mins ago1769324012
0x87a26566...989E3F56E
9.99 POL
821020202026-01-25 6:53:3247 mins ago1769324012
0x87a26566...989E3F56E
0.01 POL
820800482026-01-24 18:41:0812 hrs ago1769280068
0x87a26566...989E3F56E
39.39521821 POL
820800482026-01-24 18:41:0812 hrs ago1769280068
0x87a26566...989E3F56E
0.03943465 POL
820781842026-01-24 17:39:0014 hrs ago1769276340
0x87a26566...989E3F56E
103.43153274 POL
820781842026-01-24 17:39:0014 hrs ago1769276340
0x87a26566...989E3F56E
0.10353506 POL
820753902026-01-24 16:05:5215 hrs ago1769270752
0x87a26566...989E3F56E
10.989 POL
820753902026-01-24 16:05:5215 hrs ago1769270752
0x87a26566...989E3F56E
0.011 POL
820748232026-01-24 15:46:5815 hrs ago1769269618
0x87a26566...989E3F56E
15,667.495821 POL
820748232026-01-24 15:46:5815 hrs ago1769269618
0x87a26566...989E3F56E
15.683179 POL
820747432026-01-24 15:44:1815 hrs ago1769269458
0x87a26566...989E3F56E
15,686.298 POL
820747432026-01-24 15:44:1815 hrs ago1769269458
0x87a26566...989E3F56E
15.702 POL
820747282026-01-24 15:43:4815 hrs ago1769269428
0x87a26566...989E3F56E
15,685.43831087 POL
820747282026-01-24 15:43:4815 hrs ago1769269428
0x87a26566...989E3F56E
15.70113945 POL
820746742026-01-24 15:42:0015 hrs ago1769269320
0x87a26566...989E3F56E
15,676.38426767 POL
820746742026-01-24 15:42:0015 hrs ago1769269320
0x87a26566...989E3F56E
15.69207634 POL
820231362026-01-23 11:04:0444 hrs ago1769166244
0x87a26566...989E3F56E
24.975 POL
820231362026-01-23 11:04:0444 hrs ago1769166244
0x87a26566...989E3F56E
0.025 POL
820214272026-01-23 10:07:0645 hrs ago1769162826
0x87a26566...989E3F56E
3,456.16347305 POL
820214272026-01-23 10:07:0645 hrs ago1769162826
0x87a26566...989E3F56E
3.45962309 POL
820017092026-01-22 23:09:502 days ago1769123390
0x87a26566...989E3F56E
499.5 POL
820017092026-01-22 23:09:502 days ago1769123390
0x87a26566...989E3F56E
0.5 POL
820016342026-01-22 23:07:202 days ago1769123240
0x87a26566...989E3F56E
499.5 POL
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 Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
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.