Source Code
Latest 25 from a total of 156 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Claim Fund | 22106233 | 366 days ago | IN | 0 ETH | 0.00000651 | ||||
| Claim Fund | 21924019 | 392 days ago | IN | 0 ETH | 0.00041286 | ||||
| Claim Fund | 20773057 | 552 days ago | IN | 0 ETH | 0.00080322 | ||||
| Claim Fund | 20773054 | 552 days ago | IN | 0 ETH | 0.00025879 | ||||
| Claim Fund | 20633942 | 572 days ago | IN | 0 ETH | 0.00020769 | ||||
| Claim Fund | 20578936 | 579 days ago | IN | 0 ETH | 0.0002323 | ||||
| Claim Fund | 20556055 | 583 days ago | IN | 0 ETH | 0.00013253 | ||||
| Claim Fund | 20403700 | 604 days ago | IN | 0 ETH | 0.00010149 | ||||
| Claim Fund | 20343702 | 612 days ago | IN | 0 ETH | 0.00044042 | ||||
| Claim Fund | 20290237 | 620 days ago | IN | 0 ETH | 0.00024804 | ||||
| Claim Fund | 20160010 | 638 days ago | IN | 0 ETH | 0.00021427 | ||||
| Claim Fund | 20154266 | 639 days ago | IN | 0 ETH | 0.00019276 | ||||
| Claim Fund | 20154260 | 639 days ago | IN | 0 ETH | 0.00022578 | ||||
| Claim Fund | 20146775 | 640 days ago | IN | 0 ETH | 0.0001658 | ||||
| Claim Fund | 20144286 | 640 days ago | IN | 0 ETH | 0.00015964 | ||||
| Claim Fund | 20142771 | 640 days ago | IN | 0 ETH | 0.00038207 | ||||
| Claim Fund | 20126395 | 643 days ago | IN | 0 ETH | 0.00127375 | ||||
| Claim Fund | 20122089 | 643 days ago | IN | 0 ETH | 0.00044101 | ||||
| Claim Fund | 20093027 | 647 days ago | IN | 0 ETH | 0.00044707 | ||||
| Claim Fund | 20093024 | 647 days ago | IN | 0 ETH | 0.0004267 | ||||
| Claim Fund | 20052784 | 653 days ago | IN | 0 ETH | 0.0003809 | ||||
| Claim Fund | 20038225 | 655 days ago | IN | 0 ETH | 0.00172546 | ||||
| Claim Fund | 20028438 | 656 days ago | IN | 0 ETH | 0.0023307 | ||||
| Claim Fund | 20021996 | 657 days ago | IN | 0 ETH | 0.00041658 | ||||
| Claim Fund | 20021993 | 657 days ago | IN | 0 ETH | 0.00042415 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Vesting
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./IBEP20.sol";
contract Vesting is AccessControl, ReentrancyGuard {
using SafeMath for uint256;
uint256 public poolIndex;
mapping(uint256 => Pool) public pools;
event CreatePoolEvent(uint256 poolId);
event AddFundEvent(uint256 poolId, address user, uint256 fundAmount);
event RemoveFundEvent(uint256 poolId, address user);
event ClaimFundEvent(uint256 poolId, address user, uint256 fundClaimed);
uint8 private constant VESTING_TYPE_MILESTONE_UNLOCK_FIRST = 1;
uint8 private constant VESTING_TYPE_MILESTONE_CLIFF_FIRST = 2;
uint8 private constant VESTING_TYPE_LINEAR_UNLOCK_FIRST = 3;
uint8 private constant VESTING_TYPE_LINEAR_CLIFF_FIRST = 4;
uint256 private constant ONE_HUNDRED_PERCENT_SCALED = 10000;
uint256 private constant TEN_YEARS_IN_S = 311040000;
enum PoolState {
NEW,
STARTING,
PAUSE,
SUCCESS
}
struct Pool {
IBEP20 tokenFund;
uint256 id;
string name;
uint8 vestingType;
uint256 tge;
uint256 cliff;
uint256 unlockPercent;
uint256 linearVestingDuration;
uint256[] milestoneTimes;
uint256[] milestonePercents;
mapping(address => uint256) funds;
mapping(address => uint256) released;
uint256 fundsTotal;
uint256 fundsClaimed;
PoolState state;
}
constructor(address admin) {
_setupRole(DEFAULT_ADMIN_ROLE, admin);
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
poolIndex = 1;
}
modifier onlyAdmin() {
require(
hasRole(DEFAULT_ADMIN_ROLE, msg.sender),
"Restricted to admins!"
);
_;
}
function createPool(
address _tokenFund,
string memory _name,
uint8 _vestingType,
uint256 _tge,
uint256 _cliff,
uint256 _unlockPercent,
uint256 _linearVestingDuration,
uint256[] memory _milestoneTimes,
uint256[] memory _milestonePercents
) external nonReentrant onlyAdmin {
_validateSetup(
_vestingType,
_unlockPercent,
_tge,
_cliff,
_linearVestingDuration,
_milestoneTimes,
_milestonePercents
);
uint256 index = poolIndex++;
Pool storage pool = pools[index];
pool.id = index;
pool.tokenFund = IBEP20(_tokenFund);
pool.name = _name;
pool.vestingType = _vestingType;
pool.tge = _tge;
pool.cliff = _cliff;
pool.unlockPercent = _unlockPercent;
pool.linearVestingDuration = _linearVestingDuration;
pool.milestoneTimes = _milestoneTimes;
pool.milestonePercents = _milestonePercents;
pool.fundsTotal = 0;
pool.fundsClaimed = 0;
pool.state = PoolState.NEW;
emit CreatePoolEvent(index);
}
function start(uint256 poolId) external nonReentrant onlyAdmin {
Pool storage pool = pools[poolId];
require(
pool.state == PoolState.NEW || pool.state == PoolState.PAUSE,
"Invalid action"
);
pool.state = PoolState.STARTING;
}
function pause(uint256 poolId) external nonReentrant onlyAdmin {
Pool storage pool = pools[poolId];
require(pool.state != PoolState.PAUSE, "Invalid action");
pool.state = PoolState.PAUSE;
}
function end(uint256 poolId) external nonReentrant onlyAdmin {
Pool storage pool = pools[poolId];
require(pool.state == PoolState.STARTING, "Invalid action");
pool.state = PoolState.SUCCESS;
}
function addFunds(
uint256 poolId,
uint256[] memory fundAmounts,
address[] memory users
) external nonReentrant onlyAdmin {
require(
users.length == fundAmounts.length,
"Input arrays length mismatch"
);
//
uint256 totalFundDeposit = 0;
for (uint256 u = 0; u < fundAmounts.length; u++) {
totalFundDeposit = totalFundDeposit.add(fundAmounts[u]);
}
Pool storage pool = pools[poolId];
require(
pool.tokenFund.balanceOf(_msgSender()) >= totalFundDeposit,
"Error: not enough Token"
);
pool.tokenFund.transferFrom(_msgSender(), address(this), totalFundDeposit);
for (uint256 i = 0; i < users.length; i++) {
address user = users[i];
uint256 fundAmount = fundAmounts[i];
uint256 oldFund = pool.funds[user];
if (oldFund > 0) {
pool.fundsTotal = pool.fundsTotal.add(fundAmount);
pool.funds[user] = pool.funds[user].add(fundAmount);
} else {
pool.fundsTotal = pool.fundsTotal.add(fundAmount);
pool.funds[user] = pool.funds[user].add(fundAmount);
pool.released[user] = 0;
}
emit AddFundEvent(poolId, user, fundAmount);
}
}
function removeFunds(
uint256 poolId,
address[] memory users
) external nonReentrant onlyAdmin {
Pool storage pool = pools[poolId];
for (uint256 i = 0; i < users.length; i++) {
address user = users[i];
uint256 oldFund = pool.funds[user];
if (oldFund > 0) {
pool.funds[user] = 0;
pool.released[user] = 0;
pool.fundsTotal = pool.fundsTotal.sub(oldFund);
pool.tokenFund.transfer(_msgSender(), oldFund);
emit RemoveFundEvent(poolId, user);
}
}
}
function claimFund(uint256 poolId) external nonReentrant {
_validateClaimFund(poolId);
Pool storage pool = pools[poolId];
uint256 _now = block.timestamp;
require(_now >= pool.tge, "Invalid Time");
uint256 claimPercent = computeClaimPercent(poolId, _now);
require(claimPercent > 0, "Invalid value");
uint256 claimTotal = (pool.funds[_msgSender()].mul(claimPercent)).div(
ONE_HUNDRED_PERCENT_SCALED
);
require(claimTotal > pool.released[_msgSender()], "Invalid value");
uint256 claimRemain = claimTotal.sub(pool.released[_msgSender()]);
pool.tokenFund.transfer(_msgSender(), claimRemain);
pool.released[_msgSender()] = pool.released[_msgSender()].add(
claimRemain
);
pool.fundsClaimed = pool.fundsClaimed.add(claimRemain);
emit ClaimFundEvent(poolId, _msgSender(), claimRemain);
}
function computeClaimPercent(
uint256 poolId,
uint256 _now
) public view returns (uint256) {
Pool storage pool = pools[poolId];
uint256[] memory milestoneTimes = pool.milestoneTimes;
uint256[] memory milestonePercents = pool.milestonePercents;
uint256 totalPercent = 0;
uint256 tge = pool.tge;
if (pool.vestingType == VESTING_TYPE_MILESTONE_CLIFF_FIRST) {
if (_now >= tge.add(pool.cliff)) {
totalPercent = totalPercent.add(pool.unlockPercent);
for (uint i = 0; i < milestoneTimes.length; i++) {
uint256 milestoneTime = milestoneTimes[i];
uint256 milestonePercent = milestonePercents[i];
if (_now >= milestoneTime) {
totalPercent = totalPercent.add(milestonePercent);
}
}
}
} else if (pool.vestingType == VESTING_TYPE_MILESTONE_UNLOCK_FIRST) {
if (_now >= tge) {
totalPercent = totalPercent.add(pool.unlockPercent);
if (_now >= tge.add(pool.cliff)) {
for (uint i = 0; i < milestoneTimes.length; i++) {
uint256 milestoneTime = milestoneTimes[i];
uint256 milestonePercent = milestonePercents[i];
if (_now >= milestoneTime) {
totalPercent = totalPercent.add(milestonePercent);
}
}
}
}
} else if (pool.vestingType == VESTING_TYPE_LINEAR_UNLOCK_FIRST) {
if (_now >= tge) {
totalPercent = totalPercent.add(pool.unlockPercent);
if (_now >= tge.add(pool.cliff)) {
uint256 delta = _now.sub(tge).sub(pool.cliff);
totalPercent = totalPercent.add(delta.mul(ONE_HUNDRED_PERCENT_SCALED.sub(pool.unlockPercent))
.div(pool.linearVestingDuration)
);
}
}
} else if (pool.vestingType == VESTING_TYPE_LINEAR_CLIFF_FIRST) {
if (_now >= tge.add(pool.cliff)) {
totalPercent = totalPercent.add(pool.unlockPercent);
uint256 delta = _now.sub(tge).sub(pool.cliff);
totalPercent = totalPercent.add(
delta
.mul(ONE_HUNDRED_PERCENT_SCALED.sub(pool.unlockPercent))
.div(pool.linearVestingDuration)
);
}
}
return (totalPercent < ONE_HUNDRED_PERCENT_SCALED) ? totalPercent : ONE_HUNDRED_PERCENT_SCALED;
}
function getFundByUser(
uint256 poolId,
address user
) public view returns (uint256, uint256) {
return (pools[poolId].funds[user], pools[poolId].released[user]);
}
function getInfoUserReward(
uint256 poolId
) public view returns (uint256, uint256) {
Pool storage pool = pools[poolId];
uint256 tokenTotal = pool.fundsTotal;
uint256 claimedTotal = pool.fundsClaimed;
return (tokenTotal, claimedTotal);
}
function getPool(
uint256 poolId
)
public
view
returns (
address,
string memory,
uint8,
uint256,
uint256,
uint256,
uint256,
uint256[] memory,
uint256[] memory,
uint256,
uint256,
PoolState
)
{
Pool storage pool = pools[poolId];
return (
address(pool.tokenFund),
pool.name,
pool.vestingType,
pool.tge,
pool.cliff,
pool.unlockPercent,
pool.linearVestingDuration,
pool.milestoneTimes,
pool.milestonePercents,
pool.fundsTotal,
pool.fundsClaimed,
pool.state
);
}
function _validateAddFund(
uint256 poolId,
uint256 fundAmount,
address user
) private {
require(fundAmount > 0, "Amount must be greater than zero");
}
function _validateRemoveFund(uint256 poolId, address user) private {
require(
pools[poolId].funds[user] > 0,
"Amount must be greater than zero"
);
}
function _validateClaimFund(uint256 poolId) private {
Pool storage pool = pools[poolId];
require(pool.state == PoolState.STARTING, "Invalid action");
require(
pool.funds[_msgSender()] > 0,
"Amount must be greater than zero"
);
require(
pool.funds[_msgSender()] > pool.released[_msgSender()],
"All money has been claimed"
);
}
function _validateSetup(
uint8 vestingType,
uint256 unlockPercent,
uint256 tge,
uint256 cliff,
uint256 linearVestingDuration,
uint256[] memory milestoneTimes,
uint256[] memory milestonePercents
) private {
require(
vestingType >= VESTING_TYPE_MILESTONE_UNLOCK_FIRST &&
vestingType <= VESTING_TYPE_LINEAR_CLIFF_FIRST,
"Invalid action"
);
require(
tge >= block.timestamp &&
unlockPercent > 0 &&
unlockPercent <= ONE_HUNDRED_PERCENT_SCALED &&
cliff >= 0,
"Invalid input parameter"
);
if (
vestingType == VESTING_TYPE_MILESTONE_CLIFF_FIRST ||
vestingType == VESTING_TYPE_MILESTONE_UNLOCK_FIRST
) {
require(
milestoneTimes.length == milestonePercents.length && milestoneTimes.length >= 0
&& linearVestingDuration >= 0, "Invalid vesting parameter");
uint256 total = unlockPercent;
uint256 curTime = 0;
for (uint i = 0; i < milestoneTimes.length; i++) {
total = total + milestonePercents[i];
uint256 tmpTime = milestoneTimes[i];
require(tmpTime >= tge + cliff && tmpTime > curTime, "Invalid input parameter");
curTime = tmpTime;
}
require(
total == ONE_HUNDRED_PERCENT_SCALED,
"Invalid vesting parameter"
);
} else {
require(milestoneTimes.length == 0 && milestonePercents.length == 0
&& (linearVestingDuration > 0 && linearVestingDuration < TEN_YEARS_IN_S),
"Invalid vesting parameter"
);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(account),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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 v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// 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) (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.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.19;
interface IBEP20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
/**
* @dev Returns the token symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the token name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the bep token owner.
*/
function getOwner() external view returns (address);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address _owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"fundAmount","type":"uint256"}],"name":"AddFundEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"fundClaimed","type":"uint256"}],"name":"ClaimFundEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"CreatePoolEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":false,"internalType":"address","name":"user","type":"address"}],"name":"RemoveFundEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256[]","name":"fundAmounts","type":"uint256[]"},{"internalType":"address[]","name":"users","type":"address[]"}],"name":"addFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"claimFund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"_now","type":"uint256"}],"name":"computeClaimPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenFund","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"uint8","name":"_vestingType","type":"uint8"},{"internalType":"uint256","name":"_tge","type":"uint256"},{"internalType":"uint256","name":"_cliff","type":"uint256"},{"internalType":"uint256","name":"_unlockPercent","type":"uint256"},{"internalType":"uint256","name":"_linearVestingDuration","type":"uint256"},{"internalType":"uint256[]","name":"_milestoneTimes","type":"uint256[]"},{"internalType":"uint256[]","name":"_milestonePercents","type":"uint256[]"}],"name":"createPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"end","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getFundByUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"getInfoUserReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"getPool","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"string","name":"","type":"string"},{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"enum Vesting.PoolState","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"poolIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pools","outputs":[{"internalType":"contract IBEP20","name":"tokenFund","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"uint8","name":"vestingType","type":"uint8"},{"internalType":"uint256","name":"tge","type":"uint256"},{"internalType":"uint256","name":"cliff","type":"uint256"},{"internalType":"uint256","name":"unlockPercent","type":"uint256"},{"internalType":"uint256","name":"linearVestingDuration","type":"uint256"},{"internalType":"uint256","name":"fundsTotal","type":"uint256"},{"internalType":"uint256","name":"fundsClaimed","type":"uint256"},{"internalType":"enum Vesting.PoolState","name":"state","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"address[]","name":"users","type":"address[]"}],"name":"removeFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"start","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]Contract Creation Code
6080346200012457601f620021f438819003918201601f1916830192916001600160401b038411838510176200012957808392604095865283396020928391810103126200012457516001600160a01b0381169190829003620001245760018055600091828052828252838320818452825260ff848420541615620000eb575b50818052818152828220338352815260ff838320541615620000b0575b826001600255516120949081620001408239f35b818052818152828220338084529152828220805460ff19166001179055908190600080516020620021d48339815191528180a438806200009c565b8280528282528383208184528252838320805460ff19166001179055339083600080516020620021d48339815191528180a4386200007f565b600080fd5b634e487b7160e01b600052604160045260246000fdfe608080604052600436101561001357600080fd5b60003560e01c90816301ffc9a71461142d57508063068bcd8d1461132f5780630ad24528146112bc578063136439dd14611249578063248a9ca31461121a5780632f2ff15d1461116757806331c7364f14610ee057806336568abe14610e4e5780633679345e14610de2578063376ae06f14610db95780634ce272ee14610d9b5780634f3300ce14610c1257806389335faf146108cb57806391d148541461087e57806392ad11cd1461084657806395805dad1461079d578063a217fddf14610781578063ac4afa38146106b7578063be4c231a146101415763d547741f146100fb57600080fd5b3461013c57604036600319011261013c5761013a60043561011a611509565b90806000526000602052610135600160406000200154611705565b611a3a565b005b600080fd5b3461013c5761012036600319011261013c576004356001600160a01b038116810361013c576024359067ffffffffffffffff821161013c573660238301121561013c57816004013567ffffffffffffffff811161051757604051926101b0601f8301601f19166020018561151f565b818452366024838301011161013c5781600092602460209301838701378401015260443560ff8116810361013c5760e43567ffffffffffffffff811161013c576101fe9036906004016115c7565b6101043567ffffffffffffffff811161013c5761021f9036906004016115c7565b610227611b75565b33600090815260008051602061203f83398151915260205260409020546102509060ff16611b0b565b600160ff84161015806106a9575b61026790611bcb565b4260643510158061069e575b80610690575b80610688575b61028890611fa6565b600260ff841614801561067b575b1561062b57815181511480610623575b8061061b575b6102b890959395611ff2565b60a435926000956000945b8451861015610329576102e4610318916102dd8887611c08565b5190611ad7565b976103126102f28888611c08565b5191610302608435606435611ad7565b831015908161031f575b50611fa6565b95611b4f565b94966102c3565b905082118b61030c565b61033c9297506127109196955014611ff2565b6002549461034986611b4f565b60025585600052600360205260406000209386600186015560018060a01b03166bffffffffffffffffffffffff60a01b85541617845580519067ffffffffffffffff82116105175781906103a06002870154611625565b601f81116105db575b50602090601f83116001146105695760009261055e575b50508160011b916000199060031b1c19161760028401555b6003830160ff80199516858254161790556064356004840155608435600584015560a435600684015560c43560078401556008830182519067ffffffffffffffff8211610517576801000000000000000093848311610517576020908254848455808510610541575b500190600052602060002060005b83811061052d5750505050600983019080519267ffffffffffffffff84116105175783116105175760209082548484558085106104fa575b500190600052602060002060005b8381106104e6577f7f69b4d5cb1512b04536fe4f06aa9291143feacfe4f5557083d640b4282aaf3f60208888600e896000600c8201556000600d82015501908154169055604051908152a160018055005b600190602084519401938184015501610495565b610511908460005285846000209182019101611b5e565b87610487565b634e487b7160e01b600052604160045260246000fd5b60019060208451940193818401550161044f565b610558908460005285846000209182019101611b5e565b89610441565b0151905087806103c0565b9250600286016000526020600020906000935b601f19841685106105c0576001945083601f198116106105a7575b505050811b0160028401556103d8565b015160001960f88460031b161c19169055878080610597565b8181015183556020948501946001909301929091019061057c565b61060b90600288016000526020600020601f850160051c81019160208610610611575b601f0160051c0190611b5e565b886103a9565b90915081906105fe565b5060016102ac565b5060016102a6565b81939293511580610672575b8061064b575b61064690611ff2565b61033c565b5061064660c4358015159081610664575b50905061063d565b63128a18009150108761065c565b50805115610637565b50600160ff841614610296565b50600161027f565b5061271060a4351115610279565b5060a4351515610273565b50600460ff8416111561025e565b3461013c57602036600319011261013c576004356000526003602052604060002060018060a01b0381541660018201549161077d6106f76002830161165f565b60ff60038401541692600481015460058201546006830154600784015491600c8501549361074c60ff600e600d89015498015416976040519c8d9c8d5260208d015260408c61016091829101528c01906114a3565b9860608b015260808a015260a089015260c088015260e08701526101008601526101208501526101408401906114fc565b0390f35b3461013c57600036600319011261013c57602060405160008152f35b3461013c57602036600319011261013c576107b6611b75565b33600090815260008051602061203f83398151915260205260409020546107df9060ff16611b0b565b6004356000526003602052600e604060002001805460ff8116906004821015610830576108188260019315908115610825575b50611bcb565b60ff191617905560018055005b600291501485610812565b634e487b7160e01b600052602160045260246000fd5b3461013c57602036600319011261013c576004356000526003602052604080600020600d600c82015491015482519182526020820152f35b3461013c57604036600319011261013c57610897611509565b600435600052600060205260406000209060018060a01b0316600052602052602060ff604060002054166040519015158152f35b3461013c57606036600319011261013c5767ffffffffffffffff60043560243582811161013c576109009036906004016115c7565b9160443590811161013c57610919903690600401611559565b610921611b75565b33600090815260008051602061203f83398151915260209081526040909120549093906109509060ff16611b0b565b8151815103610bcd57600091825b82518410156109845761097861097e916102dd8686611c08565b93611b4f565b9261095e565b925092806000526003855260406000209360018060a01b039384865416906040516370a0823160e01b81523360048201528881602481865afa8015610b4b578291600091610b9c575b5010610b57576000916064899260405194859384926323b872dd60e01b845233600485015230602485015260448401525af18015610b4b57610b1e575b50600a8501959460005b8251811015610b1857807f4f1bde33bc9f5b8310628ac9b28c78df1d5427706aba8596273f8669db69a9ce87610a4d610acd9487611c08565b5116610a598389611c08565b5190806000528b8b526040600020541515600014610ad257600c8601610a80838254611ad7565b9055806000528b8b52610a9882604060002054611ad7565b816000528c8c526040600020555b604080518981526001600160a01b03929092166020830152810191909152606090a1611b4f565b610a14565b600c8601610ae1838254611ad7565b9055806000528b8b52610af982604060002054611ad7565b816000528c8c52604060002055600b86018b5260006040812055610aa6565b60018055005b610b3d90873d8911610b44575b610b35818361151f565b810190611c1c565b5086610a0a565b503d610b2b565b6040513d6000823e3d90fd5b60405162461bcd60e51b815260048101899052601760248201527f4572726f723a206e6f7420656e6f75676820546f6b656e0000000000000000006044820152606490fd5b8092508a8092503d8311610bc6575b610bb5818361151f565b8101031261013c578190518a6109cd565b503d610bab565b60405162461bcd60e51b815260048101859052601c60248201527f496e70757420617272617973206c656e677468206d69736d61746368000000006044820152606490fd5b3461013c57604036600319011261013c5760043560243567ffffffffffffffff811161013c57610c46903690600401611559565b610c4e611b75565b33600090815260008051602061203f8339815191526020908152604090912054610c7a9060ff16611b0b565b6000838152600382526040812093600a8501915b8451811015610b18576001600160a01b03908482610cac8389611c08565b5116928360005285825260406000209081549182610cd8575b50505050610cd39150611b4f565b610c8e565b91610d3191600080959455600b8c018452846040812055600c8c01610cfe838254611c44565b90558b5460405163a9059cbb60e01b81523360048201526024810193909352919485939190921691839182906044820190565b03925af18015610b4b57610cd3937f95b643abc95498df2a9c463038c8025773e0bd2ca83b559f702ca3f79f710eef92604092610d7e575b5081519086825288820152a184888080610cc5565b610d9490893d8b11610b4457610b35818361151f565b508a610d69565b3461013c57600036600319011261013c576020600254604051908152f35b3461013c57604036600319011261013c576020610dda602435600435611cfc565b604051908152f35b3461013c57604036600319011261013c576040600435610e00611509565b816000526003602052600a83600020019060018060a01b031690816000526020528260002054916000526003602052600b836000200190600052602052816000205482519182526020820152f35b3461013c57604036600319011261013c57610e67611509565b336001600160a01b03821603610e835761013a90600435611a3a565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608490fd5b3461013c5760208060031936011261013c57600435610efd611b75565b8060005260038252604060002060ff600e820154166004811015610830576001610f279114611bcb565b600a8101336000528084526040600020541561112457336000528352600b6040600020549101835260406000205410156110df578060005260038252604060002090600482015442106110ab57612710610fa4610f844284611cfc565b610f8f811515611c51565b33600052600a85018652604060002054611aae565b04610fd7600b84019133600052828652610fc46040600020548211611c51565b3360005282865260406000205490611c44565b835460405163a9059cbb60e01b81523360048201526024810183905295919491908190879060449082906000906001600160a01b03165af1928315610b4b577f37dd5007fdd211b5d56c9cf0160ba433b1bf2a7077482d359cafe3ebf70ee34296600d9461108e575b503360005280825261105786604060002054611ad7565b9133600052526040600020550161106f838254611ad7565b905560408051918252336020830152810191909152606090a160018055005b6110a490833d8511610b4457610b35818361151f565b5087611040565b60405162461bcd60e51b815260048101849052600c60248201526b496e76616c69642054696d6560a01b6044820152606490fd5b60405162461bcd60e51b815260048101839052601a60248201527f416c6c206d6f6e657920686173206265656e20636c61696d65640000000000006044820152606490fd5b6064846040519062461bcd60e51b825280600483015260248201527f416d6f756e74206d7573742062652067726561746572207468616e207a65726f6044820152fd5b3461013c57604036600319011261013c57600435611183611509565b81600052600060205261119d600160406000200154611705565b81600052600060205260406000209060018060a01b0316908160005260205260ff60406000205416156111cc57005b8160005260006020526040600020816000526020526040600020600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a4005b3461013c57602036600319011261013c5760043560005260006020526020600160406000200154604051908152f35b3461013c57602036600319011261013c57611262611b75565b33600090815260008051602061203f833981519152602052604090205461128b9060ff16611b0b565b6004356000526003602052600e604060002001805460ff811690600482101561083057610818600280931415611bcb565b3461013c57602036600319011261013c576112d5611b75565b33600090815260008051602061203f83398151915260205260409020546112fe9060ff16611b0b565b6004356000526003602052600e604060002001805460ff811690600482101561083057610818600160039314611bcb565b3461013c57602036600319011261013c5760043560005260036020526040600020600160a01b60019003815416600382015460ff166004830154600584015493600681015491600782015491600c81015494600d82015493600e83015460ff16956002840161139d9061165f565b996113aa60088601611cad565b946009016113b790611cad565b956040519b8c9b8c528b6101806020819201528c016113d5916114a3565b9460408c015260608b015260808a015260a089015260c088015286810360e0880152611400916114c8565b858103610100870152611412916114c8565b92610120850152610140840152610160830161077d916114fc565b3461013c57602036600319011261013c576004359063ffffffff60e01b821680920361013c57602091637965db0b60e01b811490811561146f575b5015158152f35b6301ffc9a760e01b14905083611468565b60005b8381106114935750506000910152565b8181015183820152602001611483565b906020916114bc81518092818552858086019101611480565b601f01601f1916010190565b90815180825260208080930193019160005b8281106114e8575050505090565b8351855293810193928101926001016114da565b9060048210156108305752565b602435906001600160a01b038216820361013c57565b90601f8019910116810190811067ffffffffffffffff82111761051757604052565b67ffffffffffffffff81116105175760051b60200190565b81601f8201121561013c5780359161157083611541565b9261157e604051948561151f565b808452602092838086019260051b82010192831161013c578301905b8282106115a8575050505090565b81356001600160a01b038116810361013c57815290830190830161159a565b81601f8201121561013c578035916115de83611541565b926115ec604051948561151f565b808452602092838086019260051b82010192831161013c578301905b828210611616575050505090565b81358152908301908301611608565b90600182811c92168015611655575b602083101461163f57565b634e487b7160e01b600052602260045260246000fd5b91607f1691611634565b906040519182600082549261167384611625565b9081845260019485811690816000146116e2575060011461169f575b505061169d9250038361151f565b565b9093915060005260209081600020936000915b8183106116ca57505061169d9350820101388061168f565b855488840185015294850194879450918301916116b2565b91505061169d94506020925060ff191682840152151560051b820101388061168f565b600090808252602090828252604092838120338252835260ff84822054161561172e5750505050565b83519167ffffffffffffffff90336060850183811186821017611a26578752602a85528585019187368437855115611a1257603083538551916001928310156119fe576078602188015360295b8381116119945750611952579087519360808501908582109082111761193e5788526042845286840194606036873784511561192a5760308653845182101561192a5790607860218601536041915b8183116118bc5750505061187a5761187693869361185a9361184b6048946118229a519a8b957f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008c8801525180926037880190611480565b8401917001034b99036b4b9b9b4b733903937b6329607d1b603784015251809386840190611480565b0103602881018752018561151f565b5192839262461bcd60e51b8452600484015260248301906114a3565b0390fd5b60648587519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015611916576f181899199a1a9b1b9c1cb0b131b232b360811b901a6118ec8588611ae4565b5360041c928015611902576000190191906117ca565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b83526032600452602483fd5b634e487b7160e01b81526032600452602490fd5b634e487b7160e01b86526041600452602486fd5b60648789519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b90600f811660108110156119ea576f181899199a1a9b1b9c1cb0b131b232b360811b901a6119c2838a611ae4565b5360041c9080156119d6576000190161177b565b634e487b7160e01b87526011600452602487fd5b634e487b7160e01b88526032600452602488fd5b634e487b7160e01b86526032600452602486fd5b634e487b7160e01b85526032600452602485fd5b634e487b7160e01b85526041600452602485fd5b9060009180835282602052604083209160018060a01b03169182845260205260ff604084205416611a6a57505050565b80835282602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b81810292918115918404141715611ac157565b634e487b7160e01b600052601160045260246000fd5b91908201809211611ac157565b908151811015611af5570160200190565b634e487b7160e01b600052603260045260246000fd5b15611b1257565b60405162461bcd60e51b81526020600482015260156024820152745265737472696374656420746f2061646d696e732160581b6044820152606490fd5b6000198114611ac15760010190565b818110611b69575050565b60008155600101611b5e565b600260015414611b86576002600155565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b15611bd257565b60405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21030b1ba34b7b760911b6044820152606490fd5b8051821015611af55760209160051b010190565b9081602091031261013c5751801515810361013c5790565b90612710918203918211611ac157565b91908203918211611ac157565b15611c5857565b60405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642076616c756560981b6044820152606490fd5b8115611c97570490565b634e487b7160e01b600052601260045260246000fd5b9060405191828154918282526020928383019160005283600020936000905b828210611ce25750505061169d9250038361151f565b855484526001958601958895509381019390910190611ccc565b600090815260036020526040812091611d1760088401611cad565b90611d2460098501611cad565b8394600481015460ff60038301541660028114600014611de157506005820154611d4d91611ad7565b831015611d6f575b505050505b5061271080821015611d6a575090565b905090565b946006611d83929394979596015490611ad7565b92845b8651811015611dd257611d998188611c08565b51611da48285611c08565b5190851015611dbd575b50611db890611b4f565b611d86565b611dcb90611db89296611ad7565b9490611dae565b50945050509038808080611d55565b929060019594929593848114600014611e9a575080831015611e09575b505050505050611d5a565b6005611e2287996006611e2b9596979899015490611ad7565b98015490611ad7565b821015611e3a575b8080611dfe565b84835b611e48575b50611e33565b8451811015611e9557611e5b8186611c08565b51611e668284611c08565b5190841015611e80575b50611e7a90611b4f565b83611e3d565b611e8e90611e7a9298611ad7565b9690611e70565b611e42565b9294509492505060038114600014611f40575082821015611ebe575b505050611d5a565b909193611ed060068301548092611ad7565b928395600584015491611ee38383611ad7565b811015611ef3575b505050611eb6565b611f3496975092611f1f611f19600794611f14611f2595611f2e9998611c44565b611c44565b91611c34565b90611aae565b91015490611c8d565b90611ad7565b90388080808080611eeb565b91929091600414611f5357505050611d5a565b600582015490611f638282611ad7565b841015611f71575b50611eb6565b611f9c949550611f25611f938493611f146007946006611f2e98015498611c44565b611f1f86611c34565b9038808080611f6b565b15611fad57565b60405162461bcd60e51b815260206004820152601760248201527f496e76616c696420696e70757420706172616d657465720000000000000000006044820152606490fd5b15611ff957565b60405162461bcd60e51b815260206004820152601960248201527f496e76616c69642076657374696e6720706172616d65746572000000000000006044820152606490fdfead3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5a2646970667358221220cb0e9bd580211338f0a88ec5becd1880f694c1e3bfbaee53db2a7c7490e72c7e64736f6c634300081300332f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d000000000000000000000000f42a2f22176d04fc01a474c8c85a346948960e02
Deployed Bytecode
0x608080604052600436101561001357600080fd5b60003560e01c90816301ffc9a71461142d57508063068bcd8d1461132f5780630ad24528146112bc578063136439dd14611249578063248a9ca31461121a5780632f2ff15d1461116757806331c7364f14610ee057806336568abe14610e4e5780633679345e14610de2578063376ae06f14610db95780634ce272ee14610d9b5780634f3300ce14610c1257806389335faf146108cb57806391d148541461087e57806392ad11cd1461084657806395805dad1461079d578063a217fddf14610781578063ac4afa38146106b7578063be4c231a146101415763d547741f146100fb57600080fd5b3461013c57604036600319011261013c5761013a60043561011a611509565b90806000526000602052610135600160406000200154611705565b611a3a565b005b600080fd5b3461013c5761012036600319011261013c576004356001600160a01b038116810361013c576024359067ffffffffffffffff821161013c573660238301121561013c57816004013567ffffffffffffffff811161051757604051926101b0601f8301601f19166020018561151f565b818452366024838301011161013c5781600092602460209301838701378401015260443560ff8116810361013c5760e43567ffffffffffffffff811161013c576101fe9036906004016115c7565b6101043567ffffffffffffffff811161013c5761021f9036906004016115c7565b610227611b75565b33600090815260008051602061203f83398151915260205260409020546102509060ff16611b0b565b600160ff84161015806106a9575b61026790611bcb565b4260643510158061069e575b80610690575b80610688575b61028890611fa6565b600260ff841614801561067b575b1561062b57815181511480610623575b8061061b575b6102b890959395611ff2565b60a435926000956000945b8451861015610329576102e4610318916102dd8887611c08565b5190611ad7565b976103126102f28888611c08565b5191610302608435606435611ad7565b831015908161031f575b50611fa6565b95611b4f565b94966102c3565b905082118b61030c565b61033c9297506127109196955014611ff2565b6002549461034986611b4f565b60025585600052600360205260406000209386600186015560018060a01b03166bffffffffffffffffffffffff60a01b85541617845580519067ffffffffffffffff82116105175781906103a06002870154611625565b601f81116105db575b50602090601f83116001146105695760009261055e575b50508160011b916000199060031b1c19161760028401555b6003830160ff80199516858254161790556064356004840155608435600584015560a435600684015560c43560078401556008830182519067ffffffffffffffff8211610517576801000000000000000093848311610517576020908254848455808510610541575b500190600052602060002060005b83811061052d5750505050600983019080519267ffffffffffffffff84116105175783116105175760209082548484558085106104fa575b500190600052602060002060005b8381106104e6577f7f69b4d5cb1512b04536fe4f06aa9291143feacfe4f5557083d640b4282aaf3f60208888600e896000600c8201556000600d82015501908154169055604051908152a160018055005b600190602084519401938184015501610495565b610511908460005285846000209182019101611b5e565b87610487565b634e487b7160e01b600052604160045260246000fd5b60019060208451940193818401550161044f565b610558908460005285846000209182019101611b5e565b89610441565b0151905087806103c0565b9250600286016000526020600020906000935b601f19841685106105c0576001945083601f198116106105a7575b505050811b0160028401556103d8565b015160001960f88460031b161c19169055878080610597565b8181015183556020948501946001909301929091019061057c565b61060b90600288016000526020600020601f850160051c81019160208610610611575b601f0160051c0190611b5e565b886103a9565b90915081906105fe565b5060016102ac565b5060016102a6565b81939293511580610672575b8061064b575b61064690611ff2565b61033c565b5061064660c4358015159081610664575b50905061063d565b63128a18009150108761065c565b50805115610637565b50600160ff841614610296565b50600161027f565b5061271060a4351115610279565b5060a4351515610273565b50600460ff8416111561025e565b3461013c57602036600319011261013c576004356000526003602052604060002060018060a01b0381541660018201549161077d6106f76002830161165f565b60ff60038401541692600481015460058201546006830154600784015491600c8501549361074c60ff600e600d89015498015416976040519c8d9c8d5260208d015260408c61016091829101528c01906114a3565b9860608b015260808a015260a089015260c088015260e08701526101008601526101208501526101408401906114fc565b0390f35b3461013c57600036600319011261013c57602060405160008152f35b3461013c57602036600319011261013c576107b6611b75565b33600090815260008051602061203f83398151915260205260409020546107df9060ff16611b0b565b6004356000526003602052600e604060002001805460ff8116906004821015610830576108188260019315908115610825575b50611bcb565b60ff191617905560018055005b600291501485610812565b634e487b7160e01b600052602160045260246000fd5b3461013c57602036600319011261013c576004356000526003602052604080600020600d600c82015491015482519182526020820152f35b3461013c57604036600319011261013c57610897611509565b600435600052600060205260406000209060018060a01b0316600052602052602060ff604060002054166040519015158152f35b3461013c57606036600319011261013c5767ffffffffffffffff60043560243582811161013c576109009036906004016115c7565b9160443590811161013c57610919903690600401611559565b610921611b75565b33600090815260008051602061203f83398151915260209081526040909120549093906109509060ff16611b0b565b8151815103610bcd57600091825b82518410156109845761097861097e916102dd8686611c08565b93611b4f565b9261095e565b925092806000526003855260406000209360018060a01b039384865416906040516370a0823160e01b81523360048201528881602481865afa8015610b4b578291600091610b9c575b5010610b57576000916064899260405194859384926323b872dd60e01b845233600485015230602485015260448401525af18015610b4b57610b1e575b50600a8501959460005b8251811015610b1857807f4f1bde33bc9f5b8310628ac9b28c78df1d5427706aba8596273f8669db69a9ce87610a4d610acd9487611c08565b5116610a598389611c08565b5190806000528b8b526040600020541515600014610ad257600c8601610a80838254611ad7565b9055806000528b8b52610a9882604060002054611ad7565b816000528c8c526040600020555b604080518981526001600160a01b03929092166020830152810191909152606090a1611b4f565b610a14565b600c8601610ae1838254611ad7565b9055806000528b8b52610af982604060002054611ad7565b816000528c8c52604060002055600b86018b5260006040812055610aa6565b60018055005b610b3d90873d8911610b44575b610b35818361151f565b810190611c1c565b5086610a0a565b503d610b2b565b6040513d6000823e3d90fd5b60405162461bcd60e51b815260048101899052601760248201527f4572726f723a206e6f7420656e6f75676820546f6b656e0000000000000000006044820152606490fd5b8092508a8092503d8311610bc6575b610bb5818361151f565b8101031261013c578190518a6109cd565b503d610bab565b60405162461bcd60e51b815260048101859052601c60248201527f496e70757420617272617973206c656e677468206d69736d61746368000000006044820152606490fd5b3461013c57604036600319011261013c5760043560243567ffffffffffffffff811161013c57610c46903690600401611559565b610c4e611b75565b33600090815260008051602061203f8339815191526020908152604090912054610c7a9060ff16611b0b565b6000838152600382526040812093600a8501915b8451811015610b18576001600160a01b03908482610cac8389611c08565b5116928360005285825260406000209081549182610cd8575b50505050610cd39150611b4f565b610c8e565b91610d3191600080959455600b8c018452846040812055600c8c01610cfe838254611c44565b90558b5460405163a9059cbb60e01b81523360048201526024810193909352919485939190921691839182906044820190565b03925af18015610b4b57610cd3937f95b643abc95498df2a9c463038c8025773e0bd2ca83b559f702ca3f79f710eef92604092610d7e575b5081519086825288820152a184888080610cc5565b610d9490893d8b11610b4457610b35818361151f565b508a610d69565b3461013c57600036600319011261013c576020600254604051908152f35b3461013c57604036600319011261013c576020610dda602435600435611cfc565b604051908152f35b3461013c57604036600319011261013c576040600435610e00611509565b816000526003602052600a83600020019060018060a01b031690816000526020528260002054916000526003602052600b836000200190600052602052816000205482519182526020820152f35b3461013c57604036600319011261013c57610e67611509565b336001600160a01b03821603610e835761013a90600435611a3a565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608490fd5b3461013c5760208060031936011261013c57600435610efd611b75565b8060005260038252604060002060ff600e820154166004811015610830576001610f279114611bcb565b600a8101336000528084526040600020541561112457336000528352600b6040600020549101835260406000205410156110df578060005260038252604060002090600482015442106110ab57612710610fa4610f844284611cfc565b610f8f811515611c51565b33600052600a85018652604060002054611aae565b04610fd7600b84019133600052828652610fc46040600020548211611c51565b3360005282865260406000205490611c44565b835460405163a9059cbb60e01b81523360048201526024810183905295919491908190879060449082906000906001600160a01b03165af1928315610b4b577f37dd5007fdd211b5d56c9cf0160ba433b1bf2a7077482d359cafe3ebf70ee34296600d9461108e575b503360005280825261105786604060002054611ad7565b9133600052526040600020550161106f838254611ad7565b905560408051918252336020830152810191909152606090a160018055005b6110a490833d8511610b4457610b35818361151f565b5087611040565b60405162461bcd60e51b815260048101849052600c60248201526b496e76616c69642054696d6560a01b6044820152606490fd5b60405162461bcd60e51b815260048101839052601a60248201527f416c6c206d6f6e657920686173206265656e20636c61696d65640000000000006044820152606490fd5b6064846040519062461bcd60e51b825280600483015260248201527f416d6f756e74206d7573742062652067726561746572207468616e207a65726f6044820152fd5b3461013c57604036600319011261013c57600435611183611509565b81600052600060205261119d600160406000200154611705565b81600052600060205260406000209060018060a01b0316908160005260205260ff60406000205416156111cc57005b8160005260006020526040600020816000526020526040600020600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a4005b3461013c57602036600319011261013c5760043560005260006020526020600160406000200154604051908152f35b3461013c57602036600319011261013c57611262611b75565b33600090815260008051602061203f833981519152602052604090205461128b9060ff16611b0b565b6004356000526003602052600e604060002001805460ff811690600482101561083057610818600280931415611bcb565b3461013c57602036600319011261013c576112d5611b75565b33600090815260008051602061203f83398151915260205260409020546112fe9060ff16611b0b565b6004356000526003602052600e604060002001805460ff811690600482101561083057610818600160039314611bcb565b3461013c57602036600319011261013c5760043560005260036020526040600020600160a01b60019003815416600382015460ff166004830154600584015493600681015491600782015491600c81015494600d82015493600e83015460ff16956002840161139d9061165f565b996113aa60088601611cad565b946009016113b790611cad565b956040519b8c9b8c528b6101806020819201528c016113d5916114a3565b9460408c015260608b015260808a015260a089015260c088015286810360e0880152611400916114c8565b858103610100870152611412916114c8565b92610120850152610140840152610160830161077d916114fc565b3461013c57602036600319011261013c576004359063ffffffff60e01b821680920361013c57602091637965db0b60e01b811490811561146f575b5015158152f35b6301ffc9a760e01b14905083611468565b60005b8381106114935750506000910152565b8181015183820152602001611483565b906020916114bc81518092818552858086019101611480565b601f01601f1916010190565b90815180825260208080930193019160005b8281106114e8575050505090565b8351855293810193928101926001016114da565b9060048210156108305752565b602435906001600160a01b038216820361013c57565b90601f8019910116810190811067ffffffffffffffff82111761051757604052565b67ffffffffffffffff81116105175760051b60200190565b81601f8201121561013c5780359161157083611541565b9261157e604051948561151f565b808452602092838086019260051b82010192831161013c578301905b8282106115a8575050505090565b81356001600160a01b038116810361013c57815290830190830161159a565b81601f8201121561013c578035916115de83611541565b926115ec604051948561151f565b808452602092838086019260051b82010192831161013c578301905b828210611616575050505090565b81358152908301908301611608565b90600182811c92168015611655575b602083101461163f57565b634e487b7160e01b600052602260045260246000fd5b91607f1691611634565b906040519182600082549261167384611625565b9081845260019485811690816000146116e2575060011461169f575b505061169d9250038361151f565b565b9093915060005260209081600020936000915b8183106116ca57505061169d9350820101388061168f565b855488840185015294850194879450918301916116b2565b91505061169d94506020925060ff191682840152151560051b820101388061168f565b600090808252602090828252604092838120338252835260ff84822054161561172e5750505050565b83519167ffffffffffffffff90336060850183811186821017611a26578752602a85528585019187368437855115611a1257603083538551916001928310156119fe576078602188015360295b8381116119945750611952579087519360808501908582109082111761193e5788526042845286840194606036873784511561192a5760308653845182101561192a5790607860218601536041915b8183116118bc5750505061187a5761187693869361185a9361184b6048946118229a519a8b957f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008c8801525180926037880190611480565b8401917001034b99036b4b9b9b4b733903937b6329607d1b603784015251809386840190611480565b0103602881018752018561151f565b5192839262461bcd60e51b8452600484015260248301906114a3565b0390fd5b60648587519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015611916576f181899199a1a9b1b9c1cb0b131b232b360811b901a6118ec8588611ae4565b5360041c928015611902576000190191906117ca565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b83526032600452602483fd5b634e487b7160e01b81526032600452602490fd5b634e487b7160e01b86526041600452602486fd5b60648789519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b90600f811660108110156119ea576f181899199a1a9b1b9c1cb0b131b232b360811b901a6119c2838a611ae4565b5360041c9080156119d6576000190161177b565b634e487b7160e01b87526011600452602487fd5b634e487b7160e01b88526032600452602488fd5b634e487b7160e01b86526032600452602486fd5b634e487b7160e01b85526032600452602485fd5b634e487b7160e01b85526041600452602485fd5b9060009180835282602052604083209160018060a01b03169182845260205260ff604084205416611a6a57505050565b80835282602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b81810292918115918404141715611ac157565b634e487b7160e01b600052601160045260246000fd5b91908201809211611ac157565b908151811015611af5570160200190565b634e487b7160e01b600052603260045260246000fd5b15611b1257565b60405162461bcd60e51b81526020600482015260156024820152745265737472696374656420746f2061646d696e732160581b6044820152606490fd5b6000198114611ac15760010190565b818110611b69575050565b60008155600101611b5e565b600260015414611b86576002600155565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b15611bd257565b60405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21030b1ba34b7b760911b6044820152606490fd5b8051821015611af55760209160051b010190565b9081602091031261013c5751801515810361013c5790565b90612710918203918211611ac157565b91908203918211611ac157565b15611c5857565b60405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642076616c756560981b6044820152606490fd5b8115611c97570490565b634e487b7160e01b600052601260045260246000fd5b9060405191828154918282526020928383019160005283600020936000905b828210611ce25750505061169d9250038361151f565b855484526001958601958895509381019390910190611ccc565b600090815260036020526040812091611d1760088401611cad565b90611d2460098501611cad565b8394600481015460ff60038301541660028114600014611de157506005820154611d4d91611ad7565b831015611d6f575b505050505b5061271080821015611d6a575090565b905090565b946006611d83929394979596015490611ad7565b92845b8651811015611dd257611d998188611c08565b51611da48285611c08565b5190851015611dbd575b50611db890611b4f565b611d86565b611dcb90611db89296611ad7565b9490611dae565b50945050509038808080611d55565b929060019594929593848114600014611e9a575080831015611e09575b505050505050611d5a565b6005611e2287996006611e2b9596979899015490611ad7565b98015490611ad7565b821015611e3a575b8080611dfe565b84835b611e48575b50611e33565b8451811015611e9557611e5b8186611c08565b51611e668284611c08565b5190841015611e80575b50611e7a90611b4f565b83611e3d565b611e8e90611e7a9298611ad7565b9690611e70565b611e42565b9294509492505060038114600014611f40575082821015611ebe575b505050611d5a565b909193611ed060068301548092611ad7565b928395600584015491611ee38383611ad7565b811015611ef3575b505050611eb6565b611f3496975092611f1f611f19600794611f14611f2595611f2e9998611c44565b611c44565b91611c34565b90611aae565b91015490611c8d565b90611ad7565b90388080808080611eeb565b91929091600414611f5357505050611d5a565b600582015490611f638282611ad7565b841015611f71575b50611eb6565b611f9c949550611f25611f938493611f146007946006611f2e98015498611c44565b611f1f86611c34565b9038808080611f6b565b15611fad57565b60405162461bcd60e51b815260206004820152601760248201527f496e76616c696420696e70757420706172616d657465720000000000000000006044820152606490fd5b15611ff957565b60405162461bcd60e51b815260206004820152601960248201527f496e76616c69642076657374696e6720706172616d65746572000000000000006044820152606490fdfead3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5a2646970667358221220cb0e9bd580211338f0a88ec5becd1880f694c1e3bfbaee53db2a7c7490e72c7e64736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000f42a2f22176d04fc01a474c8c85a346948960e02
-----Decoded View---------------
Arg [0] : admin (address): 0xF42a2f22176D04FC01a474C8C85A346948960E02
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000f42a2f22176d04fc01a474c8c85a346948960e02
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.