Source Code
Overview
S Balance
0 S
More Info
ContractCreator
Loading...
Loading
Contract Name:
Royalties
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./interfaces/IVotingEscrow.sol"; import "./interfaces/IWETH.sol"; import "./libraries/Constants.sol"; interface ISWPxNFT { function originalMinters(address) external view returns(uint); function totalSupply() external view returns(uint); function reservedAmount() external view returns(uint); } contract Royalties is ReentrancyGuard { using SafeERC20 for IERC20; IERC20 public wsonic; uint public DISTRIBUTION = Constants.EPOCH_LENGTH; uint256 public epoch; ISWPxNFT public swpxNFT; address public owner; mapping(uint => uint) public feesPerEpoch; mapping(uint => uint) public totalSupply; mapping(uint => uint) public reservedAmounts; mapping(address => bool) public depositors; mapping(address => uint) public userCheckpoint; modifier onlyOwner { require(msg.sender == owner, 'not owner'); _; } modifier allowed { require(depositors[msg.sender] == true || msg.sender == owner, 'not allowed'); _; } event Deposit(uint256 amount); event VestingUpdate(uint256 balance, uint256 vesting_period, uint256 tokenPerSec); constructor(address _wsonic, address _swpxNFT) { owner = msg.sender; wsonic = IERC20(_wsonic); swpxNFT = ISWPxNFT(_swpxNFT); epoch = 0; } function deposit(uint256 amount) external payable allowed { require(amount > 0 || msg.value > 0); uint256 _amount = 0; if(msg.value == 0){ wsonic.safeTransferFrom(msg.sender, address(this), amount); _amount = amount; } else { IWETH(address(wsonic)).deposit{value: address(this).balance}(); _amount = msg.value; } feesPerEpoch[epoch] = _amount; totalSupply[epoch] = swpxNFT.totalSupply(); reservedAmounts[epoch] = swpxNFT.reservedAmount(); epoch++; } function withdrawERC20(address _token) external onlyOwner { require(_token != address(0)); uint256 _balance = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeTransfer(msg.sender, _balance); } function claim(address to) external nonReentrant { require(to != address(0)); // get amount uint256 _toClaim = claimable(msg.sender); require(_toClaim <= wsonic.balanceOf(address(this)), 'too many rewards'); require(_toClaim > 0, 'wait next'); // update checkpoint userCheckpoint[msg.sender] = epoch; // send and enjoy wsonic.safeTransfer(to, _toClaim); } function claimTill(address to, uint256 tillEpoch) external nonReentrant { require(to != address(0)); require(tillEpoch <= epoch && tillEpoch > userCheckpoint[msg.sender], "wrong epoch"); // get amount uint256 _toClaim = _claimableTill(msg.sender, tillEpoch); require(_toClaim <= wsonic.balanceOf(address(this)), 'too many rewards'); require(_toClaim > 0, 'wait next'); // update checkpoint userCheckpoint[msg.sender] = tillEpoch; // send and enjoy wsonic.safeTransfer(to, _toClaim); } function claimable(address user) public view returns(uint) { return _claimableTill(user, epoch); } /* OWNER FUNCTIONS */ function setDepositor(address depositor) external onlyOwner { require(depositors[depositor] == false); depositors[depositor] = true; } function removeDepositor(address depositor) external onlyOwner { require(depositors[depositor] == true); depositors[depositor] = false; } function setOwner(address _owner) external onlyOwner{ require(_owner != address(0)); owner = _owner; } // internal methods function _claimableTill(address _user, uint256 _epoch) internal view returns (uint256) { require(_user != address(0)); //Total fees * swpxNFT.originalMinters[msg.sender] / (swpxNFT.totalSupply - swpxNFT.reservedAmount) uint256 cp = userCheckpoint[_user]; if(_epoch > epoch) { _epoch = epoch; } if(cp >= _epoch){ return 0; } uint i; uint256 _reward = 0; for(i = cp; i < _epoch; i++){ uint256 _resAmnt = reservedAmounts[i]; uint256 _tot = totalSupply[i]; uint256 _fee = feesPerEpoch[i]; uint256 weight = swpxNFT.originalMinters(_user); _reward += _fee * weight / (_tot - _resAmnt); } return _reward; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; interface IVotingEscrow { struct Point { int128 bias; int128 slope; // # -dweight / dt uint256 ts; uint256 blk; // block } struct LockedBalance { int128 amount; uint start; uint end; } function create_lock_for(uint _value, uint _lock_duration, address _to) external returns (uint); function locked(uint id) external view returns(LockedBalance memory); function tokenOfOwnerByIndex(address _owner, uint _tokenIndex) external view returns (uint); function token() external view returns (address); function team() external returns (address); function epoch() external view returns (uint); function point_history(uint loc) external view returns (Point memory); function user_point_history(uint tokenId, uint loc) external view returns (Point memory); function user_point_epoch(uint tokenId) external view returns (uint); function ownerOf(uint) external view returns (address); function isApprovedOrOwner(address, uint) external view returns (bool); function transferFrom(address, address, uint) external; function voted(uint) external view returns (bool); function attachments(uint) external view returns (uint); function voting(uint tokenId) external; function abstain(uint tokenId) external; function attach(uint tokenId) external; function detach(uint tokenId) external; function checkpoint() external; function deposit_for(uint tokenId, uint value) external; function balanceOfAtNFT(uint _tokenId, uint _block) external view returns (uint); function balanceOfNFT(uint _id) external view returns (uint); function balanceOf(address _owner) external view returns (uint); function totalSupply() external view returns (uint); function supply() external view returns (uint); function decimals() external view returns(uint8); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; interface IWETH { function deposit() external payable; function transfer(address to, uint256 value) external returns (bool); function withdraw(uint256) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; library Constants { uint256 internal constant EPOCH_LENGTH = 30 minutes; //7 days; }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"address","name":"_wsonic","type":"address"},{"internalType":"address","name":"_swpxNFT","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"balance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"vesting_period","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenPerSec","type":"uint256"}],"name":"VestingUpdate","type":"event"},{"inputs":[],"name":"DISTRIBUTION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tillEpoch","type":"uint256"}],"name":"claimTill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"claimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"depositors","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"feesPerEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositor","type":"address"}],"name":"removeDepositor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"reservedAmounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositor","type":"address"}],"name":"setDepositor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swpxNFT","outputs":[{"internalType":"contract ISWPxNFT","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userCheckpoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wsonic","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405261070860025534801561001657600080fd5b506040516112aa3803806112aa83398101604081905261003591610099565b6001600081815560058054336001600160a01b031991821617909155825481166001600160a01b039586161790925560048054909216929093169190911790556003556100cc565b80516001600160a01b038116811461009457600080fd5b919050565b600080604083850312156100ac57600080fd5b6100b58361007d565b91506100c36020840161007d565b90509250929050565b6111cf806100db6000396000f3fe6080604052600436106101095760003560e01c8063900cf0cf11610095578063c238f52911610064578063c238f529146102e1578063df1cd77f14610301578063eed75f6d1461032e578063f2c098b71461036e578063f4f3b2001461038e57600080fd5b8063900cf0cf1461025e578063b07b709b14610274578063b6b55f25146102a1578063bd85b039146102b457600080fd5b8063403962a3116100dc578063403962a3146101b05780637c91e4eb146101d057806384c7ab47146101e65780638b73e6061461021e5780638da5cb5b1461023e57600080fd5b806308438ce51461010e57806313af40351461014e5780631e83409a14610170578063402914f514610190575b600080fd5b34801561011a57600080fd5b5061013b610129366004610fa0565b60086020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561015a57600080fd5b5061016e610169366004610fd5565b6103ae565b005b34801561017c57600080fd5b5061016e61018b366004610fd5565b610416565b34801561019c57600080fd5b5061013b6101ab366004610fd5565b61055f565b3480156101bc57600080fd5b5061016e6101cb366004610ff7565b610573565b3480156101dc57600080fd5b5061013b60025481565b3480156101f257600080fd5b50600454610206906001600160a01b031681565b6040516001600160a01b039091168152602001610145565b34801561022a57600080fd5b5061016e610239366004610fd5565b610717565b34801561024a57600080fd5b50600554610206906001600160a01b031681565b34801561026a57600080fd5b5061013b60035481565b34801561028057600080fd5b5061013b61028f366004610fd5565b600a6020526000908152604090205481565b61016e6102af366004610fa0565b61078c565b3480156102c057600080fd5b5061013b6102cf366004610fa0565b60076020526000908152604090205481565b3480156102ed57600080fd5b50600154610206906001600160a01b031681565b34801561030d57600080fd5b5061013b61031c366004610fa0565b60066020526000908152604090205481565b34801561033a57600080fd5b5061035e610349366004610fd5565b60096020526000908152604090205460ff1681565b6040519015158152602001610145565b34801561037a57600080fd5b5061016e610389366004610fd5565b6109ce565b34801561039a57600080fd5b5061016e6103a9366004610fd5565b610a42565b6005546001600160a01b031633146103e15760405162461bcd60e51b81526004016103d890611021565b60405180910390fd5b6001600160a01b0381166103f457600080fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b61041e610b00565b6001600160a01b03811661043157600080fd5b600061043c3361055f565b6001546040516370a0823160e01b81523060048201529192506001600160a01b0316906370a0823190602401602060405180830381865afa158015610485573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a99190611044565b8111156104eb5760405162461bcd60e51b815260206004820152601060248201526f746f6f206d616e79207265776172647360801b60448201526064016103d8565b600081116105275760405162461bcd60e51b81526020600482015260096024820152681dd85a5d081b995e1d60ba1b60448201526064016103d8565b600354336000908152600a6020526040902055600154610551906001600160a01b03168383610b59565b5061055c6001600055565b50565b600061056d82600354610bc1565b92915050565b61057b610b00565b6001600160a01b03821661058e57600080fd5b60035481111580156105ae5750336000908152600a602052604090205481115b6105e85760405162461bcd60e51b815260206004820152600b60248201526a0eee4dedcce40cae0dec6d60ab1b60448201526064016103d8565b60006105f43383610bc1565b6001546040516370a0823160e01b81523060048201529192506001600160a01b0316906370a0823190602401602060405180830381865afa15801561063d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106619190611044565b8111156106a35760405162461bcd60e51b815260206004820152601060248201526f746f6f206d616e79207265776172647360801b60448201526064016103d8565b600081116106df5760405162461bcd60e51b81526020600482015260096024820152681dd85a5d081b995e1d60ba1b60448201526064016103d8565b336000908152600a60205260409020829055600154610708906001600160a01b03168483610b59565b506107136001600055565b5050565b6005546001600160a01b031633146107415760405162461bcd60e51b81526004016103d890611021565b6001600160a01b03811660009081526009602052604090205460ff16151560011461076b57600080fd5b6001600160a01b03166000908152600960205260409020805460ff19169055565b3360009081526009602052604090205460ff161515600114806107b957506005546001600160a01b031633145b6107f35760405162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b60448201526064016103d8565b60008111806108025750600034115b61080b57600080fd5b6000346000036108345760015461082d906001600160a01b0316333085610d00565b50806108a1565b600160009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561088457600080fd5b505af1158015610898573d6000803e3d6000fd5b50505050503490505b6003546000908152600660209081526040918290208390556004805483516318160ddd60e01b815293516001600160a01b03909116936318160ddd93818401939092918290030181865afa1580156108fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109219190611044565b6003546000908152600760209081526040918290209290925560048054825163f92c45b760e01b815292516001600160a01b039091169363f92c45b79380840193919291908290030181865afa15801561097f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a39190611044565b600380546000908152600860205260408120929092558054916109c583611073565b91905055505050565b6005546001600160a01b031633146109f85760405162461bcd60e51b81526004016103d890611021565b6001600160a01b03811660009081526009602052604090205460ff1615610a1e57600080fd5b6001600160a01b03166000908152600960205260409020805460ff19166001179055565b6005546001600160a01b03163314610a6c5760405162461bcd60e51b81526004016103d890611021565b6001600160a01b038116610a7f57600080fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610ac6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aea9190611044565b90506107136001600160a01b0383163383610b59565b600260005403610b525760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103d8565b6002600055565b6040516001600160a01b038316602482015260448101829052610bbc90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610d3e565b505050565b60006001600160a01b038316610bd657600080fd5b6001600160a01b0383166000908152600a6020526040902054600354831115610bff5760035492505b828110610c1057600091505061056d565b8060005b84821015610cf757600082815260086020908152604080832054600783528184205460069093528184205460048054935163d113d59d60e01b81526001600160a01b038d81169282019290925292959193919291169063d113d59d90602401602060405180830381865afa158015610c90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb49190611044565b9050610cc0848461108c565b610cca82846110a3565b610cd491906110c2565b610cde90866110e4565b9450505050508180610cef90611073565b925050610c14565b95945050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610d389085906323b872dd60e01b90608401610b85565b50505050565b6000610d93826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e109092919063ffffffff16565b805190915015610bbc5780806020019051810190610db191906110fc565b610bbc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103d8565b6060610e1f8484600085610e27565b949350505050565b606082471015610e885760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103d8565b600080866001600160a01b03168587604051610ea4919061114a565b60006040518083038185875af1925050503d8060008114610ee1576040519150601f19603f3d011682016040523d82523d6000602084013e610ee6565b606091505b5091509150610ef787838387610f02565b979650505050505050565b60608315610f71578251600003610f6a576001600160a01b0385163b610f6a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103d8565b5081610e1f565b610e1f8383815115610f865781518083602001fd5b8060405162461bcd60e51b81526004016103d89190611166565b600060208284031215610fb257600080fd5b5035919050565b80356001600160a01b0381168114610fd057600080fd5b919050565b600060208284031215610fe757600080fd5b610ff082610fb9565b9392505050565b6000806040838503121561100a57600080fd5b61101383610fb9565b946020939093013593505050565b6020808252600990820152683737ba1037bbb732b960b91b604082015260600190565b60006020828403121561105657600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000600182016110855761108561105d565b5060010190565b60008282101561109e5761109e61105d565b500390565b60008160001904831182151516156110bd576110bd61105d565b500290565b6000826110df57634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156110f7576110f761105d565b500190565b60006020828403121561110e57600080fd5b81518015158114610ff057600080fd5b60005b83811015611139578181015183820152602001611121565b83811115610d385750506000910152565b6000825161115c81846020870161111e565b9190910192915050565b602081526000825180602084015261118581604085016020870161111e565b601f01601f1916919091016040019291505056fea2646970667358221220418ccd5b0f3ee4fbf46cf128984c1147327c0dc9536955ff75a320a3c6ad94f364736f6c634300080d0033000000000000000000000000845e4145f7de2822d16fe233ecd0181c61f1d65f000000000000000000000000a4c523d3f407a53149d90a0a4074f7775f2fd1ff
Deployed Bytecode
0x6080604052600436106101095760003560e01c8063900cf0cf11610095578063c238f52911610064578063c238f529146102e1578063df1cd77f14610301578063eed75f6d1461032e578063f2c098b71461036e578063f4f3b2001461038e57600080fd5b8063900cf0cf1461025e578063b07b709b14610274578063b6b55f25146102a1578063bd85b039146102b457600080fd5b8063403962a3116100dc578063403962a3146101b05780637c91e4eb146101d057806384c7ab47146101e65780638b73e6061461021e5780638da5cb5b1461023e57600080fd5b806308438ce51461010e57806313af40351461014e5780631e83409a14610170578063402914f514610190575b600080fd5b34801561011a57600080fd5b5061013b610129366004610fa0565b60086020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561015a57600080fd5b5061016e610169366004610fd5565b6103ae565b005b34801561017c57600080fd5b5061016e61018b366004610fd5565b610416565b34801561019c57600080fd5b5061013b6101ab366004610fd5565b61055f565b3480156101bc57600080fd5b5061016e6101cb366004610ff7565b610573565b3480156101dc57600080fd5b5061013b60025481565b3480156101f257600080fd5b50600454610206906001600160a01b031681565b6040516001600160a01b039091168152602001610145565b34801561022a57600080fd5b5061016e610239366004610fd5565b610717565b34801561024a57600080fd5b50600554610206906001600160a01b031681565b34801561026a57600080fd5b5061013b60035481565b34801561028057600080fd5b5061013b61028f366004610fd5565b600a6020526000908152604090205481565b61016e6102af366004610fa0565b61078c565b3480156102c057600080fd5b5061013b6102cf366004610fa0565b60076020526000908152604090205481565b3480156102ed57600080fd5b50600154610206906001600160a01b031681565b34801561030d57600080fd5b5061013b61031c366004610fa0565b60066020526000908152604090205481565b34801561033a57600080fd5b5061035e610349366004610fd5565b60096020526000908152604090205460ff1681565b6040519015158152602001610145565b34801561037a57600080fd5b5061016e610389366004610fd5565b6109ce565b34801561039a57600080fd5b5061016e6103a9366004610fd5565b610a42565b6005546001600160a01b031633146103e15760405162461bcd60e51b81526004016103d890611021565b60405180910390fd5b6001600160a01b0381166103f457600080fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b61041e610b00565b6001600160a01b03811661043157600080fd5b600061043c3361055f565b6001546040516370a0823160e01b81523060048201529192506001600160a01b0316906370a0823190602401602060405180830381865afa158015610485573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a99190611044565b8111156104eb5760405162461bcd60e51b815260206004820152601060248201526f746f6f206d616e79207265776172647360801b60448201526064016103d8565b600081116105275760405162461bcd60e51b81526020600482015260096024820152681dd85a5d081b995e1d60ba1b60448201526064016103d8565b600354336000908152600a6020526040902055600154610551906001600160a01b03168383610b59565b5061055c6001600055565b50565b600061056d82600354610bc1565b92915050565b61057b610b00565b6001600160a01b03821661058e57600080fd5b60035481111580156105ae5750336000908152600a602052604090205481115b6105e85760405162461bcd60e51b815260206004820152600b60248201526a0eee4dedcce40cae0dec6d60ab1b60448201526064016103d8565b60006105f43383610bc1565b6001546040516370a0823160e01b81523060048201529192506001600160a01b0316906370a0823190602401602060405180830381865afa15801561063d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106619190611044565b8111156106a35760405162461bcd60e51b815260206004820152601060248201526f746f6f206d616e79207265776172647360801b60448201526064016103d8565b600081116106df5760405162461bcd60e51b81526020600482015260096024820152681dd85a5d081b995e1d60ba1b60448201526064016103d8565b336000908152600a60205260409020829055600154610708906001600160a01b03168483610b59565b506107136001600055565b5050565b6005546001600160a01b031633146107415760405162461bcd60e51b81526004016103d890611021565b6001600160a01b03811660009081526009602052604090205460ff16151560011461076b57600080fd5b6001600160a01b03166000908152600960205260409020805460ff19169055565b3360009081526009602052604090205460ff161515600114806107b957506005546001600160a01b031633145b6107f35760405162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b60448201526064016103d8565b60008111806108025750600034115b61080b57600080fd5b6000346000036108345760015461082d906001600160a01b0316333085610d00565b50806108a1565b600160009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561088457600080fd5b505af1158015610898573d6000803e3d6000fd5b50505050503490505b6003546000908152600660209081526040918290208390556004805483516318160ddd60e01b815293516001600160a01b03909116936318160ddd93818401939092918290030181865afa1580156108fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109219190611044565b6003546000908152600760209081526040918290209290925560048054825163f92c45b760e01b815292516001600160a01b039091169363f92c45b79380840193919291908290030181865afa15801561097f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a39190611044565b600380546000908152600860205260408120929092558054916109c583611073565b91905055505050565b6005546001600160a01b031633146109f85760405162461bcd60e51b81526004016103d890611021565b6001600160a01b03811660009081526009602052604090205460ff1615610a1e57600080fd5b6001600160a01b03166000908152600960205260409020805460ff19166001179055565b6005546001600160a01b03163314610a6c5760405162461bcd60e51b81526004016103d890611021565b6001600160a01b038116610a7f57600080fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610ac6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aea9190611044565b90506107136001600160a01b0383163383610b59565b600260005403610b525760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103d8565b6002600055565b6040516001600160a01b038316602482015260448101829052610bbc90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610d3e565b505050565b60006001600160a01b038316610bd657600080fd5b6001600160a01b0383166000908152600a6020526040902054600354831115610bff5760035492505b828110610c1057600091505061056d565b8060005b84821015610cf757600082815260086020908152604080832054600783528184205460069093528184205460048054935163d113d59d60e01b81526001600160a01b038d81169282019290925292959193919291169063d113d59d90602401602060405180830381865afa158015610c90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb49190611044565b9050610cc0848461108c565b610cca82846110a3565b610cd491906110c2565b610cde90866110e4565b9450505050508180610cef90611073565b925050610c14565b95945050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610d389085906323b872dd60e01b90608401610b85565b50505050565b6000610d93826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e109092919063ffffffff16565b805190915015610bbc5780806020019051810190610db191906110fc565b610bbc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103d8565b6060610e1f8484600085610e27565b949350505050565b606082471015610e885760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103d8565b600080866001600160a01b03168587604051610ea4919061114a565b60006040518083038185875af1925050503d8060008114610ee1576040519150601f19603f3d011682016040523d82523d6000602084013e610ee6565b606091505b5091509150610ef787838387610f02565b979650505050505050565b60608315610f71578251600003610f6a576001600160a01b0385163b610f6a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103d8565b5081610e1f565b610e1f8383815115610f865781518083602001fd5b8060405162461bcd60e51b81526004016103d89190611166565b600060208284031215610fb257600080fd5b5035919050565b80356001600160a01b0381168114610fd057600080fd5b919050565b600060208284031215610fe757600080fd5b610ff082610fb9565b9392505050565b6000806040838503121561100a57600080fd5b61101383610fb9565b946020939093013593505050565b6020808252600990820152683737ba1037bbb732b960b91b604082015260600190565b60006020828403121561105657600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000600182016110855761108561105d565b5060010190565b60008282101561109e5761109e61105d565b500390565b60008160001904831182151516156110bd576110bd61105d565b500290565b6000826110df57634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156110f7576110f761105d565b500190565b60006020828403121561110e57600080fd5b81518015158114610ff057600080fd5b60005b83811015611139578181015183820152602001611121565b83811115610d385750506000910152565b6000825161115c81846020870161111e565b9190910192915050565b602081526000825180602084015261118581604085016020870161111e565b601f01601f1916919091016040019291505056fea2646970667358221220418ccd5b0f3ee4fbf46cf128984c1147327c0dc9536955ff75a320a3c6ad94f364736f6c634300080d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000845e4145f7de2822d16fe233ecd0181c61f1d65f000000000000000000000000a4c523d3f407a53149d90a0a4074f7775f2fd1ff
-----Decoded View---------------
Arg [0] : _wsonic (address): 0x845e4145F7de2822d16FE233Ecd0181c61f1d65F
Arg [1] : _swpxNFT (address): 0xa4c523D3F407A53149d90a0a4074f7775f2fd1fF
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000845e4145f7de2822d16fe233ecd0181c61f1d65f
Arg [1] : 000000000000000000000000a4c523d3f407a53149d90a0a4074f7775f2fd1ff
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.