Source Code
Latest 16 from a total of 16 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Release | 20691270 | 515 days ago | IN | 0 ETH | 0.00029984 | ||||
| Release | 20691258 | 515 days ago | IN | 0 ETH | 0.00030393 | ||||
| Release | 20691243 | 515 days ago | IN | 0 ETH | 0.00046772 | ||||
| Release | 20691206 | 515 days ago | IN | 0 ETH | 0.00038178 | ||||
| Release | 20089114 | 600 days ago | IN | 0 ETH | 0.00067168 | ||||
| Release | 20089098 | 600 days ago | IN | 0 ETH | 0.00050154 | ||||
| Release | 20089078 | 600 days ago | IN | 0 ETH | 0.00054339 | ||||
| Release | 19779768 | 643 days ago | IN | 0 ETH | 0.00047586 | ||||
| Release | 19779738 | 643 days ago | IN | 0 ETH | 0.00060561 | ||||
| Create Vesting S... | 18588412 | 810 days ago | IN | 0 ETH | 0.00524383 | ||||
| Create Vesting S... | 18588403 | 810 days ago | IN | 0 ETH | 0.00505858 | ||||
| Create Vesting S... | 18588390 | 810 days ago | IN | 0 ETH | 0.00836662 | ||||
| Create Vesting S... | 18585205 | 810 days ago | IN | 0 ETH | 0.00825518 | ||||
| Release | 18583141 | 811 days ago | IN | 0 ETH | 0.00290079 | ||||
| Create Vesting S... | 18583126 | 811 days ago | IN | 0 ETH | 0.00859104 | ||||
| Transfer Ownersh... | 18583079 | 811 days ago | IN | 0 ETH | 0.00072467 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
SabaiVesting
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: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
/**
* @title Sabai Corporate Vesting contract
*/
contract SabaiVesting is Ownable, ReentrancyGuard{
using SafeMath for uint256;
using SafeERC20 for IERC20;
struct VestingSchedule{
bool initialized;
// beneficiary of tokens after they are released
address beneficiary;
// cliff period in seconds
uint256 cliff;
// start time of the vesting
uint256 start;
// duration of the vesting period after cliff in seconds
uint256 duration;
// whether or not the vesting is revocable
bool revocable;
// total amount of tokens to be released at the end of the vesting
uint256 amountTotal;
// amount of tokens released
uint256 released;
// whether or not the vesting has been revoked
bool revoked;
}
// address of the Sabai token
IERC20 immutable private _token;
bytes32[] private vestingSchedulesIds;
mapping(bytes32 => VestingSchedule) private vestingSchedules;
uint256 private vestingSchedulesTotalAmount;
mapping(address => uint256) private holdersVestingCount;
address public ManagerAddress;
/**
* @dev Reverts if no vesting schedule matches the passed identifier.
*/
modifier onlyIfVestingScheduleExists(bytes32 vestingScheduleId) {
require(vestingSchedules[vestingScheduleId].initialized == true);
_;
}
/**
* @dev Reverts if the vesting schedule does not exist or has been revoked.
*/
modifier onlyIfVestingScheduleNotRevoked(bytes32 vestingScheduleId) {
require(vestingSchedules[vestingScheduleId].initialized == true);
require(vestingSchedules[vestingScheduleId].revoked == false);
_;
}
/**
* @dev Creates a vesting contract.
* @param token_ address of the ERC20 token contract
*/
constructor(address token_, address _managerAddress) {
require(token_ != address(0x0));
require(_managerAddress != address(0x0));
_token = IERC20(token_);
ManagerAddress = _managerAddress;
}
modifier onlyManager() {
_checkManager();
_;
}
function _checkManager() internal view virtual {
require(ManagerAddress == _msgSender(), "Ownable: caller is not the manager");
}
function changeManagerAddress(address _newManagerAddress)
public
onlyOwner {
require(_newManagerAddress != address(0x0));
ManagerAddress = _newManagerAddress;
}
/**
* @dev Returns the number of vesting schedules associated to a beneficiary.
* @return the number of vesting schedules
*/
function getVestingSchedulesCountByBeneficiary(address _beneficiary)
external
view
returns(uint256){
return holdersVestingCount[_beneficiary];
}
/**
* @dev Returns the vesting schedule id at the given index.
* @return the vesting id
*/
function getVestingIdAtIndex(uint256 index)
external
view
returns(bytes32){
require(index < getVestingSchedulesCount(), "TokenVesting: index out of bounds");
return vestingSchedulesIds[index];
}
/**
* @notice Returns the vesting schedule information for a given holder and index.
* @return the vesting schedule structure information
*/
function getVestingScheduleByAddressAndIndex(address holder, uint256 index)
external
view
returns(VestingSchedule memory){
return getVestingSchedule(computeVestingScheduleIdForAddressAndIndex(holder, index));
}
/**
* @notice Returns the total amount of vesting schedules.
* @return the total amount of vesting schedules
*/
function getVestingSchedulesTotalAmount()
external
view
returns(uint256){
return vestingSchedulesTotalAmount;
}
/**
* @dev Returns the address of the ERC20 token managed by the vesting contract.
*/
function getToken()
external
view
returns(address){
return address(_token);
}
/**
* @notice Creates a new vesting schedule for a beneficiary.
* @param _beneficiary address of the beneficiary to whom vested tokens are transferred
* @param _start start time of the vesting
* @param _cliff duration in seconds of the cliff in which tokens will begin to vest
* @param _duration duration in seconds after cliff of the period in which the tokens will vest
* @param _revocable whether the vesting is revocable or not
* @param _amount total amount of tokens to be released at the end of the vesting
*/
function createVestingSchedule(
address _beneficiary,
uint256 _start,
uint256 _cliff,
uint256 _duration,
bool _revocable,
uint256 _amount
)
public
onlyManager{
require(
this.getWithdrawableAmount() >= _amount,
"TokenVesting: cannot create vesting schedule because not sufficient tokens"
);
require(_duration > 0, "TokenVesting: duration must be > 0");
require(_amount > 0, "TokenVesting: amount must be > 0");
bytes32 vestingScheduleId = this.computeNextVestingScheduleIdForHolder(_beneficiary);
uint256 cliff = _start.add(_cliff);
vestingSchedules[vestingScheduleId] = VestingSchedule(
true,
_beneficiary,
cliff,
_start,
_duration,
_revocable,
_amount,
0,
false
);
vestingSchedulesTotalAmount = vestingSchedulesTotalAmount.add(_amount);
vestingSchedulesIds.push(vestingScheduleId);
uint256 currentVestingCount = holdersVestingCount[_beneficiary];
holdersVestingCount[_beneficiary] = currentVestingCount.add(1);
}
/**
* @notice Creates new vesting schedules for a beneficiaries.
* @param _beneficiary address of the beneficiary to whom vested tokens are transferred
* @param _start start time of the vesting
* @param _cliff duration in seconds of the cliff in which tokens will begin to vest
* @param _duration duration in seconds after cliff of the period in which the tokens will vest
* @param _revocable whether the vesting is revocable or not
* @param _amount total amount of tokens to be released at the end of the vesting
*/
struct VestingScheduleMany{
// beneficiary of tokens after they are released
address beneficiary;
// cliff period in seconds
uint256 cliff;
// start time of the vesting
uint256 start;
// duration of the vesting period after cliff in seconds
uint256 duration;
// whether or not the vesting is revocable
bool revocable;
// total amount of tokens to be released at the end of the vesting
uint256 amount;
}
function createVestingScheduleMany(VestingScheduleMany[] memory _schedules)
public
onlyManager{
uint256 SchedulesManyAmount;
for (uint256 i=0; i<_schedules.length; i++) {
require(_schedules[i].duration > 0, "TokenVesting: duration must be > 0");
require(_schedules[i].amount > 0, "TokenVesting: amount must be > 0");
SchedulesManyAmount.add(_schedules[i].amount);
require(
this.getWithdrawableAmount() >= SchedulesManyAmount,
"TokenVesting: cannot create vesting schedule because not sufficient tokens"
);
}
for (uint256 i=0; i<_schedules.length; i++) {
bytes32 vestingScheduleId = this.computeNextVestingScheduleIdForHolder(_schedules[i].beneficiary);
uint256 cliff = _schedules[i].start.add(_schedules[i].cliff);
vestingSchedules[vestingScheduleId] = VestingSchedule(
true,
_schedules[i].beneficiary,
cliff,
_schedules[i].start,
_schedules[i].duration,
_schedules[i].revocable,
_schedules[i].amount,
0,
false
);
vestingSchedulesTotalAmount = vestingSchedulesTotalAmount.add(_schedules[i].amount);
vestingSchedulesIds.push(vestingScheduleId);
uint256 currentVestingCount = holdersVestingCount[_schedules[i].beneficiary];
holdersVestingCount[_schedules[i].beneficiary] = currentVestingCount.add(1);
}
}
/**
* @notice Revokes the vesting schedule for given identifier.
* @param vestingScheduleId the vesting schedule identifier
*/
function revoke(bytes32 vestingScheduleId)
public
onlyManager
onlyIfVestingScheduleNotRevoked(vestingScheduleId){
VestingSchedule storage vestingSchedule = vestingSchedules[vestingScheduleId];
require(vestingSchedule.revocable == true, "TokenVesting: vesting is not revocable");
uint256 vestedAmount = _computeReleasableAmount(vestingSchedule);
if(vestedAmount > 0){
release(vestingScheduleId, vestedAmount);
}
uint256 unreleased = vestingSchedule.amountTotal.sub(vestingSchedule.released);
vestingSchedulesTotalAmount = vestingSchedulesTotalAmount.sub(unreleased);
vestingSchedule.revoked = true;
}
/**
* @notice Withdraw the specified amount if possible.
* @param amount the amount to withdraw
*/
function withdraw(uint256 amount)
public
nonReentrant
onlyManager{
require(this.getWithdrawableAmount() >= amount, "TokenVesting: not enough withdrawable funds");
_token.safeTransfer(owner(), amount);
}
/**
* @notice Release vested amount of tokens.
* @param vestingScheduleId the vesting schedule identifier
* @param amount the amount to release
*/
function release(
bytes32 vestingScheduleId,
uint256 amount
)
public
nonReentrant
onlyIfVestingScheduleNotRevoked(vestingScheduleId){
VestingSchedule storage vestingSchedule = vestingSchedules[vestingScheduleId];
bool isBeneficiary = msg.sender == vestingSchedule.beneficiary;
require(
isBeneficiary,
"TokenVesting: only beneficiary can release vested tokens"
);
uint256 vestedAmount = _computeReleasableAmount(vestingSchedule);
require(vestedAmount >= amount, "TokenVesting: cannot release tokens, not enough vested tokens");
vestingSchedule.released = vestingSchedule.released.add(amount);
vestingSchedulesTotalAmount = vestingSchedulesTotalAmount.sub(amount);
_token.safeTransfer(vestingSchedule.beneficiary, amount);
}
/**
* @dev Returns the number of vesting schedules managed by this contract.
* @return the number of vesting schedules
*/
function getVestingSchedulesCount()
public
view
returns(uint256){
return vestingSchedulesIds.length;
}
/**
* @notice Computes the vested amount of tokens for the given vesting schedule identifier.
* @return the vested amount
*/
function computeReleasableAmount(bytes32 vestingScheduleId)
public
onlyIfVestingScheduleNotRevoked(vestingScheduleId)
view
returns(uint256){
VestingSchedule storage vestingSchedule = vestingSchedules[vestingScheduleId];
return _computeReleasableAmount(vestingSchedule);
}
/**
* @notice Returns the vesting schedule information for a given identifier.
* @return the vesting schedule structure information
*/
function getVestingSchedule(bytes32 vestingScheduleId)
public
view
returns(VestingSchedule memory){
return vestingSchedules[vestingScheduleId];
}
/**
* @dev Returns the amount of tokens that can be withdrawn by the owner.
* @return the amount of tokens
*/
function getWithdrawableAmount()
public
view
returns(uint256){
return _token.balanceOf(address(this)).sub(vestingSchedulesTotalAmount);
}
/**
* @dev Computes the next vesting schedule identifier for a given holder address.
*/
function computeNextVestingScheduleIdForHolder(address holder)
public
view
returns(bytes32){
return computeVestingScheduleIdForAddressAndIndex(holder, holdersVestingCount[holder]);
}
/**
* @dev Returns the last vesting schedule for a given holder address.
*/
function getLastVestingScheduleForHolder(address holder)
public
view
returns(VestingSchedule memory){
return vestingSchedules[computeVestingScheduleIdForAddressAndIndex(holder, holdersVestingCount[holder] - 1)];
}
/**
* @dev Computes the vesting schedule identifier for an address and an index.
*/
function computeVestingScheduleIdForAddressAndIndex(address holder, uint256 index)
public
pure
returns(bytes32){
return keccak256(abi.encodePacked(holder, index));
}
/**
* @dev Computes the releasable amount of tokens for a vesting schedule.
* @return the amount of releasable tokens
*/
function _computeReleasableAmount(VestingSchedule memory vestingSchedule)
internal
view
returns(uint256){
uint256 currentTime = getCurrentTime();
if ((currentTime < vestingSchedule.cliff) || vestingSchedule.revoked == true) {
return 0;
} else if (currentTime >= vestingSchedule.cliff.add(vestingSchedule.duration)) {
return vestingSchedule.amountTotal.sub(vestingSchedule.released);
} else {
uint256 timeAfterCliff = currentTime.sub(vestingSchedule.cliff);
uint256 vestedAmount = vestingSchedule.amountTotal.mul(timeAfterCliff).div(vestingSchedule.duration);
vestedAmount = vestedAmount.sub(vestingSchedule.released);
return vestedAmount;
}
}
function getCurrentTime()
internal
virtual
view
returns(uint256){
return block.timestamp;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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 subtraction 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
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// 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) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// 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) (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) (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 (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 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;
}
}{
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"token_","type":"address"},{"internalType":"address","name":"_managerAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"ManagerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newManagerAddress","type":"address"}],"name":"changeManagerAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"}],"name":"computeNextVestingScheduleIdForHolder","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"vestingScheduleId","type":"bytes32"}],"name":"computeReleasableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"computeVestingScheduleIdForAddressAndIndex","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_beneficiary","type":"address"},{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_cliff","type":"uint256"},{"internalType":"uint256","name":"_duration","type":"uint256"},{"internalType":"bool","name":"_revocable","type":"bool"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"createVestingSchedule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"uint256","name":"cliff","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"bool","name":"revocable","type":"bool"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct SabaiVesting.VestingScheduleMany[]","name":"_schedules","type":"tuple[]"}],"name":"createVestingScheduleMany","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"}],"name":"getLastVestingScheduleForHolder","outputs":[{"components":[{"internalType":"bool","name":"initialized","type":"bool"},{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"uint256","name":"cliff","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"bool","name":"revocable","type":"bool"},{"internalType":"uint256","name":"amountTotal","type":"uint256"},{"internalType":"uint256","name":"released","type":"uint256"},{"internalType":"bool","name":"revoked","type":"bool"}],"internalType":"struct SabaiVesting.VestingSchedule","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getVestingIdAtIndex","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"vestingScheduleId","type":"bytes32"}],"name":"getVestingSchedule","outputs":[{"components":[{"internalType":"bool","name":"initialized","type":"bool"},{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"uint256","name":"cliff","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"bool","name":"revocable","type":"bool"},{"internalType":"uint256","name":"amountTotal","type":"uint256"},{"internalType":"uint256","name":"released","type":"uint256"},{"internalType":"bool","name":"revoked","type":"bool"}],"internalType":"struct SabaiVesting.VestingSchedule","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getVestingScheduleByAddressAndIndex","outputs":[{"components":[{"internalType":"bool","name":"initialized","type":"bool"},{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"uint256","name":"cliff","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"bool","name":"revocable","type":"bool"},{"internalType":"uint256","name":"amountTotal","type":"uint256"},{"internalType":"uint256","name":"released","type":"uint256"},{"internalType":"bool","name":"revoked","type":"bool"}],"internalType":"struct SabaiVesting.VestingSchedule","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVestingSchedulesCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_beneficiary","type":"address"}],"name":"getVestingSchedulesCountByBeneficiary","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVestingSchedulesTotalAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWithdrawableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"vestingScheduleId","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"vestingScheduleId","type":"bytes32"}],"name":"revoke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a06040523480156200001157600080fd5b506040516200396138038062003961833981810160405281019062000037919062000285565b620000576200004b6200014f60201b60201c565b6200015760201b60201c565b60018081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036200009857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603620000d257600080fd5b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff168152505080600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050620002cc565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200024d8262000220565b9050919050565b6200025f8162000240565b81146200026b57600080fd5b50565b6000815190506200027f8162000254565b92915050565b600080604083850312156200029f576200029e6200021b565b5b6000620002af858286016200026e565b9250506020620002c2858286016200026e565b9150509250929050565b608051613664620002fd6000396000818161045a0152818161095a01528181610cb50152610ede01526136646000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c806390be10cc116100b8578063e3cf11521161007c578063e3cf115214610351578063ea1bb3d51461036d578063f2fde38b1461039d578063f51321d7146103b9578063f7c469f0146103e9578063f9079b371461041957610142565b806390be10cc146102ad5780639ef346b4146102cb578063b75c7dc6146102fb578063bb9356c614610317578063d50d57ab1461033357610142565b80635a7bb69a1161010a5780635a7bb69a146101d957806366afd8ef14610209578063715018a6146102255780637e913dc61461022f5780638af104da1461025f5780638da5cb5b1461028f57610142565b8063130836171461014757806321df0da71461016557806327a1567f146101835780632e1a7d4d1461019f57806348deb471146101bb575b600080fd5b61014f610449565b60405161015c9190612389565b60405180910390f35b61016d610456565b60405161017a91906123e5565b60405180910390f35b61019d600480360381019061019891906124a4565b61047e565b005b6101b960048036038101906101b49190612531565b61088b565b005b6101c36109a9565b6040516101d09190612389565b60405180910390f35b6101f360048036038101906101ee919061255e565b6109b3565b6040516102009190612389565b60405180910390f35b610223600480360381019061021e91906125c1565b6109fc565b005b61022d610d09565b005b6102496004803603810190610244919061255e565b610d1d565b60405161025691906126e5565b60405180910390f35b61027960048036038101906102749190612701565b610e78565b6040516102869190612750565b60405180910390f35b610297610eab565b6040516102a491906123e5565b60405180910390f35b6102b5610ed4565b6040516102c29190612389565b60405180910390f35b6102e560048036038101906102e0919061276b565b610f89565b6040516102f291906126e5565b60405180910390f35b6103156004803603810190610310919061276b565b611090565b005b610331600480360381019061032c919061255e565b6112d4565b005b61033b611359565b60405161034891906123e5565b60405180910390f35b61036b60048036038101906103669190612996565b61137f565b005b6103876004803603810190610382919061276b565b611985565b6040516103949190612389565b60405180910390f35b6103b760048036038101906103b2919061255e565b611afe565b005b6103d360048036038101906103ce9190612701565b611b81565b6040516103e091906126e5565b60405180910390f35b61040360048036038101906103fe919061255e565b611ba3565b6040516104109190612750565b60405180910390f35b610433600480360381019061042e9190612531565b611bf5565b6040516104409190612750565b60405180910390f35b6000600280549050905090565b60007f0000000000000000000000000000000000000000000000000000000000000000905090565b610486611c66565b803073ffffffffffffffffffffffffffffffffffffffff166390be10cc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f691906129f4565b1015610537576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161052e90612aca565b60405180910390fd5b6000831161057a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057190612b5c565b60405180910390fd5b600081116105bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b490612bc8565b60405180910390fd5b60003073ffffffffffffffffffffffffffffffffffffffff1663f7c469f0886040518263ffffffff1660e01b81526004016105f891906123e5565b602060405180830381865afa158015610615573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106399190612bfd565b905060006106508688611cff90919063ffffffff16565b90506040518061012001604052806001151581526020018973ffffffffffffffffffffffffffffffffffffffff168152602001828152602001888152602001868152602001851515815260200184815260200160008152602001600015158152506003600084815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010155606082015181600201556080820151816003015560a08201518160040160006101000a81548160ff02191690831515021790555060c0820151816005015560e082015181600601556101008201518160070160006101000a81548160ff0219169083151502179055509050506107b683600454611cff90919063ffffffff16565b60048190555060028290806001815401808255809150506001900390600052602060002001600090919091909150556000600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061083d600182611cff90919063ffffffff16565b600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050505050505050565b610893611d15565b61089b611c66565b803073ffffffffffffffffffffffffffffffffffffffff166390be10cc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090b91906129f4565b101561094c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094390612c9c565b60405180910390fd5b61099e610957610eab565b827f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16611d649092919063ffffffff16565b6109a6611dea565b50565b6000600454905090565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610a04611d15565b81600115156003600083815260200190815260200160002060000160009054906101000a900460ff16151514610a3957600080fd5b600015156003600083815260200190815260200160002060070160009054906101000a900460ff16151514610a6d57600080fd5b600060036000858152602001908152602001600020905060008160000160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905080610b1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b1290612d2e565b60405180910390fd5b6000610c0b83604051806101200160405290816000820160009054906101000a900460ff161515151581526020016000820160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820154815260200160028201548152602001600382015481526020016004820160009054906101000a900460ff1615151515815260200160058201548152602001600682015481526020016007820160009054906101000a900460ff161515151581525050611df3565b905084811015610c50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4790612dc0565b60405180910390fd5b610c67858460060154611cff90919063ffffffff16565b8360060181905550610c8485600454611edf90919063ffffffff16565b600481905550610cf98360000160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16867f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16611d649092919063ffffffff16565b50505050610d05611dea565b5050565b610d11611ef5565b610d1b6000611f73565b565b610d25612308565b60036000610d7e846001600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d799190612e0f565b610e78565b8152602001908152602001600020604051806101200160405290816000820160009054906101000a900460ff161515151581526020016000820160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820154815260200160028201548152602001600382015481526020016004820160009054906101000a900460ff1615151515815260200160058201548152602001600682015481526020016007820160009054906101000a900460ff1615151515815250509050919050565b60008282604051602001610e8d929190612eac565b60405160208183030381529060405280519060200120905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000610f846004547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610f3591906123e5565b602060405180830381865afa158015610f52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7691906129f4565b611edf90919063ffffffff16565b905090565b610f91612308565b60036000838152602001908152602001600020604051806101200160405290816000820160009054906101000a900460ff161515151581526020016000820160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820154815260200160028201548152602001600382015481526020016004820160009054906101000a900460ff1615151515815260200160058201548152602001600682015481526020016007820160009054906101000a900460ff1615151515815250509050919050565b611098611c66565b80600115156003600083815260200190815260200160002060000160009054906101000a900460ff161515146110cd57600080fd5b600015156003600083815260200190815260200160002060070160009054906101000a900460ff1615151461110157600080fd5b6000600360008481526020019081526020016000209050600115158160040160009054906101000a900460ff16151514611170576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116790612f4a565b60405180910390fd5b600061126082604051806101200160405290816000820160009054906101000a900460ff161515151581526020016000820160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820154815260200160028201548152602001600382015481526020016004820160009054906101000a900460ff1615151515815260200160058201548152602001600682015481526020016007820160009054906101000a900460ff161515151581525050611df3565b905060008111156112765761127584826109fc565b5b600061129383600601548460050154611edf90919063ffffffff16565b90506112aa81600454611edf90919063ffffffff16565b60048190555060018360070160006101000a81548160ff0219169083151502179055505050505050565b6112dc611ef5565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361131557600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611387611c66565b600080600090505b82518110156115505760008382815181106113ad576113ac612f6a565b5b602002602001015160600151116113f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113f090612b5c565b60405180910390fd5b600083828151811061140e5761140d612f6a565b5b602002602001015160a001511161145a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161145190612bc8565b60405180910390fd5b61148b8382815181106114705761146f612f6a565b5b602002602001015160a0015183611cff90919063ffffffff16565b50813073ffffffffffffffffffffffffffffffffffffffff166390be10cc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156114d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114fc91906129f4565b101561153d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153490612aca565b60405180910390fd5b808061154890612f99565b91505061138f565b5060005b82518110156119805760003073ffffffffffffffffffffffffffffffffffffffff1663f7c469f085848151811061158e5761158d612f6a565b5b6020026020010151600001516040518263ffffffff1660e01b81526004016115b691906123e5565b602060405180830381865afa1580156115d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115f79190612bfd565b9050600061164a85848151811061161157611610612f6a565b5b6020026020010151602001518685815181106116305761162f612f6a565b5b602002602001015160400151611cff90919063ffffffff16565b905060405180610120016040528060011515815260200186858151811061167457611673612f6a565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1681526020018281526020018685815181106116b4576116b3612f6a565b5b60200260200101516040015181526020018685815181106116d8576116d7612f6a565b5b60200260200101516060015181526020018685815181106116fc576116fb612f6a565b5b6020026020010151608001511515815260200186858151811061172257611721612f6a565b5b602002602001015160a00151815260200160008152602001600015158152506003600084815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010155606082015181600201556080820151816003015560a08201518160040160006101000a81548160ff02191690831515021790555060c0820151816005015560e082015181600601556101008201518160070160006101000a81548160ff02191690831515021790555090505061186485848151811061184757611846612f6a565b5b602002602001015160a00151600454611cff90919063ffffffff16565b60048190555060028290806001815401808255809150506001900390600052602060002001600090919091909150556000600560008786815181106118ac576118ab612f6a565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050611909600182611cff90919063ffffffff16565b600560008887815181106119205761191f612f6a565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050808061197890612f99565b915050611554565b505050565b600081600115156003600083815260200190815260200160002060000160009054906101000a900460ff161515146119bc57600080fd5b600015156003600083815260200190815260200160002060070160009054906101000a900460ff161515146119f057600080fd5b6000600360008581526020019081526020016000209050611af581604051806101200160405290816000820160009054906101000a900460ff161515151581526020016000820160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820154815260200160028201548152602001600382015481526020016004820160009054906101000a900460ff1615151515815260200160058201548152602001600682015481526020016007820160009054906101000a900460ff161515151581525050611df3565b92505050919050565b611b06611ef5565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611b75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6c90613053565b60405180910390fd5b611b7e81611f73565b50565b611b89612308565b611b9b611b968484610e78565b610f89565b905092915050565b6000611bee82600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e78565b9050919050565b6000611bff610449565b8210611c40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c37906130e5565b60405180910390fd5b60028281548110611c5457611c53612f6a565b5b90600052602060002001549050919050565b611c6e612037565b73ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611cfd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cf490613177565b60405180910390fd5b565b60008183611d0d9190613197565b905092915050565b600260015403611d5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d5190613217565b60405180910390fd5b6002600181905550565b611de58363a9059cbb60e01b8484604051602401611d83929190613237565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061203f565b505050565b60018081905550565b600080611dfe612107565b90508260400151811080611e1b5750600115158361010001511515145b15611e2a576000915050611eda565b611e4583608001518460400151611cff90919063ffffffff16565b8110611e6e57611e668360e001518460c00151611edf90919063ffffffff16565b915050611eda565b6000611e87846040015183611edf90919063ffffffff16565b90506000611eb88560800151611eaa848860c0015161210f90919063ffffffff16565b61212590919063ffffffff16565b9050611ed18560e0015182611edf90919063ffffffff16565b90508093505050505b919050565b60008183611eed9190612e0f565b905092915050565b611efd612037565b73ffffffffffffffffffffffffffffffffffffffff16611f1b610eab565b73ffffffffffffffffffffffffffffffffffffffff1614611f71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f68906132ac565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b60006120a1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661213b9092919063ffffffff16565b90506000815114806120c35750808060200190518101906120c291906132e1565b5b612102576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f990613380565b60405180910390fd5b505050565b600042905090565b6000818361211d91906133a0565b905092915050565b600081836121339190613411565b905092915050565b606061214a8484600085612153565b90509392505050565b606082471015612198576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161218f906134b4565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516121c19190613545565b60006040518083038185875af1925050503d80600081146121fe576040519150601f19603f3d011682016040523d82523d6000602084013e612203565b606091505b509150915061221487838387612220565b92505050949350505050565b6060831561228257600083510361227a5761223a85612295565b612279576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612270906135a8565b60405180910390fd5b5b82905061228d565b61228c83836122b8565b5b949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000825111156122cb5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122ff919061360c565b60405180910390fd5b604051806101200160405280600015158152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160001515815260200160008152602001600081526020016000151581525090565b6000819050919050565b61238381612370565b82525050565b600060208201905061239e600083018461237a565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006123cf826123a4565b9050919050565b6123df816123c4565b82525050565b60006020820190506123fa60008301846123d6565b92915050565b6000604051905090565b600080fd5b600080fd5b61241d816123c4565b811461242857600080fd5b50565b60008135905061243a81612414565b92915050565b61244981612370565b811461245457600080fd5b50565b60008135905061246681612440565b92915050565b60008115159050919050565b6124818161246c565b811461248c57600080fd5b50565b60008135905061249e81612478565b92915050565b60008060008060008060c087890312156124c1576124c061240a565b5b60006124cf89828a0161242b565b96505060206124e089828a01612457565b95505060406124f189828a01612457565b945050606061250289828a01612457565b935050608061251389828a0161248f565b92505060a061252489828a01612457565b9150509295509295509295565b6000602082840312156125475761254661240a565b5b600061255584828501612457565b91505092915050565b6000602082840312156125745761257361240a565b5b60006125828482850161242b565b91505092915050565b6000819050919050565b61259e8161258b565b81146125a957600080fd5b50565b6000813590506125bb81612595565b92915050565b600080604083850312156125d8576125d761240a565b5b60006125e6858286016125ac565b92505060206125f785828601612457565b9150509250929050565b61260a8161246c565b82525050565b612619816123c4565b82525050565b61262881612370565b82525050565b610120820160008201516126456000850182612601565b5060208201516126586020850182612610565b50604082015161266b604085018261261f565b50606082015161267e606085018261261f565b506080820151612691608085018261261f565b5060a08201516126a460a0850182612601565b5060c08201516126b760c085018261261f565b5060e08201516126ca60e085018261261f565b506101008201516126df610100850182612601565b50505050565b6000610120820190506126fb600083018461262e565b92915050565b600080604083850312156127185761271761240a565b5b60006127268582860161242b565b925050602061273785828601612457565b9150509250929050565b61274a8161258b565b82525050565b60006020820190506127656000830184612741565b92915050565b6000602082840312156127815761278061240a565b5b600061278f848285016125ac565b91505092915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6127e68261279d565b810181811067ffffffffffffffff82111715612805576128046127ae565b5b80604052505050565b6000612818612400565b905061282482826127dd565b919050565b600067ffffffffffffffff821115612844576128436127ae565b5b602082029050602081019050919050565b600080fd5b600080fd5b600060c082840312156128755761287461285a565b5b61287f60c061280e565b9050600061288f8482850161242b565b60008301525060206128a384828501612457565b60208301525060406128b784828501612457565b60408301525060606128cb84828501612457565b60608301525060806128df8482850161248f565b60808301525060a06128f384828501612457565b60a08301525092915050565b600061291261290d84612829565b61280e565b90508083825260208201905060c0840283018581111561293557612934612855565b5b835b8181101561295e578061294a888261285f565b84526020840193505060c081019050612937565b5050509392505050565b600082601f83011261297d5761297c612798565b5b813561298d8482602086016128ff565b91505092915050565b6000602082840312156129ac576129ab61240a565b5b600082013567ffffffffffffffff8111156129ca576129c961240f565b5b6129d684828501612968565b91505092915050565b6000815190506129ee81612440565b92915050565b600060208284031215612a0a57612a0961240a565b5b6000612a18848285016129df565b91505092915050565b600082825260208201905092915050565b7f546f6b656e56657374696e673a2063616e6e6f7420637265617465207665737460008201527f696e67207363686564756c652062656361757365206e6f74207375666669636960208201527f656e7420746f6b656e7300000000000000000000000000000000000000000000604082015250565b6000612ab4604a83612a21565b9150612abf82612a32565b606082019050919050565b60006020820190508181036000830152612ae381612aa7565b9050919050565b7f546f6b656e56657374696e673a206475726174696f6e206d757374206265203e60008201527f2030000000000000000000000000000000000000000000000000000000000000602082015250565b6000612b46602283612a21565b9150612b5182612aea565b604082019050919050565b60006020820190508181036000830152612b7581612b39565b9050919050565b7f546f6b656e56657374696e673a20616d6f756e74206d757374206265203e2030600082015250565b6000612bb2602083612a21565b9150612bbd82612b7c565b602082019050919050565b60006020820190508181036000830152612be181612ba5565b9050919050565b600081519050612bf781612595565b92915050565b600060208284031215612c1357612c1261240a565b5b6000612c2184828501612be8565b91505092915050565b7f546f6b656e56657374696e673a206e6f7420656e6f756768207769746864726160008201527f7761626c652066756e6473000000000000000000000000000000000000000000602082015250565b6000612c86602b83612a21565b9150612c9182612c2a565b604082019050919050565b60006020820190508181036000830152612cb581612c79565b9050919050565b7f546f6b656e56657374696e673a206f6e6c792062656e6566696369617279206360008201527f616e2072656c656173652076657374656420746f6b656e730000000000000000602082015250565b6000612d18603883612a21565b9150612d2382612cbc565b604082019050919050565b60006020820190508181036000830152612d4781612d0b565b9050919050565b7f546f6b656e56657374696e673a2063616e6e6f742072656c6561736520746f6b60008201527f656e732c206e6f7420656e6f7567682076657374656420746f6b656e73000000602082015250565b6000612daa603d83612a21565b9150612db582612d4e565b604082019050919050565b60006020820190508181036000830152612dd981612d9d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612e1a82612370565b9150612e2583612370565b9250828203905081811115612e3d57612e3c612de0565b5b92915050565b60008160601b9050919050565b6000612e5b82612e43565b9050919050565b6000612e6d82612e50565b9050919050565b612e85612e80826123c4565b612e62565b82525050565b6000819050919050565b612ea6612ea182612370565b612e8b565b82525050565b6000612eb88285612e74565b601482019150612ec88284612e95565b6020820191508190509392505050565b7f546f6b656e56657374696e673a2076657374696e67206973206e6f742072657660008201527f6f6361626c650000000000000000000000000000000000000000000000000000602082015250565b6000612f34602683612a21565b9150612f3f82612ed8565b604082019050919050565b60006020820190508181036000830152612f6381612f27565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000612fa482612370565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612fd657612fd5612de0565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061303d602683612a21565b915061304882612fe1565b604082019050919050565b6000602082019050818103600083015261306c81613030565b9050919050565b7f546f6b656e56657374696e673a20696e646578206f7574206f6620626f756e6460008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b60006130cf602183612a21565b91506130da82613073565b604082019050919050565b600060208201905081810360008301526130fe816130c2565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206d616e616760008201527f6572000000000000000000000000000000000000000000000000000000000000602082015250565b6000613161602283612a21565b915061316c82613105565b604082019050919050565b6000602082019050818103600083015261319081613154565b9050919050565b60006131a282612370565b91506131ad83612370565b92508282019050808211156131c5576131c4612de0565b5b92915050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000613201601f83612a21565b915061320c826131cb565b602082019050919050565b60006020820190508181036000830152613230816131f4565b9050919050565b600060408201905061324c60008301856123d6565b613259602083018461237a565b9392505050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613296602083612a21565b91506132a182613260565b602082019050919050565b600060208201905081810360008301526132c581613289565b9050919050565b6000815190506132db81612478565b92915050565b6000602082840312156132f7576132f661240a565b5b6000613305848285016132cc565b91505092915050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b600061336a602a83612a21565b91506133758261330e565b604082019050919050565b600060208201905081810360008301526133998161335d565b9050919050565b60006133ab82612370565b91506133b683612370565b92508282026133c481612370565b915082820484148315176133db576133da612de0565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061341c82612370565b915061342783612370565b925082613437576134366133e2565b5b828204905092915050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b600061349e602683612a21565b91506134a982613442565b604082019050919050565b600060208201905081810360008301526134cd81613491565b9050919050565b600081519050919050565b600081905092915050565b60005b838110156135085780820151818401526020810190506134ed565b60008484015250505050565b600061351f826134d4565b61352981856134df565b93506135398185602086016134ea565b80840191505092915050565b60006135518284613514565b915081905092915050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000613592601d83612a21565b915061359d8261355c565b602082019050919050565b600060208201905081810360008301526135c181613585565b9050919050565b600081519050919050565b60006135de826135c8565b6135e88185612a21565b93506135f88185602086016134ea565b6136018161279d565b840191505092915050565b6000602082019050818103600083015261362681846135d3565b90509291505056fea2646970667358221220963d56d9634572a351f989de4456c63c41cbc4fad2423c500cd6e9614e86fa0e64736f6c63430008120033000000000000000000000000b5d730d442e1d5b119fb4e5c843c48a64202ef920000000000000000000000009d225032cfb5b0a6847dde38e8b24badce7e8afb
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101425760003560e01c806390be10cc116100b8578063e3cf11521161007c578063e3cf115214610351578063ea1bb3d51461036d578063f2fde38b1461039d578063f51321d7146103b9578063f7c469f0146103e9578063f9079b371461041957610142565b806390be10cc146102ad5780639ef346b4146102cb578063b75c7dc6146102fb578063bb9356c614610317578063d50d57ab1461033357610142565b80635a7bb69a1161010a5780635a7bb69a146101d957806366afd8ef14610209578063715018a6146102255780637e913dc61461022f5780638af104da1461025f5780638da5cb5b1461028f57610142565b8063130836171461014757806321df0da71461016557806327a1567f146101835780632e1a7d4d1461019f57806348deb471146101bb575b600080fd5b61014f610449565b60405161015c9190612389565b60405180910390f35b61016d610456565b60405161017a91906123e5565b60405180910390f35b61019d600480360381019061019891906124a4565b61047e565b005b6101b960048036038101906101b49190612531565b61088b565b005b6101c36109a9565b6040516101d09190612389565b60405180910390f35b6101f360048036038101906101ee919061255e565b6109b3565b6040516102009190612389565b60405180910390f35b610223600480360381019061021e91906125c1565b6109fc565b005b61022d610d09565b005b6102496004803603810190610244919061255e565b610d1d565b60405161025691906126e5565b60405180910390f35b61027960048036038101906102749190612701565b610e78565b6040516102869190612750565b60405180910390f35b610297610eab565b6040516102a491906123e5565b60405180910390f35b6102b5610ed4565b6040516102c29190612389565b60405180910390f35b6102e560048036038101906102e0919061276b565b610f89565b6040516102f291906126e5565b60405180910390f35b6103156004803603810190610310919061276b565b611090565b005b610331600480360381019061032c919061255e565b6112d4565b005b61033b611359565b60405161034891906123e5565b60405180910390f35b61036b60048036038101906103669190612996565b61137f565b005b6103876004803603810190610382919061276b565b611985565b6040516103949190612389565b60405180910390f35b6103b760048036038101906103b2919061255e565b611afe565b005b6103d360048036038101906103ce9190612701565b611b81565b6040516103e091906126e5565b60405180910390f35b61040360048036038101906103fe919061255e565b611ba3565b6040516104109190612750565b60405180910390f35b610433600480360381019061042e9190612531565b611bf5565b6040516104409190612750565b60405180910390f35b6000600280549050905090565b60007f000000000000000000000000b5d730d442e1d5b119fb4e5c843c48a64202ef92905090565b610486611c66565b803073ffffffffffffffffffffffffffffffffffffffff166390be10cc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f691906129f4565b1015610537576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161052e90612aca565b60405180910390fd5b6000831161057a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057190612b5c565b60405180910390fd5b600081116105bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b490612bc8565b60405180910390fd5b60003073ffffffffffffffffffffffffffffffffffffffff1663f7c469f0886040518263ffffffff1660e01b81526004016105f891906123e5565b602060405180830381865afa158015610615573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106399190612bfd565b905060006106508688611cff90919063ffffffff16565b90506040518061012001604052806001151581526020018973ffffffffffffffffffffffffffffffffffffffff168152602001828152602001888152602001868152602001851515815260200184815260200160008152602001600015158152506003600084815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010155606082015181600201556080820151816003015560a08201518160040160006101000a81548160ff02191690831515021790555060c0820151816005015560e082015181600601556101008201518160070160006101000a81548160ff0219169083151502179055509050506107b683600454611cff90919063ffffffff16565b60048190555060028290806001815401808255809150506001900390600052602060002001600090919091909150556000600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061083d600182611cff90919063ffffffff16565b600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050505050505050565b610893611d15565b61089b611c66565b803073ffffffffffffffffffffffffffffffffffffffff166390be10cc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090b91906129f4565b101561094c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094390612c9c565b60405180910390fd5b61099e610957610eab565b827f000000000000000000000000b5d730d442e1d5b119fb4e5c843c48a64202ef9273ffffffffffffffffffffffffffffffffffffffff16611d649092919063ffffffff16565b6109a6611dea565b50565b6000600454905090565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610a04611d15565b81600115156003600083815260200190815260200160002060000160009054906101000a900460ff16151514610a3957600080fd5b600015156003600083815260200190815260200160002060070160009054906101000a900460ff16151514610a6d57600080fd5b600060036000858152602001908152602001600020905060008160000160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905080610b1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b1290612d2e565b60405180910390fd5b6000610c0b83604051806101200160405290816000820160009054906101000a900460ff161515151581526020016000820160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820154815260200160028201548152602001600382015481526020016004820160009054906101000a900460ff1615151515815260200160058201548152602001600682015481526020016007820160009054906101000a900460ff161515151581525050611df3565b905084811015610c50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4790612dc0565b60405180910390fd5b610c67858460060154611cff90919063ffffffff16565b8360060181905550610c8485600454611edf90919063ffffffff16565b600481905550610cf98360000160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16867f000000000000000000000000b5d730d442e1d5b119fb4e5c843c48a64202ef9273ffffffffffffffffffffffffffffffffffffffff16611d649092919063ffffffff16565b50505050610d05611dea565b5050565b610d11611ef5565b610d1b6000611f73565b565b610d25612308565b60036000610d7e846001600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d799190612e0f565b610e78565b8152602001908152602001600020604051806101200160405290816000820160009054906101000a900460ff161515151581526020016000820160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820154815260200160028201548152602001600382015481526020016004820160009054906101000a900460ff1615151515815260200160058201548152602001600682015481526020016007820160009054906101000a900460ff1615151515815250509050919050565b60008282604051602001610e8d929190612eac565b60405160208183030381529060405280519060200120905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000610f846004547f000000000000000000000000b5d730d442e1d5b119fb4e5c843c48a64202ef9273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610f3591906123e5565b602060405180830381865afa158015610f52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7691906129f4565b611edf90919063ffffffff16565b905090565b610f91612308565b60036000838152602001908152602001600020604051806101200160405290816000820160009054906101000a900460ff161515151581526020016000820160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820154815260200160028201548152602001600382015481526020016004820160009054906101000a900460ff1615151515815260200160058201548152602001600682015481526020016007820160009054906101000a900460ff1615151515815250509050919050565b611098611c66565b80600115156003600083815260200190815260200160002060000160009054906101000a900460ff161515146110cd57600080fd5b600015156003600083815260200190815260200160002060070160009054906101000a900460ff1615151461110157600080fd5b6000600360008481526020019081526020016000209050600115158160040160009054906101000a900460ff16151514611170576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116790612f4a565b60405180910390fd5b600061126082604051806101200160405290816000820160009054906101000a900460ff161515151581526020016000820160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820154815260200160028201548152602001600382015481526020016004820160009054906101000a900460ff1615151515815260200160058201548152602001600682015481526020016007820160009054906101000a900460ff161515151581525050611df3565b905060008111156112765761127584826109fc565b5b600061129383600601548460050154611edf90919063ffffffff16565b90506112aa81600454611edf90919063ffffffff16565b60048190555060018360070160006101000a81548160ff0219169083151502179055505050505050565b6112dc611ef5565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361131557600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611387611c66565b600080600090505b82518110156115505760008382815181106113ad576113ac612f6a565b5b602002602001015160600151116113f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113f090612b5c565b60405180910390fd5b600083828151811061140e5761140d612f6a565b5b602002602001015160a001511161145a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161145190612bc8565b60405180910390fd5b61148b8382815181106114705761146f612f6a565b5b602002602001015160a0015183611cff90919063ffffffff16565b50813073ffffffffffffffffffffffffffffffffffffffff166390be10cc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156114d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114fc91906129f4565b101561153d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153490612aca565b60405180910390fd5b808061154890612f99565b91505061138f565b5060005b82518110156119805760003073ffffffffffffffffffffffffffffffffffffffff1663f7c469f085848151811061158e5761158d612f6a565b5b6020026020010151600001516040518263ffffffff1660e01b81526004016115b691906123e5565b602060405180830381865afa1580156115d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115f79190612bfd565b9050600061164a85848151811061161157611610612f6a565b5b6020026020010151602001518685815181106116305761162f612f6a565b5b602002602001015160400151611cff90919063ffffffff16565b905060405180610120016040528060011515815260200186858151811061167457611673612f6a565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1681526020018281526020018685815181106116b4576116b3612f6a565b5b60200260200101516040015181526020018685815181106116d8576116d7612f6a565b5b60200260200101516060015181526020018685815181106116fc576116fb612f6a565b5b6020026020010151608001511515815260200186858151811061172257611721612f6a565b5b602002602001015160a00151815260200160008152602001600015158152506003600084815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010155606082015181600201556080820151816003015560a08201518160040160006101000a81548160ff02191690831515021790555060c0820151816005015560e082015181600601556101008201518160070160006101000a81548160ff02191690831515021790555090505061186485848151811061184757611846612f6a565b5b602002602001015160a00151600454611cff90919063ffffffff16565b60048190555060028290806001815401808255809150506001900390600052602060002001600090919091909150556000600560008786815181106118ac576118ab612f6a565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050611909600182611cff90919063ffffffff16565b600560008887815181106119205761191f612f6a565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050808061197890612f99565b915050611554565b505050565b600081600115156003600083815260200190815260200160002060000160009054906101000a900460ff161515146119bc57600080fd5b600015156003600083815260200190815260200160002060070160009054906101000a900460ff161515146119f057600080fd5b6000600360008581526020019081526020016000209050611af581604051806101200160405290816000820160009054906101000a900460ff161515151581526020016000820160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820154815260200160028201548152602001600382015481526020016004820160009054906101000a900460ff1615151515815260200160058201548152602001600682015481526020016007820160009054906101000a900460ff161515151581525050611df3565b92505050919050565b611b06611ef5565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611b75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6c90613053565b60405180910390fd5b611b7e81611f73565b50565b611b89612308565b611b9b611b968484610e78565b610f89565b905092915050565b6000611bee82600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e78565b9050919050565b6000611bff610449565b8210611c40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c37906130e5565b60405180910390fd5b60028281548110611c5457611c53612f6a565b5b90600052602060002001549050919050565b611c6e612037565b73ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611cfd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cf490613177565b60405180910390fd5b565b60008183611d0d9190613197565b905092915050565b600260015403611d5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d5190613217565b60405180910390fd5b6002600181905550565b611de58363a9059cbb60e01b8484604051602401611d83929190613237565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061203f565b505050565b60018081905550565b600080611dfe612107565b90508260400151811080611e1b5750600115158361010001511515145b15611e2a576000915050611eda565b611e4583608001518460400151611cff90919063ffffffff16565b8110611e6e57611e668360e001518460c00151611edf90919063ffffffff16565b915050611eda565b6000611e87846040015183611edf90919063ffffffff16565b90506000611eb88560800151611eaa848860c0015161210f90919063ffffffff16565b61212590919063ffffffff16565b9050611ed18560e0015182611edf90919063ffffffff16565b90508093505050505b919050565b60008183611eed9190612e0f565b905092915050565b611efd612037565b73ffffffffffffffffffffffffffffffffffffffff16611f1b610eab565b73ffffffffffffffffffffffffffffffffffffffff1614611f71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f68906132ac565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b60006120a1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661213b9092919063ffffffff16565b90506000815114806120c35750808060200190518101906120c291906132e1565b5b612102576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f990613380565b60405180910390fd5b505050565b600042905090565b6000818361211d91906133a0565b905092915050565b600081836121339190613411565b905092915050565b606061214a8484600085612153565b90509392505050565b606082471015612198576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161218f906134b4565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516121c19190613545565b60006040518083038185875af1925050503d80600081146121fe576040519150601f19603f3d011682016040523d82523d6000602084013e612203565b606091505b509150915061221487838387612220565b92505050949350505050565b6060831561228257600083510361227a5761223a85612295565b612279576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612270906135a8565b60405180910390fd5b5b82905061228d565b61228c83836122b8565b5b949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000825111156122cb5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122ff919061360c565b60405180910390fd5b604051806101200160405280600015158152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160001515815260200160008152602001600081526020016000151581525090565b6000819050919050565b61238381612370565b82525050565b600060208201905061239e600083018461237a565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006123cf826123a4565b9050919050565b6123df816123c4565b82525050565b60006020820190506123fa60008301846123d6565b92915050565b6000604051905090565b600080fd5b600080fd5b61241d816123c4565b811461242857600080fd5b50565b60008135905061243a81612414565b92915050565b61244981612370565b811461245457600080fd5b50565b60008135905061246681612440565b92915050565b60008115159050919050565b6124818161246c565b811461248c57600080fd5b50565b60008135905061249e81612478565b92915050565b60008060008060008060c087890312156124c1576124c061240a565b5b60006124cf89828a0161242b565b96505060206124e089828a01612457565b95505060406124f189828a01612457565b945050606061250289828a01612457565b935050608061251389828a0161248f565b92505060a061252489828a01612457565b9150509295509295509295565b6000602082840312156125475761254661240a565b5b600061255584828501612457565b91505092915050565b6000602082840312156125745761257361240a565b5b60006125828482850161242b565b91505092915050565b6000819050919050565b61259e8161258b565b81146125a957600080fd5b50565b6000813590506125bb81612595565b92915050565b600080604083850312156125d8576125d761240a565b5b60006125e6858286016125ac565b92505060206125f785828601612457565b9150509250929050565b61260a8161246c565b82525050565b612619816123c4565b82525050565b61262881612370565b82525050565b610120820160008201516126456000850182612601565b5060208201516126586020850182612610565b50604082015161266b604085018261261f565b50606082015161267e606085018261261f565b506080820151612691608085018261261f565b5060a08201516126a460a0850182612601565b5060c08201516126b760c085018261261f565b5060e08201516126ca60e085018261261f565b506101008201516126df610100850182612601565b50505050565b6000610120820190506126fb600083018461262e565b92915050565b600080604083850312156127185761271761240a565b5b60006127268582860161242b565b925050602061273785828601612457565b9150509250929050565b61274a8161258b565b82525050565b60006020820190506127656000830184612741565b92915050565b6000602082840312156127815761278061240a565b5b600061278f848285016125ac565b91505092915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6127e68261279d565b810181811067ffffffffffffffff82111715612805576128046127ae565b5b80604052505050565b6000612818612400565b905061282482826127dd565b919050565b600067ffffffffffffffff821115612844576128436127ae565b5b602082029050602081019050919050565b600080fd5b600080fd5b600060c082840312156128755761287461285a565b5b61287f60c061280e565b9050600061288f8482850161242b565b60008301525060206128a384828501612457565b60208301525060406128b784828501612457565b60408301525060606128cb84828501612457565b60608301525060806128df8482850161248f565b60808301525060a06128f384828501612457565b60a08301525092915050565b600061291261290d84612829565b61280e565b90508083825260208201905060c0840283018581111561293557612934612855565b5b835b8181101561295e578061294a888261285f565b84526020840193505060c081019050612937565b5050509392505050565b600082601f83011261297d5761297c612798565b5b813561298d8482602086016128ff565b91505092915050565b6000602082840312156129ac576129ab61240a565b5b600082013567ffffffffffffffff8111156129ca576129c961240f565b5b6129d684828501612968565b91505092915050565b6000815190506129ee81612440565b92915050565b600060208284031215612a0a57612a0961240a565b5b6000612a18848285016129df565b91505092915050565b600082825260208201905092915050565b7f546f6b656e56657374696e673a2063616e6e6f7420637265617465207665737460008201527f696e67207363686564756c652062656361757365206e6f74207375666669636960208201527f656e7420746f6b656e7300000000000000000000000000000000000000000000604082015250565b6000612ab4604a83612a21565b9150612abf82612a32565b606082019050919050565b60006020820190508181036000830152612ae381612aa7565b9050919050565b7f546f6b656e56657374696e673a206475726174696f6e206d757374206265203e60008201527f2030000000000000000000000000000000000000000000000000000000000000602082015250565b6000612b46602283612a21565b9150612b5182612aea565b604082019050919050565b60006020820190508181036000830152612b7581612b39565b9050919050565b7f546f6b656e56657374696e673a20616d6f756e74206d757374206265203e2030600082015250565b6000612bb2602083612a21565b9150612bbd82612b7c565b602082019050919050565b60006020820190508181036000830152612be181612ba5565b9050919050565b600081519050612bf781612595565b92915050565b600060208284031215612c1357612c1261240a565b5b6000612c2184828501612be8565b91505092915050565b7f546f6b656e56657374696e673a206e6f7420656e6f756768207769746864726160008201527f7761626c652066756e6473000000000000000000000000000000000000000000602082015250565b6000612c86602b83612a21565b9150612c9182612c2a565b604082019050919050565b60006020820190508181036000830152612cb581612c79565b9050919050565b7f546f6b656e56657374696e673a206f6e6c792062656e6566696369617279206360008201527f616e2072656c656173652076657374656420746f6b656e730000000000000000602082015250565b6000612d18603883612a21565b9150612d2382612cbc565b604082019050919050565b60006020820190508181036000830152612d4781612d0b565b9050919050565b7f546f6b656e56657374696e673a2063616e6e6f742072656c6561736520746f6b60008201527f656e732c206e6f7420656e6f7567682076657374656420746f6b656e73000000602082015250565b6000612daa603d83612a21565b9150612db582612d4e565b604082019050919050565b60006020820190508181036000830152612dd981612d9d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612e1a82612370565b9150612e2583612370565b9250828203905081811115612e3d57612e3c612de0565b5b92915050565b60008160601b9050919050565b6000612e5b82612e43565b9050919050565b6000612e6d82612e50565b9050919050565b612e85612e80826123c4565b612e62565b82525050565b6000819050919050565b612ea6612ea182612370565b612e8b565b82525050565b6000612eb88285612e74565b601482019150612ec88284612e95565b6020820191508190509392505050565b7f546f6b656e56657374696e673a2076657374696e67206973206e6f742072657660008201527f6f6361626c650000000000000000000000000000000000000000000000000000602082015250565b6000612f34602683612a21565b9150612f3f82612ed8565b604082019050919050565b60006020820190508181036000830152612f6381612f27565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000612fa482612370565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612fd657612fd5612de0565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061303d602683612a21565b915061304882612fe1565b604082019050919050565b6000602082019050818103600083015261306c81613030565b9050919050565b7f546f6b656e56657374696e673a20696e646578206f7574206f6620626f756e6460008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b60006130cf602183612a21565b91506130da82613073565b604082019050919050565b600060208201905081810360008301526130fe816130c2565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206d616e616760008201527f6572000000000000000000000000000000000000000000000000000000000000602082015250565b6000613161602283612a21565b915061316c82613105565b604082019050919050565b6000602082019050818103600083015261319081613154565b9050919050565b60006131a282612370565b91506131ad83612370565b92508282019050808211156131c5576131c4612de0565b5b92915050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000613201601f83612a21565b915061320c826131cb565b602082019050919050565b60006020820190508181036000830152613230816131f4565b9050919050565b600060408201905061324c60008301856123d6565b613259602083018461237a565b9392505050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613296602083612a21565b91506132a182613260565b602082019050919050565b600060208201905081810360008301526132c581613289565b9050919050565b6000815190506132db81612478565b92915050565b6000602082840312156132f7576132f661240a565b5b6000613305848285016132cc565b91505092915050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b600061336a602a83612a21565b91506133758261330e565b604082019050919050565b600060208201905081810360008301526133998161335d565b9050919050565b60006133ab82612370565b91506133b683612370565b92508282026133c481612370565b915082820484148315176133db576133da612de0565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061341c82612370565b915061342783612370565b925082613437576134366133e2565b5b828204905092915050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b600061349e602683612a21565b91506134a982613442565b604082019050919050565b600060208201905081810360008301526134cd81613491565b9050919050565b600081519050919050565b600081905092915050565b60005b838110156135085780820151818401526020810190506134ed565b60008484015250505050565b600061351f826134d4565b61352981856134df565b93506135398185602086016134ea565b80840191505092915050565b60006135518284613514565b915081905092915050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000613592601d83612a21565b915061359d8261355c565b602082019050919050565b600060208201905081810360008301526135c181613585565b9050919050565b600081519050919050565b60006135de826135c8565b6135e88185612a21565b93506135f88185602086016134ea565b6136018161279d565b840191505092915050565b6000602082019050818103600083015261362681846135d3565b90509291505056fea2646970667358221220963d56d9634572a351f989de4456c63c41cbc4fad2423c500cd6e9614e86fa0e64736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000b5d730d442e1d5b119fb4e5c843c48a64202ef920000000000000000000000009d225032cfb5b0a6847dde38e8b24badce7e8afb
-----Decoded View---------------
Arg [0] : token_ (address): 0xb5d730D442e1D5B119Fb4E5c843c48a64202ef92
Arg [1] : _managerAddress (address): 0x9D225032CFB5b0A6847DDe38e8B24BadCE7e8afB
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000b5d730d442e1d5b119fb4e5c843c48a64202ef92
Arg [1] : 0000000000000000000000009d225032cfb5b0a6847dde38e8b24badce7e8afb
Loading...
Loading
Loading...
Loading
Net Worth in USD
$3,477,168.03
Net Worth in ETH
1,542.712454
Token Allocations
SABAI
100.00%
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| ETH | 100.00% | $0.001973 | 1,762,670,915 | $3,477,168.03 |
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.