Feature Tip: Add private address tag to any address under My Name Tag !
More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 163 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Mint X Token | 18176021 | 499 days ago | IN | 0.1982 ETH | 0.00317224 | ||||
Mint F Token | 18174971 | 499 days ago | IN | 100 ETH | 0.00386163 | ||||
Mint X Token | 18165098 | 500 days ago | IN | 1 ETH | 0.01100108 | ||||
Mint X Token | 18163635 | 501 days ago | IN | 0.1 ETH | 0.01052456 | ||||
Mint X Token | 18163622 | 501 days ago | IN | 0.02 ETH | 0.01197575 | ||||
Mint F Token | 18163598 | 501 days ago | IN | 0.25 ETH | 0.00949124 | ||||
Mint F Token | 18162487 | 501 days ago | IN | 1 ETH | 0.00372671 | ||||
Mint F Token | 18151326 | 502 days ago | IN | 0.01 ETH | 0.00363887 | ||||
Mint X Token | 18151319 | 502 days ago | IN | 0.01 ETH | 0.0035552 | ||||
Mint X Token | 18149332 | 503 days ago | IN | 0.02 ETH | 0.00312461 | ||||
Mint F Token | 18149321 | 503 days ago | IN | 0.03 ETH | 0.00404437 | ||||
Mint F Token | 18145064 | 503 days ago | IN | 1.27 ETH | 0.00294982 | ||||
Mint X Token | 18139766 | 504 days ago | IN | 100 ETH | 0.00394894 | ||||
Mint X Token | 18138224 | 504 days ago | IN | 0.4 ETH | 0.00476113 | ||||
Mint X Token | 18132622 | 505 days ago | IN | 0.22 ETH | 0.00477191 | ||||
Mint X Token | 18124575 | 506 days ago | IN | 0.1 ETH | 0.00391648 | ||||
Mint X Token | 18120537 | 507 days ago | IN | 0.8 ETH | 0.00971596 | ||||
Mint F Token | 18112121 | 508 days ago | IN | 1 ETH | 0.00395925 | ||||
Mint X Token | 18110027 | 508 days ago | IN | 2 ETH | 0.00256525 | ||||
Mint F Token | 18103980 | 509 days ago | IN | 0.1 ETH | 0.0034652 | ||||
Mint F Token | 18103683 | 509 days ago | IN | 0.1 ETH | 0.00323376 | ||||
Mint F Token | 18102801 | 509 days ago | IN | 0.1 ETH | 0.00281605 | ||||
Mint F Token | 18102798 | 509 days ago | IN | 0.1 ETH | 0.00307937 | ||||
Mint F Token | 18102776 | 509 days ago | IN | 0.1 ETH | 0.00331668 | ||||
Mint F Token | 18098073 | 510 days ago | IN | 0.1 ETH | 0.00398272 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
18176021 | 499 days ago | 0.1982 ETH | ||||
18174971 | 499 days ago | 100 ETH | ||||
18165098 | 500 days ago | 1 ETH | ||||
18163635 | 501 days ago | 0.1 ETH | ||||
18163622 | 501 days ago | 0.02 ETH | ||||
18163598 | 501 days ago | 0.25 ETH | ||||
18162487 | 501 days ago | 1 ETH | ||||
18151326 | 502 days ago | 0.01 ETH | ||||
18151319 | 502 days ago | 0.01 ETH | ||||
18149332 | 503 days ago | 0.02 ETH | ||||
18149321 | 503 days ago | 0.03 ETH | ||||
18145064 | 503 days ago | 1.27 ETH | ||||
18139766 | 504 days ago | 100 ETH | ||||
18138224 | 504 days ago | 0.4 ETH | ||||
18132622 | 505 days ago | 0.22 ETH | ||||
18124575 | 506 days ago | 0.1 ETH | ||||
18124269 | 506 days ago | 0.2 ETH | ||||
18124269 | 506 days ago | 0.2 ETH | ||||
18120537 | 507 days ago | 0.8 ETH | ||||
18118431 | 507 days ago | 32 ETH | ||||
18118431 | 507 days ago | 32 ETH | ||||
18112121 | 508 days ago | 1 ETH | ||||
18110027 | 508 days ago | 2 ETH | ||||
18103980 | 509 days ago | 0.1 ETH | ||||
18103683 | 509 days ago | 0.1 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
stETHGateway
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import { ILidoStETH } from "../../interfaces/ILidoStETH.sol"; import { IMarket } from "../interfaces/IMarket.sol"; // solhint-disable contract-name-camelcase contract stETHGateway { using SafeERC20 for IERC20; /************* * Constants * *************/ /// @dev The address of Lido's stETH token. address public constant stETH = 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84; /// @notice The address of Fractional ETH. address public immutable fToken; /// @notice The address of Leveraged ETH. address public immutable xToken; /// @notice The address of Market. address public immutable market; /************ * Modifier * ************/ constructor( address _market, address _fToken, address _xToken ) { market = _market; fToken = _fToken; xToken = _xToken; IERC20(stETH).safeApprove(_market, uint256(-1)); IERC20(_fToken).safeApprove(_market, uint256(-1)); IERC20(_xToken).safeApprove(_market, uint256(-1)); } receive() external payable {} /**************************** * Public Mutated Functions * ****************************/ /// @notice Mint some fToken with some ETH. /// @param _minFTokenMinted The minimum amount of fToken should be received. /// @return _fTokenMinted The amount of fToken should be received. function mintFToken(uint256 _minFTokenMinted) external payable returns (uint256 _fTokenMinted) { ILidoStETH(stETH).submit{ value: msg.value }(address(0)); _fTokenMinted = IMarket(market).mintFToken(msg.value, msg.sender, _minFTokenMinted); _refund(stETH, msg.sender); } /// @notice Mint some xToken with some ETH. /// @param _minXTokenMinted The minimum amount of xToken should be received. /// @return _xTokenMinted The amount of xToken should be received. function mintXToken(uint256 _minXTokenMinted) external payable returns (uint256 _xTokenMinted) { ILidoStETH(stETH).submit{ value: msg.value }(address(0)); _xTokenMinted = IMarket(market).mintXToken(msg.value, msg.sender, _minXTokenMinted); _refund(stETH, msg.sender); } /// @notice Mint some xToken by add some ETH as collateral. /// @param _minXTokenMinted The minimum amount of xToken should be received. /// @return _xTokenMinted The amount of xToken should be received. function addBaseToken(uint256 _minXTokenMinted) external payable returns (uint256 _xTokenMinted) { ILidoStETH(stETH).submit{ value: msg.value }(address(0)); _xTokenMinted = IMarket(market).addBaseToken(msg.value, msg.sender, _minXTokenMinted); _refund(stETH, msg.sender); } /********************** * Internal Functions * **********************/ /// @dev Internal function to transfer token to this contract. /// @param _token The address of token to transfer. /// @param _amount The amount of token to transfer. /// @return uint256 The amount of token transfered. function _transferTokenIn(address _token, uint256 _amount) internal returns (uint256) { if (_amount == uint256(-1)) { _amount = IERC20(_token).balanceOf(msg.sender); } if (_amount > 0) { IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount); } return _amount; } /// @dev Internal function to refund extra token. /// @param _token The address of token to refund. /// @param _recipient The address of the token receiver. function _refund(address _token, address _recipient) internal { uint256 _balance = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeTransfer(_recipient, _balance); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; interface IMarket { /********** * Events * **********/ /// @notice Emitted when fToken or xToken is minted. /// @param owner The address of base token owner. /// @param recipient The address of receiver for fToken or xToken. /// @param baseTokenIn The amount of base token deposited. /// @param fTokenOut The amount of fToken minted. /// @param xTokenOut The amount of xToken minted. /// @param mintFee The amount of mint fee charged. event Mint( address indexed owner, address indexed recipient, uint256 baseTokenIn, uint256 fTokenOut, uint256 xTokenOut, uint256 mintFee ); /// @notice Emitted when someone redeem base token with fToken or xToken. /// @param owner The address of fToken and xToken owner. /// @param recipient The address of receiver for base token. /// @param fTokenBurned The amount of fToken burned. /// @param xTokenBurned The amount of xToken burned. /// @param baseTokenOut The amount of base token redeemed. /// @param redeemFee The amount of redeem fee charged. event Redeem( address indexed owner, address indexed recipient, uint256 fTokenBurned, uint256 xTokenBurned, uint256 baseTokenOut, uint256 redeemFee ); /// @notice Emitted when someone add more base token. /// @param owner The address of base token owner. /// @param recipient The address of receiver for fToken or xToken. /// @param baseTokenIn The amount of base token deposited. /// @param xTokenMinted The amount of xToken minted. event AddCollateral(address indexed owner, address indexed recipient, uint256 baseTokenIn, uint256 xTokenMinted); /// @notice Emitted when someone liquidate with fToken. /// @param owner The address of fToken and xToken owner. /// @param recipient The address of receiver for base token. /// @param fTokenBurned The amount of fToken burned. /// @param baseTokenOut The amount of base token redeemed. event UserLiquidate(address indexed owner, address indexed recipient, uint256 fTokenBurned, uint256 baseTokenOut); /// @notice Emitted when self liquidate with fToken. /// @param caller The address of caller. /// @param baseSwapAmt The amount of base token used to swap. /// @param baseTokenOut The amount of base token redeemed. /// @param fTokenBurned The amount of fToken liquidated. event SelfLiquidate(address indexed caller, uint256 baseSwapAmt, uint256 baseTokenOut, uint256 fTokenBurned); /**************************** * Public Mutated Functions * ****************************/ /// @notice Mint both fToken and xToken with some base token. /// @param baseIn The amount of base token supplied. /// @param recipient The address of receiver for fToken and xToken. /// @param minFTokenMinted The minimum amount of fToken should be received. /// @param minXTokenMinted The minimum amount of xToken should be received. /// @return fTokenMinted The amount of fToken should be received. /// @return xTokenMinted The amount of xToken should be received. function mint( uint256 baseIn, address recipient, uint256 minFTokenMinted, uint256 minXTokenMinted ) external returns (uint256 fTokenMinted, uint256 xTokenMinted); /// @notice Mint some fToken with some base token. /// @param baseIn The amount of base token supplied, use `uint256(-1)` to supply all base token. /// @param recipient The address of receiver for fToken. /// @param minFTokenMinted The minimum amount of fToken should be received. /// @return fTokenMinted The amount of fToken should be received. function mintFToken( uint256 baseIn, address recipient, uint256 minFTokenMinted ) external returns (uint256 fTokenMinted); /// @notice Mint some xToken with some base token. /// @param baseIn The amount of base token supplied, use `uint256(-1)` to supply all base token. /// @param recipient The address of receiver for xToken. /// @param minXTokenMinted The minimum amount of xToken should be received. /// @return xTokenMinted The amount of xToken should be received. function mintXToken( uint256 baseIn, address recipient, uint256 minXTokenMinted ) external returns (uint256 xTokenMinted); /// @notice Mint some xToken by add some base token as collateral. /// @param baseIn The amount of base token supplied, use `uint256(-1)` to supply all base token. /// @param recipient The address of receiver for xToken. /// @param minXTokenMinted The minimum amount of xToken should be received. /// @return xTokenMinted The amount of xToken should be received. function addBaseToken( uint256 baseIn, address recipient, uint256 minXTokenMinted ) external returns (uint256 xTokenMinted); /// @notice Redeem base token with fToken and xToken. /// @param fTokenIn the amount of fToken to redeem, use `uint256(-1)` to redeem all fToken. /// @param xTokenIn the amount of xToken to redeem, use `uint256(-1)` to redeem all xToken. /// @param recipient The address of receiver for base token. /// @param minBaseOut The minimum amount of base token should be received. /// @return baseOut The amount of base token should be received. function redeem( uint256 fTokenIn, uint256 xTokenIn, address recipient, uint256 minBaseOut ) external returns (uint256 baseOut); /// @notice Permissionless liquidate some fToken to increase the collateral ratio. /// @param fTokenIn the amount of fToken to supply, use `uint256(-1)` to liquidate all fToken. /// @param recipient The address of receiver for base token. /// @param minBaseOut The minimum amount of base token should be received. /// @return baseOut The amount of base token should be received. function liquidate( uint256 fTokenIn, address recipient, uint256 minBaseOut ) external returns (uint256 baseOut); /// @notice Self liquidate some fToken to increase the collateral ratio. /// @param baseSwapAmt The amount of base token to swap. /// @param minFTokenLiquidated The minimum amount of fToken should be liquidated. /// @param data The data used to swap base token to fToken. /// @return baseOut The amount of base token should be received. /// @return fTokenLiquidated the amount of fToken liquidated. function selfLiquidate( uint256 baseSwapAmt, uint256 minFTokenLiquidated, bytes calldata data ) external returns (uint256 baseOut, uint256 fTokenLiquidated); /// @notice Callback to swap base token to fToken /// @param baseSwapAmt The amount of base token to swap. /// @param data The data passed to market contract. /// @return fTokenAmt The amount of fToken received. function onSelfLiquidate(uint256 baseSwapAmt, bytes calldata data) external returns (uint256 fTokenAmt); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; interface ILidoStETH { function submit(address _referral) external payable returns (uint256); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_market","type":"address"},{"internalType":"address","name":"_fToken","type":"address"},{"internalType":"address","name":"_xToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"_minXTokenMinted","type":"uint256"}],"name":"addBaseToken","outputs":[{"internalType":"uint256","name":"_xTokenMinted","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"fToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"market","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minFTokenMinted","type":"uint256"}],"name":"mintFToken","outputs":[{"internalType":"uint256","name":"_fTokenMinted","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minXTokenMinted","type":"uint256"}],"name":"mintXToken","outputs":[{"internalType":"uint256","name":"_xTokenMinted","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"stETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60e06040523480156200001157600080fd5b506040516200109c3803806200109c833981810160405260608110156200003757600080fd5b5080516020808301516040909301516001600160601b0319606084811b821660c05285811b821660805282901b1660a052919291906200009c9073ae7ab96520de3a18e5e111b5eaab095312d7fe849085906000199062000546620000f3821b17901c565b620000c383600019846001600160a01b0316620000f360201b62000546179092919060201c565b620000ea83600019836001600160a01b0316620000f360201b62000546179092919060201c565b50505062000505565b8015806200017d575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b1580156200014d57600080fd5b505afa15801562000162573d6000803e3d6000fd5b505050506040513d60208110156200017957600080fd5b5051155b620001ba5760405162461bcd60e51b8152600401808060200182810382526036815260200180620010666036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152620002129185916200021716565b505050565b600062000273826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316620002d360201b6200065e179092919060201c565b80519091501562000212578080602001905160208110156200029457600080fd5b5051620002125760405162461bcd60e51b815260040180806020018281038252602a8152602001806200103c602a913960400191505060405180910390fd5b6060620002e48484600085620002ee565b90505b9392505050565b606082471015620003315760405162461bcd60e51b8152600401808060200182810382526026815260200180620010166026913960400191505060405180910390fd5b6200033c8562000455565b6200038e576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310620003ce5780518252601f199092019160209182019101620003ad565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811462000432576040519150601f19603f3d011682016040523d82523d6000602084013e62000437565b606091505b5090925090506200044a8282866200045b565b979650505050505050565b3b151590565b606083156200046c575081620002e7565b8251156200047d5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015620004c9578181015183820152602001620004af565b50505050905090810190601f168015620004f75780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b60805160601c60a05160601c60c05160601c610acc6200054a6000398061023d52806102d852806103ba52806104fe52508061015b5250806104045250610acc6000f3fe6080604052600436106100745760003560e01c80639ea044cf1161004e5780639ea044cf146100f5578063a8694e5714610112578063c1fe3e4814610127578063fe6173001461013c5761007b565b8063088b699e146100805780630f513f46146100b157806380f55605146100e05761007b565b3661007b57005b600080fd5b34801561008c57600080fd5b50610095610159565b604080516001600160a01b039092168252519081900360200190f35b6100ce600480360360208110156100c757600080fd5b503561017d565b60408051918252519081900360200190f35b3480156100ec57600080fd5b506100956102d6565b6100ce6004803603602081101561010b57600080fd5b50356102fa565b34801561011e57600080fd5b50610095610402565b34801561013357600080fd5b50610095610426565b6100ce6004803603602081101561015257600080fd5b503561043e565b7f000000000000000000000000000000000000000000000000000000000000000081565b600073ae7ab96520de3a18e5e111b5eaab095312d7fe846001600160a01b031663a1903eab3460006040518363ffffffff1660e01b815260040180826001600160a01b031681526020019150506020604051808303818588803b1580156101e357600080fd5b505af11580156101f7573d6000803e3d6000fd5b50505050506040513d602081101561020e57600080fd5b505060408051630c26a4ed60e41b81523460048201523360248201526044810184905290516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163c26a4ed09160648083019260209291908290030181600087803b15801561028557600080fd5b505af1158015610299573d6000803e3d6000fd5b505050506040513d60208110156102af57600080fd5b505190506102d173ae7ab96520de3a18e5e111b5eaab095312d7fe8433610677565b919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600073ae7ab96520de3a18e5e111b5eaab095312d7fe846001600160a01b031663a1903eab3460006040518363ffffffff1660e01b815260040180826001600160a01b031681526020019150506020604051808303818588803b15801561036057600080fd5b505af1158015610374573d6000803e3d6000fd5b50505050506040513d602081101561038b57600080fd5b5050604080516364c9b4c360e01b81523460048201523360248201526044810184905290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916364c9b4c39160648083019260209291908290030181600087803b15801561028557600080fd5b7f000000000000000000000000000000000000000000000000000000000000000081565b73ae7ab96520de3a18e5e111b5eaab095312d7fe8481565b600073ae7ab96520de3a18e5e111b5eaab095312d7fe846001600160a01b031663a1903eab3460006040518363ffffffff1660e01b815260040180826001600160a01b031681526020019150506020604051808303818588803b1580156104a457600080fd5b505af11580156104b8573d6000803e3d6000fd5b50505050506040513d60208110156104cf57600080fd5b50506040805163b556747360e01b81523460048201523360248201526044810184905290516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163b55674739160648083019260209291908290030181600087803b15801561028557600080fd5b8015806105cc575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561059e57600080fd5b505afa1580156105b2573d6000803e3d6000fd5b505050506040513d60208110156105c857600080fd5b5051155b6106075760405162461bcd60e51b8152600401808060200182810382526036815260200180610a616036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052610659908490610708565b505050565b606061066d84846000856107b9565b90505b9392505050565b6000826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156106c657600080fd5b505afa1580156106da573d6000803e3d6000fd5b505050506040513d60208110156106f057600080fd5b505190506106596001600160a01b0384168383610914565b600061075d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661065e9092919063ffffffff16565b8051909150156106595780806020019051602081101561077c57600080fd5b50516106595760405162461bcd60e51b815260040180806020018281038252602a815260200180610a37602a913960400191505060405180910390fd5b6060824710156107fa5760405162461bcd60e51b8152600401808060200182810382526026815260200180610a116026913960400191505060405180910390fd5b61080385610966565b610854576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106108925780518252601f199092019160209182019101610873565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146108f4576040519150601f19603f3d011682016040523d82523d6000602084013e6108f9565b606091505b509150915061090982828661096c565b979650505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610659908490610708565b3b151590565b6060831561097b575081610670565b82511561098b5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156109d55781810151838201526020016109bd565b50505050905090810190601f168015610a025780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220717555cb16c24b9c6b21c0fc291a353bdd94c22b84ac059a5c00dc267a7df6b264736f6c63430007060033416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db00000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e633726000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae2
Deployed Bytecode
0x6080604052600436106100745760003560e01c80639ea044cf1161004e5780639ea044cf146100f5578063a8694e5714610112578063c1fe3e4814610127578063fe6173001461013c5761007b565b8063088b699e146100805780630f513f46146100b157806380f55605146100e05761007b565b3661007b57005b600080fd5b34801561008c57600080fd5b50610095610159565b604080516001600160a01b039092168252519081900360200190f35b6100ce600480360360208110156100c757600080fd5b503561017d565b60408051918252519081900360200190f35b3480156100ec57600080fd5b506100956102d6565b6100ce6004803603602081101561010b57600080fd5b50356102fa565b34801561011e57600080fd5b50610095610402565b34801561013357600080fd5b50610095610426565b6100ce6004803603602081101561015257600080fd5b503561043e565b7f000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae281565b600073ae7ab96520de3a18e5e111b5eaab095312d7fe846001600160a01b031663a1903eab3460006040518363ffffffff1660e01b815260040180826001600160a01b031681526020019150506020604051808303818588803b1580156101e357600080fd5b505af11580156101f7573d6000803e3d6000fd5b50505050506040513d602081101561020e57600080fd5b505060408051630c26a4ed60e41b81523460048201523360248201526044810184905290516001600160a01b037f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db169163c26a4ed09160648083019260209291908290030181600087803b15801561028557600080fd5b505af1158015610299573d6000803e3d6000fd5b505050506040513d60208110156102af57600080fd5b505190506102d173ae7ab96520de3a18e5e111b5eaab095312d7fe8433610677565b919050565b7f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db81565b600073ae7ab96520de3a18e5e111b5eaab095312d7fe846001600160a01b031663a1903eab3460006040518363ffffffff1660e01b815260040180826001600160a01b031681526020019150506020604051808303818588803b15801561036057600080fd5b505af1158015610374573d6000803e3d6000fd5b50505050506040513d602081101561038b57600080fd5b5050604080516364c9b4c360e01b81523460048201523360248201526044810184905290516001600160a01b037f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db16916364c9b4c39160648083019260209291908290030181600087803b15801561028557600080fd5b7f00000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e63372681565b73ae7ab96520de3a18e5e111b5eaab095312d7fe8481565b600073ae7ab96520de3a18e5e111b5eaab095312d7fe846001600160a01b031663a1903eab3460006040518363ffffffff1660e01b815260040180826001600160a01b031681526020019150506020604051808303818588803b1580156104a457600080fd5b505af11580156104b8573d6000803e3d6000fd5b50505050506040513d60208110156104cf57600080fd5b50506040805163b556747360e01b81523460048201523360248201526044810184905290516001600160a01b037f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db169163b55674739160648083019260209291908290030181600087803b15801561028557600080fd5b8015806105cc575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561059e57600080fd5b505afa1580156105b2573d6000803e3d6000fd5b505050506040513d60208110156105c857600080fd5b5051155b6106075760405162461bcd60e51b8152600401808060200182810382526036815260200180610a616036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052610659908490610708565b505050565b606061066d84846000856107b9565b90505b9392505050565b6000826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156106c657600080fd5b505afa1580156106da573d6000803e3d6000fd5b505050506040513d60208110156106f057600080fd5b505190506106596001600160a01b0384168383610914565b600061075d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661065e9092919063ffffffff16565b8051909150156106595780806020019051602081101561077c57600080fd5b50516106595760405162461bcd60e51b815260040180806020018281038252602a815260200180610a37602a913960400191505060405180910390fd5b6060824710156107fa5760405162461bcd60e51b8152600401808060200182810382526026815260200180610a116026913960400191505060405180910390fd5b61080385610966565b610854576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106108925780518252601f199092019160209182019101610873565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146108f4576040519150601f19603f3d011682016040523d82523d6000602084013e6108f9565b606091505b509150915061090982828661096c565b979650505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610659908490610708565b3b151590565b6060831561097b575081610670565b82511561098b5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156109d55781810151838201526020016109bd565b50505050905090810190601f168015610a025780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220717555cb16c24b9c6b21c0fc291a353bdd94c22b84ac059a5c00dc267a7df6b264736f6c63430007060033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db00000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e633726000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae2
-----Decoded View---------------
Arg [0] : _market (address): 0xe7b9c7c9cA85340b8c06fb805f7775e3015108dB
Arg [1] : _fToken (address): 0x53805A76E1f5ebbFE7115F16f9c87C2f7e633726
Arg [2] : _xToken (address): 0xe063F04f280c60aECa68b38341C2eEcBeC703ae2
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db
Arg [1] : 00000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e633726
Arg [2] : 000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae2
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.