Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Multichain Info
No addresses found
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
KelpAdapter
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 1000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import {IStader} from "../interfaces/IStader.sol"; import {EoaExecutorWithoutDataProvider} from "@routerprotocol/intents-core/contracts/RouterIntentEoaAdapter.sol"; import {Errors} from "../Errors.sol"; import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {ILRTDepositPool} from "../interfaces/ILRTDepositPool.sol"; import {ILzOft} from "../interfaces/ILzOft.sol"; import {RestakingAdapterBase} from "./RestakingAdapterBase.sol"; /** * @title KelpAdapter * @author StakeEase */ contract KelpAdapter is RestakingAdapterBase { using SafeERC20 for IERC20; string public constant KELP_REFERRAL_ID = "3cb2cee5568aa41e45d9771080fae8496bc185b9b380a7d773b11aec"; ILRTDepositPool public immutable lrtDepositPool; IERC20 public immutable rsEth; ILzOft public immutable lzOft; uint256 public immutable lzOftDecimalConversionRate; constructor( address _native, address _wnative, address _feeManager, address _lrtDepositPool, address _rsEth, address _lzOft ) RestakingAdapterBase(_native, _wnative, _feeManager) { if (_lzOft == address(0)) revert(Errors.OFT_ADAPTER_NOT_FOUND); lrtDepositPool = ILRTDepositPool(_lrtDepositPool); rsEth = IERC20(_rsEth); lzOft = ILzOft(_lzOft); lzOftDecimalConversionRate = lzOft.decimalConversionRate(); } function name() public pure override returns (string memory) { return "KelpAdapter"; } /** * @inheritdoc EoaExecutorWithoutDataProvider */ function execute( bytes calldata data ) external payable override returns (address[] memory) { ( address asset, address recipient, uint256 amount, uint256 minReceive, uint32 dstEid, bytes memory crossChainData ) = parseInput(data); bool isNativeAsset = asset == native(); if (address(this) == self()) { if (isNativeAsset) { uint256 nativeFee = 0; if (dstEid != 0) nativeFee = abi.decode(crossChainData, (uint256)); amount = msg.value - nativeFee; } else { IERC20(asset).safeTransferFrom(msg.sender, self(), amount); amount = IERC20(asset).balanceOf(self()); } } else if (amount == type(uint256).max) { if (isNativeAsset) { uint256 nativeFee = 0; if (dstEid != 0) nativeFee = abi.decode(crossChainData, (uint256)); amount = address(this).balance - nativeFee; } else amount = IERC20(asset).balanceOf(address(this)); } require(amount != 0, Errors.AMOUNT_CANNOT_BE_ZERO); uint256 fee = feeManager.getFee(amount); if (fee != 0) { amount = amount - fee; if (isNativeAsset) payable(address(feeManager)).transfer(fee); else IERC20(asset).safeTransfer(address(feeManager), fee); } return _restakeOnKelp( isNativeAsset, asset, recipient, fee, amount, minReceive, dstEid, crossChainData ); } function _restakeOnKelp( bool isNativeAsset, address asset, address recipient, uint256 fee, uint256 amount, uint256 minReceive, uint32 dstEid, bytes memory crossChainData ) internal returns (address[] memory) { uint256 rsEthBalBefore = rsEth.balanceOf(address(this)); if (isNativeAsset) { lrtDepositPool.depositETH{value: amount}( minReceive, KELP_REFERRAL_ID ); } else { IERC20(asset).safeIncreaseAllowance( address(lrtDepositPool), amount ); lrtDepositPool.depositAsset( asset, amount, minReceive, KELP_REFERRAL_ID ); } uint256 rsEthReceived = rsEth.balanceOf(address(this)) - rsEthBalBefore; if (rsEthReceived < minReceive) revert(Errors.RESTAKED_ETH_RECEIVED_AMOUNT_LESS_THAN_MIN_RETURN); if (dstEid != 0) { depositLzOFT(dstEid, crossChainData, rsEthReceived, recipient); } else { if (recipient != address(this)) rsEth.safeTransfer(recipient, rsEthReceived); } emit RestakingSuccessful( self(), recipient, asset, fee, amount, rsEthReceived ); address[] memory tokens = new address[](1); tokens[0] = address(rsEth); return tokens; } function depositLzOFT( uint32 dstEid, bytes memory crossChainData, uint256 amount, address recipient ) public { (uint256 nativeFee, address refundAddress) = abi.decode( crossChainData, (uint256, address) ); uint256 transferAmt = (amount / lzOftDecimalConversionRate) * lzOftDecimalConversionRate; ILzOft.SendParam memory _sendParams = ILzOft.SendParam({ dstEid: dstEid, to: bytes32(uint256(uint160(recipient))), amountLD: transferAmt, minAmountLD: transferAmt, extraOptions: hex"00030100110100000000000000000000000000030d40", composeMsg: hex"", oftCmd: hex"" }); ILzOft.MessagingFee memory _messagingFee = ILzOft.MessagingFee({ nativeFee: nativeFee, lzTokenFee: 0 }); rsEth.safeIncreaseAllowance(address(lzOft), transferAmt); lzOft.send{value: nativeFee}(_sendParams, _messagingFee, refundAddress); uint256 rsEthDust = rsEth.balanceOf(address(this)); rsEth.safeTransfer(address(feeManager), rsEthDust); } function parseInput( bytes memory data ) internal pure returns (address, address, uint256, uint256, uint32, bytes memory) { ( address asset, address recipient, uint256 amount, uint256 minReceive, uint32 dstEid, bytes memory crossChainData ) = abi.decode( data, (address, address, uint256, uint256, uint32, bytes) ); return (asset, recipient, amount, minReceive, dstEid, crossChainData); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/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. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ 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]. * * CAUTION: See Security Considerations above. */ 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.9.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.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/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; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ 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)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ 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"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ 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"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation 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). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // 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 cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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 * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [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://consensys.net/diligence/blog/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.8.0/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); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import {IAdapterDataProvider} from "./interfaces/IAdapterDataProvider.sol"; /** * @title AdapterDataProvider * @author Router Protocol * @notice This contract serves as the data provider for an intent adapter based on Router * Cross-Chain Intent Framework. */ contract AdapterDataProvider is IAdapterDataProvider { address private _owner; mapping(address => bool) private _headRegistry; mapping(address => bool) private _tailRegistry; mapping(address => bool) private _inboundAssetRegistry; mapping(address => bool) private _outboundAssetRegistry; constructor(address __owner) { _owner = __owner; } /** * @inheritdoc IAdapterDataProvider */ function owner() external view returns (address) { return _owner; } /** * @inheritdoc IAdapterDataProvider */ function setOwner(address __owner) external onlyOwner { _owner = __owner; } /** * @inheritdoc IAdapterDataProvider */ function isAuthorizedPrecedingContract( address precedingContract ) external view returns (bool) { if (precedingContract == address(0)) return true; return _headRegistry[precedingContract]; } /** * @inheritdoc IAdapterDataProvider */ function isAuthorizedSucceedingContract( address succeedingContract ) external view returns (bool) { if (succeedingContract == address(0)) return true; return _tailRegistry[succeedingContract]; } /** * @inheritdoc IAdapterDataProvider */ function isValidInboundAsset(address asset) external view returns (bool) { return _inboundAssetRegistry[asset]; } /** * @inheritdoc IAdapterDataProvider */ function isValidOutboundAsset(address asset) external view returns (bool) { return _outboundAssetRegistry[asset]; } /** * @inheritdoc IAdapterDataProvider */ function setPrecedingContract( address precedingContract, bool isValid ) external onlyOwner { _headRegistry[precedingContract] = isValid; } /** * @inheritdoc IAdapterDataProvider */ function setSucceedingContract( address succeedingContract, bool isValid ) external onlyOwner { _tailRegistry[succeedingContract] = isValid; } /** * @inheritdoc IAdapterDataProvider */ function setInboundAsset(address asset, bool isValid) external onlyOwner { _inboundAssetRegistry[asset] = isValid; } /** * @inheritdoc IAdapterDataProvider */ function setOutboundAsset(address asset, bool isValid) external onlyOwner { _outboundAssetRegistry[asset] = isValid; } /** * @notice modifier to ensure that only owner can call this function */ modifier onlyOwner() { _onlyOwner(); _; } function _onlyOwner() private view { require(msg.sender == _owner, "Only owner"); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import {Basic} from "./common/Basic.sol"; import {Errors} from "./utils/Errors.sol"; import {ReentrancyGuard} from "./utils/ReentrancyGuard.sol"; import {AdapterDataProvider} from "./AdapterDataProvider.sol"; /** * @title BaseAdapter * @author Router Protocol * @notice This contract is the base implementation of an intent adapter based on Router * Cross-Chain Intent Framework. */ abstract contract BaseAdapter is Basic, ReentrancyGuard { address private immutable _self; address private immutable _native; address private immutable _wnative; AdapterDataProvider private immutable _adapterDataProvider; event ExecutionEvent(string indexed adapterName, bytes data); event OperationFailedRefundEvent( address token, address recipient, uint256 amount ); event UnsupportedOperation( address token, address refundAddress, uint256 amount ); constructor( address __native, address __wnative, bool __deployDataProvider, address __owner ) { _self = address(this); _native = __native; _wnative = __wnative; AdapterDataProvider dataProvider; if (__deployDataProvider) dataProvider = new AdapterDataProvider(__owner); else dataProvider = AdapterDataProvider(address(0)); _adapterDataProvider = dataProvider; } /** * @dev function to get the address of weth */ function wnative() public view override returns (address) { return _wnative; } /** * @dev function to get the address of native token */ function native() public view override returns (address) { return _native; } /** * @dev function to get the AdapterDataProvider instance for this contract */ function adapterDataProvider() public view returns (AdapterDataProvider) { return _adapterDataProvider; } /** * @dev Function to check whether the contract is a valid preceding contract registered in * the head registry. * @dev This registry governs the initiation of the adapter, exclusively listing authorized * preceding adapters. * @notice Only the adapters documented in this registry can invoke the current adapter, * thereby guaranteeing regulated and secure execution sequences. * @param precedingContract Address of preceding contract. * @return true if valid, false if invalid. */ function isAuthorizedPrecedingContract( address precedingContract ) public view returns (bool) { return _adapterDataProvider.isAuthorizedPrecedingContract( precedingContract ); } /** * @dev Function to check whether the contract is a valid succeeding contract registered in * the tail registry. * @dev This registry dictates the potential succeeding actions by listing adapters that * may be invoked following the current one. * @notice Only the adapters documented in this registry can be invoked by the current adapter, * thereby guaranteeing regulated and secure execution sequences. * @param succeedingContract Address of succeeding contract. * @return true if valid, false if invalid. */ function isAuthorizedSucceedingContract( address succeedingContract ) public view returns (bool) { return _adapterDataProvider.isAuthorizedSucceedingContract( succeedingContract ); } /** * @dev Function to check whether the asset is a valid inbound asset registered in the inbound * asset registry. * @dev This registry keeps track of all the acceptable incoming assets, ensuring that the * adapter only processes predefined asset types. * @param asset Address of the asset. * @return true if valid, false if invalid. */ function isValidInboundAsset(address asset) public view returns (bool) { return _adapterDataProvider.isValidInboundAsset(asset); } /** * @dev Function to check whether the asset is a valid outbound asset registered in the outbound * asset registry. * @dev It manages the types of assets that the adapter is allowed to output, thus controlling * the flow’s output and maintaining consistency. * @param asset Address of the asset. * @return true if valid, false if invalid. */ function isValidOutboundAsset(address asset) public view returns (bool) { return _adapterDataProvider.isValidOutboundAsset(asset); } /** * @dev function to get the name of the adapter */ function name() public view virtual returns (string memory); /** * @dev function to get the address of the contract */ function self() public view returns (address) { return _self; } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import {TokenInterface} from "./Interfaces.sol"; import {TokenUtilsBase} from "./TokenUtilsBase.sol"; abstract contract Basic is TokenUtilsBase { function getTokenBal(address token) internal view returns (uint _amt) { _amt = address(token) == native() ? address(this).balance : TokenInterface(token).balanceOf(address(this)); } function approve(address token, address spender, uint256 amount) internal { // solhint-disable-next-line no-empty-blocks try TokenInterface(token).approve(spender, amount) {} catch { TokenInterface(token).approve(spender, 0); TokenInterface(token).approve(spender, amount); } } function convertNativeToWnative(uint amount) internal { TokenInterface(wnative()).deposit{value: amount}(); } function convertWnativeToNative(uint amount) internal { TokenInterface(wnative()).withdraw(amount); } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.18; interface TokenInterface { function approve(address, uint256) external; function transfer(address, uint) external; function transferFrom(address, address, uint) external; function deposit() external payable; function withdraw(uint) external; function balanceOf(address) external view returns (uint); function decimals() external view returns (uint); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import {IWETH} from "../interfaces/IWETH.sol"; import {SafeERC20, IERC20} from "../utils/SafeERC20.sol"; abstract contract TokenUtilsBase { using SafeERC20 for IERC20; function wnative() public view virtual returns (address); function native() public view virtual returns (address); function approveToken( address _tokenAddr, address _to, uint256 _amount ) internal { if (_tokenAddr == native()) return; if (IERC20(_tokenAddr).allowance(address(this), _to) < _amount) { IERC20(_tokenAddr).safeApprove(_to, _amount); } } function pullTokensIfNeeded( address _token, address _from, uint256 _amount ) internal returns (uint256) { // handle max uint amount if (_amount == type(uint256).max) { _amount = getBalance(_token, _from); } if ( _from != address(0) && _from != address(this) && _token != native() && _amount != 0 ) { IERC20(_token).safeTransferFrom(_from, address(this), _amount); } return _amount; } function withdrawTokens( address _token, address _to, uint256 _amount ) internal returns (uint256) { if (_amount == type(uint256).max) { _amount = getBalance(_token, address(this)); } if (_to != address(0) && _to != address(this) && _amount != 0) { if (_token != native()) { IERC20(_token).safeTransfer(_to, _amount); } else { (bool success, ) = _to.call{value: _amount}(""); require(success, "native send fail"); } } return _amount; } function depositWnative(uint256 _amount) internal { IWETH(wnative()).deposit{value: _amount}(); } function withdrawWnative(uint256 _amount) internal { IWETH(wnative()).withdraw(_amount); } function getBalance( address _tokenAddr, address _acc ) internal view returns (uint256) { if (_tokenAddr == native()) { return _acc.balance; } else { return IERC20(_tokenAddr).balanceOf(_acc); } } function getTokenDecimals(address _token) internal view returns (uint256) { if (_token == native()) return 18; return IERC20(_token).decimals(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; /** * @title Interface for Adapter Data Provider contract for intent adapter. * @author Router Protocol. */ interface IAdapterDataProvider { /** * @dev Function to get the address of owner. */ function owner() external view returns (address); /** * @dev Function to set the address of owner. * @dev This function can only be called by the owner of this contract. * @param __owner Address of the new owner */ function setOwner(address __owner) external; /** * @dev Function to check whether the contract is a valid preceding contract registered in * the head registry. * @dev This registry governs the initiation of the adapter, exclusively listing authorized * preceding adapters. * @notice Only the adapters documented in this registry can invoke the current adapter, * thereby guaranteeing regulated and secure execution sequences. * @param precedingContract Address of preceding contract. * @return true if valid, false if invalid. */ function isAuthorizedPrecedingContract( address precedingContract ) external view returns (bool); /** * @dev Function to check whether the contract is a valid succeeding contract registered in * the tail registry. * @dev This registry dictates the potential succeeding actions by listing adapters that * may be invoked following the current one. * @notice Only the adapters documented in this registry can be invoked by the current adapter, * thereby guaranteeing regulated and secure execution sequences. * @param succeedingContract Address of succeeding contract. * @return true if valid, false if invalid. */ function isAuthorizedSucceedingContract( address succeedingContract ) external view returns (bool); /** * @dev Function to check whether the asset is a valid inbound asset registered in the inbound * asset registry. * @dev This registry keeps track of all the acceptable incoming assets, ensuring that the * adapter only processes predefined asset types. * @param asset Address of the asset. * @return true if valid, false if invalid. */ function isValidInboundAsset(address asset) external view returns (bool); /** * @dev Function to check whether the asset is a valid outbound asset registered in the outbound * asset registry. * @dev It manages the types of assets that the adapter is allowed to output, thus controlling * the flow’s output and maintaining consistency. * @param asset Address of the asset. * @return true if valid, false if invalid. */ function isValidOutboundAsset(address asset) external view returns (bool); /** * @dev Function to set preceding contract (head registry) for the adapter. * @dev This registry governs the initiation of the adapter, exclusively listing authorized * preceding adapters. * @notice Only the adapters documented in this registry can invoke the current adapter, * thereby guaranteeing regulated and secure execution sequences. * @param precedingContract Address of preceding contract. * @param isValid Boolean value suggesting if this is a valid preceding contract. */ function setPrecedingContract( address precedingContract, bool isValid ) external; /** * @dev Function to set succeeding contract (tail registry) for the adapter. * @dev This registry dictates the potential succeeding actions by listing adapters that * may be invoked following the current one. * @notice Only the adapters documented in this registry can be invoked by the current adapter, * thereby guaranteeing regulated and secure execution sequences. * @param succeedingContract Address of succeeding contract. * @param isValid Boolean value suggesting if this is a valid succeeding contract. */ function setSucceedingContract( address succeedingContract, bool isValid ) external; /** * @dev Function to set inbound asset registry for the adapter. * @dev This registry keeps track of all the acceptable incoming assets, ensuring that the * adapter only processes predefined asset types. * @param asset Address of the asset. * @param isValid Boolean value suggesting if this is a valid inbound asset. */ function setInboundAsset(address asset, bool isValid) external; /** * @dev Function to set outbound asset registry for the adapter. * @dev It manages the types of assets that the adapter is allowed to output, thus controlling * the flow’s output and maintaining consistency. * @param asset Address of the asset. * @param isValid Boolean value suggesting if this is a valid inbound asset. */ function setOutboundAsset(address asset, bool isValid) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; interface IERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint256 supply); function balanceOf(address _owner) external view returns (uint256 balance); function transfer( address _to, uint256 _value ) external returns (bool success); function transferFrom( address _from, address _to, uint256 _value ) external returns (bool success); function approve( address _spender, uint256 _value ) external returns (bool success); function allowance( address _owner, address _spender ) external view returns (uint256 remaining); event Approval( address indexed _owner, address indexed _spender, uint256 _value ); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import {IERC20} from "../utils/SafeERC20.sol"; abstract contract IWETH { function allowance(address, address) public view virtual returns (uint256); function balanceOf(address) public view virtual returns (uint256); function approve(address, uint256) public virtual; function transfer(address, uint256) public virtual returns (bool); function transferFrom( address, address, uint256 ) public virtual returns (bool); function deposit() public payable virtual; function withdraw(uint256) public virtual; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import {BaseAdapter} from "./BaseAdapter.sol"; import {EoaExecutorWithDataProvider, EoaExecutorWithoutDataProvider} from "./utils/EoaExecutor.sol"; abstract contract RouterIntentEoaAdapterWithDataProvider is BaseAdapter, EoaExecutorWithDataProvider { constructor( address __native, address __wnative, address __owner ) BaseAdapter(__native, __wnative, true, __owner) // solhint-disable-next-line no-empty-blocks { } } abstract contract RouterIntentEoaAdapterWithoutDataProvider is BaseAdapter, EoaExecutorWithoutDataProvider { constructor( address __native, address __wnative ) BaseAdapter(__native, __wnative, false, address(0)) // solhint-disable-next-line no-empty-blocks { } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; library Address { //insufficient balance error InsufficientBalance(uint256 available, uint256 required); //unable to send value, recipient may have reverted error SendingValueFail(); //insufficient balance for call error InsufficientBalanceForCall(uint256 available, uint256 required); //call to non-contract error NonContractCall(); function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } function sendValue(address payable recipient, uint256 amount) internal { uint256 balance = address(this).balance; if (balance < amount) { revert InsufficientBalance(balance, amount); } // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{value: amount}(""); if (!(success)) { revert SendingValueFail(); } } function functionCall( address target, bytes memory data ) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } 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" ); } function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { uint256 balance = address(this).balance; if (balance < value) { revert InsufficientBalanceForCall(balance, value); } return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue( address target, bytes memory data, uint256 weiValue, string memory errorMessage ) private returns (bytes memory) { if (!(isContract(target))) { revert NonContractCall(); } // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{value: weiValue}( data ); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; abstract contract EoaExecutorWithDataProvider { /** * @dev function to execute an action on an adapter used in an EOA. * @param precedingAdapter Address of the preceding adapter. * @param succeedingAdapter Address of the succeeding adapter. * @param data inputs data. * @return tokens to be refunded to user at the end of tx. */ function execute( address precedingAdapter, address succeedingAdapter, bytes calldata data ) external payable virtual returns (address[] memory tokens); } abstract contract EoaExecutorWithoutDataProvider { /** * @dev function to execute an action on an adapter used in an EOA. * @param data inputs data. * @return tokens to be refunded to user at the end of tx. */ function execute( bytes calldata data ) external payable virtual returns (address[] memory tokens); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.18; /** * @title Errors library * @author Router Intents Error * @notice Defines the error messages emitted by the contracts on Router Intents */ library Errors { string public constant ARRAY_LENGTH_MISMATCH = "1"; // 'Array lengths mismatch' string public constant INSUFFICIENT_NATIVE_FUNDS_PASSED = "2"; // 'Insufficient native tokens passed' string public constant WRONG_BATCH_PROVIDED = "3"; // 'The targetLength, valueLength, callTypeLength, funcLength do not match in executeBatch transaction functions in batch transaction contract' string public constant INVALID_CALL_TYPE = "4"; // 'The callType value can only be 1 (call)' and 2(delegatecall)' string public constant ONLY_NITRO = "5"; // 'Only nitro can call this function' string public constant ONLY_SELF = "6"; // 'Only the current contract can call this function' string public constant ADAPTER_NOT_WHITELISTED = "7"; // 'Adapter not whitelisted' }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; 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; error ReentrantCall(); 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 make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true if (_status == _ENTERED) { revert ReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import {IERC20} from "../interfaces/IERC20.sol"; import {Address} from "./Address.sol"; import {SafeMath} from "./SafeMath.sol"; library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn( token, abi.encodeWithSelector(token.transfer.selector, to, value) ); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn( token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value) ); } /// @dev Edited so it always first approves 0 and then the value, because of non standard tokens function safeApprove( IERC20 token, address spender, uint256 value ) internal { _callOptionalReturn( token, abi.encodeWithSelector(token.approve.selector, spender, 0) ); _callOptionalReturn( token, abi.encodeWithSelector(token.approve.selector, spender, value) ); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender).add( value ); _callOptionalReturn( token, abi.encodeWithSelector( token.approve.selector, spender, newAllowance ) ); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender).sub( value, "SafeERC20: decreased allowance below zero" ); _callOptionalReturn( token, abi.encodeWithSelector( token.approve.selector, spender, newAllowance ) ); } function _callOptionalReturn(IERC20 token, bytes memory data) private { bytes memory returndata = address(token).functionCall( data, "SafeERC20: low-level call failed" ); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require( abi.decode(returndata, (bool)), "SafeERC20: operation failed" ); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: mul overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; library Errors { string public constant AMOUNT_CANNOT_BE_ZERO = "1"; string public constant RECIPIENT_CANNOT_BE_ZERO = "2"; string public constant AMOUNT_RECEIVED_CANNOT_BE_ZERO = "3"; string public constant RESTAKED_ETH_RECEIVED_AMOUNT_LESS_THAN_MIN_RETURN = "4"; string public constant ONLY_EMERGENCY_OWNER = "5"; string public constant EMERGENCY_OWNER_CANNOT_BE_ZERO = "6"; string public constant WRONG_BATCH_PROVIDED = "7"; string public constant INSUFFICIENT_NATIVE_FUNDS_PASSED = "8"; string public constant ONLY_SELF = "9"; string public constant ARRAY_LENGTH_MISMATCH = "10"; string public constant INSUFFICIENT_FEE_PASSED = "11"; string public constant VOLUME_CANNOT_BE_ZERO = "12"; string public constant ONLY_NATIVE_TOKENS = "13"; string public constant ONLY_NITRO_BRIDGE = "14"; string public constant ONLY_WHITELISTED_BRIDGES = "15"; string public constant BRIDGE_ADAPTER_ADDRESS_CANNOT_BE_ZERO = "16"; string public constant MULTICALLER_ADDRESS_CANNOT_BE_ZERO = "17"; string public constant FEE_MANAGER_ADDRESS_CANNOT_BE_ZERO = "18"; string public constant SWAP_FAILED = "19"; string public constant ADAPTER_NOT_WHITELISTED = "20"; string public constant BRIDGE_TX_FAILED_ON_MULTICALL = "21"; string public constant TOKEN_PASSED_CANNOT_BE_NULL_ADDRESS = "22"; string public constant ADAPTER_ADDRESS_CANNOT_BE_ZERO = "23"; string public constant ADAPTER_TYPE_CAN_BE_EITHER_1_OR_2 = "24"; string public constant FEE_TRANSFER_FAILED = "25"; string public constant AMOUNT_LESSER_THAN_MIN_DEPOSIT = "26"; string public constant ARRAY_LENGTH_ZERO = "27"; string public constant REFUND_AMOUNT_ZERO = "28"; string public constant INVALID_RESTAKING_PROTOCOL_TYPE = "29"; string public constant INVALID_PROTOCOL_DATA = "30"; string public constant BASE_GAS_NOT_IN_RANGE = "31"; string public constant MARGINAL_GAS_PER_USER_NOT_IN_RANGE = "32"; string public constant FEE_TOO_LARGE = "33"; string public constant ZERO_DEPOSIT_FUNDS_FOR_THIS_PROTOCOL_ID = "34"; string public constant NOT_EXECUTABLE = "35"; string public constant PROTOCOL_DATA_NOT_SET = "36"; string public constant CANNOT_EXECUTE_LESSER_THAN_MIN_EXECUTABLE_BATCH = "37"; string public constant MAX_FEE_PERCENTAGE_GREATER_THAN_CEILING = "38"; string public constant FUSION_TX_BUILDER_CANNOT_BE_ADDRESS_ZERO = "39"; string public constant PROTOCOL_IS_PAUSED = "40"; string public constant OPEN_OCEAN_ADDRESS_CANNOT_BE_ZERO = "41"; string public constant BRIDGE_ADDRESS_CANNOT_BE_ZERO = "42"; string public constant WNATIVE_ADDRESS_CANNOT_BE_ZERO = "43"; string public constant CHAIN_LINK_GAS_PRICE_ORACLE_ADDRESS_CANNOT_BE_ZERO = "44"; string public constant STAKE_EASE_FEE_MANAGER_ADDRESS_CANNOT_BE_ZERO = "45"; string public constant PROTOCOL_GAS_PER_USER_OUT_OF_RANGE = "46"; string public constant GAS_PRICE_EXCEEDS_FAST_GAS_RANGE = "47"; string public constant AMOUNT_TO_RESTAKE_CANNOT_BE_ZERO = "48"; string public constant UNSUPPORTED_OPERATION = "49"; string public constant CANNOT_SET_ALL_DATA_FOR_PROTOCOL_AGAIN = "50"; string public constant INVALID_ASSET = "51"; string public constant CANNOT_SET_NEW_PROTOCOL_DATA_WITH_UPDATE_FUNCTION = "52"; string public constant OFT_ADAPTER_NOT_FOUND = "53"; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; /** * @title IFeeManager * @author StakeEase * @notice Interface for FeeManager contract for StakeEase. */ interface IFeeManager { /** * @notice Function to fetch the amount of fee. * @param txVolume Volume of transaction in ETH. * @return fee to be deducted in ETH. */ function getFee(uint256 txVolume) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; interface ILRTDepositPool { /** * @notice View amount of rsETH to mint for given asset amount * @param asset Asset address * @param amount Asset amount * @return rsethAmountToMint Amount of rseth to mint */ function getRsETHAmountToMint( address asset, uint256 amount ) external view returns (uint256 rsethAmountToMint); /** * @notice Function to help user stake LST to the protocol. * @param asset LST asset address to stake, * @param depositAmount LST asset amount to stake. * @param minRSETHAmountToReceive Minimum amount of rseth to receive. * @param referralId referralId for the referrer. */ function depositAsset( address asset, uint256 depositAmount, uint256 minRSETHAmountToReceive, string calldata referralId ) external; /// @notice Allows user to deposit ETH to the protocol /// @param minRSETHAmountExpected Minimum amount of rseth to receive /// @param referralId referral id function depositETH( uint256 minRSETHAmountExpected, string calldata referralId ) external payable; /// @notice gets the current limit of asset deposit /// @param asset Asset address /// @return currentLimit Current limit of asset deposit function getAssetCurrentLimit( address asset ) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; interface ILzOft { /** * @dev Struct representing token parameters for the OFT send() operation. */ struct SendParam { uint32 dstEid; // Destination endpoint ID. bytes32 to; // Recipient address. uint256 amountLD; // Amount to send in local decimals. uint256 minAmountLD; // Minimum amount to send in local decimals. bytes extraOptions; // Additional options supplied by the caller to be used in the LayerZero message. bytes composeMsg; // The composed message for the send() operation. bytes oftCmd; // The OFT command to be executed, unused in default OFT implementations. } struct MessagingFee { uint256 nativeFee; uint256 lzTokenFee; } struct MessagingReceipt { bytes32 guid; uint64 nonce; MessagingFee fee; } /** * @dev Struct representing OFT receipt information. */ struct OFTReceipt { uint256 amountSentLD; // Amount of tokens ACTUALLY debited from the sender in local decimals. // @dev In non-default implementations, the amountReceivedLD COULD differ from this value. uint256 amountReceivedLD; // Amount of tokens to be received on the remote side. } /** * @notice Executes the send() operation. * @param _sendParam The parameters for the send operation. * @param _fee The fee information supplied by the caller. * - nativeFee: The native fee. * - lzTokenFee: The lzToken fee. * @param _refundAddress The address to receive any excess funds from fees etc. on the src. * @return msgReceipt The LayerZero messaging receipt from the send() operation. * @return oftReceipt The OFT receipt information. * * @dev MessagingReceipt: LayerZero msg receipt * - guid: The unique identifier for the sent message. * - nonce: The nonce of the sent message. * - fee: The LayerZero fee incurred for the message. */ function send( SendParam calldata _sendParam, MessagingFee calldata _fee, address _refundAddress ) external payable returns ( MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt ); /** * @notice Provides a quote for the send() operation. * @param _sendParam The parameters for the send() operation. * @param _payInLzToken Flag indicating whether the caller is paying in the LZ token. * @return fee The calculated LayerZero messaging fee from the send() operation. * * @dev MessagingFee: LayerZero msg fee * - nativeFee: The native fee. * - lzTokenFee: The lzToken fee. */ function quoteSend( SendParam calldata _sendParam, bool _payInLzToken ) external view returns (MessagingFee memory); function decimalConversionRate() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; interface IStader { /** * @notice Function to stake ETH on Stader to receive ETHx. * @param _receiver Address of the recipient. * @param _referralId Address of the recipient. */ function deposit( address _receiver, string calldata _referralId ) external payable returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import {RouterIntentEoaAdapterWithoutDataProvider} from "@routerprotocol/intents-core/contracts/RouterIntentEoaAdapter.sol"; import {IFeeManager} from "../interfaces/IFeeManager.sol"; /** * @title RestakingAdapterBase * @author StakeEase */ abstract contract RestakingAdapterBase is RouterIntentEoaAdapterWithoutDataProvider { IFeeManager public immutable feeManager; event RestakingSuccessful( address indexed adapter, address indexed recipient, address stakingAsset, uint256 fee, uint256 amount, uint256 receivedAmount ); constructor( address _native, address _wnative, address _feeManager ) payable RouterIntentEoaAdapterWithoutDataProvider(_native, _wnative) { feeManager = IFeeManager(_feeManager); } // solhint-disable-next-line no-empty-blocks receive() external payable {} }
{ "optimizer": { "enabled": true, "runs": 1000 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_native","type":"address"},{"internalType":"address","name":"_wnative","type":"address"},{"internalType":"address","name":"_feeManager","type":"address"},{"internalType":"address","name":"_lrtDepositPool","type":"address"},{"internalType":"address","name":"_rsEth","type":"address"},{"internalType":"address","name":"_lzOft","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ReentrantCall","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"adapterName","type":"string"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"ExecutionEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"OperationFailedRefundEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"adapter","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"stakingAsset","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"receivedAmount","type":"uint256"}],"name":"RestakingSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"refundAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"UnsupportedOperation","type":"event"},{"inputs":[],"name":"KELP_REFERRAL_ID","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"adapterDataProvider","outputs":[{"internalType":"contract AdapterDataProvider","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"bytes","name":"crossChainData","type":"bytes"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"depositLzOFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"execute","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"feeManager","outputs":[{"internalType":"contract IFeeManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"precedingContract","type":"address"}],"name":"isAuthorizedPrecedingContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"succeedingContract","type":"address"}],"name":"isAuthorizedSucceedingContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"isValidInboundAsset","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"isValidOutboundAsset","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lrtDepositPool","outputs":[{"internalType":"contract ILRTDepositPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lzOft","outputs":[{"internalType":"contract ILzOft","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lzOftDecimalConversionRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"native","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rsEth","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"self","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wnative","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6101a06040523480156200001257600080fd5b50604051620020ed380380620020ed833981016040819052620000359162000151565b60016000908155306080526001600160a01b0387811660a05286811660c05260e091909152848116610100528116620000a3576040805180820182526002815261353360f01b6020820152905162461bcd60e51b81526200009a9190600401620001d2565b60405180910390fd5b6001600160a01b038084166101205282811661014052811661016081905260408051634b1f7e5560e11b8152905163963efcaa916004808201926020929091908290030181865afa158015620000fd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000123919062000222565b61018052506200023c945050505050565b80516001600160a01b03811681146200014c57600080fd5b919050565b60008060008060008060c087890312156200016b57600080fd5b620001768762000134565b9550620001866020880162000134565b9450620001966040880162000134565b9350620001a66060880162000134565b9250620001b66080880162000134565b9150620001c660a0880162000134565b90509295509295509295565b600060208083528351808285015260005b818110156200020157858101830151858201604001528201620001e3565b506000604082860101526040601f19601f8301168501019250505092915050565b6000602082840312156200023557600080fd5b5051919050565b60805160a05160c05160e0516101005161012051610140516101605161018051611d8a62000363600039600081816103ca015261046e0152600081816103260152818161056c01526105c401526000818161028c015281816105470152818161065c015281816106de01528181610ffe015281816112020152818161130601526113d1015260008181610258015281816110730152818161111e015261114501526000818161040c0152818161070001528181610a5c01528181610af60152610b540152600081816102bd01528181610bf101528181610c9a01528181610d060152610d72015260006102220152600081816101c6015261078e0152600081816102f0015281816107cb015281816108490152818161087f01526113390152611d8a6000f3fe6080604052600436106101115760003560e01c80636af563e9116100a55780639755594711610074578063b509833e11610059578063b509833e146103b8578063d0fb0203146103fa578063e34305b11461042e57600080fd5b80639755594714610378578063abe667191461039857600080fd5b80636af563e9146102ae5780637104ddb2146102e157806377843ddb146103145780637e954a711461034857600080fd5b8063168673ea116100e1578063168673ea146101fe5780632cebdeb21461021357806335b6d1ba14610246578063602981811461027a57600080fd5b8062b667e41461011d57806306fdde031461013f57806309c5eabe1461019757806311b0b42d146101b757600080fd5b3661011857005b600080fd5b34801561012957600080fd5b5061013d610138366004611763565b61044e565b005b34801561014b57600080fd5b5060408051808201909152600b81527f4b656c704164617074657200000000000000000000000000000000000000000060208201525b60405161018e9190611860565b60405180910390f35b6101aa6101a536600461187a565b610731565b60405161018e91906118ec565b3480156101c357600080fd5b507f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200161018e565b34801561020a57600080fd5b50610181610b9a565b34801561021f57600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006101e6565b34801561025257600080fd5b506101e67f000000000000000000000000000000000000000000000000000000000000000081565b34801561028657600080fd5b506101e67f000000000000000000000000000000000000000000000000000000000000000081565b3480156102ba57600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006101e6565b3480156102ed57600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006101e6565b34801561032057600080fd5b506101e67f000000000000000000000000000000000000000000000000000000000000000081565b34801561035457600080fd5b50610368610363366004611939565b610bb6565b604051901515815260200161018e565b34801561038457600080fd5b50610368610393366004611939565b610c5f565b3480156103a457600080fd5b506103686103b3366004611939565b610ccb565b3480156103c457600080fd5b506103ec7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161018e565b34801561040657600080fd5b506101e67f000000000000000000000000000000000000000000000000000000000000000081565b34801561043a57600080fd5b50610368610449366004611939565b610d37565b600080848060200190518101906104659190611956565b909250905060007f0000000000000000000000000000000000000000000000000000000000000000610497818761199c565b6104a191906119be565b6040805160e08101825263ffffffff808b1682526001600160a01b038089166020808501919091528385018690526060840186905284518086018652601681527e030100110100000000000000000000000000030d400000000000000000000081830152608085015284518082018652600080825260a08601919091528551808301875281815260c08601528551808701909652898652908501529394509092610594917f0000000000000000000000000000000000000000000000000000000000000000909116907f0000000000000000000000000000000000000000000000000000000000000000908690610da316565b6040517fc7c7f5b30000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c7c7f5b39087906105ff90869086908a906004016119d5565b60c06040518083038185885af115801561061d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106429190611add565b50506040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156106ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106cf9190611b71565b90506107256001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f000000000000000000000000000000000000000000000000000000000000000083610ee8565b50505050505050505050565b606060008060008060008061077b89898080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610f3692505050565b95509550955095509550955060006107b07f000000000000000000000000000000000000000000000000000000000000000090565b6001600160a01b0316876001600160a01b03161490506107ed7f000000000000000000000000000000000000000000000000000000000000000090565b6001600160a01b0316300361092557801561083957600063ffffffff84161561082757828060200190518101906108249190611b71565b90505b6108318134611b8a565b9550506109ce565b61086e6001600160a01b038816337f000000000000000000000000000000000000000000000000000000000000000088610f8a565b6001600160a01b0387166370a082317f00000000000000000000000000000000000000000000000000000000000000006040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa1580156108fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091e9190611b71565b94506109ce565b60001985036109ce57801561096357600063ffffffff84161561095957828060200190518101906109569190611b71565b90505b6108318147611b8a565b6040516370a0823160e01b81523060048201526001600160a01b038816906370a0823190602401602060405180830381865afa1580156109a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cb9190611b71565b94505b60408051808201909152600181527f3100000000000000000000000000000000000000000000000000000000000000602082015285610a295760405162461bcd60e51b8152600401610a209190611860565b60405180910390fd5b506040517ffcee45f4000000000000000000000000000000000000000000000000000000008152600481018690526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fcee45f490602401602060405180830381865afa158015610aab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610acf9190611b71565b90508015610b7957610ae18187611b8a565b95508115610b45576040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169082156108fc029083906000818181858888f19350505050158015610b3f573d6000803e3d6000fd5b50610b79565b610b796001600160a01b0389167f000000000000000000000000000000000000000000000000000000000000000083610ee8565b610b89828989848a8a8a8a610fdb565b985050505050505050505b92915050565b604051806060016040528060388152602001611d1d6038913981565b6040517f7e954a710000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301526000917f000000000000000000000000000000000000000000000000000000000000000090911690637e954a71906024015b602060405180830381865afa158015610c3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b949190611b9d565b6040517f975559470000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301526000917f000000000000000000000000000000000000000000000000000000000000000090911690639755594790602401610c1e565b6040517fabe667190000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063abe6671990602401610c1e565b6040517fe34305b10000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063e34305b190602401610c1e565b6040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015610e0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e309190611b71565b9050610ee2847f095ea7b30000000000000000000000000000000000000000000000000000000085610e628686611bbf565b6040516001600160a01b03909216602483015260448201526064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261142b565b50505050565b6040516001600160a01b038316602482015260448101829052610f319084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401610e7e565b505050565b600080600080600060606000806000806000808c806020019051810190610f5d9190611bd2565b9550955095509550955095508585858585859b509b509b509b509b509b5050505050505091939550919395565b6040516001600160a01b0380851660248301528316604482015260648101829052610ee29085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401610e7e565b6040516370a0823160e01b81523060048201526060906000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015611045573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110699190611b71565b9050891561110f577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166372c51c0b8787604051806060016040528060388152602001611d1d603891396040518463ffffffff1660e01b81526004016110d8929190611c99565b6000604051808303818588803b1580156110f157600080fd5b505af1158015611105573d6000803e3d6000fd5b50505050506111e0565b6111436001600160a01b038a167f000000000000000000000000000000000000000000000000000000000000000088610da3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c3ae17668a8888604051806060016040528060388152602001611d1d603891396040518563ffffffff1660e01b81526004016111ad9493929190611cb2565b600060405180830381600087803b1580156111c757600080fd5b505af11580156111db573d6000803e3d6000fd5b505050505b6040516370a0823160e01b815230600482015260009082906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015611249573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126d9190611b71565b6112779190611b8a565b9050858110156112cc57604080518082018252600181527f34000000000000000000000000000000000000000000000000000000000000006020820152905162461bcd60e51b8152610a209190600401611860565b63ffffffff8516156112e9576112e48585838c61044e565b61132d565b6001600160a01b038916301461132d5761132d6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168a83610ee8565b6001600160a01b0389167f0000000000000000000000000000000000000000000000000000000000000000604080516001600160a01b038e81168252602082018d90529181018b9052606081018590529116907f9d428dd8c881eb58945cc39a02a73bd5b035f723884dab68f156a68513dc57e29060800160405180910390a3604080516001808252818301909252600091602080830190803683370190505090507f00000000000000000000000000000000000000000000000000000000000000008160008151811061140357611403611cea565b6001600160a01b03909216602092830291909101909101529250505098975050505050505050565b6000611480826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166115139092919063ffffffff16565b90508051600014806114a15750808060200190518101906114a19190611b9d565b610f315760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610a20565b6060611522848460008561152a565b949350505050565b6060824710156115a25760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610a20565b600080866001600160a01b031685876040516115be9190611d00565b60006040518083038185875af1925050503d80600081146115fb576040519150601f19603f3d011682016040523d82523d6000602084013e611600565b606091505b50915091506116118783838761161c565b979650505050505050565b6060831561168b578251600003611684576001600160a01b0385163b6116845760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a20565b5081611522565b61152283838151156116a05781518083602001fd5b8060405162461bcd60e51b8152600401610a209190611860565b63ffffffff811681146116cc57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561170e5761170e6116cf565b604052919050565b600067ffffffffffffffff821115611730576117306116cf565b50601f01601f191660200190565b6001600160a01b03811681146116cc57600080fd5b803561175e8161173e565b919050565b6000806000806080858703121561177957600080fd5b8435611784816116ba565b9350602085013567ffffffffffffffff8111156117a057600080fd5b8501601f810187136117b157600080fd5b80356117c46117bf82611716565b6116e5565b8181528860208385010111156117d957600080fd5b816020840160208301376000602083830101528095505050506040850135915061180560608601611753565b905092959194509250565b60005b8381101561182b578181015183820152602001611813565b50506000910152565b6000815180845261184c816020860160208601611810565b601f01601f19169290920160200192915050565b6020815260006118736020830184611834565b9392505050565b6000806020838503121561188d57600080fd5b823567ffffffffffffffff808211156118a557600080fd5b818501915085601f8301126118b957600080fd5b8135818111156118c857600080fd5b8660208285010111156118da57600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b8181101561192d5783516001600160a01b031683529284019291840191600101611908565b50909695505050505050565b60006020828403121561194b57600080fd5b81356118738161173e565b6000806040838503121561196957600080fd5b82519150602083015161197b8161173e565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b6000826119b957634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610b9457610b94611986565b6080815263ffffffff8451166080820152602084015160a0820152604084015160c0820152606084015160e08201526000608085015160e0610100840152611a21610160840182611834565b905060a0860151607f198085840301610120860152611a408383611834565b925060c08801519150808584030161014086015250611a5f8282611834565b92505050611a7a602083018580518252602090810151910152565b6001600160a01b0383166060830152611522565b600060408284031215611aa057600080fd5b6040516040810181811067ffffffffffffffff82111715611ac357611ac36116cf565b604052825181526020928301519281019290925250919050565b60008082840360c0811215611af157600080fd5b6080811215611aff57600080fd5b506040516060810167ffffffffffffffff8282108183111715611b2457611b246116cf565b8160405285518352602086015191508082168214611b4157600080fd5b506020820152611b548560408601611a8e565b60408201529150611b688460808501611a8e565b90509250929050565b600060208284031215611b8357600080fd5b5051919050565b81810381811115610b9457610b94611986565b600060208284031215611baf57600080fd5b8151801515811461187357600080fd5b80820180821115610b9457610b94611986565b60008060008060008060c08789031215611beb57600080fd5b8651611bf68161173e565b6020880151909650611c078161173e565b8095505060408701519350606087015192506080870151611c27816116ba565b60a088015190925067ffffffffffffffff811115611c4457600080fd5b8701601f81018913611c5557600080fd5b8051611c636117bf82611716565b8181528a6020838501011115611c7857600080fd5b611c89826020830160208601611810565b8093505050509295509295509295565b8281526040602082015260006115226040830184611834565b6001600160a01b0385168152836020820152826040820152608060608201526000611ce06080830184611834565b9695505050505050565b634e487b7160e01b600052603260045260246000fd5b60008251611d12818460208701611810565b919091019291505056fe3363623263656535353638616134316534356439373731303830666165383439366263313835623962333830613764373733623131616563a2646970667358221220f90c38988bd1fb9d7b5f652f27ba8aacda9f5e940adc202a718951bdbdb54e6464736f6c63430008140033000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006cfff678b05966a27b163bb18bed78ad9c778f84000000000000000000000000036676389e48133b63a802f8635ad39e752d375d000000000000000000000000a1290d69c65a6fe4df752f95823fae25cb99e5a700000000000000000000000085d456b2dff1fd8245387c0bfb64dfb700e98ef3
Deployed Bytecode
0x6080604052600436106101115760003560e01c80636af563e9116100a55780639755594711610074578063b509833e11610059578063b509833e146103b8578063d0fb0203146103fa578063e34305b11461042e57600080fd5b80639755594714610378578063abe667191461039857600080fd5b80636af563e9146102ae5780637104ddb2146102e157806377843ddb146103145780637e954a711461034857600080fd5b8063168673ea116100e1578063168673ea146101fe5780632cebdeb21461021357806335b6d1ba14610246578063602981811461027a57600080fd5b8062b667e41461011d57806306fdde031461013f57806309c5eabe1461019757806311b0b42d146101b757600080fd5b3661011857005b600080fd5b34801561012957600080fd5b5061013d610138366004611763565b61044e565b005b34801561014b57600080fd5b5060408051808201909152600b81527f4b656c704164617074657200000000000000000000000000000000000000000060208201525b60405161018e9190611860565b60405180910390f35b6101aa6101a536600461187a565b610731565b60405161018e91906118ec565b3480156101c357600080fd5b507f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee5b6040516001600160a01b03909116815260200161018e565b34801561020a57600080fd5b50610181610b9a565b34801561021f57600080fd5b507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26101e6565b34801561025257600080fd5b506101e67f000000000000000000000000036676389e48133b63a802f8635ad39e752d375d81565b34801561028657600080fd5b506101e67f000000000000000000000000a1290d69c65a6fe4df752f95823fae25cb99e5a781565b3480156102ba57600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006101e6565b3480156102ed57600080fd5b507f000000000000000000000000b308911c4aca5698d62728597c355c64c978ae326101e6565b34801561032057600080fd5b506101e67f00000000000000000000000085d456b2dff1fd8245387c0bfb64dfb700e98ef381565b34801561035457600080fd5b50610368610363366004611939565b610bb6565b604051901515815260200161018e565b34801561038457600080fd5b50610368610393366004611939565b610c5f565b3480156103a457600080fd5b506103686103b3366004611939565b610ccb565b3480156103c457600080fd5b506103ec7f000000000000000000000000000000000000000000000000000000e8d4a5100081565b60405190815260200161018e565b34801561040657600080fd5b506101e67f0000000000000000000000006cfff678b05966a27b163bb18bed78ad9c778f8481565b34801561043a57600080fd5b50610368610449366004611939565b610d37565b600080848060200190518101906104659190611956565b909250905060007f000000000000000000000000000000000000000000000000000000e8d4a51000610497818761199c565b6104a191906119be565b6040805160e08101825263ffffffff808b1682526001600160a01b038089166020808501919091528385018690526060840186905284518086018652601681527e030100110100000000000000000000000000030d400000000000000000000081830152608085015284518082018652600080825260a08601919091528551808301875281815260c08601528551808701909652898652908501529394509092610594917f000000000000000000000000a1290d69c65a6fe4df752f95823fae25cb99e5a7909116907f00000000000000000000000085d456b2dff1fd8245387c0bfb64dfb700e98ef3908690610da316565b6040517fc7c7f5b30000000000000000000000000000000000000000000000000000000081526001600160a01b037f00000000000000000000000085d456b2dff1fd8245387c0bfb64dfb700e98ef3169063c7c7f5b39087906105ff90869086908a906004016119d5565b60c06040518083038185885af115801561061d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106429190611add565b50506040516370a0823160e01b81523060048201526000907f000000000000000000000000a1290d69c65a6fe4df752f95823fae25cb99e5a76001600160a01b0316906370a0823190602401602060405180830381865afa1580156106ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106cf9190611b71565b90506107256001600160a01b037f000000000000000000000000a1290d69c65a6fe4df752f95823fae25cb99e5a7167f0000000000000000000000006cfff678b05966a27b163bb18bed78ad9c778f8483610ee8565b50505050505050505050565b606060008060008060008061077b89898080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610f3692505050565b95509550955095509550955060006107b07f000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee90565b6001600160a01b0316876001600160a01b03161490506107ed7f000000000000000000000000b308911c4aca5698d62728597c355c64c978ae3290565b6001600160a01b0316300361092557801561083957600063ffffffff84161561082757828060200190518101906108249190611b71565b90505b6108318134611b8a565b9550506109ce565b61086e6001600160a01b038816337f000000000000000000000000b308911c4aca5698d62728597c355c64c978ae3288610f8a565b6001600160a01b0387166370a082317f000000000000000000000000b308911c4aca5698d62728597c355c64c978ae326040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa1580156108fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091e9190611b71565b94506109ce565b60001985036109ce57801561096357600063ffffffff84161561095957828060200190518101906109569190611b71565b90505b6108318147611b8a565b6040516370a0823160e01b81523060048201526001600160a01b038816906370a0823190602401602060405180830381865afa1580156109a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cb9190611b71565b94505b60408051808201909152600181527f3100000000000000000000000000000000000000000000000000000000000000602082015285610a295760405162461bcd60e51b8152600401610a209190611860565b60405180910390fd5b506040517ffcee45f4000000000000000000000000000000000000000000000000000000008152600481018690526000907f0000000000000000000000006cfff678b05966a27b163bb18bed78ad9c778f846001600160a01b03169063fcee45f490602401602060405180830381865afa158015610aab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610acf9190611b71565b90508015610b7957610ae18187611b8a565b95508115610b45576040516001600160a01b037f0000000000000000000000006cfff678b05966a27b163bb18bed78ad9c778f84169082156108fc029083906000818181858888f19350505050158015610b3f573d6000803e3d6000fd5b50610b79565b610b796001600160a01b0389167f0000000000000000000000006cfff678b05966a27b163bb18bed78ad9c778f8483610ee8565b610b89828989848a8a8a8a610fdb565b985050505050505050505b92915050565b604051806060016040528060388152602001611d1d6038913981565b6040517f7e954a710000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301526000917f000000000000000000000000000000000000000000000000000000000000000090911690637e954a71906024015b602060405180830381865afa158015610c3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b949190611b9d565b6040517f975559470000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301526000917f000000000000000000000000000000000000000000000000000000000000000090911690639755594790602401610c1e565b6040517fabe667190000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063abe6671990602401610c1e565b6040517fe34305b10000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063e34305b190602401610c1e565b6040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015610e0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e309190611b71565b9050610ee2847f095ea7b30000000000000000000000000000000000000000000000000000000085610e628686611bbf565b6040516001600160a01b03909216602483015260448201526064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261142b565b50505050565b6040516001600160a01b038316602482015260448101829052610f319084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401610e7e565b505050565b600080600080600060606000806000806000808c806020019051810190610f5d9190611bd2565b9550955095509550955095508585858585859b509b509b509b509b509b5050505050505091939550919395565b6040516001600160a01b0380851660248301528316604482015260648101829052610ee29085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401610e7e565b6040516370a0823160e01b81523060048201526060906000906001600160a01b037f000000000000000000000000a1290d69c65a6fe4df752f95823fae25cb99e5a716906370a0823190602401602060405180830381865afa158015611045573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110699190611b71565b9050891561110f577f000000000000000000000000036676389e48133b63a802f8635ad39e752d375d6001600160a01b03166372c51c0b8787604051806060016040528060388152602001611d1d603891396040518463ffffffff1660e01b81526004016110d8929190611c99565b6000604051808303818588803b1580156110f157600080fd5b505af1158015611105573d6000803e3d6000fd5b50505050506111e0565b6111436001600160a01b038a167f000000000000000000000000036676389e48133b63a802f8635ad39e752d375d88610da3565b7f000000000000000000000000036676389e48133b63a802f8635ad39e752d375d6001600160a01b031663c3ae17668a8888604051806060016040528060388152602001611d1d603891396040518563ffffffff1660e01b81526004016111ad9493929190611cb2565b600060405180830381600087803b1580156111c757600080fd5b505af11580156111db573d6000803e3d6000fd5b505050505b6040516370a0823160e01b815230600482015260009082906001600160a01b037f000000000000000000000000a1290d69c65a6fe4df752f95823fae25cb99e5a716906370a0823190602401602060405180830381865afa158015611249573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126d9190611b71565b6112779190611b8a565b9050858110156112cc57604080518082018252600181527f34000000000000000000000000000000000000000000000000000000000000006020820152905162461bcd60e51b8152610a209190600401611860565b63ffffffff8516156112e9576112e48585838c61044e565b61132d565b6001600160a01b038916301461132d5761132d6001600160a01b037f000000000000000000000000a1290d69c65a6fe4df752f95823fae25cb99e5a7168a83610ee8565b6001600160a01b0389167f000000000000000000000000b308911c4aca5698d62728597c355c64c978ae32604080516001600160a01b038e81168252602082018d90529181018b9052606081018590529116907f9d428dd8c881eb58945cc39a02a73bd5b035f723884dab68f156a68513dc57e29060800160405180910390a3604080516001808252818301909252600091602080830190803683370190505090507f000000000000000000000000a1290d69c65a6fe4df752f95823fae25cb99e5a78160008151811061140357611403611cea565b6001600160a01b03909216602092830291909101909101529250505098975050505050505050565b6000611480826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166115139092919063ffffffff16565b90508051600014806114a15750808060200190518101906114a19190611b9d565b610f315760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610a20565b6060611522848460008561152a565b949350505050565b6060824710156115a25760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610a20565b600080866001600160a01b031685876040516115be9190611d00565b60006040518083038185875af1925050503d80600081146115fb576040519150601f19603f3d011682016040523d82523d6000602084013e611600565b606091505b50915091506116118783838761161c565b979650505050505050565b6060831561168b578251600003611684576001600160a01b0385163b6116845760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a20565b5081611522565b61152283838151156116a05781518083602001fd5b8060405162461bcd60e51b8152600401610a209190611860565b63ffffffff811681146116cc57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561170e5761170e6116cf565b604052919050565b600067ffffffffffffffff821115611730576117306116cf565b50601f01601f191660200190565b6001600160a01b03811681146116cc57600080fd5b803561175e8161173e565b919050565b6000806000806080858703121561177957600080fd5b8435611784816116ba565b9350602085013567ffffffffffffffff8111156117a057600080fd5b8501601f810187136117b157600080fd5b80356117c46117bf82611716565b6116e5565b8181528860208385010111156117d957600080fd5b816020840160208301376000602083830101528095505050506040850135915061180560608601611753565b905092959194509250565b60005b8381101561182b578181015183820152602001611813565b50506000910152565b6000815180845261184c816020860160208601611810565b601f01601f19169290920160200192915050565b6020815260006118736020830184611834565b9392505050565b6000806020838503121561188d57600080fd5b823567ffffffffffffffff808211156118a557600080fd5b818501915085601f8301126118b957600080fd5b8135818111156118c857600080fd5b8660208285010111156118da57600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b8181101561192d5783516001600160a01b031683529284019291840191600101611908565b50909695505050505050565b60006020828403121561194b57600080fd5b81356118738161173e565b6000806040838503121561196957600080fd5b82519150602083015161197b8161173e565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b6000826119b957634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610b9457610b94611986565b6080815263ffffffff8451166080820152602084015160a0820152604084015160c0820152606084015160e08201526000608085015160e0610100840152611a21610160840182611834565b905060a0860151607f198085840301610120860152611a408383611834565b925060c08801519150808584030161014086015250611a5f8282611834565b92505050611a7a602083018580518252602090810151910152565b6001600160a01b0383166060830152611522565b600060408284031215611aa057600080fd5b6040516040810181811067ffffffffffffffff82111715611ac357611ac36116cf565b604052825181526020928301519281019290925250919050565b60008082840360c0811215611af157600080fd5b6080811215611aff57600080fd5b506040516060810167ffffffffffffffff8282108183111715611b2457611b246116cf565b8160405285518352602086015191508082168214611b4157600080fd5b506020820152611b548560408601611a8e565b60408201529150611b688460808501611a8e565b90509250929050565b600060208284031215611b8357600080fd5b5051919050565b81810381811115610b9457610b94611986565b600060208284031215611baf57600080fd5b8151801515811461187357600080fd5b80820180821115610b9457610b94611986565b60008060008060008060c08789031215611beb57600080fd5b8651611bf68161173e565b6020880151909650611c078161173e565b8095505060408701519350606087015192506080870151611c27816116ba565b60a088015190925067ffffffffffffffff811115611c4457600080fd5b8701601f81018913611c5557600080fd5b8051611c636117bf82611716565b8181528a6020838501011115611c7857600080fd5b611c89826020830160208601611810565b8093505050509295509295509295565b8281526040602082015260006115226040830184611834565b6001600160a01b0385168152836020820152826040820152608060608201526000611ce06080830184611834565b9695505050505050565b634e487b7160e01b600052603260045260246000fd5b60008251611d12818460208701611810565b919091019291505056fe3363623263656535353638616134316534356439373731303830666165383439366263313835623962333830613764373733623131616563a2646970667358221220f90c38988bd1fb9d7b5f652f27ba8aacda9f5e940adc202a718951bdbdb54e6464736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006cfff678b05966a27b163bb18bed78ad9c778f84000000000000000000000000036676389e48133b63a802f8635ad39e752d375d000000000000000000000000a1290d69c65a6fe4df752f95823fae25cb99e5a700000000000000000000000085d456b2dff1fd8245387c0bfb64dfb700e98ef3
-----Decoded View---------------
Arg [0] : _native (address): 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
Arg [1] : _wnative (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [2] : _feeManager (address): 0x6CFFf678b05966A27B163BB18BEd78aD9c778F84
Arg [3] : _lrtDepositPool (address): 0x036676389e48133B63a802f8635AD39E752D375D
Arg [4] : _rsEth (address): 0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7
Arg [5] : _lzOft (address): 0x85d456B2DfF1fd8245387C0BfB64Dfb700e98Ef3
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
Arg [1] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [2] : 0000000000000000000000006cfff678b05966a27b163bb18bed78ad9c778f84
Arg [3] : 000000000000000000000000036676389e48133b63a802f8635ad39e752d375d
Arg [4] : 000000000000000000000000a1290d69c65a6fe4df752f95823fae25cb99e5a7
Arg [5] : 00000000000000000000000085d456b2dff1fd8245387c0bfb64dfb700e98ef3
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.