Contract Overview
My Name Tag:
Not Available, login to update
[ Download CSV Export ]
Latest 1 internal transaction
Parent Txn Hash | Block | From | To | Value | |||
---|---|---|---|---|---|---|---|
0xce9ece07b2135ecea8dafa59707d42e5842b45e79c7ccd4d00406d9e2a9650a8 | 19878499 | 463 days 3 hrs ago | Coffin Finance: Deployer | Contract Creation | 0 FTM |
[ Download CSV Export ]
Contract Name:
CoffinMakerV2
Compiler Version
v0.8.7+commit.e28d00a7
Optimization Enabled:
Yes with 450 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity ^0.8.7; // SPDX-License-Identifier: MIT import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import '@openzeppelin/contracts/security/Pausable.sol'; import "./Coffin.sol"; import "./interfaces/IConsolidatedFund.sol"; // CoffinMakerV2 ( MasterChef ) contract CoffinMakerV2 is Ownable, Pausable, ReentrancyGuard { using SafeERC20 for IERC20; using SafeMath for uint256; struct UserInfo { uint256 amount; // How many LP tokens the user has provided. int256 rewardDebt; // it's int256, not uint256. uint256 nextHarvestUntil; // When can the user harvest again. uint256 depositTimerStart; // deposit starting timer for withdraw lockup uint firstDepositTime; // the last time a user deposited at. uint lastDepositTime; // most recent deposit time. uint lastWithdrawTime; // the last time a user withdrew at. // address referral; // } // Info of each pool. struct PoolInfo { IERC20 lpToken; // Address of LP token contract. uint256 allocPoint; // How many allocation points assigned to this pool. COFFINs to distribute per second. uint256 lastRewardTime; uint256 accRewardPerShare; // Accumulated COFFINs per share,nextHarvestUntil times 1e12. uint256 harvestInterval; // Harvest interval in seconds uint256 withdrawLockupTime; // withdraw lockup time uint startRate; } // validates: pool exists modifier validatePoolByPid(uint pid) { require(pid < poolInfo.length, 'pool does not exist'); _; } // fund address public fund; // profit_sharing_fund fund: Withdrawal tax ( 14% - 0% ) 1 day 1 % decay address public profit_sharing_fund; // The reward TOKEN Coffin public rewardToken; // Dev's address address public dev_fund; // Marketing fund address address public marketing_fund; // address public comaddr; uint256 private constant ACC_REWARD_PRECISION = 1e12; // Max harvest interval: 14 days. uint256 public constant MAXIMUM_HARVEST_INTERVAL = 1 days; // Max lockup interval: 14 days. uint256 public constant MAXIMUM_LOCKUP_INTERVAL = 14 days; mapping(address=>address) public referrals; mapping(address=>uint) public referralsCount; mapping(address=>uint) public referralsLast; // address public fund; // Info of each pool. PoolInfo[] public poolInfo; // Info of each user that stakes LP tokens. mapping(address => bool) public poolExistence; mapping(uint256 => mapping(address => UserInfo)) public userInfo; // Total allocation poitns. Must be the sum of all allocation points in all pools. uint256 public totalAllocPoint = 0; // The block timestamp when reward mining starts. uint256 public startTime; uint256 public endTime; // reward tokens created per second. uint256 public rewardPerSecond; uint256 public constant STARTING_WITHIN = 30 days; constructor() {} function init(address _rewardToken, uint256 _startTime, uint256 _rewardPerSecond, address _fund) external virtual onlyOwner { require (startTime==0, "only one time."); require (_rewardToken != address(0),"reward token address error") ; rewardToken = Coffin(_rewardToken); startTime = block.timestamp; if (_startTime!=0) { require(_startTime > block.timestamp, "CoffinMakerV2: The start time must be in the future. "); require(_startTime - block.timestamp <= STARTING_WITHIN, "CoffinMakerV2: invalid starting time "); startTime = _startTime; } rewardPerSecond = _rewardPerSecond; if (_rewardPerSecond==0) { rewardPerSecond = 1 ether; } fund = _fund; } function poolLength() external view returns (uint256) { return poolInfo.length; } modifier nonDuplicated(address _lpToken) { require(poolExistence[address(_lpToken)] == false, "CoffinMakerV2: duplicated"); uint256 length = poolInfo.length; for (uint256 pid = 0; pid < length; ++pid) { require(address(poolInfo[pid].lpToken) != _lpToken, "CoffinMakerV2: duplicated"); } _; } function setStartTime(uint _startTime) external onlyOwner { require(startTime>block.timestamp, "already started"); require(_startTime>block.timestamp, "start time should be future"); startTime = _startTime; } function addPool( uint256 _allocPoint, address _lpToken, uint256 _harvestInterval, uint256 _withdrawLockupTime, bool withUpdateAllPool ) public onlyOwner nonDuplicated(_lpToken) { require(startTime!=0, 'not initilized yet'); if (withUpdateAllPool) { // basically should update everytime, except for starting. _updateAllPools(); } require(_harvestInterval <= MAXIMUM_HARVEST_INTERVAL, "CoffinMakerV2: invalid harvest interval"); require(_withdrawLockupTime <= MAXIMUM_LOCKUP_INTERVAL, "CoffinMakerV2: invalid lockup interval"); totalAllocPoint += _allocPoint; poolExistence[_lpToken] = true; uint256 _lastRewardTime = block.timestamp > startTime ? block.timestamp : startTime; poolInfo.push( PoolInfo({ lpToken: IERC20(_lpToken), allocPoint: _allocPoint, lastRewardTime: _lastRewardTime, accRewardPerShare: 0, harvestInterval: _harvestInterval, withdrawLockupTime: _withdrawLockupTime, startRate: enWei(14) }) ); } // Update the given pool's reward allocation point. // Can only be called by the owner. function setPool( uint256 _pid, uint256 _allocPoint, uint256 _harvestInterval, uint256 _withdrawLockupTime, uint256 _startRate, bool withUpdate ) public onlyOwner validatePoolByPid(_pid) { // check require(startTime!=0, 'not initilized yet'); require(_harvestInterval <= MAXIMUM_HARVEST_INTERVAL, "CoffinMakerV2: invalid harvest interval"); require(_withdrawLockupTime <= MAXIMUM_LOCKUP_INTERVAL, "CoffinMakerV2: invalid lockup interval"); require(_startRate<=100, "too much"); if (withUpdate) { _updateAllPools(); } // updates all pools totalAllocPoint = totalAllocPoint - poolInfo[_pid].allocPoint + _allocPoint; poolInfo[_pid].allocPoint = _allocPoint; poolInfo[_pid].harvestInterval = _harvestInterval; poolInfo[_pid].withdrawLockupTime = _withdrawLockupTime; poolInfo[_pid].startRate = enWei(_startRate); emit PoolSet(_pid, _allocPoint, _harvestInterval, _withdrawLockupTime, _startRate ); } // View function to see pending reward tokens on frontend. function pendingReward(uint256 _pid, address _user) external view returns (uint256) { // function pendingReward(uint256 _pid, address _user) external view returns (int256) { require(startTime!=0, 'not initilized yet'); if (block.timestamp<startTime) { return uint256(0); } PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accRewardPerShare = pool.accRewardPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (block.timestamp > pool.lastRewardTime && lpSupply != 0) { uint256 delta = block.timestamp - pool.lastRewardTime; uint256 addedReward = (delta.mul(rewardPerSecond).mul(pool.allocPoint)).div(totalAllocPoint); accRewardPerShare += (addedReward.mul(ACC_REWARD_PRECISION)).div(lpSupply); } return uint256(int256((user.amount.mul(accRewardPerShare)).div(ACC_REWARD_PRECISION)) - (user.rewardDebt)); } // View function to see if user can harvest . function canHarvest(uint256 _pid, address _user) public view returns (bool) { if (untilHarvest(_pid,_user)==0) { return true; } return false; } function untilHarvest(uint256 _pid, address _user) public view returns (uint) { require(startTime!=0, 'not initilized yet'); UserInfo storage user = userInfo[_pid][_user]; if (user.nextHarvestUntil>block.timestamp) { return user.nextHarvestUntil - block.timestamp ; } else { return 0; } } function canWithdraw(uint256 _pid, address _user) public view returns (bool) { if (untilWithdraw(_pid, _user)==0) { return true; } return false; } function untilWithdraw(uint256 _pid, address _user) public view returns (uint) { require(startTime!=0, 'not initilized yet'); UserInfo storage user = userInfo[_pid][_user]; PoolInfo storage pool = poolInfo[_pid]; if ((user.depositTimerStart + pool.withdrawLockupTime) > block.timestamp) { return (user.depositTimerStart + pool.withdrawLockupTime) - block.timestamp; } return 0; } function updatePools(uint256[] calldata pids) external { uint256 len = pids.length; for (uint256 i = 0; i < len; ++i) { updatePool(pids[i]); } } // Update reward variables for all pools. Be careful of gas spending! function massUpdatePools() external { _updateAllPools(); } function _updateAllPools() internal { uint256 len = poolInfo.length; for (uint256 i = 0; i < len; i++) { updatePool(i); } } // Update reward variables of the given pool to be up-to-date. function updatePool(uint256 _pid) public returns (PoolInfo memory pool) { require(startTime!=0, 'not initilized yet'); pool = poolInfo[_pid]; if( pool.allocPoint==0) { // require(pool.allocPoint>0 , "cannot update this pool for now"); return pool; } if (block.timestamp <= pool.lastRewardTime) { return pool; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { poolInfo[_pid] = pool; pool.lastRewardTime = block.timestamp; return pool; } int256 delta = int256(block.timestamp - pool.lastRewardTime); uint256 reward = (uint256(delta).mul(rewardPerSecond).mul(pool.allocPoint)) / totalAllocPoint; uint256 dev_reward = 0; uint256 marketing_reward = 0; uint256 farmingReward = 0; // if (dev_fund!=address(0)) { // 12% for dev fund. // ( 100 % - 3% initial ) / 97 * 12 => 12% dev_reward = reward.div(97).mul(12); rewardToken.reward_mint(dev_fund, dev_reward); } if (marketing_fund!=address(0)) { // 8% for marketing fund. airdrop, listing, audit, partner reward, etc. // ( 100 % - 3% initial ) / 97 * 8 => 8% marketing_reward = reward.div(97).mul(8); rewardToken.reward_mint(marketing_fund, marketing_reward); } // farming reward // ( 100 % - 3% initial ) - 12 % - 8 % = 77 % farmingReward = reward.sub(marketing_reward).sub(dev_reward); rewardToken.reward_mint(fund, farmingReward); pool.accRewardPerShare += (farmingReward.mul( ACC_REWARD_PRECISION)) / lpSupply; pool.lastRewardTime = block.timestamp; poolInfo[_pid] = pool; } function poolTokenBalance(uint256 _pid) view public returns(uint256){ PoolInfo storage pool = poolInfo[_pid]; return pool.lpToken.balanceOf(msg.sender); } // Deposit LP tokens to CoffinMaker for reward token allocation. function deposit( uint256 _pid, uint256 _amount, address _to, address referral ) external nonReentrant validatePoolByPid(_pid) whenNotPaused { // check require(startTime!=0, 'not initilized yet'); require(_amount > 0, "deposit should be more than 0"); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_to]; require(pool.allocPoint>0 , "cannot deposit this token for now"); updatePool(_pid); require(pool.lpToken.balanceOf(msg.sender)>= _amount , "you don't have enough balance in your wallet."); // effect if(_to==msg.sender||user.amount==0) { user.nextHarvestUntil = block.timestamp + pool.harvestInterval; user.depositTimerStart = block.timestamp; user.lastDepositTime = block.timestamp; // marks timestamp for first deposit user.firstDepositTime = user.firstDepositTime > 0 ? user.firstDepositTime : block.timestamp; } // check balance before transfer. uint256 bal1 = pool.lpToken.balanceOf(address(this)); pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount); // check balance after transfer. uint256 bal2 = pool.lpToken.balanceOf(address(this)); // check the diff , it's income value. uint256 actual_amount = bal2-bal1; require(actual_amount<=_amount, " income value should be smaller than argument value. " ); user.amount += actual_amount; user.rewardDebt += int256((actual_amount.mul( pool.accRewardPerShare)).div( ACC_REWARD_PRECISION)); if (referral!=address(0) && msg.sender!=referral && referrals[msg.sender]==address(0)) { // For airdrop, nftdrop, etc. // It’s one of reference for random selection referrals[msg.sender] = referral; referralsCount[referral]++; referralsLast[referral] = block.timestamp; } emit EventDeposit(msg.sender, _pid, _amount, _to); } function withdrawLockup(uint256 pid) view public returns(uint256) { PoolInfo storage pool = poolInfo[pid]; UserInfo storage user = userInfo[pid][msg.sender]; return user.depositTimerStart.add(pool.withdrawLockupTime).sub(block.timestamp); } // Withdraw LP tokens from CoffinMaker. function withdraw( uint256 _pid, uint256 _amount, address _to ) public nonReentrant validatePoolByPid(_pid) { require(startTime!=0, 'not initilized yet'); require(_to != address(0), "cannot withdraw to zero address"); //PoolInfo memory pool = updatePool(_pid); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; // check require(user.amount >= _amount, "CoffinMakerV2: withdraw request greater than staked amount"); updatePool(_pid); require(_amount > 0, "CoffinMakerV2: withdraw amount should be more than 0"); require( (user.depositTimerStart + pool.withdrawLockupTime) <= block.timestamp, "CoffinMakerV2: still in withdraw lockup time" ); uint256 bal1 = pool.lpToken.balanceOf(address(this)); // user.rewardDebt -= int256((_amount.mul( pool.accRewardPerShare)) .div( ACC_REWARD_PRECISION)); user.amount -= _amount; user.lastWithdrawTime = block.timestamp; // tax calc. tax decay. 1 day 1 %. uint timeDelta = 0; uint feeAmount = 0; uint withdrawable = 0; if (profit_sharing_fund!=address(0)) { timeDelta = block.timestamp.sub(user.lastDepositTime); (feeAmount, withdrawable) = getWithdrawable(pool.startRate, timeDelta, _amount); } // if (feeAmount>0) { pool.lpToken.transfer(address(profit_sharing_fund), feeAmount); // pool.lpToken.transfer(address(msg.sender), withdrawable); pool.lpToken.transfer(address(_to), withdrawable); } else { // pool.lpToken.transfer(address(msg.sender), _amount); pool.lpToken.transfer(address(_to), _amount); } // check again. just in case. uint256 bal2 = pool.lpToken.balanceOf(address(this)); assert((bal1 - bal2) == _amount); emit EventWithdraw(msg.sender, _pid, _amount, _to); } // returns: decay rate function getFeeRate(uint _startRate, uint timeDelta) public pure returns (uint feeRate) { uint daysPassed = timeDelta < 1 days ? 0 : timeDelta / 1 days; uint rateDecayed = enWei(daysPassed); uint _rate = rateDecayed >= _startRate ? 0 : _startRate - rateDecayed; return _rate; } // manual override to reassign the first & last deposit time for a given (pid, account) // it's only testing purpose. function reviseDepositTime(uint _pid, address _user, uint256 _first, uint256 _last) public onlyOwner { UserInfo storage user = userInfo[_pid][_user]; user.firstDepositTime = _first; user.lastDepositTime = _last; emit DepositTimeRevised(_pid, _user, _first, _last); } // returns: feeAmount and with withdrawableAmount for a given _startRate and amount function getWithdrawable(uint _startRate, uint _timeDelta, uint _amount) public pure returns (uint _feeAmount, uint _withdrawable) { uint feeRate = fromWei(getFeeRate(_startRate, _timeDelta)); uint feeAmount = (_amount * feeRate) / 100; uint withdrawable = _amount - feeAmount; return (feeAmount, withdrawable); } // Withdraw without caring about rewards. EMERGENCY ONLY. // still you need to pay tax if not enough time to deposit. function emergencyWithdraw(uint256 _pid) public nonReentrant validatePoolByPid(_pid) { require(startTime!=0, 'not initilized yet'); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; // effect uint256 amount = user.amount; uint256 lastDepositTime = user.lastDepositTime; user.amount = 0; user.rewardDebt = 0; user.nextHarvestUntil = 0; user.depositTimerStart = 0; user.firstDepositTime = 0; user.lastDepositTime = 0; user.lastWithdrawTime = 0; // tax calc. tax decay. 1 day 1 %. uint timeDelta = 0; uint feeAmount = 0; uint withdrawable = 0; if (profit_sharing_fund!=address(0)) { timeDelta = block.timestamp.sub(lastDepositTime); (feeAmount, withdrawable) = getWithdrawable(pool.startRate, timeDelta, amount); } // if (feeAmount>0) { pool.lpToken.transfer(address(profit_sharing_fund), feeAmount); pool.lpToken.transfer(address(msg.sender), withdrawable); } else { pool.lpToken.transfer(address(msg.sender), amount); } emit EmergencyWithdraw(msg.sender, _pid, amount); } function harvest(uint256 _pid, address _to) public nonReentrant validatePoolByPid(_pid) { require(startTime!=0, 'not initilized yet'); require(_to != address(0), "cannot withdraw to zero address"); PoolInfo memory pool = updatePool(_pid); UserInfo storage user = userInfo[_pid][msg.sender]; require(block.timestamp >= user.nextHarvestUntil, "CoffinMakerV2: need to wait for next harvest time"); int256 accumulatedReward = int256((user.amount.mul(pool.accRewardPerShare)) .div( ACC_REWARD_PRECISION)); uint256 pending = uint256(accumulatedReward - user.rewardDebt); require(pending > 0, "CoffinMakerV2: no pending reward "); // Effects user.rewardDebt = accumulatedReward; user.nextHarvestUntil = block.timestamp + pool.harvestInterval; // Interactions safeRewardTransfer(_to, pending); emit EventHarvest(msg.sender, _pid, pending, _to); } // Safe rewward token transfer function, // just in case if rounding error causes pool to not have enough reward tokens. function safeRewardTransfer(address _to, uint256 _amount) internal { IConsolidatedFund(fund).transferTo(address(rewardToken), _to, _amount); } function setRewardPerSecond(uint256 _rewardPerSecond) external onlyOwner { require(startTime!=0, 'not initilized yet'); _updateAllPools(); rewardPerSecond = _rewardPerSecond; } function setDevFund(address _dev_fund) public { require(msg.sender==owner() || msg.sender == dev_fund, "CoffinMakerV2: only from dev"); dev_fund = _dev_fund; emit EventSetDev( _dev_fund); } function setProfitSharingFund(address _profit_sharing_fund) public { require(msg.sender==owner() || msg.sender == profit_sharing_fund, "CoffinMakerV2: only from profit_sharing_fund"); profit_sharing_fund = _profit_sharing_fund; emit EventSetProfitSharingFund( _profit_sharing_fund); } function setMarketingFund(address _marketing_fund) public { require(msg.sender==owner() || msg.sender == _marketing_fund, "CoffinMakerV2: only from marketing_fund"); marketing_fund = _marketing_fund; emit EventSetMarketingFund( _marketing_fund); } function enWei(uint amount) public pure returns (uint) { return amount * 1e18; } function fromWei(uint amount) public pure returns (uint) { return amount / 1e18; } event EventSetProfitSharingFund(address indexed profit_sharing_fund); event EventSetDev(address indexed dev_fund); event EventSetMarketingFund(address indexed _marketing_fund); event EventHarvest(address indexed user, uint256 indexed pid, uint256 amount, address _to); event EventDeposit(address indexed user, uint256 indexed pid, uint256 amount, address to); event EventWithdraw(address indexed user, uint256 indexed pid, uint256 amount, address to); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); event PoolSet(uint pid, uint allocPoint, uint _harvestInterval, uint _withdrawLockupTime, uint _startRate); event DepositTimeRevised(uint _pid, address account, uint _first, uint _last); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT 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 no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.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() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT 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 make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "./TaxableToken.sol"; contract Coffin is TaxableToken, Initializable { using SafeMath for uint256; uint256 public constant genesis_supply = 3_000_000 ether; // for initial liquidity. // uint256 public constant REWARD_ALLOCATION = 97_000_000 ether; // uint256 public rewardClaimed; function init( address _maker ) external initializer onlyOwner { coffin_pools[_maker] = true; coffin_pools_array.push(_maker); // coffin_pools[msg.sender] = true; // coffin_pools_array.push(msg.sender); _mint(msg.sender, genesis_supply); } function reward_mint(address recipient, uint256 amount) public onlyPools { require(amount > 0, "invalidAmount"); require(recipient != address(0), "!rewardController"); uint256 _remainingRewards = REWARD_ALLOCATION - rewardClaimed; require(amount <= _remainingRewards, "exceedRewards"); rewardClaimed = rewardClaimed + amount; super._mint(recipient, amount); emit Minted(msg.sender, recipient, amount); } // constructor() TaxableToken("TestToken", "testSHARE") {} constructor() TaxableToken("CoffinToken", "COFFIN") {} event MaxTotalSupplyUpdated(uint256 _newCap); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; interface IConsolidatedFund { function balance(address _token) external view returns (uint256); function transferTo( address _token, address _receiver, uint256 _amount ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return _verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(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) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) private pure returns (bytes memory) { if (success) { return returndata; } else { // 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT 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 pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } }
// SPDX-License-Identifier: MIT // coffin finance pragma solidity ^0.8.7; // pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./CoffinOracle.sol"; import "./PoolToken.sol"; import "./libs/Babylonian.sol"; import './interfaces/ITaxableTokenPolicy.sol'; contract TaxableToken is PoolToken { using SafeMath for uint256; address public coffinOracle; // fixed tax rate uint16 public staticTaxRate = 0; // latest tax rate uint16 public latestTaxRate = 0; // Address of the Tax Office address public taxOffice; // Address of the tax collector wallet address public taxCollectorAddress; // Tax Policy address public policy; // bool public using_twap; // Dollar Price threshold below which taxes will get burned uint256 public burnThreshold = 0.98e18; uint256 public taxThreshold = 1e18; // bool public taxActivated = false; bool public autoCalculateTax = false; address public constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; uint16 public maxTaxRate = 2000; // basis tax rate. 0.05% by default. // believe it should be bigger than flashloan fee. // C.R.E.A.M => 0.03% , AAVE => 0.09%. uint16 public basisTaxRate = 5; uint32 public adjustTaxRateA = 2000000; uint32 public adjustTaxRateB = 4; mapping(address => bool) private _isExcluded; address[] private _excluded; // modifier modifier onlyOwnerOrTaxOffice() { require( owner() == msg.sender || taxOffice == msg.sender, "Caller is not the owner or the tax office" ); _; } // constructor constructor(string memory _name, string memory _symbol) PoolToken(_name, _symbol) {} // internal // get current coUSD price function _getCoUSDPrice() public view returns (uint256 _price) { if (using_twap) { (uint256 __price, uint8 __d) = ICoffinOracle(coffinOracle) .getTwapCOUSDUSD(); _price = __price * (10**(18 - __d)); } else { (uint256 __price, uint8 __d) = ICoffinOracle(coffinOracle) .getCOUSDUSD(); _price = __price * (10**(18 - __d)); } } function setTaxPolicy(address _policy) external onlyOwner { require(_policy!=address(0), 'wrong tax policy' ); policy = _policy; } function calcAutoTaxRate(uint256 _cousdPrice) public view returns (uint16) { if (policy==address(0)) { return 0; } return ITaxableTokenPolicy(policy).calcTaxRate( _cousdPrice, taxThreshold, adjustTaxRateA, adjustTaxRateB, basisTaxRate, maxTaxRate ); } function getTaxInfo() private view returns ( uint16 _currentTaxRate, uint16 _staticTaxRate, uint256 _burnThreshold, uint256 _taxThreshold, bool _taxActivated, bool _autoCalculateTax, uint16 _maxTaxRate, uint32 _adjustTaxRateA, bool _burnTax, uint256 _currentCoUSDPrice, uint256 __rawPrice, uint8 __rawDecimal, uint32 _adjustTaxRateB ) { _burnThreshold = burnThreshold; _taxThreshold = taxThreshold; _taxActivated = taxActivated; _autoCalculateTax = autoCalculateTax; _maxTaxRate = maxTaxRate; _adjustTaxRateA = adjustTaxRateA; _staticTaxRate = staticTaxRate; (_currentTaxRate, _burnTax, _currentCoUSDPrice) = _getTaxInfo(); (__rawPrice, __rawDecimal) = ICoffinOracle(coffinOracle).getCOUSDUSD(); _adjustTaxRateB = adjustTaxRateB; } function _getTaxInfo() private view returns ( uint16 currentTaxRate, bool burnTax, uint256 currentCoUSDPrice ) { if (taxActivated) { (currentCoUSDPrice) = _getCoUSDPrice(); if (currentCoUSDPrice > 0 && currentCoUSDPrice < taxThreshold) { if (currentCoUSDPrice < burnThreshold) { burnTax = true; } if (autoCalculateTax) { currentTaxRate = calcAutoTaxRate(currentCoUSDPrice); } else { currentTaxRate = staticTaxRate; } } } } function _transfer( address sender, address recipient, uint256 amount ) internal override { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); (uint16 currentTaxRate, bool burnTax, ) = _getTaxInfo(); latestTaxRate = currentTaxRate; if ( currentTaxRate == 0 || coffin_pools[sender] || coffin_pools[recipient] || _isExcluded[sender] || _isExcluded[recipient] ) { super._transfer(sender, recipient, amount); } else { _transferWithTax( sender, recipient, amount, currentTaxRate, burnTax ); } } function _transferWithTax( address sender, address recipient, uint256 amount, uint16 _taxRate, bool burnTax ) internal returns (bool) { if (_taxRate>maxTaxRate) { _taxRate = maxTaxRate; } uint256 taxAmount = amount.mul(_taxRate).div(10000); uint256 amountAfterTax = amount.sub(taxAmount); require(taxAmount < amount, "the tax amount should be less than the transferred amount."); if (burnTax) { // Burn tax if (taxAmount>0) { super._burn(sender, taxAmount); } } else { // Transfer tax to tax collector if (taxAmount>0) { super._transfer(sender, taxCollectorAddress, taxAmount); } } // Transfer amount after tax to recipient if (amountAfterTax>0) { super._transfer(sender, recipient, amountAfterTax); } return true; } /********** onlyOwnerOrTaxOffice ************/ // set coffinOracle function setCoffinOracle(address _coffinOracle) public onlyOwnerOrTaxOffice { require( _coffinOracle != address(0), "oracle address cannot be 0 address" ); coffinOracle = _coffinOracle; } function enableAutoCalculateTax() public onlyOwnerOrTaxOffice { autoCalculateTax = true; } function disableAutoCalculateTax() public onlyOwnerOrTaxOffice { autoCalculateTax = false; } function enableTwap() public onlyOwnerOrTaxOffice { using_twap = true; } function disablTwap() public onlyOwnerOrTaxOffice { using_twap = false; } function enableTax() public onlyOwnerOrTaxOffice { taxActivated = true; } function disableTax() public onlyOwnerOrTaxOffice { taxActivated = false; } function setTaxOffice(address _taxOffice) public onlyOwnerOrTaxOffice { require( _taxOffice != address(0), "tax office address cannot be 0 address" ); emit TaxOfficeTransferred(taxOffice, _taxOffice); taxOffice = _taxOffice; } function setTaxCollectorAddress(address _taxCollectorAddress) public onlyOwnerOrTaxOffice { require( _taxCollectorAddress != address(0), "tax collector address must be non-zero address" ); taxCollectorAddress = _taxCollectorAddress; } function excludeAddressFromTax(address account) external onlyOwnerOrTaxOffice returns (bool) { require(!_isExcluded[account], "Account is already excluded"); _isExcluded[account] = true; return true; } function includeAddressInTax(address account) external onlyOwnerOrTaxOffice returns (bool) { require(_isExcluded[account], "Account is already included"); _isExcluded[account] = false; return true; } function isExcluded(address account) public view returns (bool) { return _isExcluded[account]; } function setTaxThreshold(uint256 _taxThreshold) public onlyOwnerOrTaxOffice returns (bool) { taxThreshold = _taxThreshold; return true; } function setBurnThreshold(uint256 _burnThreshold) public onlyOwnerOrTaxOffice returns (bool) { burnThreshold = _burnThreshold; return true; } function setStaticTaxRate(uint16 _staticTaxRate) public onlyOwnerOrTaxOffice { require(staticTaxRate < 2500, "Tax rates are too high. "); staticTaxRate = _staticTaxRate; } function setBasisTaxRate(uint16 _basisTaxRate) public onlyOwnerOrTaxOffice { require(basisTaxRate < 300, "basis tax rates should be only few. "); basisTaxRate = _basisTaxRate; } function setMaxTaxRate(uint16 _maxTaxRate) public onlyOwnerOrTaxOffice { require(_maxTaxRate < 5000, "Tax rates are too high."); maxTaxRate = _maxTaxRate; } function setAdjustTaxRateA(uint32 _adjustTaxRate) public onlyOwnerOrTaxOffice { // for adjustmentA adjustTaxRateA = _adjustTaxRate; } function setAdjustTaxRateB(uint32 _adjustTaxRate) public onlyOwnerOrTaxOffice { // for adjustmentB adjustTaxRateB = _adjustTaxRate; } event TaxOfficeTransferred(address oldAddress, address newAddress); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { uint256 currentAllowance = allowance(account, _msgSender()); require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance"); unchecked { _approve(account, _msgSender(), currentAllowance - amount); } _burn(account, amount); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./interfaces/IUniswapV2Router02.sol"; import "./interfaces/IUniswapV2Factory.sol"; import "./interfaces/IUniswapLP.sol"; import "./libs/FixedPoint.sol"; import "./interfaces/IBandStdReference.sol"; interface ICoffinOracle { function PERIOD() external view returns (uint32); function getCOFFINUSD() external view returns (uint256, uint8); function updateTwap(address token0, address token1) external ; function getCOUSDUSD() external view returns (uint256, uint8); function getTwapCOUSDUSD() external view returns (uint256, uint8); function getTwapCOFFINUSD() external view returns (uint256, uint8); function getTwapXCOFFINUSD() external view returns (uint256, uint8); function updateTwapDollar() external ; function updateTwapCoffin() external ; function updateTwapXCoffin() external ; function getXCOFFINUSD() external view returns (uint256, uint8); function getCOUSDFTM() external view returns (uint256, uint8); function getXCOFFINFTM() external view returns (uint256, uint8); function getCOFFINFTM() external view returns (uint256, uint8); function getFTMUSD() external view returns (uint256, uint8); } contract MockCoffinOracle is ICoffinOracle, Ownable { uint256 public xcoffinftm = (1 / 2) * 1 * 10**18; uint256 public coffinftm = 2 * 1 * 10**18; uint256 public ftmusd = (1 / 4) * 1 * 10**18; uint256 public cousdftm = (101 / 100) * 4 * 1 * 10**18; uint32 public override PERIOD = 600; // 10-minute TWAP function updateTwap(address token0, address token1) external override { } function updateTwapDollar() external override{ } function updateTwapCoffin() external override{ } function updateTwapXCoffin() external override{ } function setCOUSDFTM(uint256 val) external { cousdftm = val; } function getCOUSDFTM() public view override returns (uint256, uint8) { return (cousdftm, 18); } function setXCOFFINFTM(uint256 val) external { xcoffinftm = val; } function getXCOFFINFTM() public view override returns (uint256, uint8) { return (xcoffinftm, 18); } function setCOFFINFTM(uint256 val) external { coffinftm = val; } function getCOFFINFTM() public view override returns (uint256, uint8) { return (coffinftm, 18); } uint256 public cousdusd = 1030000000000000000; function setCOUSDUSD(uint256 val) external { cousdusd = val;// decimal 18 } function getCOUSDUSD() public view override returns(uint256,uint8){ return (cousdusd,18);// decimal 18 } function setFTMUSD(uint256 val) external { ftmusd = val; } function getFTMUSD() public view override returns (uint256, uint8) { return (ftmusd, 18); } function getCOFFINUSD() public view override returns (uint256, uint8) { (uint256 v1, uint8 d1) = getCOFFINFTM(); (uint256 v2, uint8 d2) = getFTMUSD(); return ((v1 * v2) / (10**d1), d2); } function getXCOFFINUSD() public view override returns (uint256, uint8) { (uint256 v1, uint8 d1) = getXCOFFINFTM(); (uint256 v2, uint8 d2) = getFTMUSD(); return ((v1 * v2) / (10**d1), d2); } function getTwapCOUSDUSD() external view override returns (uint256, uint8){ return getCOUSDUSD(); } function getTwapCOFFINUSD() external view override returns (uint256, uint8){ return getCOFFINUSD(); } function getTwapXCOFFINUSD() external view override returns (uint256, uint8){ return getXCOFFINUSD(); } } contract CoffinOracle is ICoffinOracle, Initializable,Ownable { using SafeMath for uint256; using FixedPoint for *; IUniswapV2Router02 public uniswapv2router; address public coffin; address public dollar; address public xcoffin; address public wftm = 0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83; address public usdc = 0x04068DA6C83AFCFA0e13ba15A6696662335D5B75; address public boo = 0x841FAD6EAe12c286d1Fd18d1d525DFfA75C7EFFE; address public dai = 0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E; IBandStdReference bandRef; uint32 public override PERIOD = 600; // 10-minute TWAP struct Pair { uint256 price0CumulativeLast; uint256 price1CumulativeLast; uint32 blockTimestampLast; FixedPoint.uq112x112 price0Average; FixedPoint.uq112x112 price1Average; bool initialized; } mapping(address => Pair) public getPair; function setPeriod(uint32 _period) external onlyOwner { PERIOD = _period; } function init( address _coffinAddress, address _cousdAddress, address _xcoffinAddress ) external initializer onlyOwner{ // router address. it's spooky router by default. address routerAddress = 0xF491e7B69E4244ad4002BC14e878a34207E38c29; setRouter(routerAddress); address fantomBandProtocol = 0x56E2898E0ceFF0D1222827759B56B28Ad812f92F; setBandOracle(fantomBandProtocol); setCOFFINAddress(_coffinAddress); setDollarAddress(_cousdAddress); setXCOFFINAddress(_xcoffinAddress); } function getBandRate(string memory token0, string memory token1) public view returns (uint256) { IBandStdReference.ReferenceData memory data = bandRef.getReferenceData( token0, token1 ); return data.rate; } function getFTMUSD() public view override returns (uint256, uint8) { return (getBandRate("FTM","USD"), 18); } function setCOFFINAddress(address _coffinAddress) public onlyOwner { coffin = _coffinAddress; } function setXCOFFINAddress(address _xcoffinAddress) public onlyOwner { xcoffin = _xcoffinAddress; } function setDollarAddress(address _cousdAddress) public onlyOwner { dollar = _cousdAddress; } function setRouter(address _uniswapv2routeraddress) public onlyOwner { uniswapv2router = IUniswapV2Router02(_uniswapv2routeraddress); } function setBandOracle(address _bandOracleAddress) public onlyOwner { bandRef = IBandStdReference(_bandOracleAddress); } function getCOFFINUSD() external view override returns (uint256, uint8) { (uint256 v1, uint8 d1) = getCOFFINFTM(); (uint256 v2, uint8 d2) = getFTMUSD(); return ((v1 * v2) / (10**d1), d2); } function getTwapCOFFINUSD() external view override returns (uint256, uint8) { (uint256 v1, uint8 d1) = getTwapCOFFINFTM(); (uint256 v2, uint8 d2) = getFTMUSD(); return ((v1 * v2) / (10**d1), d2); } function getUSDCUSD() public view returns (uint256, uint8) { return (getBandRate("USDC","USD"), 18); } function getDAIUSD() public view returns (uint256, uint8) { return (getBandRate("DAI","USD"), 18); } uint8 public oracleMode = 0; function enableFTMOracle() external onlyOwner { oracleMode = 1; } function enableDAIOracle() external onlyOwner { oracleMode = 2 ; } function enableUSDCracle() external onlyOwner { oracleMode = 0 ; } function getCOUSDUSD() external view override returns (uint256, uint8) { if (oracleMode==1) { (uint256 v1, uint8 d1) = getCOUSDFTM(); (uint256 v2, uint8 d2) = getFTMUSD(); return ((v1 * v2) / (10**d1), d2); } else if (oracleMode==2) { (uint256 v1, uint8 d1) = getCOUSDDAI(); (uint256 v2, uint8 d2) = getDAIUSD(); return ((v1 * v2) / (10**d1), d2); } else { (uint256 v1, uint8 d1) = getCOUSDUSDC(); (uint256 v2, uint8 d2) = getUSDCUSD(); return ((v1 * v2) / (10**d1), d2); } } function getTwapCOUSDUSD() external view override returns (uint256, uint8) { if (oracleMode==1) { (uint256 v1, uint8 d1) = getTwapCOUSDFTM(); (uint256 v2, uint8 d2) = getFTMUSD(); return ((v1 * v2) / (10**d1), d2); } else if (oracleMode==2) { (uint256 v1, uint8 d1) = getTwapCOUSDDAI(); (uint256 v2, uint8 d2) = getDAIUSD(); return ((v1 * v2) / (10**d1), d2); } else { (uint256 v1, uint8 d1) = getTwapCOUSDUSDC(); (uint256 v2, uint8 d2) = getUSDCUSD(); return ((v1 * v2) / (10**d1), d2); } } function getXCOFFINUSD() external view override returns (uint256, uint8) { (uint256 v1, uint8 d1) = getXCOFFINFTM(); (uint256 v2, uint8 d2) = getFTMUSD(); return ((v1 * v2) / (10**d1), d2); } function getTwapXCOFFINUSD() external view override returns (uint256, uint8) { (uint256 v1, uint8 d1) = getTwapXCOFFINFTM(); (uint256 v2, uint8 d2) = getFTMUSD(); return ((v1 * v2) / (10**d1), d2); } function getTwapCOUSDFTM() public view returns (uint256, uint8) { (uint256 a, uint8 b) = getTwapRate(dollar,wftm); if (a>0) { return (a,b); } return getRealtimeRate(dollar,wftm); } function getTwapCOUSDDAI() public view returns (uint256, uint8) { (uint256 a, uint8 b) = getTwapRate(dollar,dai); if (a>0) { return (a,b); } return getRealtimeRate(dollar,usdc); } function getTwapCOUSDUSDC() public view returns (uint256, uint8) { (uint256 a, uint8 b) = getTwapRate(dollar,usdc); if (a>0) { return (a,b); } return getRealtimeRate(dollar,usdc); } function getCOUSDFTM() public view override returns (uint256, uint8) { return getRealtimeRate(dollar,wftm); } function getCOUSDUSDC() public view returns (uint256, uint8) { return getRealtimeRate(dollar,usdc); } function getCOUSDDAI() public view returns (uint256, uint8) { return getRealtimeRate(dollar,dai); } function getTwapXCOFFINFTM() public view returns (uint256, uint8) { (uint256 a, uint8 b) = getTwapRate(xcoffin,wftm); if (a>0) { return (a,b); } return getRealtimeRate(xcoffin,wftm); } function getXCOFFINFTM() public view override returns (uint256, uint8) { return getRealtimeRate(xcoffin,wftm); } function getTwapCOFFINFTM() public view returns (uint256, uint8) { (uint256 a, uint8 b) = getTwapRate(coffin,wftm); if (a>0) { return (a,b); } return getRealtimeRate(coffin,wftm); } function getCOFFINFTM() public view override returns (uint256, uint8) { return getRealtimeRate(coffin,wftm); } function currentBlockTimestamp() internal view returns (uint32) { return uint32(block.timestamp % 2**32); } function currentCumulativePrices(address uniswapV2Pair) internal view returns ( uint256 price0Cumulative, uint256 price1Cumulative, uint32 blockTimestamp ) { // Pair storage pairStorage = getPair[uniswapV2Pair]; blockTimestamp = currentBlockTimestamp(); IUniswapLP uniswapPair = IUniswapLP(uniswapV2Pair); price0Cumulative = uniswapPair.price0CumulativeLast(); price1Cumulative = uniswapPair.price1CumulativeLast(); // if time has elapsed since the last update on the pair, mock the accumulated price values (uint112 reserve0, uint112 reserve1, uint32 _blockTimestampLast) = uniswapPair.getReserves(); if (_blockTimestampLast != blockTimestamp) { // subtraction overflow is desired uint32 timeElapsed = blockTimestamp - _blockTimestampLast; // addition overflow is desired // counterfactual price0Cumulative += uint256(FixedPoint.fraction(reserve1, reserve0)._x) * timeElapsed; // counterfactual price1Cumulative += uint256(FixedPoint.fraction(reserve0, reserve1)._x) * timeElapsed; } } function getTwapRate(address token0, address token1) public view returns (uint256 priceLatest, uint8 decimals) { address[] memory path = new address[](2); path[0] = token0; path[1] = token1; address factory = address(uniswapv2router.factory()); address uniswapV2Pair = IUniswapV2Factory(factory).getPair(token0, token1); if (uniswapV2Pair== address(0)) { return (0,0); } // Pair memory pair = getPair[uniswapV2Pair]; Pair storage pairStorage = getPair[uniswapV2Pair]; // require(pairStorage.initialized, "need to setup first"); if (!pairStorage.initialized) { return getRealtimeRate(token0, token1); // return (0,0); } (uint256 price0Cumulative, uint256 price1Cumulative, uint32 blockTimestamp) = currentCumulativePrices( address(uniswapV2Pair) ); uint32 timeElapsed = blockTimestamp - pairStorage.blockTimestampLast; // Overflow is desired FixedPoint.uq112x112 memory price0Average = FixedPoint.uq112x112(uint224((price0Cumulative - pairStorage.price0CumulativeLast) / timeElapsed)); FixedPoint.uq112x112 memory price1Average = FixedPoint.uq112x112(uint224((price1Cumulative - pairStorage.price1CumulativeLast) / timeElapsed)); uint256 amountIn = 1e18; if (IUniswapLP(uniswapV2Pair).token0() == token0) { priceLatest = uint256(price0Average.mul(amountIn).decode144()); decimals = ERC20(token1).decimals(); } else { require(IUniswapLP(uniswapV2Pair).token0() == token1, "TwapOracle: INVALID_TOKEN"); priceLatest = uint256(price1Average.mul(amountIn).decode144()); decimals = ERC20(token0).decimals(); } } function getTwapRateWithUpdate(address token0, address token1) external returns (uint256 priceLatest, uint8 decimals) { updateTwap(token0,token1); return getTwapRate(token0,token1); } function updateTwapDollarFTM() public { updateTwap(dollar, wftm); } function updateTwapDollar() public override { updateTwap(dollar, dai); } function updateTwapDollarUSDC() public { updateTwap(dollar, usdc); } function updateTwapCoffin() public override { updateTwap(coffin, wftm); } function updateTwapXCoffin() public override { updateTwap(xcoffin, wftm); } function updateTwap(address token0, address token1) public override { address[] memory path = new address[](2); path[0] = token0; path[1] = token1; address factory = address(uniswapv2router.factory()); address uniswapV2Pair = IUniswapV2Factory(factory).getPair(token0, token1); if (uniswapV2Pair== address(0)) { return; } Pair storage pairStorage = getPair[uniswapV2Pair]; // require(pairStorage.initialized, "need to setup first"); (uint256 price0Cumulative, uint256 price1Cumulative, uint32 blockTimestamp) = currentCumulativePrices( address(uniswapV2Pair) ); if (!pairStorage.initialized) { // first time pairStorage.price0CumulativeLast = price0Cumulative; pairStorage.price1CumulativeLast = price1Cumulative; pairStorage.blockTimestampLast = blockTimestamp; pairStorage.initialized = true; return; } // Overflow is desired uint32 timeElapsed = blockTimestamp - pairStorage.blockTimestampLast; // Ensure that at least one full period has passed since the last update if (timeElapsed < PERIOD) { return ; } pairStorage.price0Average = FixedPoint.uq112x112(uint224((price0Cumulative - pairStorage.price0CumulativeLast) / timeElapsed)); pairStorage.price1Average = FixedPoint.uq112x112(uint224((price1Cumulative - pairStorage.price1CumulativeLast) / timeElapsed)); pairStorage.price0CumulativeLast = price0Cumulative; pairStorage.price1CumulativeLast = price1Cumulative; pairStorage.blockTimestampLast = blockTimestamp; } function getRealtimeRate(address tokenA, address tokenB) public view returns (uint256 priceLatest, uint8 decimals) { address factory = address(uniswapv2router.factory()); address pair = IUniswapV2Factory(factory).getPair(tokenA, tokenB); if (pair== address(0)) { return (0,0); } (uint112 reserve0, uint112 reserve1,) = IUniswapLP(pair).getReserves(); if (IUniswapLP(pair).token0()==address(tokenA)) { priceLatest = uint256(reserve1).mul(uint256(10**ERC20(tokenA).decimals())).div(uint256(reserve0)); decimals = ERC20(tokenB).decimals(); } else { priceLatest = uint256(reserve0).mul(uint256(10**ERC20(tokenA).decimals())).div(uint256(reserve1)); decimals = ERC20(tokenB).decimals(); } if ((18-decimals)>0) { priceLatest = priceLatest.mul(10**(18-decimals)); decimals = 18; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; contract PoolToken is ERC20Burnable , Ownable{ using SafeMath for uint256; // The addresses in this array are added by the oracle and these contracts are able to mint coffin address[] public coffin_pools_array; // Mapping is also used for faster verification mapping(address => bool) public coffin_pools; /* ========== MODIFIERS ========== */ modifier onlyPools() { require(coffin_pools[msg.sender] == true, "Only coffin pools can call this function"); _; } modifier onlyByOwnerOrPool() { require( msg.sender == owner() || coffin_pools[msg.sender] == true, "You are not the owner, or a pool"); _; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /* ========== constructor ========== */ constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) {} /* ========== view ========== */ function poolLength() view public returns(uint256) { return coffin_pools_array.length; } /* ========== onlyPools ========== */ // Used by pools when user redeems function pool_burn_from(address addr, uint256 amount) public onlyPools { super.burnFrom(addr, amount); emit Burned(addr, msg.sender, amount); } // This function is what other pools will call to mint new token function pool_mint(address addr, uint256 amount) public onlyPools { super._mint(addr, amount); emit Minted(msg.sender, addr, amount); } /* ========== onlyOwner ========== */ // function burnFrom(address addr, uint256 amount) public override onlyOwner { super.burnFrom(addr, amount); emit Minted(msg.sender, addr, amount); } // pools which can mint/burn function addPool(address pool_address) public onlyOwner { require(pool_address != address(0), "Zero address detected"); require(coffin_pools[pool_address] == false, "Address already exists"); coffin_pools[pool_address] = true; coffin_pools_array.push(pool_address); emit PoolAdded(pool_address); } // Remove a pool function removePool(address pool_address) public onlyOwner { require(pool_address != address(0), "Zero address detected"); require(coffin_pools[pool_address] == true, "Address nonexistant"); // Delete from the mapping delete coffin_pools[pool_address]; // 'Delete' from the array by setting the address to 0x0 for (uint i = 0; i < coffin_pools_array.length; i++){ if (coffin_pools_array[i] == pool_address) { coffin_pools_array[i] = address(0); // This will leave a null in the array and keep the indices the same break; } } emit PoolRemoved(pool_address); } /* ========== EVENTS ========== */ event Burned(address indexed from, address indexed by, uint256 amount); event Minted(address indexed from, address indexed to, uint256 amount); event PoolAdded(address pool_address); event PoolRemoved(address pool_address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; // computes square roots using the babylonian method // https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method library Babylonian { function sqrt(uint256 y) internal pure returns (uint256 z) { if (y > 3) { z = y; uint256 x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } // else z = 0 } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; interface ITaxableTokenPolicy { function calcTaxRate( uint256 dollarPrice, uint256 taxThreshold, uint256 paramA, uint256 paramB, uint256 basisTaxRate, uint256 maxTaxRate ) external pure returns (uint16) ; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.11; import "./IUniswapV2Router01.sol"; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; interface IUniswapV2Factory { function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; pragma experimental ABIEncoderV2; interface IUniswapLP { function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns ( uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast ); function price0CumulativeLast() external view returns (uint256); function price1CumulativeLast() external view returns (uint256); function getTokenWeights() external view returns (uint32 tokenWeight0, uint32 tokenWeight1); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "./Babylonian.sol"; // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) library FixedPoint { // range: [0, 2**112 - 1] // resolution: 1 / 2**112 struct uq112x112 { uint224 _x; } // range: [0, 2**144 - 1] // resolution: 1 / 2**112 struct uq144x112 { uint256 _x; } uint8 private constant RESOLUTION = 112; uint256 private constant Q112 = uint256(1) << RESOLUTION; uint256 private constant Q224 = Q112 << RESOLUTION; // encode a uint112 as a UQ112x112 function encode(uint112 x) internal pure returns (uq112x112 memory) { return uq112x112(uint224(x) << RESOLUTION); } // encodes a uint144 as a UQ144x112 function encode144(uint144 x) internal pure returns (uq144x112 memory) { return uq144x112(uint256(x) << RESOLUTION); } // divide a UQ112x112 by a uint112, returning a UQ112x112 function div(uq112x112 memory self, uint112 x) internal pure returns (uq112x112 memory) { require(x != 0, "FixedPoint: DIV_BY_ZERO"); return uq112x112(self._x / uint224(x)); } // multiply a UQ112x112 by a uint, returning a UQ144x112 // reverts on overflow function mul(uq112x112 memory self, uint256 y) internal pure returns (uq144x112 memory) { uint256 z; require(y == 0 || (z = uint256(self._x) * y) / y == uint256(self._x), "FixedPoint: MULTIPLICATION_OVERFLOW"); return uq144x112(z); } // returns a UQ112x112 which represents the ratio of the numerator to the denominator // equivalent to encode(numerator).div(denominator) function fraction(uint112 numerator, uint112 denominator) internal pure returns (uq112x112 memory) { require(denominator > 0, "FixedPoint: DIV_BY_ZERO"); return uq112x112((uint224(numerator) << RESOLUTION) / denominator); } // decode a UQ112x112 into a uint112 by truncating after the radix point function decode(uq112x112 memory self) internal pure returns (uint112) { return uint112(self._x >> RESOLUTION); } // decode a UQ144x112 into a uint144 by truncating after the radix point function decode144(uq144x112 memory self) internal pure returns (uint144) { return uint144(self._x >> RESOLUTION); } // take the reciprocal of a UQ112x112 function reciprocal(uq112x112 memory self) internal pure returns (uq112x112 memory) { require(self._x != 0, "FixedPoint: ZERO_RECIPROCAL"); return uq112x112(uint224(Q224 / self._x)); } // square root of a UQ112x112 function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) { return uq112x112(uint224(Babylonian.sqrt(uint256(self._x)) << 56)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; interface IBandStdReference { /// A structure returned whenever someone requests for standard reference data. struct ReferenceData { uint256 rate; // base/quote exchange rate, multiplied by 1e18. uint256 lastUpdatedBase; // UNIX epoch of the last time when base price gets updated. uint256 lastUpdatedQuote; // UNIX epoch of the last time when quote price gets updated. } /// Returns the price data for the given base/quote pair. Revert if not available. function getReferenceData(string memory _base, string memory _quote) external view returns (ReferenceData memory); /// Similar to getReferenceData, but with multiple base/quote pairs at once. function getReferenceDataBulk( string[] memory _bases, string[] memory _quotes ) external view returns (ReferenceData[] memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; interface IUniswapV2Router01 { function factory() external view returns (address); function WETH() external view returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); }
{ "optimizer": { "enabled": true, "runs": 450 }, "metadata": { "bytecodeHash": "none", "useLiteralContent": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_pid","type":"uint256"},{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"_first","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_last","type":"uint256"}],"name":"DepositTimeRevised","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"EventDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"_to","type":"address"}],"name":"EventHarvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"dev_fund","type":"address"}],"name":"EventSetDev","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_marketing_fund","type":"address"}],"name":"EventSetMarketingFund","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"profit_sharing_fund","type":"address"}],"name":"EventSetProfitSharingFund","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"EventWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_harvestInterval","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_withdrawLockupTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_startRate","type":"uint256"}],"name":"PoolSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"MAXIMUM_HARVEST_INTERVAL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAXIMUM_LOCKUP_INTERVAL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STARTING_WITHIN","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"address","name":"_lpToken","type":"address"},{"internalType":"uint256","name":"_harvestInterval","type":"uint256"},{"internalType":"uint256","name":"_withdrawLockupTime","type":"uint256"},{"internalType":"bool","name":"withUpdateAllPool","type":"bool"}],"name":"addPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"canHarvest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"canWithdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"address","name":"referral","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dev_fund","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"enWei","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"endTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"fromWei","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"fund","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startRate","type":"uint256"},{"internalType":"uint256","name":"timeDelta","type":"uint256"}],"name":"getFeeRate","outputs":[{"internalType":"uint256","name":"feeRate","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startRate","type":"uint256"},{"internalType":"uint256","name":"_timeDelta","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"getWithdrawable","outputs":[{"internalType":"uint256","name":"_feeAmount","type":"uint256"},{"internalType":"uint256","name":"_withdrawable","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_to","type":"address"}],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_startTime","type":"uint256"},{"internalType":"uint256","name":"_rewardPerSecond","type":"uint256"},{"internalType":"address","name":"_fund","type":"address"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"marketing_fund","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"poolExistence","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardTime","type":"uint256"},{"internalType":"uint256","name":"accRewardPerShare","type":"uint256"},{"internalType":"uint256","name":"harvestInterval","type":"uint256"},{"internalType":"uint256","name":"withdrawLockupTime","type":"uint256"},{"internalType":"uint256","name":"startRate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"poolTokenBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"profit_sharing_fund","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"referrals","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"referralsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"referralsLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_first","type":"uint256"},{"internalType":"uint256","name":"_last","type":"uint256"}],"name":"reviseDepositTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract Coffin","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_dev_fund","type":"address"}],"name":"setDevFund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_marketing_fund","type":"address"}],"name":"setMarketingFund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"uint256","name":"_harvestInterval","type":"uint256"},{"internalType":"uint256","name":"_withdrawLockupTime","type":"uint256"},{"internalType":"uint256","name":"_startRate","type":"uint256"},{"internalType":"bool","name":"withUpdate","type":"bool"}],"name":"setPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_profit_sharing_fund","type":"address"}],"name":"setProfitSharingFund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardPerSecond","type":"uint256"}],"name":"setRewardPerSecond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startTime","type":"uint256"}],"name":"setStartTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"untilHarvest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"untilWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"updatePool","outputs":[{"components":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardTime","type":"uint256"},{"internalType":"uint256","name":"accRewardPerShare","type":"uint256"},{"internalType":"uint256","name":"harvestInterval","type":"uint256"},{"internalType":"uint256","name":"withdrawLockupTime","type":"uint256"},{"internalType":"uint256","name":"startRate","type":"uint256"}],"internalType":"struct CoffinMakerV2.PoolInfo","name":"pool","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"pids","type":"uint256[]"}],"name":"updatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"int256","name":"rewardDebt","type":"int256"},{"internalType":"uint256","name":"nextHarvestUntil","type":"uint256"},{"internalType":"uint256","name":"depositTimerStart","type":"uint256"},{"internalType":"uint256","name":"firstDepositTime","type":"uint256"},{"internalType":"uint256","name":"lastDepositTime","type":"uint256"},{"internalType":"uint256","name":"lastWithdrawTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_to","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"}],"name":"withdrawLockup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040526000600d553480156200001657600080fd5b50620000223362000039565b6000805460ff60a01b191690556001805562000089565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b613d3a80620000996000396000f3fe608060405234801561001057600080fd5b50600436106103365760003560e01c806385300e73116101b2578063b4c96514116100f9578063de73149d116100a2578063f44a2ac01161007c578063f44a2ac0146107f2578063f7c618c114610805578063fbbb0df314610818578063feeb26a81461082257600080fd5b8063de73149d146107c2578063e65d1522146107cc578063f2fde38b146107df57600080fd5b8063c776cb89116100d3578063c776cb8914610779578063cbd258b51461078c578063cf94ee96146107af57600080fd5b8063b4c9651414610740578063b60d428814610753578063c0aa28521461076657600080fd5b80639ca423b31161015b578063a3b7865811610135578063a3b7865814610707578063ab7b82a41461071a578063ae4db9191461072d57600080fd5b80639ca423b3146106b85780639ecc3bac146106e15780639f6c5426146106f457600080fd5b80638f10369a1161018c5780638f10369a1461060a57806393f1a40b1461061357806398969e82146106a557600080fd5b806385300e73146105cf57806386782813146105ef5780638da5cb5b146105f957600080fd5b8063447809941161028157806366da58151161022a57806378e979251161020457806378e97925146105785780637e668b4214610581578063802d6457146105a957806384715b11146105bc57600080fd5b806366da58151461053d5780636b366c6614610550578063715018a61461057057600080fd5b80635c975abb1161025b5780635c975abb146105105780636294d5c714610522578063630b5ba11461053557600080fd5b8063447809941461047857806351eb05a61461048b5780635312ea8e146104fd57600080fd5b80632e6c998d116102e35780633e0a322d116102bd5780633e0a322d1461043f5780633ea01b5d1461045257806343aec3a71461046557600080fd5b80632e6c998d146103e85780633197cbb61461040b5780633905d8711461041457600080fd5b806317caf6f11161031457806317caf6f1146103b957806318fccc76146103c257806324597f13146103d557600080fd5b8063081e3eda1461033b5780630ad58d2f146103525780631526fe2714610367575b600080fd5b600a545b6040519081526020015b60405180910390f35b610365610360366004613a47565b610835565b005b61037a610375366004613938565b610ec5565b604080516001600160a01b0390981688526020880196909652948601939093526060850191909152608084015260a083015260c082015260e001610349565b61033f600d5481565b6103656103d036600461396a565b610f1e565b6103656103e3366004613845565b611208565b6103fb6103f636600461396a565b6112cf565b6040519015158152602001610349565b61033f600f5481565b600654610427906001600160a01b031681565b6040516001600160a01b039091168152602001610349565b61036561044d366004613938565b6112f1565b6103fb61046036600461396a565b6113d0565b6103656104733660046139d1565b6113dc565b6103656104863660046138a6565b611760565b61049e610499366004613938565b6117a4565b6040516103499190600060e0820190506001600160a01b0383511682526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015292915050565b61036561050b366004613938565b611c9d565b600054600160a01b900460ff166103fb565b61033f61053036600461396a565b61200e565b6103656120a8565b61036561054b366004613938565b6120b2565b61033f61055e366004613845565b60086020526000908152604090205481565b61036561214b565b61033f600e5481565b61059461058f366004613ab7565b61219d565b60408051928352602083019190915201610349565b6103656105b7366004613ae3565b6121e6565b6103656105ca366004613a7c565b612512565b61033f6105dd366004613845565b60096020526000908152604090205481565b61033f62278d0081565b6000546001600160a01b0316610427565b61033f60105481565b61067061062136600461396a565b600c602052816000526040600020602052806000526040600020600091509150508060000154908060010154908060020154908060030154908060040154908060050154908060060154905087565b604080519788526020880196909652948601939093526060850191909152608084015260a083015260c082015260e001610349565b61033f6106b336600461396a565b612b66565b6104276106c6366004613845565b6007602052600090815260409020546001600160a01b031681565b600354610427906001600160a01b031681565b61033f610702366004613a25565b612d2c565b610365610715366004613845565b612d83565b61033f61072836600461396a565b612e51565b61036561073b366004613845565b612f32565b61033f61074e366004613938565b612feb565b600254610427906001600160a01b031681565b610365610774366004613860565b613093565b600554610427906001600160a01b031681565b6103fb61079a366004613845565b600b6020526000908152604090205460ff1681565b61033f6107bd366004613938565b6132b8565b61033f6201518081565b61033f6107da366004613938565b6132cc565b6103656107ed366004613845565b6132e0565b610365610800366004613996565b613399565b600454610427906001600160a01b031681565b61033f6212750081565b61033f610830366004613938565b613460565b6002600154141561088d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600155600a54839081106108db5760405162461bcd60e51b81526020600482015260136024820152721c1bdbdb08191bd95cc81b9bdd08195e1a5cdd606a1b6044820152606401610884565b600e5461091f5760405162461bcd60e51b81526020600482015260126024820152711b9bdd081a5b9a5d1a5b1a5e9959081e595d60721b6044820152606401610884565b6001600160a01b0382166109755760405162461bcd60e51b815260206004820152601f60248201527f63616e6e6f7420776974686472617720746f207a65726f2061646472657373006044820152606401610884565b6000600a858154811061098a5761098a613ce9565b60009182526020808320888452600c825260408085203386529092529220805460079092029092019250851115610a295760405162461bcd60e51b815260206004820152603a60248201527f436f6666696e4d616b657256323a20776974686472617720726571756573742060448201527f67726561746572207468616e207374616b656420616d6f756e740000000000006064820152608401610884565b610a32866117a4565b5060008511610aa95760405162461bcd60e51b815260206004820152603460248201527f436f6666696e4d616b657256323a20776974686472617720616d6f756e74207360448201527f686f756c64206265206d6f7265207468616e20300000000000000000000000006064820152608401610884565b4282600501548260030154610abe9190613bc7565b1115610b215760405162461bcd60e51b815260206004820152602c60248201527f436f6666696e4d616b657256323a207374696c6c20696e20776974686472617760448201526b206c6f636b75702074696d6560a01b6064820152608401610884565b81546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015610b6457600080fd5b505afa158015610b78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9c9190613951565b9050610bc464e8d4a51000610bbe8560030154896134c290919063ffffffff16565b906134ce565b826001016000828254610bd79190613c20565b9091555050815486908390600090610bf0908490613c5f565b9091555050426006830155600354600090819081906001600160a01b031615610c3a576005850154610c239042906134da565b9250610c348660060154848b61219d565b90925090505b8115610d5357855460035460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810185905291169063a9059cbb90604401602060405180830381600087803b158015610c8f57600080fd5b505af1158015610ca3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc7919061391b565b50855460405163a9059cbb60e01b81526001600160a01b038a81166004830152602482018490529091169063a9059cbb90604401602060405180830381600087803b158015610d1557600080fd5b505af1158015610d29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4d919061391b565b50610dda565b855460405163a9059cbb60e01b81526001600160a01b038a81166004830152602482018c90529091169063a9059cbb90604401602060405180830381600087803b158015610da057600080fd5b505af1158015610db4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd8919061391b565b505b85546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015610e1d57600080fd5b505afa158015610e31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e559190613951565b905089610e628287613c5f565b14610e6f57610e6f613cbd565b604080518b81526001600160a01b038b1660208201528c9133917fc1fc7d369795ea1f99a0f1cc7f3eb4e4e2c256c001f24f3ba48f4ce7f3666ef0910160405180910390a3505060018055505050505050505050565b600a8181548110610ed557600080fd5b600091825260209091206007909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039095169650929491939092919087565b60026001541415610f715760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610884565b6002600155600a5482908110610fbf5760405162461bcd60e51b81526020600482015260136024820152721c1bdbdb08191bd95cc81b9bdd08195e1a5cdd606a1b6044820152606401610884565b600e546110035760405162461bcd60e51b81526020600482015260126024820152711b9bdd081a5b9a5d1a5b1a5e9959081e595d60721b6044820152606401610884565b6001600160a01b0382166110595760405162461bcd60e51b815260206004820152601f60248201527f63616e6e6f7420776974686472617720746f207a65726f2061646472657373006044820152606401610884565b6000611064846117a4565b6000858152600c6020908152604080832033845290915290206002810154919250904210156110fb5760405162461bcd60e51b815260206004820152603160248201527f436f6666696e4d616b657256323a206e65656420746f207761697420666f722060448201527f6e65787420686172766573742074696d650000000000000000000000000000006064820152608401610884565b600061112164e8d4a51000610bbe856060015185600001546134c290919063ffffffff16565b905060008260010154826111359190613c20565b9050600081116111915760405162461bcd60e51b815260206004820152602160248201527f436f6666696e4d616b657256323a206e6f2070656e64696e67207265776172646044820152600160fd1b6064820152608401610884565b6001830182905560808401516111a79042613bc7565b60028401556111b686826134e6565b604080518281526001600160a01b0388166020820152889133917fbf994279e565ba90e83c9185d2c8bdc08f3e325268ace95b049d3c315080f9a1910160405180910390a35050600180555050505050565b6000546001600160a01b03163314806112295750336001600160a01b038216145b6112855760405162461bcd60e51b815260206004820152602760248201527f436f6666696e4d616b657256323a206f6e6c792066726f6d206d61726b6574696044820152661b99d7d99d5b9960ca1b6064820152608401610884565b600680546001600160a01b0319166001600160a01b0383169081179091556040517fb5954fe3513bea0af27ed9f9d8456cfcc21456e7a77b2709748b6316f4685d4890600090a250565b60006112db838361200e565b6112e7575060016112eb565b5060005b92915050565b6000546001600160a01b031633146113395760405162461bcd60e51b81526020600482018190526024820152600080516020613d0e8339815191526044820152606401610884565b42600e541161137c5760405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e481cdd185c9d1959608a1b6044820152606401610884565b4281116113cb5760405162461bcd60e51b815260206004820152601b60248201527f73746172742074696d652073686f756c642062652066757475726500000000006044820152606401610884565b600e55565b60006112db8383612e51565b6000546001600160a01b031633146114245760405162461bcd60e51b81526020600482018190526024820152600080516020613d0e8339815191526044820152606401610884565b6001600160a01b0384166000908152600b6020526040902054849060ff161561148f5760405162461bcd60e51b815260206004820152601960248201527f436f6666696e4d616b657256323a206475706c696361746564000000000000006044820152606401610884565b600a5460005b8181101561153257826001600160a01b0316600a82815481106114ba576114ba613ce9565b60009182526020909120600790910201546001600160a01b031614156115225760405162461bcd60e51b815260206004820152601960248201527f436f6666696e4d616b657256323a206475706c696361746564000000000000006044820152606401610884565b61152b81613ca2565b9050611495565b50600e546115775760405162461bcd60e51b81526020600482015260126024820152711b9bdd081a5b9a5d1a5b1a5e9959081e595d60721b6044820152606401610884565b82156115855761158561355e565b620151808511156115e85760405162461bcd60e51b815260206004820152602760248201527f436f6666696e4d616b657256323a20696e76616c6964206861727665737420696044820152661b9d195c9d985b60ca1b6064820152608401610884565b6212750084111561164a5760405162461bcd60e51b815260206004820152602660248201527f436f6666696e4d616b657256323a20696e76616c6964206c6f636b757020696e6044820152651d195c9d985b60d21b6064820152608401610884565b86600d600082825461165c9190613bc7565b90915550506001600160a01b0386166000908152600b60205260408120805460ff19166001179055600e54421161169557600e54611697565b425b9050600a6040518060e00160405280896001600160a01b031681526020018a8152602001838152602001600081526020018881526020018781526020016116de600e6132b8565b90528154600180820184556000938452602093849020835160079093020180546001600160a01b0319166001600160a01b03909316929092178255928201519281019290925560408101516002830155606081015160038301556080810151600483015560a0810151600583015560c001516006909101555050505050505050565b8060005b8181101561179e5761178d84848381811061178157611781613ce9565b905060200201356117a4565b5061179781613ca2565b9050611764565b50505050565b6117ed6040518060e0016040528060006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b600e546118315760405162461bcd60e51b81526020600482015260126024820152711b9bdd081a5b9a5d1a5b1a5e9959081e595d60721b6044820152606401610884565b600a828154811061184457611844613ce9565b60009182526020918290206040805160e081018252600790930290910180546001600160a01b0316835260018101549383018490526002810154918301919091526003810154606083015260048101546080830152600581015460a08301526006015460c082015291506118b757919050565b806040015142116118c757919050565b80516040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561190a57600080fd5b505afa15801561191e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119429190613951565b9050806119d75781600a848154811061195d5761195d613ce9565b600091825260209182902083516007929092020180546001600160a01b0319166001600160a01b039092169190911781559082015160018201556040808301516002830155606083015160038301556080830151600483015560a0830151600583015560c090920151600690910155429083015250919050565b60008260400151426119e99190613c5f565b90506000600d54611a138560200151611a0d601054866134c290919063ffffffff16565b906134c2565b611a1d9190613bdf565b600554909150600090819081906001600160a01b031615611ab957611a48600c611a0d8660616134ce565b60048054600554604051635c6b16c160e01b81526001600160a01b0391821693810193909352602483018490529295509190911690635c6b16c190604401600060405180830381600087803b158015611aa057600080fd5b505af1158015611ab4573d6000803e3d6000fd5b505050505b6006546001600160a01b031615611b4b57611ada6008611a0d8660616134ce565b60048054600654604051635c6b16c160e01b81526001600160a01b0391821693810193909352602483018490529294509190911690635c6b16c190604401600060405180830381600087803b158015611b3257600080fd5b505af1158015611b46573d6000803e3d6000fd5b505050505b611b5f83611b5986856134da565b906134da565b60048054600254604051635c6b16c160e01b81526001600160a01b0391821693810193909352602483018490529293509190911690635c6b16c190604401600060405180830381600087803b158015611bb757600080fd5b505af1158015611bcb573d6000803e3d6000fd5b5050505085611be864e8d4a51000836134c290919063ffffffff16565b611bf29190613bdf565b87606001818151611c039190613bc7565b905250426040880152600a80548891908a908110611c2357611c23613ce9565b600091825260209182902083516007929092020180546001600160a01b0319166001600160a01b0390921691909117815590820151600182015560408201516002820155606082015160038201556080820151600482015560a0820151600582015560c09091015160069091015550949695505050505050565b60026001541415611cf05760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610884565b6002600155600a5481908110611d3e5760405162461bcd60e51b81526020600482015260136024820152721c1bdbdb08191bd95cc81b9bdd08195e1a5cdd606a1b6044820152606401610884565b600e54611d825760405162461bcd60e51b81526020600482015260126024820152711b9bdd081a5b9a5d1a5b1a5e9959081e595d60721b6044820152606401610884565b6000600a8381548110611d9757611d97613ce9565b60009182526020808320868452600c8252604080852033865290925290832080546005820180548684556001840187905560028401879055600380850188905560048501889055918790556006840187905590546007909502909301955090939092819081906001600160a01b031615611e2c57611e1542856134da565b9250611e268760060154848761219d565b90925090505b8115611f4357865460035460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810185905291169063a9059cbb90604401602060405180830381600087803b158015611e8157600080fd5b505af1158015611e95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eb9919061391b565b50865460405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b158015611f0557600080fd5b505af1158015611f19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f3d919061391b565b50611fc8565b865460405163a9059cbb60e01b8152336004820152602481018790526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b158015611f8e57600080fd5b505af1158015611fa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc6919061391b565b505b604051858152899033907fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959060200160405180910390a350506001805550505050505050565b6000600e54600014156120585760405162461bcd60e51b81526020600482015260126024820152711b9bdd081a5b9a5d1a5b1a5e9959081e595d60721b6044820152606401610884565b6000838152600c602090815260408083206001600160a01b03861684529091529020600281015442101561209e574281600201546120969190613c5f565b9150506112eb565b60009150506112eb565b6120b061355e565b565b6000546001600160a01b031633146120fa5760405162461bcd60e51b81526020600482018190526024820152600080516020613d0e8339815191526044820152606401610884565b600e5461213e5760405162461bcd60e51b81526020600482015260126024820152711b9bdd081a5b9a5d1a5b1a5e9959081e595d60721b6044820152606401610884565b61214661355e565b601055565b6000546001600160a01b031633146121935760405162461bcd60e51b81526020600482018190526024820152600080516020613d0e8339815191526044820152606401610884565b6120b0600061358c565b60008060006121af6107da8787612d2c565b9050600060646121bf8387613c01565b6121c99190613bdf565b905060006121d78287613c5f565b91989197509095505050505050565b6000546001600160a01b0316331461222e5760405162461bcd60e51b81526020600482018190526024820152600080516020613d0e8339815191526044820152606401610884565b600a54869081106122775760405162461bcd60e51b81526020600482015260136024820152721c1bdbdb08191bd95cc81b9bdd08195e1a5cdd606a1b6044820152606401610884565b600e546122bb5760405162461bcd60e51b81526020600482015260126024820152711b9bdd081a5b9a5d1a5b1a5e9959081e595d60721b6044820152606401610884565b6201518085111561231e5760405162461bcd60e51b815260206004820152602760248201527f436f6666696e4d616b657256323a20696e76616c6964206861727665737420696044820152661b9d195c9d985b60ca1b6064820152608401610884565b621275008411156123805760405162461bcd60e51b815260206004820152602660248201527f436f6666696e4d616b657256323a20696e76616c6964206c6f636b757020696e6044820152651d195c9d985b60d21b6064820152608401610884565b60648311156123bc5760405162461bcd60e51b81526020600482015260086024820152670e8dede40daeac6d60c31b6044820152606401610884565b81156123ca576123ca61355e565b85600a88815481106123de576123de613ce9565b906000526020600020906007020160010154600d546123fd9190613c5f565b6124079190613bc7565b600d8190555085600a888154811061242157612421613ce9565b90600052602060002090600702016001018190555084600a888154811061244a5761244a613ce9565b90600052602060002090600702016004018190555083600a888154811061247357612473613ce9565b906000526020600020906007020160050181905550612491836132b8565b600a88815481106124a4576124a4613ce9565b60009182526020918290206006600790920201019190915560408051898152918201889052810186905260608101859052608081018490527f81812e4c1e8eddf8d0d3a4879e3cf023d05f4066149028c949e9f55f128d3d6e9060a00160405180910390a150505050505050565b600260015414156125655760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610884565b6002600155600a54849081106125b35760405162461bcd60e51b81526020600482015260136024820152721c1bdbdb08191bd95cc81b9bdd08195e1a5cdd606a1b6044820152606401610884565b600054600160a01b900460ff161561260d5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610884565b600e546126515760405162461bcd60e51b81526020600482015260126024820152711b9bdd081a5b9a5d1a5b1a5e9959081e595d60721b6044820152606401610884565b600084116126a15760405162461bcd60e51b815260206004820152601d60248201527f6465706f7369742073686f756c64206265206d6f7265207468616e20300000006044820152606401610884565b6000600a86815481106126b6576126b6613ce9565b60009182526020808320898452600c825260408085206001600160a01b038a168652909252922060016007909202909201908101549092506127445760405162461bcd60e51b815260206004820152602160248201527f63616e6e6f74206465706f736974207468697320746f6b656e20666f72206e6f6044820152607760f81b6064820152608401610884565b61274d876117a4565b5081546040516370a0823160e01b815233600482015287916001600160a01b0316906370a082319060240160206040518083038186803b15801561279057600080fd5b505afa1580156127a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c89190613951565b101561282c5760405162461bcd60e51b815260206004820152602d60248201527f796f7520646f6e2774206861766520656e6f7567682062616c616e636520696e60448201526c103cb7bab9103bb0b63632ba1760991b6064820152608401610884565b6001600160a01b03851633148061284257508054155b156128835760048201546128569042613bc7565b6002820155426003820181905560058201556004810154612877574261287d565b80600401545b60048201555b81546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b1580156128c657600080fd5b505afa1580156128da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128fe9190613951565b8354909150612918906001600160a01b031633308a6135dc565b82546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561295b57600080fd5b505afa15801561296f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129939190613951565b905060006129a18383613c5f565b905088811115612a195760405162461bcd60e51b815260206004820152603560248201527f20696e636f6d652076616c75652073686f756c6420626520736d616c6c65722060448201527f7468616e20617267756d656e742076616c75652e2000000000000000000000006064820152608401610884565b80846000016000828254612a2d9190613bc7565b90915550506003850154612a4d9064e8d4a5100090610bbe9084906134c2565b846001016000828254612a609190613b87565b90915550506001600160a01b03871615801590612a865750336001600160a01b03881614155b8015612aa85750336000908152600760205260409020546001600160a01b0316155b15612b115733600090815260076020908152604080832080546001600160a01b0319166001600160a01b038c16908117909155835260089091528120805491612af083613ca2565b90915550506001600160a01b03871660009081526009602052604090204290555b604080518a81526001600160a01b038a1660208201528b9133917f048b7d6c91bf86a13f68cf031cea5b6728dcf9d85e06cc7ee4a8dee210f23d35910160405180910390a35050600180555050505050505050565b6000600e5460001415612bb05760405162461bcd60e51b81526020600482015260126024820152711b9bdd081a5b9a5d1a5b1a5e9959081e595d60721b6044820152606401610884565b600e54421015612bc2575060006112eb565b6000600a8481548110612bd757612bd7613ce9565b60009182526020808320878452600c825260408085206001600160a01b03898116875293528085206007949094029091016003810154815492516370a0823160e01b815230600482015291965093949291909116906370a082319060240160206040518083038186803b158015612c4d57600080fd5b505afa158015612c61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c859190613951565b9050836002015442118015612c9957508015155b15612cfb576000846002015442612cb09190613c5f565b90506000612cd7600d54610bbe8860010154611a0d601054876134c290919063ffffffff16565b9050612cec83610bbe8364e8d4a510006134c2565b612cf69085613bc7565b935050505b60018301548354612d179064e8d4a5100090610bbe90866134c2565b612d219190613c20565b979650505050505050565b600080620151808310612d4b57612d466201518084613bdf565b612d4e565b60005b90506000612d5b826132b8565b9050600085821015612d7657612d718287613c5f565b612d79565b60005b9695505050505050565b6000546001600160a01b0316331480612da657506003546001600160a01b031633145b612e075760405162461bcd60e51b815260206004820152602c60248201527f436f6666696e4d616b657256323a206f6e6c792066726f6d2070726f6669745f60448201526b1cda185c9a5b99d7d99d5b9960a21b6064820152608401610884565b600380546001600160a01b0319166001600160a01b0383169081179091556040517f445a4a809a6bbbf3722f4f5c29ec02e73b9558d498bd5ef78a83a35aa3a4134e90600090a250565b6000600e5460001415612e9b5760405162461bcd60e51b81526020600482015260126024820152711b9bdd081a5b9a5d1a5b1a5e9959081e595d60721b6044820152606401610884565b6000838152600c602090815260408083206001600160a01b03861684529091528120600a805491929186908110612ed457612ed4613ce9565b906000526020600020906007020190504281600501548360030154612ef99190613bc7565b1115612f27574281600501548360030154612f149190613bc7565b612f1e9190613c5f565b925050506112eb565b506000949350505050565b6000546001600160a01b0316331480612f5557506005546001600160a01b031633145b612fa15760405162461bcd60e51b815260206004820152601c60248201527f436f6666696e4d616b657256323a206f6e6c792066726f6d20646576000000006044820152606401610884565b600580546001600160a01b0319166001600160a01b0383169081179091556040517f1a728d773e9cc26cb9750f8f128ed598dd65c55dda674b1d71ca53b168e6627990600090a250565b600080600a838154811061300157613001613ce9565b6000918252602090912060079091020180546040516370a0823160e01b81523360048201529192506001600160a01b0316906370a082319060240160206040518083038186803b15801561305457600080fd5b505afa158015613068573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061308c9190613951565b9392505050565b6000546001600160a01b031633146130db5760405162461bcd60e51b81526020600482018190526024820152600080516020613d0e8339815191526044820152606401610884565b600e541561311c5760405162461bcd60e51b815260206004820152600e60248201526d37b7363c9037b732903a34b6b29760911b6044820152606401610884565b6001600160a01b0384166131725760405162461bcd60e51b815260206004820152601a60248201527f72657761726420746f6b656e2061646472657373206572726f720000000000006044820152606401610884565b600480546001600160a01b0319166001600160a01b03861617905542600e55821561327c5742831161320c5760405162461bcd60e51b815260206004820152603560248201527f436f6666696e4d616b657256323a205468652073746172742074696d65206d7560448201527f737420626520696e20746865206675747572652e2000000000000000000000006064820152608401610884565b62278d0061321a4285613c5f565b11156132765760405162461bcd60e51b815260206004820152602560248201527f436f6666696e4d616b657256323a20696e76616c6964207374617274696e672060448201526403a34b6b2960dd1b6064820152608401610884565b600e8390555b60108290558161329357670de0b6b3a76400006010555b600280546001600160a01b0319166001600160a01b0392909216919091179055505050565b60006112eb82670de0b6b3a7640000613c01565b60006112eb670de0b6b3a764000083613bdf565b6000546001600160a01b031633146133285760405162461bcd60e51b81526020600482018190526024820152600080516020613d0e8339815191526044820152606401610884565b6001600160a01b03811661338d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610884565b6133968161358c565b50565b6000546001600160a01b031633146133e15760405162461bcd60e51b81526020600482018190526024820152600080516020613d0e8339815191526044820152606401610884565b6000848152600c602090815260408083206001600160a01b0387168085529083529281902060048101869055600581018590558151888152928301939093528101849052606081018390527f2b80c9e73360d34fe349badc64eec5a64c8102ff3c9bd44a0895765af8f3ccc89060800160405180910390a15050505050565b600080600a838154811061347657613476613ce9565b60009182526020808320868452600c825260408085203386529092529220600560079092029092019081015460038301549193506134ba914291611b59919061364b565b949350505050565b600061308c8284613c01565b600061308c8284613bdf565b600061308c8284613c5f565b600254600480546040516352f950a960e11b81526001600160a01b03918216928101929092528481166024830152604482018490529091169063a5f2a15290606401600060405180830381600087803b15801561354257600080fd5b505af1158015613556573d6000803e3d6000fd5b505050505050565b600a5460005b8181101561358857613575816117a4565b508061358081613ca2565b915050613564565b5050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166323b872dd60e01b17905261179e908590613657565b600061308c8284613bc7565b60006136ac826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661372e9092919063ffffffff16565b80519091501561372957808060200190518101906136ca919061391b565b6137295760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610884565b505050565b60606134ba848460008585843b6137875760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610884565b600080866001600160a01b031685876040516137a39190613b38565b60006040518083038185875af1925050503d80600081146137e0576040519150601f19603f3d011682016040523d82523d6000602084013e6137e5565b606091505b5091509150612d21828286606083156137ff57508161308c565b82511561380f5782518084602001fd5b8160405162461bcd60e51b81526004016108849190613b54565b80356001600160a01b038116811461384057600080fd5b919050565b60006020828403121561385757600080fd5b61308c82613829565b6000806000806080858703121561387657600080fd5b61387f85613829565b9350602085013592506040850135915061389b60608601613829565b905092959194509250565b600080602083850312156138b957600080fd5b823567ffffffffffffffff808211156138d157600080fd5b818501915085601f8301126138e557600080fd5b8135818111156138f457600080fd5b8660208260051b850101111561390957600080fd5b60209290920196919550909350505050565b60006020828403121561392d57600080fd5b815161308c81613cff565b60006020828403121561394a57600080fd5b5035919050565b60006020828403121561396357600080fd5b5051919050565b6000806040838503121561397d57600080fd5b8235915061398d60208401613829565b90509250929050565b600080600080608085870312156139ac57600080fd5b843593506139bc60208601613829565b93969395505050506040820135916060013590565b600080600080600060a086880312156139e957600080fd5b853594506139f960208701613829565b935060408601359250606086013591506080860135613a1781613cff565b809150509295509295909350565b60008060408385031215613a3857600080fd5b50508035926020909101359150565b600080600060608486031215613a5c57600080fd5b8335925060208401359150613a7360408501613829565b90509250925092565b60008060008060808587031215613a9257600080fd5b8435935060208501359250613aa960408601613829565b915061389b60608601613829565b600080600060608486031215613acc57600080fd5b505081359360208301359350604090920135919050565b60008060008060008060c08789031215613afc57600080fd5b863595506020870135945060408701359350606087013592506080870135915060a0870135613b2a81613cff565b809150509295509295509295565b60008251613b4a818460208701613c76565b9190910192915050565b6020815260008251806020840152613b73816040850160208701613c76565b601f01601f19169190910160400192915050565b6000808212826001600160ff1b0303841381151615613ba857613ba8613cd3565b600160ff1b8390038412811615613bc157613bc1613cd3565b50500190565b60008219821115613bda57613bda613cd3565b500190565b600082613bfc57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615613c1b57613c1b613cd3565b500290565b60008083128015600160ff1b850184121615613c3e57613c3e613cd3565b836001600160ff1b03018313811615613c5957613c59613cd3565b50500390565b600082821015613c7157613c71613cd3565b500390565b60005b83811015613c91578181015183820152602001613c79565b8381111561179e5750506000910152565b6000600019821415613cb657613cb6613cd3565b5060010190565b634e487b7160e01b600052600160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b801515811461339657600080fdfe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a164736f6c6343000807000a
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Validator ID :
0 FTM
Amount Staked
0
Amount Delegated
0
Staking Total
0
Staking Start Epoch
0
Staking Start Time
0
Proof of Importance
0
Origination Score
0
Validation Score
0
Active
0
Online
0
Downtime
0 s
Address | Amount | claimed Rewards | Created On Epoch | Created On |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.