Source Code
Latest 25 from a total of 2,804 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Claim All | 17012105 | 1050 days ago | IN | 0 ETH | 0.00240598 | ||||
| Claim All | 16955923 | 1057 days ago | IN | 0 ETH | 0.00272085 | ||||
| Claim All | 16947088 | 1059 days ago | IN | 0 ETH | 0.00269224 | ||||
| Claim All | 16946210 | 1059 days ago | IN | 0 ETH | 0.00452451 | ||||
| Claim All | 16874744 | 1069 days ago | IN | 0 ETH | 0.00119223 | ||||
| Claim All | 16867785 | 1070 days ago | IN | 0 ETH | 0.00156218 | ||||
| Claim All | 16825882 | 1076 days ago | IN | 0 ETH | 0.00224201 | ||||
| Claim All | 16791110 | 1081 days ago | IN | 0 ETH | 0.00531415 | ||||
| Claim All | 16758449 | 1085 days ago | IN | 0 ETH | 0.00214421 | ||||
| Claim All | 16756826 | 1085 days ago | IN | 0 ETH | 0.00251115 | ||||
| Claim All | 16755760 | 1086 days ago | IN | 0 ETH | 0.00349029 | ||||
| Claim All | 16754986 | 1086 days ago | IN | 0 ETH | 0.00246479 | ||||
| Claim All | 16665816 | 1098 days ago | IN | 0 ETH | 0.00171505 | ||||
| Claim All | 16665814 | 1098 days ago | IN | 0 ETH | 0.00287602 | ||||
| Claim All | 16663176 | 1099 days ago | IN | 0 ETH | 0.00364366 | ||||
| Claim All | 16659422 | 1099 days ago | IN | 0 ETH | 0.00325664 | ||||
| Claim All | 16644838 | 1101 days ago | IN | 0 ETH | 0.00288149 | ||||
| Claim All | 16612849 | 1106 days ago | IN | 0 ETH | 0.00224588 | ||||
| Claim All | 16604441 | 1107 days ago | IN | 0 ETH | 0.0023496 | ||||
| Claim All | 16578848 | 1110 days ago | IN | 0 ETH | 0.00537218 | ||||
| Claim All | 16540900 | 1116 days ago | IN | 0 ETH | 0.00306234 | ||||
| Claim All | 16507445 | 1120 days ago | IN | 0 ETH | 0.00279111 | ||||
| Claim All | 16507227 | 1120 days ago | IN | 0 ETH | 0.00356766 | ||||
| Claim All | 16507207 | 1120 days ago | IN | 0 ETH | 0.00224504 | ||||
| Claim All | 16507175 | 1120 days ago | IN | 0 ETH | 0.00361436 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Vesting
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 100 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./libraries/SignedSafeMath.sol";
import "./token/STRM.sol";
/// @title Vesting contract
/// @notice takes merkletrees and vest them at TGE and/or linearly over a period of time
contract Vesting is Ownable {
using SignedSafeMath for int256;
using SafeMath for uint256;
/// @notice Precision on divisions
uint256 private constant PRECISION = 1e12;
// @notice Pool expiration in blocks (4 months at an average of 13 seconds per block)
uint256 private constant POOL_EXPIRATION = 800_000;
struct UserInfo {
int256 rewardDebt;
}
struct VestInfo {
uint256 instrumentalPerBlock;
uint256 initialRewards;
uint256 maxRewards;
uint64 start;
uint64 end;
uint256 totalVolume;
bytes32 root;
}
struct BoostInfo {
uint64 blockNumber;
bytes32 root;
}
/// @notice Address of INSTRUMENTAL contract.
STRM public immutable INSTRUMENTAL;
uint256 internal claimableRewards = 0;
/// @notice mapping of pool to Boost array
/// mapping(uint256 => Boost[]) public boosts;
/// BoostInfo[] public boosts;
bytes32[][] public roots;
/// @notice roots blockNumbers where boosts are starting
uint64[][] public rootsBN;
/// @notice Info for each vesting.
VestInfo[] public vestInfo;
/// @notice Info for each user.
mapping(uint256 => mapping(address => UserInfo)) public userInfo;
event Claim(address indexed user, uint256 indexed vid, uint256 amount);
event LogVestAddition(
uint256 indexed pid,
uint256 instrumentalPerBlock,
uint256 initialRewards,
uint64 end,
uint256 totalVolume
);
event LogUpdateVest(
uint256 indexed vid,
uint64 lastRewardBlock,
uint256 accInstrumentalPerShare
);
event LogBoostAddition(uint256 indexed pid, bytes32 root);
/// @notice
/// @dev
/// @param _instrumental ()
constructor(STRM _instrumental) {
INSTRUMENTAL = _instrumental;
}
function _arePoolExpired() internal view returns (bool) {
uint256 end = 0;
for (uint256 i = 0; i < vestInfo.length; ++i) {
end = vestInfo[i].end > end ? vestInfo[i].end : end;
}
return block.number > end + POOL_EXPIRATION;
}
function withdrawLeftovers() public onlyOwner {
require(_arePoolExpired() == true, "Vesting: Pools are not expired");
INSTRUMENTAL.transfer(msg.sender, INSTRUMENTAL.balanceOf(address(this)));
}
/// @notice Returns the number of LM pools.
/// @notice
/// @dev
/// @return pools (uint256)
function vestInfoLength() public view returns (uint256 pools) {
return vestInfo.length;
}
/// @notice Add a new vesting airdrop, defining the vesting yields, the lifetime and the root merkletree,
/// merkletree leaf aggregate use address and user volume on instrumental, user rewards is the fraction of user's volume vs total volume
/// ensure totalVolume is exactly the aggregated volume for each user or you'll get spurious results
/// @param instrumentalPerBlock (uint256)
/// @param initialRewards (uint256)
/// @param end (uint64)
/// @param totalVolume (uint256)
/// @param root (bytes32)
function add(
uint256 instrumentalPerBlock,
uint256 initialRewards,
uint64 end,
uint256 totalVolume,
bytes32 root
) public onlyOwner {
uint256 maxRewards = uint256(end).sub(block.number).mul(instrumentalPerBlock).add(
initialRewards
);
require(
INSTRUMENTAL.balanceOf(address(this)) >= maxRewards + claimableRewards,
"Vesting: Insufficient funds"
);
claimableRewards += maxRewards;
vestInfo.push(
VestInfo({
instrumentalPerBlock: instrumentalPerBlock,
initialRewards: initialRewards,
maxRewards: maxRewards,
start: uint64(block.number),
end: end,
totalVolume: totalVolume,
root: root
})
);
roots.push(new bytes32[](0));
rootsBN.push(new uint64[](0));
emit LogVestAddition(
vestInfo.length - 1,
instrumentalPerBlock,
initialRewards,
end,
totalVolume
);
}
/// @notice Instrumental can boost rewards for a set of user.
/// Every now and then Instrumental can add a mekletree at a specific block, each user present in the merkletree will get
/// a 10% boost for the rest of the Vesting lifetime. A user elligible for multiple boost will
/// get it's reward time shorten by 10% each time
/// @dev
/// @param vid (uint256)
/// @param root (bytes32)
function addBoost(uint256 vid, bytes32 root) public onlyOwner {
roots[vid].push(root);
rootsBN[vid].push(uint64(block.number));
emit LogBoostAddition(vid, root);
}
function getBoost(
uint256 vid,
uint256 volume,
bytes32[] memory proof
) public view returns (uint256 boost) {
if (roots[vid].length == 0) return 1;
VestInfo memory vest = vestInfo[vid];
// require(verify(proof, vest.root, volume), "Vesting: Invalid proof");
boost = PRECISION;
for (uint256 i = 0; i < roots[vid].length; i++) {
if (verify(proof, roots[vid][i], volume)) {
uint256 weight = uint256(vest.end).sub(rootsBN[vid][i]).mul(PRECISION) /
(uint256(vest.end).sub(vest.start));
boost = boost.add(weight.mul(11) / 10);
}
}
boost = boost / PRECISION;
}
/// @notice compute pending instrumental rewards for one user
/// @param vid (uint256)
/// @param volume (uint256)
/// @param proof ()
/// @return rewards (uint256)
function pendingInstrumental(
uint256 vid,
uint256 volume,
bytes32[] memory proof
) public view returns (uint256 rewards) {
VestInfo memory vest = vestInfo[vid];
require(verify(proof, vest.root, volume), "Vesting: Invalid proof");
UserInfo memory user = userInfo[vid][msg.sender];
uint256 userShare = volume.mul(PRECISION) / vest.totalVolume;
// the maxRewards this user could possibly claim
uint256 maxRewards = vest.maxRewards.mul(userShare);
// accumulated instrumental since vesting inception
uint256 accumulatedInstrumental = block
.number
.sub(vest.start)
.mul(vest.instrumentalPerBlock)
.mul(getBoost(vid, volume, proof))
.add(vest.initialRewards)
.mul(userShare);
uint256 maxAccumulatedInstrumental = accumulatedInstrumental > maxRewards
? maxRewards
: accumulatedInstrumental;
rewards = int256(maxAccumulatedInstrumental / PRECISION).sub(user.rewardDebt).toUInt256();
}
/// @notice
/// @dev
/// @param vid (uint256)
/// @param to (address)
/// @param proof ()
/// @param volume (uint256)
function claim(
uint256 vid,
address to,
bytes32[] calldata proof,
uint256 volume
) public {
require(_arePoolExpired() == false, "LM: Pool has expired");
UserInfo storage user = userInfo[vid][msg.sender];
uint256 rewards = pendingInstrumental(vid, volume, proof);
// Effects
user.rewardDebt = user.rewardDebt.add(int256(rewards));
// Interactions
if (rewards != 0) {
claimableRewards -= rewards;
INSTRUMENTAL.transfer(to, rewards);
}
emit Claim(msg.sender, vid, rewards);
}
function claimAll(
uint256[] calldata vids,
address to,
bytes32[][] calldata proofs,
uint256[] calldata volumes
) public {
for (uint256 i = 0; i < vids.length; i++) {
claim(vids[i], to, proofs[i], volumes[i]);
}
}
function verify(
bytes32[] memory proof,
bytes32 root,
uint256 volume
) internal view returns (bool) {
bytes32 leaf = keccak256(abi.encodePacked(msg.sender, volume));
return MerkleProof.verify(proof, root, leaf);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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 Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing 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 v4.4.0 (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
* See `test/utils/cryptography/MerkleProof.test.js` for some examples.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
// Hash(current element of the proof + current computed hash)
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
}
}
return computedHash;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
library SignedSafeMath {
int256 constant private _INT256_MIN = -2**255;
/**
* @dev Returns the multiplication of two signed integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(int256 a, int256 b) internal pure returns (int256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
require(!(a == -1 && b == _INT256_MIN), "SignedSafeMath: multiplication overflow");
int256 c = a * b;
require(c / a == b, "SignedSafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two signed integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(int256 a, int256 b) internal pure returns (int256) {
require(b != 0, "SignedSafeMath: division by zero");
require(!(b == -1 && a == _INT256_MIN), "SignedSafeMath: division overflow");
int256 c = a / b;
return c;
}
/**
* @dev Returns the subtraction of two signed integers, reverting on
* overflow.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a), "SignedSafeMath: subtraction overflow");
return c;
}
/**
* @dev Returns the addition of two signed integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow");
return c;
}
function toUInt256(int256 a) internal pure returns (uint256) {
require(a >= 0, "Integer < 0");
return uint256(a);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";
/// @title Instrumental Token ERC20 token contract
contract STRM is ERC20Permit {
constructor(
string memory name_,
string memory symbol_,
uint256 totalSupply_
) ERC20(name_, symbol_) ERC20Permit(name_) {
_mint(msg.sender, totalSupply_);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/draft-ERC20Permit.sol)
pragma solidity ^0.8.0;
import "./draft-IERC20Permit.sol";
import "../ERC20.sol";
import "../../../utils/cryptography/draft-EIP712.sol";
import "../../../utils/cryptography/ECDSA.sol";
import "../../../utils/Counters.sol";
/**
* @dev Implementation 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.
*
* _Available since v3.4._
*/
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
using Counters for Counters.Counter;
mapping(address => Counters.Counter) private _nonces;
// solhint-disable-next-line var-name-mixedcase
bytes32 private immutable _PERMIT_TYPEHASH =
keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/**
* @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
*
* It's a good idea to use the same `name` that is defined as the ERC20 token name.
*/
constructor(string memory name) EIP712(name, "1") {}
/**
* @dev See {IERC20Permit-permit}.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual override {
require(block.timestamp <= deadline, "ERC20Permit: expired deadline");
bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));
bytes32 hash = _hashTypedDataV4(structHash);
address signer = ECDSA.recover(hash, v, r, s);
require(signer == owner, "ERC20Permit: invalid signature");
_approve(owner, spender, value);
}
/**
* @dev See {IERC20Permit-nonces}.
*/
function nonces(address owner) public view virtual override returns (uint256) {
return _nonces[owner].current();
}
/**
* @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view override returns (bytes32) {
return _domainSeparatorV4();
}
/**
* @dev "Consume a nonce": return the current value and increment.
*
* _Available since v4.1._
*/
function _useNonce(address owner) internal virtual returns (uint256 current) {
Counters.Counter storage nonce = _nonces[owner];
current = nonce.current();
nonce.increment();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/cryptography/draft-EIP712.sol)
pragma solidity ^0.8.0;
import "./ECDSA.sol";
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
*
* The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
* thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
* they need in their contracts using a combination of `abi.encode` and `keccak256`.
*
* This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as efficient as possible while still properly updating
* the chain id to protect against replay attacks on an eventual fork of the chain.
*
* NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
*
* _Available since v3.4._
*/
abstract contract EIP712 {
/* solhint-disable var-name-mixedcase */
// Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
// invalidate the cached domain separator if the chain id changes.
bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
uint256 private immutable _CACHED_CHAIN_ID;
address private immutable _CACHED_THIS;
bytes32 private immutable _HASHED_NAME;
bytes32 private immutable _HASHED_VERSION;
bytes32 private immutable _TYPE_HASH;
/* solhint-enable var-name-mixedcase */
/**
* @dev Initializes the domain separator and parameter caches.
*
* The meaning of `name` and `version` is specified in
* https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
*
* - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
* - `version`: the current major version of the signing domain.
*
* NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
* contract upgrade].
*/
constructor(string memory name, string memory version) {
bytes32 hashedName = keccak256(bytes(name));
bytes32 hashedVersion = keccak256(bytes(version));
bytes32 typeHash = keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
);
_HASHED_NAME = hashedName;
_HASHED_VERSION = hashedVersion;
_CACHED_CHAIN_ID = block.chainid;
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
_CACHED_THIS = address(this);
_TYPE_HASH = typeHash;
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
return _CACHED_DOMAIN_SEPARATOR;
} else {
return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
}
}
function _buildDomainSeparator(
bytes32 typeHash,
bytes32 nameHash,
bytes32 versionHash
) private view returns (bytes32) {
return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
}
/**
* @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
* function returns the hash of the fully encoded EIP712 message for this domain.
*
* This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
*
* ```solidity
* bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
* keccak256("Mail(address to,string contents)"),
* mailTo,
* keccak256(bytes(mailContents))
* )));
* address signer = ECDSA.recover(digest, signature);
* ```
*/
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s;
uint8 v;
assembly {
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}{
"optimizer": {
"enabled": true,
"runs": 100
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract STRM","name":"_instrumental","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"vid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"root","type":"bytes32"}],"name":"LogBoostAddition","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"vid","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"lastRewardBlock","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"accInstrumentalPerShare","type":"uint256"}],"name":"LogUpdateVest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"instrumentalPerBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"initialRewards","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"end","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"totalVolume","type":"uint256"}],"name":"LogVestAddition","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"},{"inputs":[],"name":"INSTRUMENTAL","outputs":[{"internalType":"contract STRM","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"instrumentalPerBlock","type":"uint256"},{"internalType":"uint256","name":"initialRewards","type":"uint256"},{"internalType":"uint64","name":"end","type":"uint64"},{"internalType":"uint256","name":"totalVolume","type":"uint256"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"vid","type":"uint256"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"name":"addBoost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"vid","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint256","name":"volume","type":"uint256"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"vids","type":"uint256[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes32[][]","name":"proofs","type":"bytes32[][]"},{"internalType":"uint256[]","name":"volumes","type":"uint256[]"}],"name":"claimAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"vid","type":"uint256"},{"internalType":"uint256","name":"volume","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"getBoost","outputs":[{"internalType":"uint256","name":"boost","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"vid","type":"uint256"},{"internalType":"uint256","name":"volume","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"pendingInstrumental","outputs":[{"internalType":"uint256","name":"rewards","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"roots","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"rootsBN","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"int256","name":"rewardDebt","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"vestInfo","outputs":[{"internalType":"uint256","name":"instrumentalPerBlock","type":"uint256"},{"internalType":"uint256","name":"initialRewards","type":"uint256"},{"internalType":"uint256","name":"maxRewards","type":"uint256"},{"internalType":"uint64","name":"start","type":"uint64"},{"internalType":"uint64","name":"end","type":"uint64"},{"internalType":"uint256","name":"totalVolume","type":"uint256"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vestInfoLength","outputs":[{"internalType":"uint256","name":"pools","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawLeftovers","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a0604052600060015534801561001557600080fd5b5060405162001c0938038062001c09833981016040819052610036916100a0565b61003f33610050565b6001600160a01b03166080526100d0565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100b257600080fd5b81516001600160a01b03811681146100c957600080fd5b9392505050565b608051611b0862000101600039600081816101140152818161034e01528181610a5a0152610c610152611b086000f3fe608060405234801561001057600080fd5b50600436106100e05760003560e01c806359a8031d1161008757806359a8031d1461019957806368d5c768146101ac578063715018a6146101fd57806383259f17146102055780638da5cb5b1461021857806393f1a40b14610220578063e72a87941461024b578063f2fde38b1461027657600080fd5b8063029704af146100e55780630fc3cec0146100fc5780631173fa471461010f5780631718978c146101435780631f16bbdb14610158578063215883f51461016b57806332c764b91461017e57806341de931514610186575b600080fd5b6004545b6040519081526020015b60405180910390f35b6100e961010a36600461159a565b610289565b6101367f000000000000000000000000000000000000000000000000000000000000000081565b6040516100f391906115bc565b6101566101513660046115d0565b6102c6565b005b61015661016636600461159a565b61069e565b6100e961017936600461163b565b61079a565b6101566109bb565b610156610194366004611774565b610b6a565b6100e96101a736600461163b565b610d1f565b6101bf6101ba3660046117d5565b610edd565b604080519788526020880196909652948601939093526001600160401b03918216606086015216608084015260a083015260c082015260e0016100f3565b610156610f39565b6101566102133660046117ee565b610f74565b610136610ffa565b6100e961022e36600461189b565b600560209081526000928352604080842090915290825290205481565b61025e61025936600461159a565b611009565b6040516001600160401b0390911681526020016100f3565b6101566102843660046118c7565b611061565b6002828154811061029957600080fd5b9060005260206000200181815481106102b157600080fd5b90600052602060002001600091509150505481565b336102cf610ffa565b6001600160a01b0316146102fe5760405162461bcd60e51b81526004016102f5906118e2565b60405180910390fd5b6000610327856103218861031b6001600160401b038916436110fe565b9061110a565b90611116565b905060015481610337919061192d565b6040516370a0823160e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906103839030906004016115bc565b60206040518083038186803b15801561039b57600080fd5b505afa1580156103af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d39190611945565b10156104215760405162461bcd60e51b815260206004820152601b60248201527f56657374696e673a20496e73756666696369656e742066756e6473000000000060448201526064016102f5565b8060016000828254610433919061192d565b90915550506040805160e081018252878152602081018781529181018381526001600160401b03438116606084019081528882166080850190815260a0850189815260c08601898152600480546001810182556000918252975160069098027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b81019890985597517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c88015594517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d87015591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19e8601805492518516600160401b026001600160801b0319909316919094161717909155517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19f830155517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd1a0909101556002906040519080825280602002602001820160405280156105c2578160200160208202803683370190505b508154600181018355600092835260209283902082516105e8949190920192019061148f565b5060408051600080825260208201928390526003805460018101825591529051610637927fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b90920191906114d6565b506004546106479060019061195e565b60408051888152602081018890526001600160401b038716818301526060810186905290517f236dcc5a1d6f9e6cd5ea54080d4119c72d0e1491a87484977f461f855b71274b9181900360800190a2505050505050565b336106a7610ffa565b6001600160a01b0316146106cd5760405162461bcd60e51b81526004016102f5906118e2565b600282815481106106e0576106e0611975565b600091825260208083209091018054600181018255908352912001819055600380548390811061071257610712611975565b6000918252602080832090910180546001810182559083529120600482040180546001600160401b0343811660086003909516949094026101000a9384029302191691909117905560405182907f5441afcc9ee36744eea6921a60ce6053afe52425af614739306c4e680d4d7b259061078e9084815260200190565b60405180910390a25050565b6000600284815481106107af576107af611975565b6000918252602090912001546107c7575060016109b4565b6000600485815481106107dc576107dc611975565b600091825260208083206040805160e08101825260069094029091018054845260018101549284019290925260028201549083015260038101546001600160401b038082166060850152600160401b909104166080830152600481015460a08301526005015460c082015264e8d4a51000935091505b6002868154811061086557610865611975565b6000918252602090912001548110156109a0576108bb846002888154811061088f5761088f611975565b9060005260206000200183815481106108aa576108aa611975565b906000526020600020015487611122565b1561098e5760006108ef83606001516001600160401b031684608001516001600160401b03166110fe90919063ffffffff16565b61095d64e8d4a5100061031b60038b8154811061090e5761090e611975565b90600052602060002001868154811061092957610929611975565b6000918252602090912060048204015460808901516001600160401b03908116926003166008026101000a909104166110fe565b610967919061198b565b905061098a600a61097983600b61110a565b610983919061198b565b8590611116565b9350505b80610998816119ad565b915050610852565b506109b064e8d4a510008361198b565b9150505b9392505050565b336109c4610ffa565b6001600160a01b0316146109ea5760405162461bcd60e51b81526004016102f5906118e2565b6109f261116f565b1515600114610a435760405162461bcd60e51b815260206004820152601e60248201527f56657374696e673a20506f6f6c7320617265206e6f742065787069726564000060448201526064016102f5565b6040516370a0823160e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb90339083906370a0823190610a999030906004016115bc565b60206040518083038186803b158015610ab157600080fd5b505afa158015610ac5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae99190611945565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015610b2f57600080fd5b505af1158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6791906119c8565b50565b610b7261116f565b15610bb65760405162461bcd60e51b815260206004820152601460248201527313134e88141bdbdb081a185cc8195e1c1a5c995960621b60448201526064016102f5565b6000858152600560209081526040808320338452825280832081518684028181018501909352868152909392610c0d928a92879290918a918a918291850190849080828437600092019190915250610d1f92505050565b8254909150610c1c9082611221565b82558015610cdf578060016000828254610c36919061195e565b909155505060405163a9059cbb60e01b81526001600160a01b038781166004830152602482018390527f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb90604401602060405180830381600087803b158015610ca557600080fd5b505af1158015610cb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cdd91906119c8565b505b604051818152879033907f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf79060200160405180910390a350505050505050565b60008060048581548110610d3557610d35611975565b60009182526020918290206040805160e08101825260069093029091018054835260018101549383019390935260028301549082015260038201546001600160401b038082166060840152600160401b909104166080820152600482015460a082015260059091015460c08201819052909150610db490849086611122565b610df95760405162461bcd60e51b81526020600482015260166024820152752b32b9ba34b7339d1024b73b30b634b210383937b7b360511b60448201526064016102f5565b60008581526005602090815260408083203384528252808320815192830190915254815260a0830151909190610e348764e8d4a5100061110a565b610e3e919061198b565b90506000610e5982856040015161110a90919063ffffffff16565b90506000610e958361031b8760200151610321610e778e8e8e61079a565b8a5160608c015161031b9190829043906001600160401b03166110fe565b90506000828211610ea65781610ea8565b825b8551909150610ecf90610eca90610ec464e8d4a510008561198b565b906112ac565b611339565b9a9950505050505050505050565b60048181548110610eed57600080fd5b6000918252602090912060069091020180546001820154600283015460038401546004850154600590950154939550919390926001600160401b0380841693600160401b900416919087565b33610f42610ffa565b6001600160a01b031614610f685760405162461bcd60e51b81526004016102f5906118e2565b610f72600061137d565b565b60005b86811015610ff057610fde888883818110610f9457610f94611975565b9050602002013587878785818110610fae57610fae611975565b9050602002810190610fc091906119ea565b878787818110610fd257610fd2611975565b90506020020135610b6a565b80610fe8816119ad565b915050610f77565b5050505050505050565b6000546001600160a01b031690565b6003828154811061101957600080fd5b90600052602060002001818154811061103157600080fd5b9060005260206000209060049182820401919006600802915091509054906101000a90046001600160401b031681565b3361106a610ffa565b6001600160a01b0316146110905760405162461bcd60e51b81526004016102f5906118e2565b6001600160a01b0381166110f55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102f5565b610b678161137d565b60006109b4828461195e565b60006109b48284611a33565b60006109b4828461192d565b6040516bffffffffffffffffffffffff193360601b1660208201526034810182905260009081906054016040516020818303038152906040528051906020012090506109b08585836113cd565b600080805b60045481101561120b57816004828154811061119257611192611975565b6000918252602090912060069091020160030154600160401b90046001600160401b0316116111c157816111f9565b600481815481106111d4576111d4611975565b6000918252602090912060069091020160030154600160401b90046001600160401b03165b9150611204816119ad565b9050611174565b50611219620c35008261192d565b431191505090565b60008061122e8385611a52565b9050600083121580156112415750838112155b80611256575060008312801561125657508381125b6109b45760405162461bcd60e51b815260206004820152602160248201527f5369676e6564536166654d6174683a206164646974696f6e206f766572666c6f6044820152607760f81b60648201526084016102f5565b6000806112b98385611a93565b9050600083121580156112cc5750838113155b806112e157506000831280156112e157508381135b6109b45760405162461bcd60e51b8152602060048201526024808201527f5369676e6564536166654d6174683a207375627472616374696f6e206f766572604482015263666c6f7760e01b60648201526084016102f5565b6000808212156113795760405162461bcd60e51b815260206004820152600b60248201526a0496e7465676572203c20360ac1b60448201526064016102f5565b5090565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826113da85846113e3565b14949350505050565b600081815b845181101561148757600085828151811061140557611405611975565b60200260200101519050808311611447576040805160208101859052908101829052606001604051602081830303815290604052805190602001209250611474565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b508061147f816119ad565b9150506113e8565b509392505050565b8280548282559060005260206000209081019282156114ca579160200282015b828111156114ca5782518255916020019190600101906114af565b50611379929150611585565b828054828255906000526020600020906003016004900481019282156114ca5791602002820160005b8382111561154957835183826101000a8154816001600160401b0302191690836001600160401b0316021790555092602001926008016020816007010492830192600103026114ff565b801561157c5782816101000a8154906001600160401b030219169055600801602081600701049283019260010302611549565b50506113799291505b5b808211156113795760008155600101611586565b600080604083850312156115ad57600080fd5b50508035926020909101359150565b6001600160a01b0391909116815260200190565b600080600080600060a086880312156115e857600080fd5b853594506020860135935060408601356001600160401b038116811461160d57600080fd5b94979396509394606081013594506080013592915050565b634e487b7160e01b600052604160045260246000fd5b60008060006060848603121561165057600080fd5b83359250602080850135925060408501356001600160401b038082111561167657600080fd5b818701915087601f83011261168a57600080fd5b81358181111561169c5761169c611625565b8060051b604051601f19603f830116810181811085821117156116c1576116c1611625565b60405291825284820192508381018501918a8311156116df57600080fd5b938501935b828510156116fd578435845293850193928501926116e4565b8096505050505050509250925092565b80356001600160a01b038116811461172457600080fd5b919050565b60008083601f84011261173b57600080fd5b5081356001600160401b0381111561175257600080fd5b6020830191508360208260051b850101111561176d57600080fd5b9250929050565b60008060008060006080868803121561178c57600080fd5b8535945061179c6020870161170d565b935060408601356001600160401b038111156117b757600080fd5b6117c388828901611729565b96999598509660600135949350505050565b6000602082840312156117e757600080fd5b5035919050565b60008060008060008060006080888a03121561180957600080fd5b87356001600160401b038082111561182057600080fd5b61182c8b838c01611729565b909950975087915061184060208b0161170d565b965060408a013591508082111561185657600080fd5b6118628b838c01611729565b909650945060608a013591508082111561187b57600080fd5b506118888a828b01611729565b989b979a50959850939692959293505050565b600080604083850312156118ae57600080fd5b823591506118be6020840161170d565b90509250929050565b6000602082840312156118d957600080fd5b6109b48261170d565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000821982111561194057611940611917565b500190565b60006020828403121561195757600080fd5b5051919050565b60008282101561197057611970611917565b500390565b634e487b7160e01b600052603260045260246000fd5b6000826119a857634e487b7160e01b600052601260045260246000fd5b500490565b60006000198214156119c1576119c1611917565b5060010190565b6000602082840312156119da57600080fd5b815180151581146109b457600080fd5b6000808335601e19843603018112611a0157600080fd5b8301803591506001600160401b03821115611a1b57600080fd5b6020019150600581901b360382131561176d57600080fd5b6000816000190483118215151615611a4d57611a4d611917565b500290565b600080821280156001600160ff1b0384900385131615611a7457611a74611917565b600160ff1b8390038412811615611a8d57611a8d611917565b50500190565b60008083128015600160ff1b850184121615611ab157611ab1611917565b6001600160ff1b0384018313811615611acc57611acc611917565b5050039056fea26469706673582212204eece2c1fb4a68689d5e016cde0bcbc9770bb61b639d952142efc2eb28c2615f64736f6c634300080900330000000000000000000000000edf9bc41bbc1354c70e2107f80c42cae7fbbca8
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100e05760003560e01c806359a8031d1161008757806359a8031d1461019957806368d5c768146101ac578063715018a6146101fd57806383259f17146102055780638da5cb5b1461021857806393f1a40b14610220578063e72a87941461024b578063f2fde38b1461027657600080fd5b8063029704af146100e55780630fc3cec0146100fc5780631173fa471461010f5780631718978c146101435780631f16bbdb14610158578063215883f51461016b57806332c764b91461017e57806341de931514610186575b600080fd5b6004545b6040519081526020015b60405180910390f35b6100e961010a36600461159a565b610289565b6101367f0000000000000000000000000edf9bc41bbc1354c70e2107f80c42cae7fbbca881565b6040516100f391906115bc565b6101566101513660046115d0565b6102c6565b005b61015661016636600461159a565b61069e565b6100e961017936600461163b565b61079a565b6101566109bb565b610156610194366004611774565b610b6a565b6100e96101a736600461163b565b610d1f565b6101bf6101ba3660046117d5565b610edd565b604080519788526020880196909652948601939093526001600160401b03918216606086015216608084015260a083015260c082015260e0016100f3565b610156610f39565b6101566102133660046117ee565b610f74565b610136610ffa565b6100e961022e36600461189b565b600560209081526000928352604080842090915290825290205481565b61025e61025936600461159a565b611009565b6040516001600160401b0390911681526020016100f3565b6101566102843660046118c7565b611061565b6002828154811061029957600080fd5b9060005260206000200181815481106102b157600080fd5b90600052602060002001600091509150505481565b336102cf610ffa565b6001600160a01b0316146102fe5760405162461bcd60e51b81526004016102f5906118e2565b60405180910390fd5b6000610327856103218861031b6001600160401b038916436110fe565b9061110a565b90611116565b905060015481610337919061192d565b6040516370a0823160e01b81526001600160a01b037f0000000000000000000000000edf9bc41bbc1354c70e2107f80c42cae7fbbca816906370a08231906103839030906004016115bc565b60206040518083038186803b15801561039b57600080fd5b505afa1580156103af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d39190611945565b10156104215760405162461bcd60e51b815260206004820152601b60248201527f56657374696e673a20496e73756666696369656e742066756e6473000000000060448201526064016102f5565b8060016000828254610433919061192d565b90915550506040805160e081018252878152602081018781529181018381526001600160401b03438116606084019081528882166080850190815260a0850189815260c08601898152600480546001810182556000918252975160069098027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b81019890985597517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c88015594517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d87015591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19e8601805492518516600160401b026001600160801b0319909316919094161717909155517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19f830155517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd1a0909101556002906040519080825280602002602001820160405280156105c2578160200160208202803683370190505b508154600181018355600092835260209283902082516105e8949190920192019061148f565b5060408051600080825260208201928390526003805460018101825591529051610637927fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b90920191906114d6565b506004546106479060019061195e565b60408051888152602081018890526001600160401b038716818301526060810186905290517f236dcc5a1d6f9e6cd5ea54080d4119c72d0e1491a87484977f461f855b71274b9181900360800190a2505050505050565b336106a7610ffa565b6001600160a01b0316146106cd5760405162461bcd60e51b81526004016102f5906118e2565b600282815481106106e0576106e0611975565b600091825260208083209091018054600181018255908352912001819055600380548390811061071257610712611975565b6000918252602080832090910180546001810182559083529120600482040180546001600160401b0343811660086003909516949094026101000a9384029302191691909117905560405182907f5441afcc9ee36744eea6921a60ce6053afe52425af614739306c4e680d4d7b259061078e9084815260200190565b60405180910390a25050565b6000600284815481106107af576107af611975565b6000918252602090912001546107c7575060016109b4565b6000600485815481106107dc576107dc611975565b600091825260208083206040805160e08101825260069094029091018054845260018101549284019290925260028201549083015260038101546001600160401b038082166060850152600160401b909104166080830152600481015460a08301526005015460c082015264e8d4a51000935091505b6002868154811061086557610865611975565b6000918252602090912001548110156109a0576108bb846002888154811061088f5761088f611975565b9060005260206000200183815481106108aa576108aa611975565b906000526020600020015487611122565b1561098e5760006108ef83606001516001600160401b031684608001516001600160401b03166110fe90919063ffffffff16565b61095d64e8d4a5100061031b60038b8154811061090e5761090e611975565b90600052602060002001868154811061092957610929611975565b6000918252602090912060048204015460808901516001600160401b03908116926003166008026101000a909104166110fe565b610967919061198b565b905061098a600a61097983600b61110a565b610983919061198b565b8590611116565b9350505b80610998816119ad565b915050610852565b506109b064e8d4a510008361198b565b9150505b9392505050565b336109c4610ffa565b6001600160a01b0316146109ea5760405162461bcd60e51b81526004016102f5906118e2565b6109f261116f565b1515600114610a435760405162461bcd60e51b815260206004820152601e60248201527f56657374696e673a20506f6f6c7320617265206e6f742065787069726564000060448201526064016102f5565b6040516370a0823160e01b81526001600160a01b037f0000000000000000000000000edf9bc41bbc1354c70e2107f80c42cae7fbbca8169063a9059cbb90339083906370a0823190610a999030906004016115bc565b60206040518083038186803b158015610ab157600080fd5b505afa158015610ac5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae99190611945565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015610b2f57600080fd5b505af1158015610b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6791906119c8565b50565b610b7261116f565b15610bb65760405162461bcd60e51b815260206004820152601460248201527313134e88141bdbdb081a185cc8195e1c1a5c995960621b60448201526064016102f5565b6000858152600560209081526040808320338452825280832081518684028181018501909352868152909392610c0d928a92879290918a918a918291850190849080828437600092019190915250610d1f92505050565b8254909150610c1c9082611221565b82558015610cdf578060016000828254610c36919061195e565b909155505060405163a9059cbb60e01b81526001600160a01b038781166004830152602482018390527f0000000000000000000000000edf9bc41bbc1354c70e2107f80c42cae7fbbca8169063a9059cbb90604401602060405180830381600087803b158015610ca557600080fd5b505af1158015610cb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cdd91906119c8565b505b604051818152879033907f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf79060200160405180910390a350505050505050565b60008060048581548110610d3557610d35611975565b60009182526020918290206040805160e08101825260069093029091018054835260018101549383019390935260028301549082015260038201546001600160401b038082166060840152600160401b909104166080820152600482015460a082015260059091015460c08201819052909150610db490849086611122565b610df95760405162461bcd60e51b81526020600482015260166024820152752b32b9ba34b7339d1024b73b30b634b210383937b7b360511b60448201526064016102f5565b60008581526005602090815260408083203384528252808320815192830190915254815260a0830151909190610e348764e8d4a5100061110a565b610e3e919061198b565b90506000610e5982856040015161110a90919063ffffffff16565b90506000610e958361031b8760200151610321610e778e8e8e61079a565b8a5160608c015161031b9190829043906001600160401b03166110fe565b90506000828211610ea65781610ea8565b825b8551909150610ecf90610eca90610ec464e8d4a510008561198b565b906112ac565b611339565b9a9950505050505050505050565b60048181548110610eed57600080fd5b6000918252602090912060069091020180546001820154600283015460038401546004850154600590950154939550919390926001600160401b0380841693600160401b900416919087565b33610f42610ffa565b6001600160a01b031614610f685760405162461bcd60e51b81526004016102f5906118e2565b610f72600061137d565b565b60005b86811015610ff057610fde888883818110610f9457610f94611975565b9050602002013587878785818110610fae57610fae611975565b9050602002810190610fc091906119ea565b878787818110610fd257610fd2611975565b90506020020135610b6a565b80610fe8816119ad565b915050610f77565b5050505050505050565b6000546001600160a01b031690565b6003828154811061101957600080fd5b90600052602060002001818154811061103157600080fd5b9060005260206000209060049182820401919006600802915091509054906101000a90046001600160401b031681565b3361106a610ffa565b6001600160a01b0316146110905760405162461bcd60e51b81526004016102f5906118e2565b6001600160a01b0381166110f55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102f5565b610b678161137d565b60006109b4828461195e565b60006109b48284611a33565b60006109b4828461192d565b6040516bffffffffffffffffffffffff193360601b1660208201526034810182905260009081906054016040516020818303038152906040528051906020012090506109b08585836113cd565b600080805b60045481101561120b57816004828154811061119257611192611975565b6000918252602090912060069091020160030154600160401b90046001600160401b0316116111c157816111f9565b600481815481106111d4576111d4611975565b6000918252602090912060069091020160030154600160401b90046001600160401b03165b9150611204816119ad565b9050611174565b50611219620c35008261192d565b431191505090565b60008061122e8385611a52565b9050600083121580156112415750838112155b80611256575060008312801561125657508381125b6109b45760405162461bcd60e51b815260206004820152602160248201527f5369676e6564536166654d6174683a206164646974696f6e206f766572666c6f6044820152607760f81b60648201526084016102f5565b6000806112b98385611a93565b9050600083121580156112cc5750838113155b806112e157506000831280156112e157508381135b6109b45760405162461bcd60e51b8152602060048201526024808201527f5369676e6564536166654d6174683a207375627472616374696f6e206f766572604482015263666c6f7760e01b60648201526084016102f5565b6000808212156113795760405162461bcd60e51b815260206004820152600b60248201526a0496e7465676572203c20360ac1b60448201526064016102f5565b5090565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826113da85846113e3565b14949350505050565b600081815b845181101561148757600085828151811061140557611405611975565b60200260200101519050808311611447576040805160208101859052908101829052606001604051602081830303815290604052805190602001209250611474565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b508061147f816119ad565b9150506113e8565b509392505050565b8280548282559060005260206000209081019282156114ca579160200282015b828111156114ca5782518255916020019190600101906114af565b50611379929150611585565b828054828255906000526020600020906003016004900481019282156114ca5791602002820160005b8382111561154957835183826101000a8154816001600160401b0302191690836001600160401b0316021790555092602001926008016020816007010492830192600103026114ff565b801561157c5782816101000a8154906001600160401b030219169055600801602081600701049283019260010302611549565b50506113799291505b5b808211156113795760008155600101611586565b600080604083850312156115ad57600080fd5b50508035926020909101359150565b6001600160a01b0391909116815260200190565b600080600080600060a086880312156115e857600080fd5b853594506020860135935060408601356001600160401b038116811461160d57600080fd5b94979396509394606081013594506080013592915050565b634e487b7160e01b600052604160045260246000fd5b60008060006060848603121561165057600080fd5b83359250602080850135925060408501356001600160401b038082111561167657600080fd5b818701915087601f83011261168a57600080fd5b81358181111561169c5761169c611625565b8060051b604051601f19603f830116810181811085821117156116c1576116c1611625565b60405291825284820192508381018501918a8311156116df57600080fd5b938501935b828510156116fd578435845293850193928501926116e4565b8096505050505050509250925092565b80356001600160a01b038116811461172457600080fd5b919050565b60008083601f84011261173b57600080fd5b5081356001600160401b0381111561175257600080fd5b6020830191508360208260051b850101111561176d57600080fd5b9250929050565b60008060008060006080868803121561178c57600080fd5b8535945061179c6020870161170d565b935060408601356001600160401b038111156117b757600080fd5b6117c388828901611729565b96999598509660600135949350505050565b6000602082840312156117e757600080fd5b5035919050565b60008060008060008060006080888a03121561180957600080fd5b87356001600160401b038082111561182057600080fd5b61182c8b838c01611729565b909950975087915061184060208b0161170d565b965060408a013591508082111561185657600080fd5b6118628b838c01611729565b909650945060608a013591508082111561187b57600080fd5b506118888a828b01611729565b989b979a50959850939692959293505050565b600080604083850312156118ae57600080fd5b823591506118be6020840161170d565b90509250929050565b6000602082840312156118d957600080fd5b6109b48261170d565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000821982111561194057611940611917565b500190565b60006020828403121561195757600080fd5b5051919050565b60008282101561197057611970611917565b500390565b634e487b7160e01b600052603260045260246000fd5b6000826119a857634e487b7160e01b600052601260045260246000fd5b500490565b60006000198214156119c1576119c1611917565b5060010190565b6000602082840312156119da57600080fd5b815180151581146109b457600080fd5b6000808335601e19843603018112611a0157600080fd5b8301803591506001600160401b03821115611a1b57600080fd5b6020019150600581901b360382131561176d57600080fd5b6000816000190483118215151615611a4d57611a4d611917565b500290565b600080821280156001600160ff1b0384900385131615611a7457611a74611917565b600160ff1b8390038412811615611a8d57611a8d611917565b50500190565b60008083128015600160ff1b850184121615611ab157611ab1611917565b6001600160ff1b0384018313811615611acc57611acc611917565b5050039056fea26469706673582212204eece2c1fb4a68689d5e016cde0bcbc9770bb61b639d952142efc2eb28c2615f64736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000edf9bc41bbc1354c70e2107f80c42cae7fbbca8
-----Decoded View---------------
Arg [0] : _instrumental (address): 0x0eDF9bc41Bbc1354c70e2107F80C42caE7FBBcA8
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000000edf9bc41bbc1354c70e2107f80c42cae7fbbca8
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.