Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 5 from a total of 5 transactions
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
OtcOffer
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 999999 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity 0.8.19; // SPDX-License-Identifier: AGPL-3.0-or-later // Temple (core/OtcOffer.sol) import { Pausable } from "@openzeppelin/contracts/security/Pausable.sol"; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import { CommonEventsAndErrors } from "contracts/common/CommonEventsAndErrors.sol"; /** * @title OTC Offer * * @notice Temple offers OTC purchases to users on certain tokens - slippage and price impact free. * Temple sets the offer price and users can swap tokens for any arbitrary size at this price, up to some * max amount of treasury funds (determined by the `fundsOwner` balance and ERC20 approvals). */ contract OtcOffer is Pausable, Ownable { using SafeERC20 for IERC20Metadata; /// @notice The token that the user will sell IERC20Metadata public immutable userSellToken; /// @notice The token that the user will buy IERC20Metadata public immutable userBuyToken; /// @notice Where to pull the `userBuyToken` from, and to send the `userSellToken` /// @dev The funds owner must grant approval for this contract to pull the `userBuyToken` address public fundsOwner; /// @notice The number of decimal places represented by `offerPrice` uint8 public constant OFFER_PRICE_DECIMALS = 18; /// @notice The offer price, specified in terms of `offerPricingToken`. uint256 public offerPrice; enum OfferPricingToken { /// @notice The offerPrice 'pricing' token is defined in terms of the `userBuyToken` /// ie price is userBuyToken / userSellToken /// eg when user sells OHM to buy DAI, the price is defined in terms of DAI/OHM UserBuyToken, /// @notice The offerPrice 'pricing' token is defined in terms of the `userBuyToken` /// ie price is userSellToken / userBuyToken /// eg when user sells DAI to buy OHM, the price can still be defined in terms of DAI/OHM UserSellToken } /// @notice Which token the `offerPrice` is defined in terms of. OfferPricingToken public immutable offerPricingToken; // @notice How to scale the fixed point buyTokenAmount given differences in token decimal places. uint256 public immutable scalar; // @notice The minimum valid offer price (in order to avoid an incorrectly set/fat fingered price being set) uint128 public minValidOfferPrice; // @notice The maximum valid offer price (in order to avoid an incorrectly set/fat fingered price being set) uint128 public maxValidOfferPrice; event OfferPriceSet(uint256 _offerPrice); event OfferPriceRangeSet(uint128 minValidOfferPrice, uint128 maxValidOfferPrice); event Swap(address indexed account, address indexed fundsOwner, uint256 userSellTokenAmount, uint256 userBuyTokenAmount); event FundsOwnerSet(address indexed fundsOwner); error OfferPriceNotValid(); constructor( address _userSellToken, address _userBuyToken, address _fundsOwner, uint256 _offerPrice, OfferPricingToken _offerPricingToken, uint128 _minValidOfferPrice, uint128 _maxValidOfferPrice ) { userSellToken = IERC20Metadata(_userSellToken); userBuyToken = IERC20Metadata(_userBuyToken); fundsOwner = _fundsOwner; offerPrice = _offerPrice; offerPricingToken = _offerPricingToken; minValidOfferPrice = _minValidOfferPrice; maxValidOfferPrice = _maxValidOfferPrice; // The price is always specified in 18dp // Eg If selling OHM (9dp) for USDC (6dp): // 1000 OHM (9dp) * 11 USDC/OHM (18dp) = 11_000 USDC (6dp) // So this would need to get scaled down by 30dp uint256 scaleDecimals = offerPricingToken == OfferPricingToken.UserBuyToken ? OFFER_PRICE_DECIMALS + userSellToken.decimals() - userBuyToken.decimals() : OFFER_PRICE_DECIMALS + userBuyToken.decimals() - userSellToken.decimals(); scalar = 10 ** scaleDecimals; } /// @notice Owner can pause user swaps from occuring function pause() external onlyOwner { _pause(); } /// @notice Owner can unpause so user swaps can occur function unpause() external onlyOwner { _unpause(); } /// @notice Owner can update where the funds are pulled from and sent to upon a swap function setFundsOwner(address _fundsOwner) external onlyOwner { if (_fundsOwner == address(0)) revert CommonEventsAndErrors.InvalidAddress(); fundsOwner = _fundsOwner; emit FundsOwnerSet(_fundsOwner); } /// @notice Owner can update the offer price at which user swaps can occur /// @dev The new price must be within the `minValidOfferPrice` <= price <= `maxValidOfferPrice` range function setOfferPrice(uint256 _offerPrice) external onlyOwner { if (_offerPrice < minValidOfferPrice || _offerPrice > maxValidOfferPrice) revert OfferPriceNotValid(); offerPrice = _offerPrice; emit OfferPriceSet(_offerPrice); } /// @notice Owner can update the threshold for when updating the offer price function setOfferPriceRange(uint128 _minValidOfferPrice, uint128 _maxValidOfferPrice) external onlyOwner { if (_minValidOfferPrice > _maxValidOfferPrice) revert CommonEventsAndErrors.InvalidParam(); minValidOfferPrice = _minValidOfferPrice; maxValidOfferPrice = _maxValidOfferPrice; emit OfferPriceRangeSet(_minValidOfferPrice, _maxValidOfferPrice); } /// @notice Swap `userSellToken` for `userBuyToken`, at the `offerPrice` function swap(uint256 sellTokenAmount) external whenNotPaused returns (uint256 buyTokenAmount) { if (sellTokenAmount == 0) revert CommonEventsAndErrors.ExpectedNonZero(); buyTokenAmount = quote(sellTokenAmount); address _fundsOwner = fundsOwner; emit Swap(msg.sender, _fundsOwner, sellTokenAmount, buyTokenAmount); userSellToken.safeTransferFrom(msg.sender, _fundsOwner, sellTokenAmount); userBuyToken.safeTransferFrom(_fundsOwner, msg.sender, buyTokenAmount); } /// @notice How many `userBuyToken` you would receive given an amount of `sellTokenAmount` function quote(uint256 sellTokenAmount) public view returns (uint256 buyTokenAmount) { buyTokenAmount = offerPricingToken == OfferPricingToken.UserBuyToken ? sellTokenAmount * offerPrice / scalar : sellTokenAmount * scalar / offerPrice; } /** * @notice The available funds for a user swap is goverend by the amount of `userBuyToken` that * the `fundsOwner` has available. * @dev The minimum of the `fundsOwner` balance of `userBuyToken`, and the spending * approval from `fundsOwner` to this OtcOffer contract. */ function userBuyTokenAvailable() external view returns (uint256) { address _fundsOwner = fundsOwner; uint256 _balance = userBuyToken.balanceOf(_fundsOwner); uint256 _allowance = userBuyToken.allowance(_fundsOwner, address(this)); return _balance < _allowance ? _balance : _allowance; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (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. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.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 // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
pragma solidity 0.8.19; // SPDX-License-Identifier: AGPL-3.0-or-later // Temple (common/CommonEventsAndErrors.sol) /// @notice A collection of common errors thrown within the Temple contracts library CommonEventsAndErrors { error InsufficientBalance(address token, uint256 required, uint256 balance); error InvalidParam(); error InvalidAddress(); error InvalidAccess(); error InvalidAmount(address token, uint256 amount); error ExpectedNonZero(); error Unimplemented(); event TokenRecovered(address indexed to, address indexed token, uint256 amount); }
{ "optimizer": { "enabled": true, "runs": 999999 }, "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":"_userSellToken","type":"address"},{"internalType":"address","name":"_userBuyToken","type":"address"},{"internalType":"address","name":"_fundsOwner","type":"address"},{"internalType":"uint256","name":"_offerPrice","type":"uint256"},{"internalType":"enum OtcOffer.OfferPricingToken","name":"_offerPricingToken","type":"uint8"},{"internalType":"uint128","name":"_minValidOfferPrice","type":"uint128"},{"internalType":"uint128","name":"_maxValidOfferPrice","type":"uint128"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ExpectedNonZero","type":"error"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[],"name":"InvalidParam","type":"error"},{"inputs":[],"name":"OfferPriceNotValid","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"fundsOwner","type":"address"}],"name":"FundsOwnerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint128","name":"minValidOfferPrice","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"maxValidOfferPrice","type":"uint128"}],"name":"OfferPriceRangeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_offerPrice","type":"uint256"}],"name":"OfferPriceSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"fundsOwner","type":"address"},{"indexed":false,"internalType":"uint256","name":"userSellTokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"userBuyTokenAmount","type":"uint256"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"OFFER_PRICE_DECIMALS","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fundsOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxValidOfferPrice","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minValidOfferPrice","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"offerPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"offerPricingToken","outputs":[{"internalType":"enum OtcOffer.OfferPricingToken","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"sellTokenAmount","type":"uint256"}],"name":"quote","outputs":[{"internalType":"uint256","name":"buyTokenAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"scalar","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_fundsOwner","type":"address"}],"name":"setFundsOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_offerPrice","type":"uint256"}],"name":"setOfferPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"_minValidOfferPrice","type":"uint128"},{"internalType":"uint128","name":"_maxValidOfferPrice","type":"uint128"}],"name":"setOfferPriceRange","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"sellTokenAmount","type":"uint256"}],"name":"swap","outputs":[{"internalType":"uint256","name":"buyTokenAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"userBuyToken","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"userBuyTokenAvailable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"userSellToken","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6101006040523480156200001257600080fd5b50604051620019ae380380620019ae833981016040819052620000359162000366565b6000805460ff191690556200004a33620002d8565b6001600160a01b0387811660805286811660a052600180546001600160a01b031916918716919091178155600285905583908111156200008e576200008e620003f7565b60c0816001811115620000a557620000a5620003f7565b9052506001600160801b03818116600160801b029083161760035560008060c0516001811115620000da57620000da620003f7565b14620001cd576080516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000121573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200014791906200040d565b60a0516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000188573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001ae91906200040d565b620001bb9060126200044f565b620001c7919062000471565b620002b4565b60a0516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200020e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200023491906200040d565b6080516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000275573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029b91906200040d565b620002a89060126200044f565b620002b4919062000471565b60ff169050620002c681600a6200058a565b60e05250620005989650505050505050565b600080546001600160a01b03838116610100818102610100600160a81b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b80516001600160a01b03811681146200034957600080fd5b919050565b80516001600160801b03811681146200034957600080fd5b600080600080600080600060e0888a0312156200038257600080fd5b6200038d8862000331565b96506200039d6020890162000331565b9550620003ad6040890162000331565b945060608801519350608088015160028110620003c957600080fd5b9250620003d960a089016200034e565b9150620003e960c089016200034e565b905092959891949750929550565b634e487b7160e01b600052602160045260246000fd5b6000602082840312156200042057600080fd5b815160ff811681146200043257600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b60ff81811683821601908111156200046b576200046b62000439565b92915050565b60ff82811682821603908111156200046b576200046b62000439565b600181815b80851115620004ce578160001904821115620004b257620004b262000439565b80851615620004c057918102915b93841c939080029062000492565b509250929050565b600082620004e7575060016200046b565b81620004f6575060006200046b565b81600181146200050f57600281146200051a576200053a565b60019150506200046b565b60ff8411156200052e576200052e62000439565b50506001821b6200046b565b5060208310610133831016604e8410600b84101617156200055f575081810a6200046b565b6200056b83836200048d565b806000190482111562000582576200058262000439565b029392505050565b6000620004328383620004d6565b60805160a05160c05160e0516113ab62000603600039600081816103b80152818161097001526109a601526000818161035e0152610933015260008181610282015281816105e8015281816107ee01526108aa01526000818161018101526105a601526113ab6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c8063963d3715116100d8578063b873d8061161008c578063ed1bd76c11610066578063ed1bd76c1461038d578063f2fde38b146103a0578063f45e65d8146103b357600080fd5b8063b873d80614610337578063db590eac14610351578063eb99da4a1461035957600080fd5b8063aa13372e116100bd578063aa13372e146102b7578063ac12ea8e14610308578063aec1c3271461032457600080fd5b8063963d37151461027d578063972973e7146102a457600080fd5b80635c975abb1161012f5780638456cb59116101145780638456cb591461023f5780638da5cb5b1461024757806394b918de1461026a57600080fd5b80635c975abb14610221578063715018a61461023757600080fd5b80633f4ba83a116101605780633f4ba83a146101e45780633f7af9ea146101ee57806346ee3c591461020157600080fd5b80631980872e1461017c5780633bf19e29146101cd575b600080fd5b6101a37f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6101d660025481565b6040519081526020016101c4565b6101ec6103da565b005b6101ec6101fc366004611137565b6103ec565b6001546101a39073ffffffffffffffffffffffffffffffffffffffff1681565b60005460ff1660405190151581526020016101c4565b6101ec6104c1565b6101ec6104d3565b600054610100900473ffffffffffffffffffffffffffffffffffffffff166101a3565b6101d661027836600461116a565b6104e3565b6101a37f000000000000000000000000000000000000000000000000000000000000000081565b6101ec6102b236600461116a565b610616565b6003546102e79070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1681565b6040516fffffffffffffffffffffffffffffffff90911681526020016101c4565b6003546102e7906fffffffffffffffffffffffffffffffff1681565b6101ec610332366004611183565b6106d9565b61033f601281565b60405160ff90911681526020016101c4565b6101d661079d565b6103807f000000000000000000000000000000000000000000000000000000000000000081565b6040516101c491906111ef565b6101d661039b36600461116a565b61092e565b6101ec6103ae366004611183565b6109e3565b6101d67f000000000000000000000000000000000000000000000000000000000000000081565b6103e2610a9f565b6103ea610b26565b565b6103f4610a9f565b806fffffffffffffffffffffffffffffffff16826fffffffffffffffffffffffffffffffff161115610452576040517fd252903400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6fffffffffffffffffffffffffffffffff82811670010000000000000000000000000000000091831691820281176003556040805191825260208201929092527f3cb7aa6ad329dbbae3ba64a123b11b3d714240d6b16f448bb41e815b7618b9ef910160405180910390a15050565b6104c9610a9f565b6103ea6000610ba3565b6104db610a9f565b6103ea610c20565b60006104ed610c7b565b81600003610527576040517f54db0c8c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105308261092e565b600154604080518581526020810184905292935073ffffffffffffffffffffffffffffffffffffffff90911691829133917ffa2dda1cc1b86e41239702756b13effbc1a092b5c57e3ad320fbe4f3b13fe235910160405180910390a36105ce73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016338386610ce8565b61061073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016823385610ce8565b50919050565b61061e610a9f565b6003546fffffffffffffffffffffffffffffffff16811080610667575060035470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1681115b1561069e576040517f9aa5f25100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60028190556040518181527f58af8a859607b837cd10bfb8098d6da3c00d714fd6a1a9b7c764533d1fcb17df9060200160405180910390a150565b6106e1610a9f565b73ffffffffffffffffffffffffffffffffffffffff811661072e576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517ffc96af5cc8fe5d8e2880342c1ad3fbe1731bccf067275cd1fced2f4f8f13512d90600090a250565b6001546040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201819052600092909183917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610835573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108599190611230565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301523060248301529192506000917f0000000000000000000000000000000000000000000000000000000000000000169063dd62ed3e90604401602060405180830381865afa1580156108f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109159190611230565b90508082106109245780610926565b815b935050505090565b6000807f00000000000000000000000000000000000000000000000000000000000000006001811115610963576109636111c0565b146109a4576002546109957f000000000000000000000000000000000000000000000000000000000000000084611249565b61099f9190611287565b6109dd565b7f0000000000000000000000000000000000000000000000000000000000000000600254836109d39190611249565b6109dd9190611287565b92915050565b6109eb610a9f565b73ffffffffffffffffffffffffffffffffffffffff8116610a93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610a9c81610ba3565b50565b60005473ffffffffffffffffffffffffffffffffffffffff6101009091041633146103ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a8a565b610b2e610d83565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b6000805473ffffffffffffffffffffffffffffffffffffffff8381166101008181027fffffffffffffffffffffff0000000000000000000000000000000000000000ff851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b610c28610c7b565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610b793390565b60005460ff16156103ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610a8a565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052610d7d908590610def565b50505050565b60005460ff166103ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610a8a565b6000610e51826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610f039092919063ffffffff16565b9050805160001480610e72575080806020019051810190610e7291906112c2565b610efe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610a8a565b505050565b6060610f128484600085610f1a565b949350505050565b606082471015610fac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610a8a565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610fd59190611308565b60006040518083038185875af1925050503d8060008114611012576040519150601f19603f3d011682016040523d82523d6000602084013e611017565b606091505b509150915061102887838387611033565b979650505050505050565b606083156110c95782516000036110c25773ffffffffffffffffffffffffffffffffffffffff85163b6110c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a8a565b5081610f12565b610f1283838151156110de5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8a9190611324565b80356fffffffffffffffffffffffffffffffff8116811461113257600080fd5b919050565b6000806040838503121561114a57600080fd5b61115383611112565b915061116160208401611112565b90509250929050565b60006020828403121561117c57600080fd5b5035919050565b60006020828403121561119557600080fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146111b957600080fd5b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b602081016002831061122a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b60006020828403121561124257600080fd5b5051919050565b80820281158282048414176109dd577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000826112bd577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156112d457600080fd5b815180151581146111b957600080fd5b60005b838110156112ff5781810151838201526020016112e7565b50506000910152565b6000825161131a8184602087016112e4565b9190910192915050565b60208152600082518060208401526113438160408501602087016112e4565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220a7c4af24da1f14f9a3d87caf1104d88c824c70c106d1dc7d862cfd62e3a3848e64736f6c6343000813003300000000000000000000000064aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d50000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000005c8898f8e0f9468d4a677887bc03ee26593210120000000000000000000000000000000000000000000000009d3c3ef8992d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000098a7d9b8314c0000000000000000000000000000000000000000000000000000a688906bd8b00000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101775760003560e01c8063963d3715116100d8578063b873d8061161008c578063ed1bd76c11610066578063ed1bd76c1461038d578063f2fde38b146103a0578063f45e65d8146103b357600080fd5b8063b873d80614610337578063db590eac14610351578063eb99da4a1461035957600080fd5b8063aa13372e116100bd578063aa13372e146102b7578063ac12ea8e14610308578063aec1c3271461032457600080fd5b8063963d37151461027d578063972973e7146102a457600080fd5b80635c975abb1161012f5780638456cb59116101145780638456cb591461023f5780638da5cb5b1461024757806394b918de1461026a57600080fd5b80635c975abb14610221578063715018a61461023757600080fd5b80633f4ba83a116101605780633f4ba83a146101e45780633f7af9ea146101ee57806346ee3c591461020157600080fd5b80631980872e1461017c5780633bf19e29146101cd575b600080fd5b6101a37f00000000000000000000000064aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d581565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6101d660025481565b6040519081526020016101c4565b6101ec6103da565b005b6101ec6101fc366004611137565b6103ec565b6001546101a39073ffffffffffffffffffffffffffffffffffffffff1681565b60005460ff1660405190151581526020016101c4565b6101ec6104c1565b6101ec6104d3565b600054610100900473ffffffffffffffffffffffffffffffffffffffff166101a3565b6101d661027836600461116a565b6104e3565b6101a37f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f81565b6101ec6102b236600461116a565b610616565b6003546102e79070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1681565b6040516fffffffffffffffffffffffffffffffff90911681526020016101c4565b6003546102e7906fffffffffffffffffffffffffffffffff1681565b6101ec610332366004611183565b6106d9565b61033f601281565b60405160ff90911681526020016101c4565b6101d661079d565b6103807f000000000000000000000000000000000000000000000000000000000000000081565b6040516101c491906111ef565b6101d661039b36600461116a565b61092e565b6101ec6103ae366004611183565b6109e3565b6101d67f000000000000000000000000000000000000000000000000000000003b9aca0081565b6103e2610a9f565b6103ea610b26565b565b6103f4610a9f565b806fffffffffffffffffffffffffffffffff16826fffffffffffffffffffffffffffffffff161115610452576040517fd252903400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6fffffffffffffffffffffffffffffffff82811670010000000000000000000000000000000091831691820281176003556040805191825260208201929092527f3cb7aa6ad329dbbae3ba64a123b11b3d714240d6b16f448bb41e815b7618b9ef910160405180910390a15050565b6104c9610a9f565b6103ea6000610ba3565b6104db610a9f565b6103ea610c20565b60006104ed610c7b565b81600003610527576040517f54db0c8c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105308261092e565b600154604080518581526020810184905292935073ffffffffffffffffffffffffffffffffffffffff90911691829133917ffa2dda1cc1b86e41239702756b13effbc1a092b5c57e3ad320fbe4f3b13fe235910160405180910390a36105ce73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000064aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d516338386610ce8565b61061073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f16823385610ce8565b50919050565b61061e610a9f565b6003546fffffffffffffffffffffffffffffffff16811080610667575060035470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1681115b1561069e576040517f9aa5f25100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60028190556040518181527f58af8a859607b837cd10bfb8098d6da3c00d714fd6a1a9b7c764533d1fcb17df9060200160405180910390a150565b6106e1610a9f565b73ffffffffffffffffffffffffffffffffffffffff811661072e576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517ffc96af5cc8fe5d8e2880342c1ad3fbe1731bccf067275cd1fced2f4f8f13512d90600090a250565b6001546040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201819052600092909183917f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f16906370a0823190602401602060405180830381865afa158015610835573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108599190611230565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301523060248301529192506000917f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f169063dd62ed3e90604401602060405180830381865afa1580156108f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109159190611230565b90508082106109245780610926565b815b935050505090565b6000807f00000000000000000000000000000000000000000000000000000000000000006001811115610963576109636111c0565b146109a4576002546109957f000000000000000000000000000000000000000000000000000000003b9aca0084611249565b61099f9190611287565b6109dd565b7f000000000000000000000000000000000000000000000000000000003b9aca00600254836109d39190611249565b6109dd9190611287565b92915050565b6109eb610a9f565b73ffffffffffffffffffffffffffffffffffffffff8116610a93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610a9c81610ba3565b50565b60005473ffffffffffffffffffffffffffffffffffffffff6101009091041633146103ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a8a565b610b2e610d83565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b6000805473ffffffffffffffffffffffffffffffffffffffff8381166101008181027fffffffffffffffffffffff0000000000000000000000000000000000000000ff851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b610c28610c7b565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610b793390565b60005460ff16156103ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610a8a565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052610d7d908590610def565b50505050565b60005460ff166103ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610a8a565b6000610e51826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610f039092919063ffffffff16565b9050805160001480610e72575080806020019051810190610e7291906112c2565b610efe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610a8a565b505050565b6060610f128484600085610f1a565b949350505050565b606082471015610fac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610a8a565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051610fd59190611308565b60006040518083038185875af1925050503d8060008114611012576040519150601f19603f3d011682016040523d82523d6000602084013e611017565b606091505b509150915061102887838387611033565b979650505050505050565b606083156110c95782516000036110c25773ffffffffffffffffffffffffffffffffffffffff85163b6110c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a8a565b5081610f12565b610f1283838151156110de5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8a9190611324565b80356fffffffffffffffffffffffffffffffff8116811461113257600080fd5b919050565b6000806040838503121561114a57600080fd5b61115383611112565b915061116160208401611112565b90509250929050565b60006020828403121561117c57600080fd5b5035919050565b60006020828403121561119557600080fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146111b957600080fd5b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b602081016002831061122a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b60006020828403121561124257600080fd5b5051919050565b80820281158282048414176109dd577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000826112bd577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156112d457600080fd5b815180151581146111b957600080fd5b60005b838110156112ff5781810151838201526020016112e7565b50506000910152565b6000825161131a8184602087016112e4565b9190910192915050565b60208152600082518060208401526113438160408501602087016112e4565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220a7c4af24da1f14f9a3d87caf1104d88c824c70c106d1dc7d862cfd62e3a3848e64736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000064aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d50000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000005c8898f8e0f9468d4a677887bc03ee26593210120000000000000000000000000000000000000000000000009d3c3ef8992d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000098a7d9b8314c0000000000000000000000000000000000000000000000000000a688906bd8b00000
-----Decoded View---------------
Arg [0] : _userSellToken (address): 0x64aa3364F17a4D01c6f1751Fd97C2BD3D7e7f1D5
Arg [1] : _userBuyToken (address): 0x6B175474E89094C44Da98b954EedeAC495271d0F
Arg [2] : _fundsOwner (address): 0x5C8898f8E0F9468D4A677887bC03EE2659321012
Arg [3] : _offerPrice (uint256): 11330000000000000000
Arg [4] : _offerPricingToken (uint8): 0
Arg [5] : _minValidOfferPrice (uint128): 11000000000000000000
Arg [6] : _maxValidOfferPrice (uint128): 12000000000000000000
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 00000000000000000000000064aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5
Arg [1] : 0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f
Arg [2] : 0000000000000000000000005c8898f8e0f9468d4a677887bc03ee2659321012
Arg [3] : 0000000000000000000000000000000000000000000000009d3c3ef8992d0000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [5] : 00000000000000000000000000000000000000000000000098a7d9b8314c0000
Arg [6] : 000000000000000000000000000000000000000000000000a688906bd8b00000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ 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.