Contract
0x05545815a5579d80Bd4c380da3487EAC2c4Ce299
5
Contract Overview
Balance:
0 MATIC
My Name Tag:
Not Available
Txn Hash |
Method
|
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x54ced3b364658b63b828468b59098e9dcaf8ab71201fab518e453f7e13298068 | 0x60e06040 | 25550814 | 381 days 2 hrs ago | 0x1ff808e34e4df60326a3fc4c2b0f80748a3d60c2 | IN | Create: Registry | 0 MATIC | 0.016754750001 |
[ Download CSV Export ]
Contract Name:
Registry
Compiler Version
v0.8.7+commit.e28d00a7
Optimization Enabled:
Yes with 999999 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; /** * @title AirSwap Registry: Manage and query AirSwap server URLs * @notice https://www.airswap.io/ */ contract Registry { using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.AddressSet; IERC20 public immutable stakingToken; uint256 public immutable obligationCost; uint256 public immutable tokenCost; mapping(address => EnumerableSet.AddressSet) internal supportedTokens; mapping(address => EnumerableSet.AddressSet) internal supportingStakers; mapping(address => string) public stakerURLs; event InitialStake(address indexed account); event FullUnstake(address indexed account); event AddTokens(address indexed account, address[] tokens); event RemoveTokens(address indexed account, address[] tokens); event SetURL(address indexed account, string url); /** * @notice Constructor * @param _stakingToken address of token used for staking * @param _obligationCost base amount required to stake * @param _tokenCost amount required to stake per token */ constructor( IERC20 _stakingToken, uint256 _obligationCost, uint256 _tokenCost ) { stakingToken = _stakingToken; obligationCost = _obligationCost; tokenCost = _tokenCost; } /** * @notice Set the URL for a staker * @param _url string value of the URL */ function setURL(string calldata _url) external { stakerURLs[msg.sender] = _url; emit SetURL(msg.sender, _url); } /** * @notice Add tokens supported by the caller * @param tokens array of token addresses */ function addTokens(address[] calldata tokens) external { uint256 length = tokens.length; require(length > 0, "NO_TOKENS_TO_ADD"); EnumerableSet.AddressSet storage tokenList = supportedTokens[msg.sender]; uint256 transferAmount = 0; if (tokenList.length() == 0) { transferAmount = obligationCost; emit InitialStake(msg.sender); } for (uint256 i = 0; i < length; i++) { address token = tokens[i]; require(tokenList.add(token), "TOKEN_EXISTS"); supportingStakers[token].add(msg.sender); } transferAmount += tokenCost * length; emit AddTokens(msg.sender, tokens); if (transferAmount > 0) { stakingToken.safeTransferFrom(msg.sender, address(this), transferAmount); } } /** * @notice Remove tokens supported by the caller * @param tokens array of token addresses */ function removeTokens(address[] calldata tokens) external { uint256 length = tokens.length; require(length > 0, "NO_TOKENS_TO_REMOVE"); EnumerableSet.AddressSet storage tokenList = supportedTokens[msg.sender]; for (uint256 i = 0; i < length; i++) { address token = tokens[i]; require(tokenList.remove(token), "TOKEN_DOES_NOT_EXIST"); supportingStakers[token].remove(msg.sender); } uint256 transferAmount = tokenCost * length; if (tokenList.length() == 0) { transferAmount += obligationCost; emit FullUnstake(msg.sender); } emit RemoveTokens(msg.sender, tokens); if (transferAmount > 0) { stakingToken.safeTransfer(msg.sender, transferAmount); } } /** * @notice Remove all tokens supported by the caller */ function removeAllTokens() external { EnumerableSet.AddressSet storage supportedTokenList = supportedTokens[ msg.sender ]; uint256 length = supportedTokenList.length(); require(length > 0, "NO_TOKENS_TO_REMOVE"); address[] memory tokenList = new address[](length); for (uint256 i = length; i > 0; ) { i--; address token = supportedTokenList.at(i); tokenList[i] = token; supportedTokenList.remove(token); supportingStakers[token].remove(msg.sender); } uint256 transferAmount = obligationCost + tokenCost * length; emit FullUnstake(msg.sender); emit RemoveTokens(msg.sender, tokenList); if (transferAmount > 0) { stakingToken.safeTransfer(msg.sender, transferAmount); } } /** * @notice Return a list of all server URLs supporting a given token * @param token address of the token * @return urls array of server URLs supporting the token */ function getURLsForToken(address token) external view returns (string[] memory urls) { EnumerableSet.AddressSet storage stakers = supportingStakers[token]; uint256 length = stakers.length(); urls = new string[](length); for (uint256 i = 0; i < length; i++) { urls[i] = stakerURLs[address(stakers.at(i))]; } } /** * @notice Get the URLs for an array of stakers * @param stakers array of staker addresses * @return urls array of server URLs in the same order */ function getURLsForStakers(address[] calldata stakers) external view returns (string[] memory urls) { uint256 stakersLength = stakers.length; urls = new string[](stakersLength); for (uint256 i = 0; i < stakersLength; i++) { urls[i] = stakerURLs[stakers[i]]; } } /** * @notice Return whether a staker supports a given token * @param staker account address used to stake * @param token address of the token * @return true if the staker supports the token */ function supportsToken(address staker, address token) external view returns (bool) { return supportedTokens[staker].contains(token); } /** * @notice Return a list of all supported tokens for a given staker * @param staker account address of the staker * @return tokenList array of all the supported tokens */ function getSupportedTokens(address staker) external view returns (address[] memory tokenList) { EnumerableSet.AddressSet storage tokens = supportedTokens[staker]; uint256 length = tokens.length(); tokenList = new address[](length); for (uint256 i = 0; i < length; i++) { tokenList[i] = tokens.at(i); } } /** * @notice Return a list of all stakers supporting a given token * @param token address of the token * @return stakers array of all stakers that support a given token */ function getStakersForToken(address token) external view returns (address[] memory stakers) { EnumerableSet.AddressSet storage stakerList = supportingStakers[token]; uint256 length = stakerList.length(); stakers = new address[](length); for (uint256 i = 0; i < length; i++) { stakers[i] = stakerList.at(i); } } /** * @notice Return the staking balance of a given staker * @param staker address of the account used to stake * @return balance of the staker account */ function balanceOf(address staker) external view returns (uint256) { uint256 tokenCount = supportedTokens[staker].length(); if (tokenCount == 0) { return 0; } return obligationCost + tokenCost * tokenCount; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.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 // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.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; 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"); (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"); (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"); (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"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
{ "optimizer": { "enabled": true, "runs": 999999 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"contract IERC20","name":"_stakingToken","type":"address"},{"internalType":"uint256","name":"_obligationCost","type":"uint256"},{"internalType":"uint256","name":"_tokenCost","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"AddTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"FullUnstake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"InitialStake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"RemoveTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"string","name":"url","type":"string"}],"name":"SetURL","type":"event"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"addTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getStakersForToken","outputs":[{"internalType":"address[]","name":"stakers","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"getSupportedTokens","outputs":[{"internalType":"address[]","name":"tokenList","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"stakers","type":"address[]"}],"name":"getURLsForStakers","outputs":[{"internalType":"string[]","name":"urls","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getURLsForToken","outputs":[{"internalType":"string[]","name":"urls","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"obligationCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"removeAllTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"removeTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_url","type":"string"}],"name":"setURL","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakerURLs","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"address","name":"token","type":"address"}],"name":"supportsToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60e060405234801561001057600080fd5b50604051611e89380380611e8983398101604081905261002f9161004d565b60609290921b6001600160601b03191660805260a05260c052610090565b60008060006060848603121561006257600080fd5b83516001600160a01b038116811461007957600080fd5b602085015160409095015190969495509392505050565b60805160601c60a05160c051611d7a61010f6000396000818161024a01528181610547015281816107b701528181610b840152610dba01526000818161011d0152818161040d015281816107ef01528181610bae0152610de40152600081816101e3015281816105e7015281816108b30152610ea40152611d7a6000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c806370a082311161008c578063793cc5a111610066578063793cc5a11461023d578063912221d514610245578063c3ced1521461026c578063d12877dc1461028c57600080fd5b806370a08231146101cb57806372f702f3146101de578063773434081461022a57600080fd5b806353731c69116100c857806353731c69146101625780636c3824ef146101855780636df35874146101985780636e8658a7146101b857600080fd5b806307526acf146100ef5780632b24ef55146101185780634ae05c7d1461014d575b600080fd5b6101026100fd3660046117f0565b61029f565b60405161010f91906119f4565b60405180910390f35b61013f7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161010f565b61016061015b36600461183e565b61037d565b005b61017561017036600461180b565b610616565b604051901515815260200161010f565b61016061019336600461183e565b61064e565b6101ab6101a63660046117f0565b6108da565b60405161010f9190611a4e565b6101026101c63660046117f0565b610a68565b61013f6101d93660046117f0565b610b3e565b6102057f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161010f565b6101606102383660046118d5565b610bd9565b610160610c48565b61013f7f000000000000000000000000000000000000000000000000000000000000000081565b61027f61027a3660046117f0565b610ed1565b60405161010f9190611b1b565b6101ab61029a36600461183e565b610f6b565b73ffffffffffffffffffffffffffffffffffffffff811660009081526020819052604081206060916102d0826110ee565b90508067ffffffffffffffff8111156102eb576102eb611d15565b604051908082528060200260200182016040528015610314578160200160208202803683370190505b50925060005b818110156103755761032c83826110f8565b84828151811061033e5761033e611ce6565b73ffffffffffffffffffffffffffffffffffffffff909216602092830291909101909101528061036d81611c4f565b91505061031a565b505050919050565b80806103ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4e4f5f544f4b454e535f544f5f4144440000000000000000000000000000000060448201526064015b60405180910390fd5b33600090815260208190526040812090610403826110ee565b61045657506040517f00000000000000000000000000000000000000000000000000000000000000009033907fb084bc494a89304dcf54b309b9692bdafd4b67539fd9dc15219bd6b82ecc61a390600090a25b60005b8381101561054057600086868381811061047557610475611ce6565b905060200201602081019061048a91906117f0565b90506104968482611104565b6104fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f544f4b454e5f455849535453000000000000000000000000000000000000000060448201526064016103e1565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040902061052b9033611104565b5050808061053890611c4f565b915050610459565b5061056b837f0000000000000000000000000000000000000000000000000000000000000000611b46565b6105759082611b2e565b90503373ffffffffffffffffffffffffffffffffffffffff167f8a4417f85fc0d82e2365afb5e344e2d731a29ce2b5a000da7857409c49d28cc286866040516105bf92919061199b565b60405180910390a2801561060f5761060f73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016333084611126565b5050505050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604081206106459083611202565b90505b92915050565b80806106b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4e4f5f544f4b454e535f544f5f52454d4f56450000000000000000000000000060448201526064016103e1565b336000908152602081905260408120905b828110156107ae5760008585838181106106e3576106e3611ce6565b90506020020160208101906106f891906117f0565b90506107048382611231565b61076a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f544f4b454e5f444f45535f4e4f545f455849535400000000000000000000000060448201526064016103e1565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090206107999033611231565b505080806107a690611c4f565b9150506106c7565b5060006107db837f0000000000000000000000000000000000000000000000000000000000000000611b46565b90506107e6826110ee565b610843576108147f000000000000000000000000000000000000000000000000000000000000000082611b2e565b60405190915033907f5145121d6af63d58cca25c9f269c9ba617dded29d84ffd18499436c7c21b3f2890600090a25b3373ffffffffffffffffffffffffffffffffffffffff167f4efa1188fb6a3db44946ac387489b6f4e29207ef0d603be528f3747152588045868660405161088b92919061199b565b60405180910390a2801561060f5761060f73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163383611253565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040812060609161090b826110ee565b90508067ffffffffffffffff81111561092657610926611d15565b60405190808252806020026020018201604052801561095957816020015b60608152602001906001900390816109445790505b50925060005b81811015610375576002600061097585846110f8565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080546109ba90611bfb565b80601f01602080910402602001604051908101604052809291908181526020018280546109e690611bfb565b8015610a335780601f10610a0857610100808354040283529160200191610a33565b820191906000526020600020905b815481529060010190602001808311610a1657829003601f168201915b5050505050848281518110610a4a57610a4a611ce6565b60200260200101819052508080610a6090611c4f565b91505061095f565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600160205260408120606091610a99826110ee565b90508067ffffffffffffffff811115610ab457610ab4611d15565b604051908082528060200260200182016040528015610add578160200160208202803683370190505b50925060005b8181101561037557610af583826110f8565b848281518110610b0757610b07611ce6565b73ffffffffffffffffffffffffffffffffffffffff9092166020928302919091019091015280610b3681611c4f565b915050610ae3565b73ffffffffffffffffffffffffffffffffffffffff811660009081526020819052604081208190610b6e906110ee565b905080610b7e5750600092915050565b610ba8817f0000000000000000000000000000000000000000000000000000000000000000611b46565b610bd2907f0000000000000000000000000000000000000000000000000000000000000000611b2e565b9392505050565b336000908152600260205260409020610bf3908383611710565b503373ffffffffffffffffffffffffffffffffffffffff167f249856326dc0fe2c794b9c0daafa35de121bec273c9253186c69197caa3407198383604051610c3c929190611ace565b60405180910390a25050565b33600090815260208190526040812090610c61826110ee565b905060008111610ccd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4e4f5f544f4b454e535f544f5f52454d4f56450000000000000000000000000060448201526064016103e1565b60008167ffffffffffffffff811115610ce857610ce8611d15565b604051908082528060200260200182016040528015610d11578160200160208202803683370190505b509050815b8015610db15780610d2681611bc6565b915060009050610d3685836110f8565b905080838381518110610d4b57610d4b611ce6565b73ffffffffffffffffffffffffffffffffffffffff90921660209283029190910190910152610d7a8582611231565b5073ffffffffffffffffffffffffffffffffffffffff81166000908152600160205260409020610daa9033611231565b5050610d16565b506000610dde837f0000000000000000000000000000000000000000000000000000000000000000611b46565b610e08907f0000000000000000000000000000000000000000000000000000000000000000611b2e565b60405190915033907f5145121d6af63d58cca25c9f269c9ba617dded29d84ffd18499436c7c21b3f2890600090a23373ffffffffffffffffffffffffffffffffffffffff167f4efa1188fb6a3db44946ac387489b6f4e29207ef0d603be528f374715258804583604051610e7c91906119f4565b60405180910390a28015610ecb57610ecb73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163383611253565b50505050565b60026020526000908152604090208054610eea90611bfb565b80601f0160208091040260200160405190810160405280929190818152602001828054610f1690611bfb565b8015610f635780601f10610f3857610100808354040283529160200191610f63565b820191906000526020600020905b815481529060010190602001808311610f4657829003601f168201915b505050505081565b6060818067ffffffffffffffff811115610f8757610f87611d15565b604051908082528060200260200182016040528015610fba57816020015b6060815260200190600190039081610fa55790505b50915060005b818110156110e65760026000868684818110610fde57610fde611ce6565b9050602002016020810190610ff391906117f0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805461103890611bfb565b80601f016020809104026020016040519081016040528092919081815260200182805461106490611bfb565b80156110b15780601f10611086576101008083540402835291602001916110b1565b820191906000526020600020905b81548152906001019060200180831161109457829003601f168201915b50505050508382815181106110c8576110c8611ce6565b602002602001018190525080806110de90611c4f565b915050610fc0565b505092915050565b6000610648825490565b600061064583836112ae565b60006106458373ffffffffffffffffffffffffffffffffffffffff84166112d8565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052610ecb9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611327565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001830160205260408120541515610645565b60006106458373ffffffffffffffffffffffffffffffffffffffff8416611433565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526112a99084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611180565b505050565b60008260000182815481106112c5576112c5611ce6565b9060005260206000200154905092915050565b600081815260018301602052604081205461131f57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610648565b506000610648565b6000611389826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166115269092919063ffffffff16565b8051909150156112a957808060200190518101906113a791906118b3565b6112a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016103e1565b6000818152600183016020526040812054801561151c576000611457600183611b83565b855490915060009061146b90600190611b83565b90508181146114d057600086600001828154811061148b5761148b611ce6565b90600052602060002001549050808760000184815481106114ae576114ae611ce6565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806114e1576114e1611cb7565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610648565b6000915050610648565b6060611535848460008561153d565b949350505050565b6060824710156115cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016103e1565b843b611637576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103e1565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611660919061197f565b60006040518083038185875af1925050503d806000811461169d576040519150601f19603f3d011682016040523d82523d6000602084013e6116a2565b606091505b50915091506116b28282866116bd565b979650505050505050565b606083156116cc575081610bd2565b8251156116dc5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103e19190611b1b565b82805461171c90611bfb565b90600052602060002090601f01602090048101928261173e57600085556117a2565b82601f10611775578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008235161785556117a2565b828001600101855582156117a2579182015b828111156117a2578235825591602001919060010190611787565b506117ae9291506117b2565b5090565b5b808211156117ae57600081556001016117b3565b803573ffffffffffffffffffffffffffffffffffffffff811681146117eb57600080fd5b919050565b60006020828403121561180257600080fd5b610645826117c7565b6000806040838503121561181e57600080fd5b611827836117c7565b9150611835602084016117c7565b90509250929050565b6000806020838503121561185157600080fd5b823567ffffffffffffffff8082111561186957600080fd5b818501915085601f83011261187d57600080fd5b81358181111561188c57600080fd5b8660208260051b85010111156118a157600080fd5b60209290920196919550909350505050565b6000602082840312156118c557600080fd5b81518015158114610bd257600080fd5b600080602083850312156118e857600080fd5b823567ffffffffffffffff8082111561190057600080fd5b818501915085601f83011261191457600080fd5b81358181111561192357600080fd5b8660208285010111156118a157600080fd5b6000815180845261194d816020860160208601611b9a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60008251611991818460208701611b9a565b9190910192915050565b60208082528181018390526000908460408401835b868110156119e95773ffffffffffffffffffffffffffffffffffffffff6119d6846117c7565b16825291830191908301906001016119b0565b509695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015611a4257835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101611a10565b50909695505050505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015611ac1577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452611aaf858351611935565b94509285019290850190600101611a75565b5092979650505050505050565b60208152816020820152818360408301376000818301604090810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160101919050565b6020815260006106456020830184611935565b60008219821115611b4157611b41611c88565b500190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611b7e57611b7e611c88565b500290565b600082821015611b9557611b95611c88565b500390565b60005b83811015611bb5578181015183820152602001611b9d565b83811115610ecb5750506000910152565b600081611bd557611bd5611c88565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b600181811c90821680611c0f57607f821691505b60208210811415611c49577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611c8157611c81611c88565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea2646970667358221220de72c7c724e10ceb533b248587a65fc2c0e4725d80bb140c0da394db1ff93e5a64736f6c63430008070033000000000000000000000000d161ddcfcc0c2d823021aa26200824efa75218d100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000d161ddcfcc0c2d823021aa26200824efa75218d100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _stakingToken (address): 0xd161ddcfcc0c2d823021aa26200824efa75218d1
Arg [1] : _obligationCost (uint256): 0
Arg [2] : _tokenCost (uint256): 0
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000d161ddcfcc0c2d823021aa26200824efa75218d1
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|