Source Code
Latest 25 from a total of 1,161 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Withdraw | 406091248 | 55 days ago | IN | 0.0005 ETH | 0.00003777 | ||||
| Withdraw | 368635276 | 163 days ago | IN | 0.0005 ETH | 0.00000112 | ||||
| Withdraw | 361205615 | 184 days ago | IN | 0.0005 ETH | 0.00000089 | ||||
| Get Reward | 359951288 | 188 days ago | IN | 0.0005 ETH | 0.00000211 | ||||
| Withdraw | 358371774 | 193 days ago | IN | 0.0005 ETH | 0.00000174 | ||||
| Transfer | 345880753 | 229 days ago | IN | 0 ETH | 0.0000028 | ||||
| Get Reward | 336820205 | 255 days ago | IN | 0.0005 ETH | 0.00000178 | ||||
| Withdraw | 320714089 | 302 days ago | IN | 0.0005 ETH | 0.00000112 | ||||
| Withdraw | 300644066 | 360 days ago | IN | 0.0005 ETH | 0.00000133 | ||||
| Get Reward | 300643905 | 360 days ago | IN | 0.0005 ETH | 0.0000024 | ||||
| Withdraw | 296035719 | 374 days ago | IN | 0.0005 ETH | 0.00001026 | ||||
| Get Reward | 294723149 | 378 days ago | IN | 0.0005 ETH | 0.00000247 | ||||
| Withdraw | 294722044 | 378 days ago | IN | 0.0005 ETH | 0.00000212 | ||||
| Get Reward | 294058786 | 379 days ago | IN | 0.0005 ETH | 0.00000279 | ||||
| Withdraw | 285449568 | 404 days ago | IN | 0.0005 ETH | 0.00000761 | ||||
| Withdraw | 284960532 | 406 days ago | IN | 0.0005 ETH | 0.00000121 | ||||
| Withdraw | 284073157 | 408 days ago | IN | 0.0005 ETH | 0.00000574 | ||||
| Get Reward | 284073048 | 408 days ago | IN | 0.0005 ETH | 0.00000872 | ||||
| Get Reward | 283707783 | 410 days ago | IN | 0.0005 ETH | 0.00001313 | ||||
| Withdraw | 283707321 | 410 days ago | IN | 0.0005 ETH | 0.00000894 | ||||
| Withdraw | 283032602 | 412 days ago | IN | 0.0005 ETH | 0.00000286 | ||||
| Withdraw | 282059811 | 414 days ago | IN | 0.0005 ETH | 0.0000029 | ||||
| Withdraw | 281834945 | 415 days ago | IN | 0.0005 ETH | 0.00000226 | ||||
| Get Reward | 281834898 | 415 days ago | IN | 0.0005 ETH | 0.00000302 | ||||
| Withdraw | 281619224 | 416 days ago | IN | 0.0005 ETH | 0.00000294 |
Latest 1 internal transaction
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 345880753 | 229 days ago | 0.385 ETH |
Cross-Chain Transactions
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x0CF665a9...f1004bE82 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
SpartaRewardLpLinearStaking
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
import {LpLinearStaking, SpartaDexPair, IAccessControl} from "./LpLinearStaking.sol";
import {ISpartaStaking} from "./interfaces/ISpartaStaking.sol";
import {IContractsRepostiory} from "../IContractsRepostiory.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract SpartaRewardLpLinearStaking is LpLinearStaking {
using SafeERC20 for IERC20;
bytes32 constant SPARTA_STAKING_CONTRACT_ID = keccak256("SPARTA_STAKING");
IContractsRepostiory public contractsRepository;
constructor(
SpartaDexPair _lpToken,
IERC20 _sparta,
IAccessControl _acl,
IContractsRepostiory _contractsRepository,
address _treasury,
uint256 _value
) LpLinearStaking(_lpToken, _sparta, _acl, _treasury, _value) {
contractsRepository = _contractsRepository;
}
function getReward()
external
payable
override
isInitialized
onlyWithFees
updateReward(msg.sender)
{
address spartaStakingAddress = contractsRepository.tryGetContract(
SPARTA_STAKING_CONTRACT_ID
);
uint256 reward = rewards[msg.sender];
if (reward == 0) {
revert AmountZero();
}
uint256 toTransfer = reward;
if (spartaStakingAddress != address(0)) {
ISpartaStaking staking = ISpartaStaking(spartaStakingAddress);
toTransfer = (reward * 250000) / 1000000;
uint256 onStaking = reward - toTransfer;
rewardToken.forceApprove(spartaStakingAddress, onStaking);
staking.stakeAs(msg.sender, onStaking);
}
rewards[msg.sender] = 0;
rewardToken.safeTransfer(msg.sender, toTransfer);
emit RewardTaken(msg.sender, toTransfer);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
* 0 before setting it to a non-zero value.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
interface IUniswapV2Callee {
function uniswapV2Call(
address sender,
uint amount0,
uint amount1,
bytes calldata data
) external;
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
interface IUniswapV2ERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(
address owner,
address spender
) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(
address from,
address to,
uint value
) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(
address owner,
address spender,
uint value,
uint deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
interface IUniswapV2Factory {
error IdenticalAddress();
error ZeroAddress();
error PairAlreadyExists();
error OnlyFeeToSetter();
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(
address tokenA,
address tokenB
) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(
address tokenA,
address tokenB
) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
import {IUniswapV2ERC20} from "./IUniswapV2ERC20.sol";
interface IUniswapV2Pair is IUniswapV2ERC20 {
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(
address indexed sender,
uint amount0,
uint amount1,
address indexed to
);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves()
external
view
returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(
uint amount0Out,
uint amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, "ds-math-add-overflow");
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, "ds-math-sub-underflow");
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow");
}
function div(uint x, uint y) internal pure returns (uint) {
require(y != 0, "ds-math-div-zero");
return x / y;
}
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
library UQ112x112 {
uint224 constant Q112 = 2 ** 112;
// encode a uint112 as a UQ112x112
function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
// divide a UQ112x112 by a uint112, returning a UQ112x112
function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
z = x / uint224(y);
}
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
import {IUniswapV2ERC20} from "./interfaces/IUniswapV2ERC20.sol";
import {SafeMath} from "./libraries/SafeMath.sol";
contract SpartaDexERC20 is IUniswapV2ERC20 {
string public constant override name = "SpartaDexERC20";
string public constant override symbol = "SRTDX";
uint8 public constant override decimals = 18;
uint public override totalSupply;
mapping(address => uint) public override balanceOf;
mapping(address => mapping(address => uint)) public override allowance;
bytes32 public override DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant override PERMIT_TYPEHASH =
0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint) public override nonces;
constructor() {
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
),
keccak256(bytes(name)),
keccak256(bytes("1")),
_chainId(),
address(this)
)
);
}
function _chainId() internal view returns (uint256 chainId_) {
assembly {
chainId_ := chainid()
}
}
function _mint(address to, uint value) internal {
totalSupply += value;
balanceOf[to] += value;
emit Transfer(address(0), to, value);
}
function _burn(address from, uint value) internal {
balanceOf[from] -= value;
totalSupply -= value;
emit Transfer(from, address(0), value);
}
function _approve(address owner, address spender, uint value) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(address from, address to, uint value) private {
balanceOf[from] -= value;
balanceOf[to] += value;
emit Transfer(from, to, value);
}
function approve(
address spender,
uint value
) external override returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint value) external override returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(
address from,
address to,
uint value
) external override returns (bool) {
if (allowance[from][msg.sender] != type(uint).max) {
allowance[from][msg.sender] -= value;
}
_transfer(from, to, value);
return true;
}
function permit(
address owner,
address spender,
uint value,
uint deadline,
uint8 v,
bytes32 r,
bytes32 s
) external override {
require(deadline >= block.timestamp, "UniswapV2: EXPIRED");
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR,
keccak256(
abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
value,
nonces[owner]++,
deadline
)
)
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(
recoveredAddress != address(0) && recoveredAddress == owner,
"UniswapV2: INVALID_SIGNATURE"
);
_approve(owner, spender, value);
}
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
import {IUniswapV2Pair} from "./interfaces/IUniswapV2Pair.sol";
import {SpartaDexERC20} from "./SpartaDexERC20.sol";
import {Math} from "./libraries/Math.sol";
import {SafeMath} from "./libraries/SafeMath.sol";
import {UQ112x112} from "./libraries/UQ112x112.sol";
import {IUniswapV2Factory} from "./interfaces/IUniswapV2Factory.sol";
import {IUniswapV2Callee} from "./interfaces/IUniswapV2Callee.sol";
contract SpartaDexPair is IUniswapV2Pair, SpartaDexERC20 {
using SafeMath for uint;
using UQ112x112 for uint224;
uint public constant override MINIMUM_LIQUIDITY = 10 ** 3;
bytes4 private constant SELECTOR =
bytes4(keccak256(bytes("transfer(address,uint256)")));
address public override factory;
address public override token0;
address public override token1;
uint112 private reserve0; // uses single storage slot, accessible via getReserves
uint112 private reserve1; // uses single storage slot, accessible via getReserves
uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves
uint public override price0CumulativeLast;
uint public override price1CumulativeLast;
uint public override kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event
uint private unlocked = 1;
modifier lock() {
require(unlocked == 1, "UniswapV2: LOCKED");
unlocked = 0;
_;
unlocked = 1;
}
function getReserves()
public
view
override
returns (
uint112 _reserve0,
uint112 _reserve1,
uint32 _blockTimestampLast
)
{
_reserve0 = reserve0;
_reserve1 = reserve1;
_blockTimestampLast = blockTimestampLast;
}
function _safeTransfer(address token, address to, uint value) private {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(SELECTOR, to, value)
);
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"UniswapV2: TRANSFER_FAILED"
);
}
constructor() {
factory = msg.sender;
}
// called once by the factory at time of deployment
function initialize(address _token0, address _token1) external override {
require(msg.sender == factory, "UniswapV2: FORBIDDEN"); // sufficient check
token0 = _token0;
token1 = _token1;
}
// update reserves and, on the first call per block, price accumulators
function _update(
uint balance0,
uint balance1,
uint112 _reserve0,
uint112 _reserve1
) private {
require(
balance0 <= type(uint112).max && balance1 <= type(uint112).max,
"UniswapV2: OVERFLOW"
);
uint32 blockTimestamp = uint32(block.timestamp % 2 ** 32);
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
// * never overflows, and + overflow is desired
price0CumulativeLast +=
uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) *
timeElapsed;
price1CumulativeLast +=
uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) *
timeElapsed;
}
reserve0 = uint112(balance0);
reserve1 = uint112(balance1);
blockTimestampLast = blockTimestamp;
emit Sync(reserve0, reserve1);
}
// if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
function _mintFee(
uint112 _reserve0,
uint112 _reserve1
) private returns (bool feeOn) {
address feeTo = IUniswapV2Factory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
uint rootKLast = Math.sqrt(_kLast);
if (rootK > rootKLast) {
uint numerator = totalSupply.mul(rootK.sub(rootKLast));
uint denominator = rootK.mul(5).add(rootKLast);
uint liquidity = numerator / denominator;
if (liquidity > 0) _mint(feeTo, liquidity);
}
}
} else if (_kLast != 0) {
kLast = 0;
}
}
// this low-level function should be called from a contract which performs important safety checks
function mint(address to) external override lock returns (uint liquidity) {
(uint112 _reserve0, uint112 _reserve1, ) = getReserves(); // gas savings
uint balance0 = IUniswapV2Pair(token0).balanceOf(address(this));
uint balance1 = IUniswapV2Pair(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
if (_totalSupply == 0) {
liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
_mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
} else {
liquidity = Math.min(
amount0.mul(_totalSupply) / _reserve0,
amount1.mul(_totalSupply) / _reserve1
);
}
require(liquidity > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED");
_mint(to, liquidity);
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Mint(msg.sender, amount0, amount1);
}
// this low-level function should be called from a contract which performs important safety checks
function burn(
address to
) external override lock returns (uint amount0, uint amount1) {
(uint112 _reserve0, uint112 _reserve1, ) = getReserves(); // gas savings
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
uint balance0 = IUniswapV2Pair(_token0).balanceOf(address(this));
uint balance1 = IUniswapV2Pair(_token1).balanceOf(address(this));
uint liquidity = balanceOf[address(this)];
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
require(
amount0 > 0 && amount1 > 0,
"UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED"
);
_burn(address(this), liquidity);
_safeTransfer(_token0, to, amount0);
_safeTransfer(_token1, to, amount1);
balance0 = IUniswapV2Pair(_token0).balanceOf(address(this));
balance1 = IUniswapV2Pair(_token1).balanceOf(address(this));
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Burn(msg.sender, amount0, amount1, to);
}
// this low-level function should be called from a contract which performs important safety checks
function swap(
uint amount0Out,
uint amount1Out,
address to,
bytes calldata data
) external override lock {
require(
amount0Out > 0 || amount1Out > 0,
"UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT"
);
(uint112 _reserve0, uint112 _reserve1, ) = getReserves(); // gas savings
require(
amount0Out < _reserve0 && amount1Out < _reserve1,
"UniswapV2: INSUFFICIENT_LIQUIDITY"
);
uint balance0;
uint balance1;
{
// scope for _token{0,1}, avoids stack too deep errors
address _token0 = token0;
address _token1 = token1;
require(to != _token0 && to != _token1, "UniswapV2: INVALID_TO");
if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens
if (data.length > 0)
IUniswapV2Callee(to).uniswapV2Call(
msg.sender,
amount0Out,
amount1Out,
data
);
balance0 = IUniswapV2Pair(_token0).balanceOf(address(this));
balance1 = IUniswapV2Pair(_token1).balanceOf(address(this));
}
uint amount0In = balance0 > _reserve0 - amount0Out
? balance0 - (_reserve0 - amount0Out)
: 0;
uint amount1In = balance1 > _reserve1 - amount1Out
? balance1 - (_reserve1 - amount1Out)
: 0;
require(
amount0In > 0 || amount1In > 0,
"UniswapV2: INSUFFICIENT_INPUT_AMOUNT"
);
{
// scope for reserve{0,1}Adjusted, avoids stack too deep errors
uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3));
uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3));
require(
balance0Adjusted.mul(balance1Adjusted) >=
uint(_reserve0).mul(_reserve1).mul(1000 ** 2),
"UniswapV2: K"
);
}
_update(balance0, balance1, _reserve0, _reserve1);
emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
}
// force balances to match reserves
function skim(address to) external override lock {
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
_safeTransfer(
_token0,
to,
IUniswapV2Pair(_token0).balanceOf(address(this)).sub(reserve0)
);
_safeTransfer(
_token1,
to,
IUniswapV2Pair(_token1).balanceOf(address(this)).sub(reserve1)
);
}
// force reserves to match balances
function sync() external override lock {
_update(
IUniswapV2Pair(token0).balanceOf(address(this)),
IUniswapV2Pair(token1).balanceOf(address(this)),
reserve0,
reserve1
);
}
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
/**
* @title IAccessControlHolder
* @notice Interface created to store reference to the access control.
*/
interface IAccessControlHolder {
/**
* @notice Function returns reference to IAccessControl.
* @return IAccessControl reference to access control.
*/
function acl() external view returns (IAccessControl);
}// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
interface IContractsRepostiory {
error ContractDoesNotExist();
error OnlyRepositoryOnwer();
function getContract(bytes32 contractId) external view returns (address);
function tryGetContract(bytes32 contractId) external view returns (address);
function setContract(bytes32 contractId, address contractAddress) external;
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
/**
* @title IWithFees.
* @notice This interface describes the functions for managing fees in a contract.
*/
interface IWithFees {
error OnlyFeesManagerAccess();
error OnlyWithFees();
error ETHTransferFailed();
/**
* @notice Function returns the treasury address where fees are collected.
* @return The address of the treasury .
*/
function treasury() external view returns (address);
/**
* @notice Function returns the value of the fees.
* @return uint256 Amount of fees to pay.
*/
function fees() external view returns (uint256);
/**
* @notice Function transfers the collected fees to the treasury address.
*/
function transfer() external;
}// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface ILinearStaking {
error BeforeStakingStart();
error AfterStakingFinish();
error AmountZero();
error RewardBalanceTooSmall();
error NotValidUnlockTimestamp();
error ToEarlyToWithdrawReward();
error TooSmallAmount();
error StartNotValid();
event Staked(address indexed wallet, uint256 amount);
event Unstaked(address indexed wallet, uint256 amount);
event RewardTaken(address indexed wallet, uint256 amount);
event Initialized(
uint256 start,
uint256 duration,
uint256 reward,
uint256 unlockTokensTimestamp
);
function stake(uint256) external;
function unlockTokens(IERC20 token, address _to, uint256 _amount) external;
function withdraw(uint256) external payable;
function earned(address _account) external view returns (uint256);
function start() external view returns (uint256);
function finishAt() external view returns (uint256);
function stakingToken() external view returns (IERC20);
function rewardToken() external view returns (IERC20);
function totalSupply() external view returns (uint256);
function duration() external view returns (uint256);
function balanceOf(address) external view returns (uint256);
function rewardPerToken() external view returns (uint256);
function unlockTokensTimestamp() external view returns (uint256);
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
interface ISpartaStaking {
error RewardBalanceTooSmall();
error BeforeStakingStart();
error AfterStakingFinish();
error TokensAlreadyClaimed();
error RoundDoesNotExist();
error BeforeReleaseTime();
error NotValidUnlockTimestamp();
error ToEarlyToWithdrawReward();
error StartNotValid();
error MinimalUnstakingPeriod();
error CannotUnstake();
error CurrentImplementation();
struct TokensToClaim {
bool taken;
uint256 release;
uint256 value;
}
event Staked(address indexed wallet, uint256 value);
event Unstaked(
address indexed wallet,
uint256 tokensAmount,
uint256 tokensToClaim,
uint256 duration
);
event TokensClaimed(
address indexed wallet,
uint256 indexed roundId,
uint256 tokensToClaimid
);
event RewardTaken(address indexed wallet, uint256 amount);
event Initialized(
uint256 start,
uint256 duration,
uint256 reward,
uint256 unlockTokensTimestamp
);
event MovedToNextImplementation(
address indexed by,
uint256 balance,
uint256 reward
);
function finishAt() external view returns (uint256);
function stake(uint256 amount) external;
function stakeAs(address wallet, uint256 amount) external;
function unlockTokens(address to, uint256 amount) external;
function unlockTokensTimestamp() external view returns (uint256);
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
import {ILinearStaking} from "./interfaces/ILinearStaking.sol";
import {IAccessControlHolder} from "../IAccessControlHolder.sol";
import {ToInitialize} from "../ToInitialize.sol";
import {WithFees} from "../WithFees.sol";
import {ZeroAmountGuard} from "../ZeroAmountGuard.sol";
import {ZeroAddressGuard} from "../ZeroAddressGuard.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
contract LinearStaking is
ILinearStaking,
ToInitialize,
Ownable,
WithFees,
ZeroAmountGuard,
ZeroAddressGuard
{
using SafeERC20 for IERC20;
uint256 constant UNLOCK_TIMESTAMP_MINIMUM_DIFF = 30 days;
IERC20 public immutable override stakingToken;
IERC20 public immutable override rewardToken;
uint256 public override totalSupply;
uint256 public start;
uint256 public override duration;
uint256 public updatedAt;
uint256 public rewardRate;
uint256 public rewardPerTokenStored;
uint256 public unlockTokensTimestamp;
mapping(address => uint256) public userRewardPerTokenPaid;
mapping(address => uint256) public rewards;
mapping(address => uint256) public override balanceOf;
modifier updateReward(address _account) {
rewardPerTokenStored = rewardPerToken();
updatedAt = lastTimeRewardApplicable();
if (_account != address(0)) {
rewards[_account] = earned(_account);
userRewardPerTokenPaid[_account] = rewardPerTokenStored;
}
_;
}
modifier isOngoing() {
if (block.timestamp < start) {
revert BeforeStakingStart();
}
if (finishAt() < block.timestamp) {
revert AfterStakingFinish();
}
_;
}
constructor(
IERC20 stakingToken_,
IERC20 rewardToken_,
IAccessControl acl_,
address treasury_,
uint256 fees_
) Ownable() WithFees(acl_, treasury_, fees_) {
stakingToken = stakingToken_;
rewardToken = rewardToken_;
}
function initialize(
uint256 amount_,
uint256 duration_,
uint256 start_,
uint256 unlockTokensTimestamp_
)
external
notInitialized
onlyOwner
notZeroAmount(amount_)
notZeroAmount(duration_)
{
if (rewardToken.balanceOf(address(this)) < amount_) {
revert RewardBalanceTooSmall();
}
if (block.timestamp > start_) {
revert StartNotValid();
}
duration = duration_;
rewardRate = amount_ / duration_;
start = start_;
updatedAt = block.timestamp;
unlockTokensTimestamp = unlockTokensTimestamp_;
if (
finishAt() + UNLOCK_TIMESTAMP_MINIMUM_DIFF > unlockTokensTimestamp_
) {
revert NotValidUnlockTimestamp();
}
initialized = true;
emit Initialized(start_, duration_, amount_, unlockTokensTimestamp_);
}
function unlockTokens(
IERC20 token,
address to,
uint256 amount
)
external
notZeroAmount(amount)
notZeroAddress(to)
isInitialized
onlyOwner
{
if (block.timestamp < unlockTokensTimestamp) {
revert ToEarlyToWithdrawReward();
}
token.safeTransfer(to, amount);
}
function stake(
uint256 amount
) external override isInitialized isOngoing updateReward(msg.sender) {
stakingToken.safeTransferFrom(msg.sender, address(this), amount);
balanceOf[msg.sender] += amount;
totalSupply += amount;
emit Staked(msg.sender, amount);
}
function withdraw(
uint256 amount
)
external
payable
override
onlyWithFees
isInitialized
notZeroAmount(amount)
updateReward(msg.sender)
{
stakingToken.safeTransfer(msg.sender, amount);
balanceOf[msg.sender] -= amount;
totalSupply -= amount;
emit Unstaked(msg.sender, amount);
}
function getReward()
external
payable
virtual
isInitialized
onlyWithFees
updateReward(msg.sender)
{
uint256 reward = rewards[msg.sender];
if (reward == 0) {
revert AmountZero();
}
rewards[msg.sender] = 0;
rewardToken.safeTransfer(msg.sender, reward);
emit RewardTaken(msg.sender, reward);
}
function rewardPerToken() public view override returns (uint) {
if (totalSupply == 0 || block.timestamp < start) {
return rewardPerTokenStored;
}
return
rewardPerTokenStored +
(rewardRate * (lastTimeRewardApplicable() - updatedAt) * 1e18) /
totalSupply;
}
function earned(address _account) public view override returns (uint256) {
return
((balanceOf[_account] *
((rewardPerToken() - userRewardPerTokenPaid[_account]))) /
1e18) + rewards[_account];
}
function lastTimeRewardApplicable() public view returns (uint256) {
return _min(finishAt(), block.timestamp);
}
function finishAt() public view override returns (uint256) {
return start + duration;
}
function _min(uint x, uint y) private pure returns (uint256) {
return x <= y ? x : y;
}
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
import {SpartaDexPair} from "../dex/core/SpartaDexPair.sol";
import {LinearStaking} from "./LinearStaking.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
contract LpLinearStaking is LinearStaking {
constructor(
SpartaDexPair _lpToken,
IERC20 _reward,
IAccessControl _acl,
address _treasury,
uint256 _value
)
LinearStaking(
IERC20(address(_lpToken)),
_reward,
_acl,
_treasury,
_value
)
{}
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
contract ToInitialize {
error AlreadyInitialized();
error NotInitialized();
bool internal initialized;
modifier isInitialized() {
_isInitialized();
_;
}
function _isInitialized() internal view {
if (!initialized) {
revert NotInitialized();
}
}
modifier notInitialized() {
if (initialized) {
revert AlreadyInitialized();
}
_;
}
}// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
import {IAccessControlHolder, IAccessControl} from "./IAccessControlHolder.sol";
import {IWithFees} from "./IWithFees.sol";
/**
* @title WithFees
* @notice This contract is responsible for managing, calculating and transferring fees.
*/
contract WithFees is IAccessControlHolder, IWithFees {
address public immutable override treasury;
uint256 public immutable override fees;
IAccessControl public immutable override acl;
bytes32 public constant FEES_MANAGER = keccak256("FEES_MANAGER");
/**
* @notice Modifier to allow only function calls that are accompanied by the required fee.
* @dev Function reverts with OnlyWithFees error, if the value is smaller than expected.
*/
modifier onlyWithFees() {
if (fees != msg.value) {
revert OnlyWithFees();
}
_;
}
/**
* @notice Modifier to allow only accounts with FEES_MANAGER role.
* @dev Reverts with OnlyFeesManagerAccess error, if the sender does not have the role.
*/
modifier onlyFeesManagerAccess() {
if (!acl.hasRole(FEES_MANAGER, msg.sender)) {
revert OnlyFeesManagerAccess();
}
_;
}
constructor(IAccessControl acl_, address treasury_, uint256 value_) {
acl = acl_;
treasury = treasury_;
fees = value_;
}
/**
* @notice Transfers the balance of the contract to the treasury.
* @dev Only accessible by an account with the FEES_MANAGER role.
*/
function transfer() external onlyFeesManagerAccess {
(bool sent, ) = treasury.call{value: address(this).balance}("");
if (!sent) {
revert ETHTransferFailed();
}
}
}// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
/**
* @title ZeroAddressGuard.
* @notice This contract is responsible for ensuring that a given address is not a zero address.
*/
contract ZeroAddressGuard {
error ZeroAddress();
/**
* @notice Modifier to make a function callable only when the provided address is non-zero.
* @dev If the address is a zero address, the function reverts with ZeroAddress error.
* @param _addr Address to be checked..
*/
modifier notZeroAddress(address _addr) {
_ensureIsNotZeroAddress(_addr);
_;
}
/// @notice Checks if a given address is a zero address and reverts if it is.
/// @param _addr Address to be checked.
/// @dev If the address is a zero address, the function reverts with ZeroAddress error.
/**
* @notice Checks if a given address is a zero address and reverts if it is.
* @dev .
* @param _addr .
*/
function _ensureIsNotZeroAddress(address _addr) internal pure {
if (_addr == address(0)) {
revert ZeroAddress();
}
}
}// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.18;
/**
* @title ZeroAmountGuard
* @notice This contract provides a modifier to guard against zero values in a transaction.
*/
contract ZeroAmountGuard {
error ZeroAmount();
/**
* @notice Modifier ensures the amount provided is not zero.
* param _amount The amount to check.
* @dev If the amount is zero, the function reverts with a ZeroAmount error.
*/
modifier notZeroAmount(uint256 _amount) {
_ensureIsNotZero(_amount);
_;
}
/**
* @notice Function verifies that the given amount is not zero.
* @param _amount The amount to check.
*/
function _ensureIsNotZero(uint256 _amount) internal pure {
if (_amount == 0) {
revert ZeroAmount();
}
}
}{
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract SpartaDexPair","name":"_lpToken","type":"address"},{"internalType":"contract IERC20","name":"_sparta","type":"address"},{"internalType":"contract IAccessControl","name":"_acl","type":"address"},{"internalType":"contract IContractsRepostiory","name":"_contractsRepository","type":"address"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AfterStakingFinish","type":"error"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"AmountZero","type":"error"},{"inputs":[],"name":"BeforeStakingStart","type":"error"},{"inputs":[],"name":"ETHTransferFailed","type":"error"},{"inputs":[],"name":"NotInitialized","type":"error"},{"inputs":[],"name":"NotValidUnlockTimestamp","type":"error"},{"inputs":[],"name":"OnlyFeesManagerAccess","type":"error"},{"inputs":[],"name":"OnlyWithFees","type":"error"},{"inputs":[],"name":"RewardBalanceTooSmall","type":"error"},{"inputs":[],"name":"StartNotValid","type":"error"},{"inputs":[],"name":"ToEarlyToWithdrawReward","type":"error"},{"inputs":[],"name":"TooSmallAmount","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unlockTokensTimestamp","type":"uint256"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardTaken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Unstaked","type":"event"},{"inputs":[],"name":"FEES_MANAGER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acl","outputs":[{"internalType":"contract IAccessControl","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractsRepository","outputs":[{"internalType":"contract IContractsRepostiory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"duration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finishAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReward","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount_","type":"uint256"},{"internalType":"uint256","name":"duration_","type":"uint256"},{"internalType":"uint256","name":"start_","type":"uint256"},{"internalType":"uint256","name":"unlockTokensTimestamp_","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"start","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unlockTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unlockTokensTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"updatedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userRewardPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"}]Contract Creation Code
0x6101206040523480156200001257600080fd5b506040516200306b3803806200306b83398181016040528101906200003891906200041e565b8585858484848484848482828262000065620000596200019860201b60201c565b620001a060201b60201c565b8273ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff16815250508173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508060a081815250505050508473ffffffffffffffffffffffffffffffffffffffff1660e08173ffffffffffffffffffffffffffffffffffffffff16815250508373ffffffffffffffffffffffffffffffffffffffff166101008173ffffffffffffffffffffffffffffffffffffffff16815250505050505050505050505082600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050505050620004ba565b600033905090565b60008060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600060016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600062000297826200026a565b9050919050565b6000620002ab826200028a565b9050919050565b620002bd816200029e565b8114620002c957600080fd5b50565b600081519050620002dd81620002b2565b92915050565b6000620002f0826200028a565b9050919050565b6200030281620002e3565b81146200030e57600080fd5b50565b6000815190506200032281620002f7565b92915050565b600062000335826200028a565b9050919050565b620003478162000328565b81146200035357600080fd5b50565b60008151905062000367816200033c565b92915050565b60006200037a826200028a565b9050919050565b6200038c816200036d565b81146200039857600080fd5b50565b600081519050620003ac8162000381565b92915050565b620003bd816200028a565b8114620003c957600080fd5b50565b600081519050620003dd81620003b2565b92915050565b6000819050919050565b620003f881620003e3565b81146200040457600080fd5b50565b6000815190506200041881620003ed565b92915050565b60008060008060008060c087890312156200043e576200043d62000265565b5b60006200044e89828a01620002cc565b96505060206200046189828a0162000311565b95505060406200047489828a0162000356565b94505060606200048789828a016200039b565b93505060806200049a89828a01620003cc565b92505060a0620004ad89828a0162000407565b9150509295509295509295565b60805160a05160c05160e05161010051612b2d6200053e60003960008181610dce01528181610ece01528181610fca015261186f0152600081816109d10152818161123d015261163701526000818161128501526117c201526000818161087e01528181610ae201526114a40152600081816111b201526113790152612b2d6000f3fe6080604052600436106101cc5760003560e01c80637b0a47ee116100f7578063a694fc3a11610095578063de28735911610064578063de28735914610619578063df136d6514610644578063f2fde38b1461066f578063f7c618c114610698576101cc565b8063a694fc3a1461056f578063be9a655514610598578063c8ce3986146105c3578063cd3daf9d146105ee576101cc565b80638b876347116100d15780638b876347146104b15780638da5cb5b146104ee57806398214cf2146105195780639af1d35a14610544576101cc565b80637b0a47ee1461044457806380faa57d1461046f5780638a4068dd1461049a576101cc565b806360a2da441161016f57806370a082311161013e57806370a082311461039a578063715018a6146103d757806372f702f3146103ee5780637519ab5014610419576101cc565b806360a2da44146102f057806361d027b31461031957806367d3b488146103445780636b1b8eb21461036f576101cc565b806318160ddd116101ab57806318160ddd146102765780632d452658146102a15780632e1a7d4d146102ca5780633d18b912146102e6576101cc565b80628cc262146101d15780630700037d1461020e5780630fb5a6b41461024b575b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f391906120bb565b6106c3565b6040516102059190612101565b60405180910390f35b34801561021a57600080fd5b50610235600480360381019061023091906120bb565b6107c5565b6040516102429190612101565b60405180910390f35b34801561025757600080fd5b506102606107dd565b60405161026d9190612101565b60405180910390f35b34801561028257600080fd5b5061028b6107e3565b6040516102989190612101565b60405180910390f35b3480156102ad57600080fd5b506102c860048036038101906102c39190612186565b6107e9565b005b6102e460048036038101906102df91906121d9565b61087b565b005b6102ee610ad7565b005b3480156102fc57600080fd5b5061031760048036038101906103129190612206565b610f66565b005b34801561032557600080fd5b5061032e6111b0565b60405161033b919061227c565b60405180910390f35b34801561035057600080fd5b506103596111d4565b6040516103669190612101565b60405180910390f35b34801561037b57600080fd5b506103846111eb565b60405161039191906122b0565b60405180910390f35b3480156103a657600080fd5b506103c160048036038101906103bc91906120bb565b61120f565b6040516103ce9190612101565b60405180910390f35b3480156103e357600080fd5b506103ec611227565b005b3480156103fa57600080fd5b5061040361123b565b604051610410919061232a565b60405180910390f35b34801561042557600080fd5b5061042e61125f565b60405161043b9190612101565b60405180910390f35b34801561045057600080fd5b50610459611265565b6040516104669190612101565b60405180910390f35b34801561047b57600080fd5b5061048461126b565b6040516104919190612101565b60405180910390f35b3480156104a657600080fd5b506104af611283565b005b3480156104bd57600080fd5b506104d860048036038101906104d391906120bb565b61143b565b6040516104e59190612101565b60405180910390f35b3480156104fa57600080fd5b50610503611453565b604051610510919061227c565b60405180910390f35b34801561052557600080fd5b5061052e61147c565b60405161053b9190612366565b60405180910390f35b34801561055057600080fd5b506105596114a2565b6040516105669190612101565b60405180910390f35b34801561057b57600080fd5b50610596600480360381019061059191906121d9565b6114c6565b005b3480156105a457600080fd5b506105ad61173d565b6040516105ba9190612101565b60405180910390f35b3480156105cf57600080fd5b506105d8611743565b6040516105e59190612101565b60405180910390f35b3480156105fa57600080fd5b50610603611749565b6040516106109190612101565b60405180910390f35b34801561062557600080fd5b5061062e6117c0565b60405161063b91906123a2565b60405180910390f35b34801561065057600080fd5b506106596117e4565b6040516106669190612101565b60405180910390f35b34801561067b57600080fd5b50610696600480360381019061069191906120bb565b6117ea565b005b3480156106a457600080fd5b506106ad61186d565b6040516106ba919061232a565b60405180910390f35b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054670de0b6b3a7640000600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610756611749565b61076091906123ec565b600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107aa9190612420565b6107b49190612491565b6107be91906124c2565b9050919050565b60096020528060005260406000206000915090505481565b60035481565b60015481565b806107f381611891565b826107fd816118ce565b610805611937565b61080d61197d565b600754421015610849576040517f0b370af000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61087484848773ffffffffffffffffffffffffffffffffffffffff166119fb9092919063ffffffff16565b5050505050565b347f0000000000000000000000000000000000000000000000000000000000000000146108d4576040517f4e0c7b5900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108dc611937565b806108e681611891565b336108ef611749565b6006819055506108fd61126b565b600481905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146109ca57610940816106c3565b600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600654600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b610a1533847f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166119fb9092919063ffffffff16565b82600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610a6491906123ec565b925050819055508260016000828254610a7d91906123ec565b925050819055503373ffffffffffffffffffffffffffffffffffffffff167f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f7584604051610aca9190612101565b60405180910390a2505050565b610adf611937565b347f000000000000000000000000000000000000000000000000000000000000000014610b38576040517f4e0c7b5900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b33610b41611749565b600681905550610b4f61126b565b600481905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610c1c57610b92816106c3565b600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600654600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663af21adcc7fcff0b2aa5e7c4b7504f82fe5b653487ab6687811069599e66a892f7e698c613d6040518263ffffffff1660e01b8152600401610c9991906122b0565b602060405180830381865afa158015610cb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cda919061250b565b90506000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008103610d5a576040517fcbca5aa200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000819050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610e82576000839050620f42406203d09084610dab9190612420565b610db59190612491565b915060008284610dc591906123ec565b9050610e1285827f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16611a819092919063ffffffff16565b8173ffffffffffffffffffffffffffffffffffffffff166341f5fde033836040518363ffffffff1660e01b8152600401610e4d929190612538565b600060405180830381600087803b158015610e6757600080fd5b505af1158015610e7b573d6000803e3d6000fd5b5050505050505b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f1233827f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166119fb9092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f11232b62083a698039ef038dbb12def09340c4ac3b4c838e46d3e7c89ebbb9ba82604051610f589190612101565b60405180910390a250505050565b60008054906101000a900460ff1615610fab576040517f0dc149f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fb361197d565b83610fbd81611891565b83610fc781611891565b857f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611021919061227c565b602060405180830381865afa15801561103e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110629190612576565b101561109a576040517f7182cb8b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b834211156110d4576040517f97f428ca00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8460038190555084866110e79190612491565b6005819055508360028190555042600481905550826007819055508262278d0061110f6111d4565b61111991906124c2565b1115611151576040517fa6d069af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60016000806101000a81548160ff0219169083151502179055507f21adc90360bc280b314eb6502b95564cc7180b3d7cdb300b03a8a2f41de14f3e848688866040516111a094939291906125a3565b60405180910390a1505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60006003546002546111e691906124c2565b905090565b7fad51469fd38cb9e4028f769761e769052a9f1f331b57ad921ac8a45c7903db2881565b600a6020528060005260406000206000915090505481565b61122f61197d565b6112396000611b9e565b565b7f000000000000000000000000000000000000000000000000000000000000000081565b60045481565b60055481565b600061127e6112786111d4565b42611c63565b905090565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166391d148547fad51469fd38cb9e4028f769761e769052a9f1f331b57ad921ac8a45c7903db28336040518363ffffffff1660e01b81526004016112fe9291906125e8565b602060405180830381865afa15801561131b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133f9190612649565b611375576040517fcd4a831000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16476040516113bb906126a7565b60006040518083038185875af1925050503d80600081146113f8576040519150601f19603f3d011682016040523d82523d6000602084013e6113fd565b606091505b5050905080611438576040517fb12d13eb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b60086020528060005260406000206000915090505481565b60008060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7f000000000000000000000000000000000000000000000000000000000000000081565b6114ce611937565b60025442101561150a576040517f587f220300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b426115136111d4565b101561154b576040517fa6a2809800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b33611554611749565b60068190555061156261126b565b600481905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461162f576115a5816106c3565b600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600654600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b61167c3330847f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16611c7d909392919063ffffffff16565b81600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546116cb91906124c2565b9250508190555081600160008282546116e491906124c2565b925050819055503373ffffffffffffffffffffffffffffffffffffffff167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d836040516117319190612101565b60405180910390a25050565b60025481565b60075481565b600080600154148061175c575060025442105b1561176b5760065490506117bd565b600154670de0b6b3a764000060045461178261126b565b61178c91906123ec565b6005546117999190612420565b6117a39190612420565b6117ad9190612491565b6006546117ba91906124c2565b90505b90565b7f000000000000000000000000000000000000000000000000000000000000000081565b60065481565b6117f261197d565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611861576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118589061273f565b60405180910390fd5b61186a81611b9e565b50565b7f000000000000000000000000000000000000000000000000000000000000000081565b600081036118cb576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611934576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b60008054906101000a900460ff1661197b576040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b611985611d06565b73ffffffffffffffffffffffffffffffffffffffff166119a3611453565b73ffffffffffffffffffffffffffffffffffffffff16146119f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119f0906127ab565b60405180910390fd5b565b611a7c8363a9059cbb60e01b8484604051602401611a1a929190612538565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611d0e565b505050565b600063095ea7b360e01b8383604051602401611a9e929190612538565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050611b078482611dd6565b611b9857611b8d8463095ea7b360e01b856000604051602401611b2b929190612813565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611d0e565b611b978482611d0e565b5b50505050565b60008060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600060016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081831115611c735781611c75565b825b905092915050565b611d00846323b872dd60e01b858585604051602401611c9e9392919061283c565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611d0e565b50505050565b600033905090565b6000611d70826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611e8b9092919063ffffffff16565b9050600081511480611d92575080806020019051810190611d919190612649565b5b611dd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dc8906128e5565b60405180910390fd5b505050565b60008060008473ffffffffffffffffffffffffffffffffffffffff1684604051611e00919061296b565b6000604051808303816000865af19150503d8060008114611e3d576040519150601f19603f3d011682016040523d82523d6000602084013e611e42565b606091505b5091509150818015611e705750600081511480611e6f575080806020019051810190611e6e9190612649565b5b5b8015611e815750611e8085611ea3565b5b9250505092915050565b6060611e9a8484600085611ec6565b90509392505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b606082471015611f0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f02906129f4565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611f34919061296b565b60006040518083038185875af1925050503d8060008114611f71576040519150601f19603f3d011682016040523d82523d6000602084013e611f76565b606091505b5091509150611f8787838387611f93565b92505050949350505050565b60608315611ff5576000835103611fed57611fad85611ea3565b611fec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fe390612a60565b60405180910390fd5b5b829050612000565b611fff8383612008565b5b949350505050565b60008251111561201b5781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161204f9190612ad5565b60405180910390fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006120888261205d565b9050919050565b6120988161207d565b81146120a357600080fd5b50565b6000813590506120b58161208f565b92915050565b6000602082840312156120d1576120d0612058565b5b60006120df848285016120a6565b91505092915050565b6000819050919050565b6120fb816120e8565b82525050565b600060208201905061211660008301846120f2565b92915050565b60006121278261207d565b9050919050565b6121378161211c565b811461214257600080fd5b50565b6000813590506121548161212e565b92915050565b612163816120e8565b811461216e57600080fd5b50565b6000813590506121808161215a565b92915050565b60008060006060848603121561219f5761219e612058565b5b60006121ad86828701612145565b93505060206121be868287016120a6565b92505060406121cf86828701612171565b9150509250925092565b6000602082840312156121ef576121ee612058565b5b60006121fd84828501612171565b91505092915050565b600080600080608085870312156122205761221f612058565b5b600061222e87828801612171565b945050602061223f87828801612171565b935050604061225087828801612171565b925050606061226187828801612171565b91505092959194509250565b6122768161207d565b82525050565b6000602082019050612291600083018461226d565b92915050565b6000819050919050565b6122aa81612297565b82525050565b60006020820190506122c560008301846122a1565b92915050565b6000819050919050565b60006122f06122eb6122e68461205d565b6122cb565b61205d565b9050919050565b6000612302826122d5565b9050919050565b6000612314826122f7565b9050919050565b61232481612309565b82525050565b600060208201905061233f600083018461231b565b92915050565b6000612350826122f7565b9050919050565b61236081612345565b82525050565b600060208201905061237b6000830184612357565b92915050565b600061238c826122f7565b9050919050565b61239c81612381565b82525050565b60006020820190506123b76000830184612393565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006123f7826120e8565b9150612402836120e8565b925082820390508181111561241a576124196123bd565b5b92915050565b600061242b826120e8565b9150612436836120e8565b9250828202612444816120e8565b9150828204841483151761245b5761245a6123bd565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061249c826120e8565b91506124a7836120e8565b9250826124b7576124b6612462565b5b828204905092915050565b60006124cd826120e8565b91506124d8836120e8565b92508282019050808211156124f0576124ef6123bd565b5b92915050565b6000815190506125058161208f565b92915050565b60006020828403121561252157612520612058565b5b600061252f848285016124f6565b91505092915050565b600060408201905061254d600083018561226d565b61255a60208301846120f2565b9392505050565b6000815190506125708161215a565b92915050565b60006020828403121561258c5761258b612058565b5b600061259a84828501612561565b91505092915050565b60006080820190506125b860008301876120f2565b6125c560208301866120f2565b6125d260408301856120f2565b6125df60608301846120f2565b95945050505050565b60006040820190506125fd60008301856122a1565b61260a602083018461226d565b9392505050565b60008115159050919050565b61262681612611565b811461263157600080fd5b50565b6000815190506126438161261d565b92915050565b60006020828403121561265f5761265e612058565b5b600061266d84828501612634565b91505092915050565b600081905092915050565b50565b6000612691600083612676565b915061269c82612681565b600082019050919050565b60006126b282612684565b9150819050919050565b600082825260208201905092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006127296026836126bc565b9150612734826126cd565b604082019050919050565b600060208201905081810360008301526127588161271c565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006127956020836126bc565b91506127a08261275f565b602082019050919050565b600060208201905081810360008301526127c481612788565b9050919050565b6000819050919050565b600060ff82169050919050565b60006127fd6127f86127f3846127cb565b6122cb565b6127d5565b9050919050565b61280d816127e2565b82525050565b6000604082019050612828600083018561226d565b6128356020830184612804565b9392505050565b6000606082019050612851600083018661226d565b61285e602083018561226d565b61286b60408301846120f2565b949350505050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b60006128cf602a836126bc565b91506128da82612873565b604082019050919050565b600060208201905081810360008301526128fe816128c2565b9050919050565b600081519050919050565b60005b8381101561292e578082015181840152602081019050612913565b60008484015250505050565b600061294582612905565b61294f8185612676565b935061295f818560208601612910565b80840191505092915050565b6000612977828461293a565b915081905092915050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b60006129de6026836126bc565b91506129e982612982565b604082019050919050565b60006020820190508181036000830152612a0d816129d1565b9050919050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000612a4a601d836126bc565b9150612a5582612a14565b602082019050919050565b60006020820190508181036000830152612a7981612a3d565b9050919050565b600081519050919050565b6000601f19601f8301169050919050565b6000612aa782612a80565b612ab181856126bc565b9350612ac1818560208601612910565b612aca81612a8b565b840191505092915050565b60006020820190508181036000830152612aef8184612a9c565b90509291505056fea264697066735822122035c78ef6e5b0042d76392515d7a7064c998547fe43052c6742288bf5503e433764736f6c634300081200330000000000000000000000004993e9d7c2c76760ac1cbd1674d44152a59daaed00000000000000000000000011f98c7e42a367dab4f200d2fdc460fb445ce9a800000000000000000000000001b3646adb846061411da058757b944049075b22000000000000000000000000586d1842e9f6a268bb4d72c91f1dc2a822363aed0000000000000000000000003e8e2dfb31556c824ab6004042068c26be56c4cc0000000000000000000000000000000000000000000000000001c6bf52634000
Deployed Bytecode
0x6080604052600436106101cc5760003560e01c80637b0a47ee116100f7578063a694fc3a11610095578063de28735911610064578063de28735914610619578063df136d6514610644578063f2fde38b1461066f578063f7c618c114610698576101cc565b8063a694fc3a1461056f578063be9a655514610598578063c8ce3986146105c3578063cd3daf9d146105ee576101cc565b80638b876347116100d15780638b876347146104b15780638da5cb5b146104ee57806398214cf2146105195780639af1d35a14610544576101cc565b80637b0a47ee1461044457806380faa57d1461046f5780638a4068dd1461049a576101cc565b806360a2da441161016f57806370a082311161013e57806370a082311461039a578063715018a6146103d757806372f702f3146103ee5780637519ab5014610419576101cc565b806360a2da44146102f057806361d027b31461031957806367d3b488146103445780636b1b8eb21461036f576101cc565b806318160ddd116101ab57806318160ddd146102765780632d452658146102a15780632e1a7d4d146102ca5780633d18b912146102e6576101cc565b80628cc262146101d15780630700037d1461020e5780630fb5a6b41461024b575b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f391906120bb565b6106c3565b6040516102059190612101565b60405180910390f35b34801561021a57600080fd5b50610235600480360381019061023091906120bb565b6107c5565b6040516102429190612101565b60405180910390f35b34801561025757600080fd5b506102606107dd565b60405161026d9190612101565b60405180910390f35b34801561028257600080fd5b5061028b6107e3565b6040516102989190612101565b60405180910390f35b3480156102ad57600080fd5b506102c860048036038101906102c39190612186565b6107e9565b005b6102e460048036038101906102df91906121d9565b61087b565b005b6102ee610ad7565b005b3480156102fc57600080fd5b5061031760048036038101906103129190612206565b610f66565b005b34801561032557600080fd5b5061032e6111b0565b60405161033b919061227c565b60405180910390f35b34801561035057600080fd5b506103596111d4565b6040516103669190612101565b60405180910390f35b34801561037b57600080fd5b506103846111eb565b60405161039191906122b0565b60405180910390f35b3480156103a657600080fd5b506103c160048036038101906103bc91906120bb565b61120f565b6040516103ce9190612101565b60405180910390f35b3480156103e357600080fd5b506103ec611227565b005b3480156103fa57600080fd5b5061040361123b565b604051610410919061232a565b60405180910390f35b34801561042557600080fd5b5061042e61125f565b60405161043b9190612101565b60405180910390f35b34801561045057600080fd5b50610459611265565b6040516104669190612101565b60405180910390f35b34801561047b57600080fd5b5061048461126b565b6040516104919190612101565b60405180910390f35b3480156104a657600080fd5b506104af611283565b005b3480156104bd57600080fd5b506104d860048036038101906104d391906120bb565b61143b565b6040516104e59190612101565b60405180910390f35b3480156104fa57600080fd5b50610503611453565b604051610510919061227c565b60405180910390f35b34801561052557600080fd5b5061052e61147c565b60405161053b9190612366565b60405180910390f35b34801561055057600080fd5b506105596114a2565b6040516105669190612101565b60405180910390f35b34801561057b57600080fd5b50610596600480360381019061059191906121d9565b6114c6565b005b3480156105a457600080fd5b506105ad61173d565b6040516105ba9190612101565b60405180910390f35b3480156105cf57600080fd5b506105d8611743565b6040516105e59190612101565b60405180910390f35b3480156105fa57600080fd5b50610603611749565b6040516106109190612101565b60405180910390f35b34801561062557600080fd5b5061062e6117c0565b60405161063b91906123a2565b60405180910390f35b34801561065057600080fd5b506106596117e4565b6040516106669190612101565b60405180910390f35b34801561067b57600080fd5b50610696600480360381019061069191906120bb565b6117ea565b005b3480156106a457600080fd5b506106ad61186d565b6040516106ba919061232a565b60405180910390f35b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054670de0b6b3a7640000600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610756611749565b61076091906123ec565b600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107aa9190612420565b6107b49190612491565b6107be91906124c2565b9050919050565b60096020528060005260406000206000915090505481565b60035481565b60015481565b806107f381611891565b826107fd816118ce565b610805611937565b61080d61197d565b600754421015610849576040517f0b370af000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61087484848773ffffffffffffffffffffffffffffffffffffffff166119fb9092919063ffffffff16565b5050505050565b347f0000000000000000000000000000000000000000000000000001c6bf52634000146108d4576040517f4e0c7b5900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108dc611937565b806108e681611891565b336108ef611749565b6006819055506108fd61126b565b600481905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146109ca57610940816106c3565b600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600654600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b610a1533847f0000000000000000000000004993e9d7c2c76760ac1cbd1674d44152a59daaed73ffffffffffffffffffffffffffffffffffffffff166119fb9092919063ffffffff16565b82600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610a6491906123ec565b925050819055508260016000828254610a7d91906123ec565b925050819055503373ffffffffffffffffffffffffffffffffffffffff167f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f7584604051610aca9190612101565b60405180910390a2505050565b610adf611937565b347f0000000000000000000000000000000000000000000000000001c6bf5263400014610b38576040517f4e0c7b5900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b33610b41611749565b600681905550610b4f61126b565b600481905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610c1c57610b92816106c3565b600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600654600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663af21adcc7fcff0b2aa5e7c4b7504f82fe5b653487ab6687811069599e66a892f7e698c613d6040518263ffffffff1660e01b8152600401610c9991906122b0565b602060405180830381865afa158015610cb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cda919061250b565b90506000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008103610d5a576040517fcbca5aa200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000819050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610e82576000839050620f42406203d09084610dab9190612420565b610db59190612491565b915060008284610dc591906123ec565b9050610e1285827f00000000000000000000000011f98c7e42a367dab4f200d2fdc460fb445ce9a873ffffffffffffffffffffffffffffffffffffffff16611a819092919063ffffffff16565b8173ffffffffffffffffffffffffffffffffffffffff166341f5fde033836040518363ffffffff1660e01b8152600401610e4d929190612538565b600060405180830381600087803b158015610e6757600080fd5b505af1158015610e7b573d6000803e3d6000fd5b5050505050505b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f1233827f00000000000000000000000011f98c7e42a367dab4f200d2fdc460fb445ce9a873ffffffffffffffffffffffffffffffffffffffff166119fb9092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f11232b62083a698039ef038dbb12def09340c4ac3b4c838e46d3e7c89ebbb9ba82604051610f589190612101565b60405180910390a250505050565b60008054906101000a900460ff1615610fab576040517f0dc149f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fb361197d565b83610fbd81611891565b83610fc781611891565b857f00000000000000000000000011f98c7e42a367dab4f200d2fdc460fb445ce9a873ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611021919061227c565b602060405180830381865afa15801561103e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110629190612576565b101561109a576040517f7182cb8b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b834211156110d4576040517f97f428ca00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8460038190555084866110e79190612491565b6005819055508360028190555042600481905550826007819055508262278d0061110f6111d4565b61111991906124c2565b1115611151576040517fa6d069af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60016000806101000a81548160ff0219169083151502179055507f21adc90360bc280b314eb6502b95564cc7180b3d7cdb300b03a8a2f41de14f3e848688866040516111a094939291906125a3565b60405180910390a1505050505050565b7f0000000000000000000000003e8e2dfb31556c824ab6004042068c26be56c4cc81565b60006003546002546111e691906124c2565b905090565b7fad51469fd38cb9e4028f769761e769052a9f1f331b57ad921ac8a45c7903db2881565b600a6020528060005260406000206000915090505481565b61122f61197d565b6112396000611b9e565b565b7f0000000000000000000000004993e9d7c2c76760ac1cbd1674d44152a59daaed81565b60045481565b60055481565b600061127e6112786111d4565b42611c63565b905090565b7f00000000000000000000000001b3646adb846061411da058757b944049075b2273ffffffffffffffffffffffffffffffffffffffff166391d148547fad51469fd38cb9e4028f769761e769052a9f1f331b57ad921ac8a45c7903db28336040518363ffffffff1660e01b81526004016112fe9291906125e8565b602060405180830381865afa15801561131b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133f9190612649565b611375576040517fcd4a831000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60007f0000000000000000000000003e8e2dfb31556c824ab6004042068c26be56c4cc73ffffffffffffffffffffffffffffffffffffffff16476040516113bb906126a7565b60006040518083038185875af1925050503d80600081146113f8576040519150601f19603f3d011682016040523d82523d6000602084013e6113fd565b606091505b5050905080611438576040517fb12d13eb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b60086020528060005260406000206000915090505481565b60008060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7f0000000000000000000000000000000000000000000000000001c6bf5263400081565b6114ce611937565b60025442101561150a576040517f587f220300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b426115136111d4565b101561154b576040517fa6a2809800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b33611554611749565b60068190555061156261126b565b600481905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461162f576115a5816106c3565b600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600654600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b61167c3330847f0000000000000000000000004993e9d7c2c76760ac1cbd1674d44152a59daaed73ffffffffffffffffffffffffffffffffffffffff16611c7d909392919063ffffffff16565b81600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546116cb91906124c2565b9250508190555081600160008282546116e491906124c2565b925050819055503373ffffffffffffffffffffffffffffffffffffffff167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d836040516117319190612101565b60405180910390a25050565b60025481565b60075481565b600080600154148061175c575060025442105b1561176b5760065490506117bd565b600154670de0b6b3a764000060045461178261126b565b61178c91906123ec565b6005546117999190612420565b6117a39190612420565b6117ad9190612491565b6006546117ba91906124c2565b90505b90565b7f00000000000000000000000001b3646adb846061411da058757b944049075b2281565b60065481565b6117f261197d565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611861576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118589061273f565b60405180910390fd5b61186a81611b9e565b50565b7f00000000000000000000000011f98c7e42a367dab4f200d2fdc460fb445ce9a881565b600081036118cb576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611934576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b60008054906101000a900460ff1661197b576040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b611985611d06565b73ffffffffffffffffffffffffffffffffffffffff166119a3611453565b73ffffffffffffffffffffffffffffffffffffffff16146119f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119f0906127ab565b60405180910390fd5b565b611a7c8363a9059cbb60e01b8484604051602401611a1a929190612538565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611d0e565b505050565b600063095ea7b360e01b8383604051602401611a9e929190612538565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050611b078482611dd6565b611b9857611b8d8463095ea7b360e01b856000604051602401611b2b929190612813565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611d0e565b611b978482611d0e565b5b50505050565b60008060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600060016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081831115611c735781611c75565b825b905092915050565b611d00846323b872dd60e01b858585604051602401611c9e9392919061283c565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611d0e565b50505050565b600033905090565b6000611d70826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611e8b9092919063ffffffff16565b9050600081511480611d92575080806020019051810190611d919190612649565b5b611dd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dc8906128e5565b60405180910390fd5b505050565b60008060008473ffffffffffffffffffffffffffffffffffffffff1684604051611e00919061296b565b6000604051808303816000865af19150503d8060008114611e3d576040519150601f19603f3d011682016040523d82523d6000602084013e611e42565b606091505b5091509150818015611e705750600081511480611e6f575080806020019051810190611e6e9190612649565b5b5b8015611e815750611e8085611ea3565b5b9250505092915050565b6060611e9a8484600085611ec6565b90509392505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b606082471015611f0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f02906129f4565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611f34919061296b565b60006040518083038185875af1925050503d8060008114611f71576040519150601f19603f3d011682016040523d82523d6000602084013e611f76565b606091505b5091509150611f8787838387611f93565b92505050949350505050565b60608315611ff5576000835103611fed57611fad85611ea3565b611fec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fe390612a60565b60405180910390fd5b5b829050612000565b611fff8383612008565b5b949350505050565b60008251111561201b5781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161204f9190612ad5565b60405180910390fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006120888261205d565b9050919050565b6120988161207d565b81146120a357600080fd5b50565b6000813590506120b58161208f565b92915050565b6000602082840312156120d1576120d0612058565b5b60006120df848285016120a6565b91505092915050565b6000819050919050565b6120fb816120e8565b82525050565b600060208201905061211660008301846120f2565b92915050565b60006121278261207d565b9050919050565b6121378161211c565b811461214257600080fd5b50565b6000813590506121548161212e565b92915050565b612163816120e8565b811461216e57600080fd5b50565b6000813590506121808161215a565b92915050565b60008060006060848603121561219f5761219e612058565b5b60006121ad86828701612145565b93505060206121be868287016120a6565b92505060406121cf86828701612171565b9150509250925092565b6000602082840312156121ef576121ee612058565b5b60006121fd84828501612171565b91505092915050565b600080600080608085870312156122205761221f612058565b5b600061222e87828801612171565b945050602061223f87828801612171565b935050604061225087828801612171565b925050606061226187828801612171565b91505092959194509250565b6122768161207d565b82525050565b6000602082019050612291600083018461226d565b92915050565b6000819050919050565b6122aa81612297565b82525050565b60006020820190506122c560008301846122a1565b92915050565b6000819050919050565b60006122f06122eb6122e68461205d565b6122cb565b61205d565b9050919050565b6000612302826122d5565b9050919050565b6000612314826122f7565b9050919050565b61232481612309565b82525050565b600060208201905061233f600083018461231b565b92915050565b6000612350826122f7565b9050919050565b61236081612345565b82525050565b600060208201905061237b6000830184612357565b92915050565b600061238c826122f7565b9050919050565b61239c81612381565b82525050565b60006020820190506123b76000830184612393565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006123f7826120e8565b9150612402836120e8565b925082820390508181111561241a576124196123bd565b5b92915050565b600061242b826120e8565b9150612436836120e8565b9250828202612444816120e8565b9150828204841483151761245b5761245a6123bd565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061249c826120e8565b91506124a7836120e8565b9250826124b7576124b6612462565b5b828204905092915050565b60006124cd826120e8565b91506124d8836120e8565b92508282019050808211156124f0576124ef6123bd565b5b92915050565b6000815190506125058161208f565b92915050565b60006020828403121561252157612520612058565b5b600061252f848285016124f6565b91505092915050565b600060408201905061254d600083018561226d565b61255a60208301846120f2565b9392505050565b6000815190506125708161215a565b92915050565b60006020828403121561258c5761258b612058565b5b600061259a84828501612561565b91505092915050565b60006080820190506125b860008301876120f2565b6125c560208301866120f2565b6125d260408301856120f2565b6125df60608301846120f2565b95945050505050565b60006040820190506125fd60008301856122a1565b61260a602083018461226d565b9392505050565b60008115159050919050565b61262681612611565b811461263157600080fd5b50565b6000815190506126438161261d565b92915050565b60006020828403121561265f5761265e612058565b5b600061266d84828501612634565b91505092915050565b600081905092915050565b50565b6000612691600083612676565b915061269c82612681565b600082019050919050565b60006126b282612684565b9150819050919050565b600082825260208201905092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006127296026836126bc565b9150612734826126cd565b604082019050919050565b600060208201905081810360008301526127588161271c565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006127956020836126bc565b91506127a08261275f565b602082019050919050565b600060208201905081810360008301526127c481612788565b9050919050565b6000819050919050565b600060ff82169050919050565b60006127fd6127f86127f3846127cb565b6122cb565b6127d5565b9050919050565b61280d816127e2565b82525050565b6000604082019050612828600083018561226d565b6128356020830184612804565b9392505050565b6000606082019050612851600083018661226d565b61285e602083018561226d565b61286b60408301846120f2565b949350505050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b60006128cf602a836126bc565b91506128da82612873565b604082019050919050565b600060208201905081810360008301526128fe816128c2565b9050919050565b600081519050919050565b60005b8381101561292e578082015181840152602081019050612913565b60008484015250505050565b600061294582612905565b61294f8185612676565b935061295f818560208601612910565b80840191505092915050565b6000612977828461293a565b915081905092915050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b60006129de6026836126bc565b91506129e982612982565b604082019050919050565b60006020820190508181036000830152612a0d816129d1565b9050919050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000612a4a601d836126bc565b9150612a5582612a14565b602082019050919050565b60006020820190508181036000830152612a7981612a3d565b9050919050565b600081519050919050565b6000601f19601f8301169050919050565b6000612aa782612a80565b612ab181856126bc565b9350612ac1818560208601612910565b612aca81612a8b565b840191505092915050565b60006020820190508181036000830152612aef8184612a9c565b90509291505056fea264697066735822122035c78ef6e5b0042d76392515d7a7064c998547fe43052c6742288bf5503e433764736f6c63430008120033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.