Address Contract Verified
Address
0xd08481058399490B83a72676901d4e9dB70E75aC
Balance
4.5298 ETH
Nonce
1
Code Size
6605 bytes
Creator
0x94BC7C40...Ee9E at tx 0x325ca90e...d9935d
Indexed Transactions
0
Contract Bytecode
6605 bytes
0x6080604052600436106101a55760003560e01c8063715018a6116100e1578063a457c2d71161008a578063d63a4d5c11610064578063d63a4d5c146105be578063dd62ed3e146105de578063e0880b5614610624578063f2fde38b1461064457600080fd5b8063a457c2d714610551578063a9059cbb14610571578063ac9650d81461059157600080fd5b80638da5cb5b116100bb5780638da5cb5b146104e757806395d89b411461050f57806397a067241461052457600080fd5b8063715018a61461049257806379cc6790146104a75780637e1c4273146104c757600080fd5b806327ce01471161014e5780633a7960e0116101285780633a7960e01461040457806342966c681461041a5780635247ab051461043c57806370a082311461045c57600080fd5b806327ce014714610393578063313ce567146103c857806339509351146103e457600080fd5b806318160ddd1161017f57806318160ddd1461034657806319123c1f1461035b57806323b872dd1461037357600080fd5b80630396933a146102b457806306fdde03146102f4578063095ea7b31461031657600080fd5b366102af576000546001600160a01b031615610201576000546040517f5b40d93f0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911660048201526024015b60405180910390fd5b34600061020d60035490565b905080600003610249576040517fdec05e7e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80610258600160801b8461154b565b6102629190611578565b60066000828254610273919061158c565b909155505060405182815233907fe5ba7d8b3902741267e9eb5f03b42f5f4f67aeef15cd66d31ecf1d574975b2779060200160405180910390a2005b600080fd5b3480156102c057600080fd5b506102e16102cf3660046115b4565b60086020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561030057600080fd5b50610309610664565b6040516102eb9190611621565b34801561032257600080fd5b50610336610331366004611634565b6106f6565b60405190151581526020016102eb565b34801561035257600080fd5b506003546102e1565b34801561036757600080fd5b506102e1600160801b81565b34801561037f57600080fd5b5061033661038e366004611660565b610710565b34801561039f57600080fd5b506103b36103ae3660046115b4565b610734565b604080519283526020830191909152016102eb565b3480156103d457600080fd5b50604051601281526020016102eb565b3480156103f057600080fd5b506103366103ff366004611634565b610783565b34801561041057600080fd5b506102e160065481565b34801561042657600080fd5b5061043a6104353660046116a1565b6107c2565b005b34801561044857600080fd5b506102e1610457366004611634565b6107cf565b34801561046857600080fd5b506102e16104773660046115b4565b6001600160a01b031660009081526001602052604090205490565b34801561049e57600080fd5b5061043a61088b565b3480156104b357600080fd5b5061043a6104c2366004611634565b61089f565b3480156104d357600080fd5b506102e16104e23660046115b4565b6108b8565b3480156104f357600080fd5b506000546040516001600160a01b0390911681526020016102eb565b34801561051b57600080fd5b5061030961090e565b34801561053057600080fd5b506102e161053f3660046115b4565b60076020526000908152604090205481565b34801561055d57600080fd5b5061033661056c366004611634565b61091d565b34801561057d57600080fd5b5061033661058c366004611634565b6109c7565b34801561059d57600080fd5b506105b16105ac3660046116ba565b6109d5565b6040516102eb919061172f565b3480156105ca57600080fd5b506102e16105d9366004611791565b610aca565b3480156105ea57600080fd5b506102e16105f93660046117b3565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b34801561063057600080fd5b506103b361063f3660046117ec565b610af4565b34801561065057600080fd5b5061043a61065f3660046115b4565b610b40565b60606004805461067390611818565b80601f016020809104026020016040519081016040528092919081815260200182805461069f90611818565b80156106ec5780601f106106c1576101008083540402835291602001916106ec565b820191906000526020600020905b8154815290600101906020018083116106cf57829003601f168201915b5050505050905090565b600033610704818585610bcd565b60019150505b92915050565b60003361071e858285610d26565b610729858585610db8565b506001949350505050565b60008061077a60065461075c856001600160a01b031660009081526001602052604090205490565b6001600160a01b038616600090815260076020526040902054610af4565b91509150915091565b3360008181526002602090815260408083206001600160a01b038716845290915281205490919061070490829086906107bd90879061158c565b610bcd565b6107cc3382610fb7565b50565b600033816107e0846105d9846108b8565b9050806000036107f55760009250505061070a565b6001600160a01b0382166000908152600860205260408120805483929061081d90849061158c565b9091555061083690506001600160a01b0386168261112b565b846001600160a01b0316826001600160a01b03167f789b051f922a2c31369bf315f70ac999ae79364971fbc9a8f094bac1e2ffa8af8360405161087b91815260200190565b60405180910390a3949350505050565b610893611244565b61089d600061129e565b565b6108aa823383610d26565b6108b48282610fb7565b5050565b6000806108e060065461075c856001600160a01b031660009081526001602052604090205490565b506001600160a01b0384166000908152600860205260409020549091506109079082611852565b9392505050565b60606005805461067390611818565b3360008181526002602090815260408083206001600160a01b0387168452909152812054909190838110156109ba5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016101f8565b6107298286868403610bcd565b600033610704818585610db8565b60608167ffffffffffffffff8111156109f0576109f0611865565b604051908082528060200260200182016040528015610a2357816020015b6060815260200190600190039081610a0e5790505b50905060005b82811015610ac357610a9330858584818110610a4757610a4761187b565b9050602002810190610a599190611891565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061130692505050565b828281518110610aa557610aa561187b565b60200260200101819052508080610abb906118df565b915050610a29565b5092915050565b600080828410610ada5782610adc565b835b90508015610aea5780610aec565b825b949350505050565b6000808083610b0b610b06878961154b565b61132b565b610b1591906118f8565b9050610b25600160801b82611578565b610b33600160801b83611920565b9250925050935093915050565b610b48611244565b6001600160a01b038116610bc45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016101f8565b6107cc8161129e565b6001600160a01b038316610c485760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016101f8565b6001600160a01b038216610cc45760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016101f8565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038381166000908152600260209081526040808320938616835292905220546000198114610db25781811015610da55760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016101f8565b610db28484848403610bcd565b50505050565b6001600160a01b038316610e345760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016101f8565b6001600160a01b038216610eb05760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016101f8565b610ebb83838361138b565b6001600160a01b03831660009081526001602052604090205481811015610f4a5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016101f8565b6001600160a01b0380851660008181526001602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610faa9086815260200190565b60405180910390a3610db2565b6001600160a01b0382166110335760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016101f8565b61103f8260008361138b565b6001600160a01b038216600090815260016020526040902054818110156110ce5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016101f8565b6001600160a01b03831660008181526001602090815260408083208686039055600380548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d19565b505050565b8047101561117b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016101f8565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146111c8576040519150601f19603f3d011682016040523d82523d6000602084013e6111cd565b606091505b50509050806111265760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016101f8565b6000546001600160a01b0316331461089d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101f8565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606061090783836040518060600160405280602781526020016119716027913961141f565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821115611387576040517fb4120f1400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5090565b600061139e82600654610b06919061154b565b90506001600160a01b038416156113dd576001600160a01b038416600090815260076020526040812080548392906113d79084906118f8565b90915550505b6001600160a01b03831615610db2576001600160a01b03831660009081526007602052604081208054839290611414908490611934565b909155505050505050565b6060600080856001600160a01b03168560405161143c9190611954565b600060405180830381855af49150503d8060008114611477576040519150601f19603f3d011682016040523d82523d6000602084013e61147c565b606091505b509150915061148d86838387611497565b9695505050505050565b606083156115065782516000036114ff576001600160a01b0385163b6114ff5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101f8565b5081610aec565b610aec838381511561151b5781518083602001fd5b8060405162461bcd60e51b81526004016101f89190611621565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761070a5761070a611535565b634e487b7160e01b600052601260045260246000fd5b60008261158757611587611562565b500490565b8082018082111561070a5761070a611535565b6001600160a01b03811681146107cc57600080fd5b6000602082840312156115c657600080fd5b81356109078161159f565b60005b838110156115ec5781810151838201526020016115d4565b50506000910152565b6000815180845261160d8160208601602086016115d1565b601f01601f19169290920160200192915050565b60208152600061090760208301846115f5565b6000806040838503121561164757600080fd5b82356116528161159f565b946020939093013593505050565b60008060006060848603121561167557600080fd5b83356116808161159f565b925060208401356116908161159f565b929592945050506040919091013590565b6000602082840312156116b357600080fd5b5035919050565b600080602083850312156116cd57600080fd5b823567ffffffffffffffff808211156116e557600080fd5b818501915085601f8301126116f957600080fd5b81358181111561170857600080fd5b8660208260051b850101111561171d57600080fd5b60209290920196919550909350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561178457603f198886030184526117728583516115f5565b94509285019290850190600101611756565b5092979650505050505050565b600080604083850312156117a457600080fd5b50508035926020909101359150565b600080604083850312156117c657600080fd5b82356117d18161159f565b915060208301356117e18161159f565b809150509250929050565b60008060006060848603121561180157600080fd5b505081359360208301359350604090920135919050565b600181811c9082168061182c57607f821691505b60208210810361184c57634e487b7160e01b600052602260045260246000fd5b50919050565b8181038181111561070a5761070a611535565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126118a857600080fd5b83018035915067ffffffffffffffff8211156118c357600080fd5b6020019150368190038213156118d857600080fd5b9250929050565b6000600182016118f1576118f1611535565b5060010190565b808201828112600083128015821682158216171561191857611918611535565b505092915050565b60008261192f5761192f611562565b500690565b8181036000831280158383131683831282161715610ac357610ac3611535565b600082516119668184602087016115d1565b919091019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122081eabc87c395238664d01d8059388bea7ba8becaab60a4bf0e92df8a8d08893964736f6c63430008110033
Verified Source Code Full Match
Compiler: v0.8.17+commit.8df45f5f
EVM: london
Optimization: Yes (1000 runs)
Utils.sol 10 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
abstract contract Utils {
/** clamp the amount provided to a maximum, defaulting to provided maximum if 0 provided */
function clamp(uint256 amount, uint256 max) pure public returns(uint256) {
uint256 min = amount < max ? amount : max;
return min == 0 ? max : min;
}
}
TIMEDividend.sol 170 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Multicall.sol";
import "./interfaces/IInternetMoneySwapRouter.sol";
import "./Utils.sol";
/**
* @title TIMEDividend a token to track ownership over dividend
* dividend come in over time and their ownership amount may shift
*/
contract TIMEDividend is Ownable, ERC20, ERC20Burnable, Utils, Multicall {
using Address for address payable;
/// @dev magnitude is a constant that converts amounts to scaling magnitudes
/// so that resolution for payouts is maintained
uint256 public constant magnitude = 2**128;
uint256 public magnifiedDividendPerShare;
mapping(address => int256) public magnifiedDividendCorrections;
mapping(address => uint256) public cumulativeDividendClaimed;
/// @dev This emits when PLS is distributed to token holders.
/// @param from The address which sends PLS to this contract.
/// @param weiAmount The amount of distributed PLS in wei.
event DistributeDividend(address indexed from, uint256 weiAmount);
/// @dev This emits when an address withdraws their dividend.
/// @param account The address which withdraws native token from this contract.
/// @param amount The amount of withdrawn native token.
event ClaimDividend(address indexed account, address indexed recipient, uint256 amount);
error HasAdmin(address owner);
error SupplyMissing();
error OutOfBounds();
/**
* @param supply the supply of the number of tokens to produce
*/
constructor(uint256 supply)
ERC20("T.I.M.E. Dividend", "TIME")
Ownable()
{
_mint(_msgSender(), supply);
}
/**
* @notice This payable function is used to receive amount which will be given to the token holders as dividend
* @notice This function can be run by anyone transferring the native currency into the contract.
* @dev This private function is used to distribute PLS dividend among the token holders
*/
receive() external payable {
// this function can only be run after mint process is complete
// and ownership has been revoked
if (owner() != address(0)) {
revert HasAdmin(owner());
}
uint256 amount = msg.value;
uint256 supply = totalSupply();
if (supply == 0) {
revert SupplyMissing();
}
magnifiedDividendPerShare += ((amount * magnitude) / supply);
emit DistributeDividend(_msgSender(), amount);
}
/** converts a uint256 to int256 after checking bounds */
function toInt256(uint256 target) internal pure returns(int256) {
if (target > uint256(type(int256).max)) {
revert OutOfBounds();
}
return int256(target);
}
/**
* @dev This internal function is overridden from {ERC20} contract to handle mag corrections
* See {ERC20-_beforeTokenTransfer} for more details
* @notice updates magnified dividend corrections as they are transferred between accounts
* @param from the address to send tokens from
* @param to the address to send tokens to
* @param amount the count of tokens being sent
* @notice this covers transfers, mints, and burns
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal override {
int256 correctionDelta = toInt256(magnifiedDividendPerShare * amount);
if (from != address(0)) {
magnifiedDividendCorrections[from] += correctionDelta;
}
if (to != address(0)) {
magnifiedDividendCorrections[to] -= correctionDelta;
}
}
/**
* @notice This function is used to get total claimable dividend of `account`
* @param account Address to check for
* @return Total claimable dividend of `account`
*/
function claimableDividendOf(address account) public view returns (uint256) {
(uint256 totalClaimable, ) = dividendFrom(
magnifiedDividendPerShare,
balanceOf(account),
magnifiedDividendCorrections[account]
);
return totalClaimable - cumulativeDividendClaimed[account];
}
/**
* @param account the account whose dividend should be checked
* @return accumulatedDividend the amount of dividend accumulated
*/
function accumulativeDividendOf(address account) public view returns (uint256, uint256) {
return dividendFrom(
magnifiedDividendPerShare,
balanceOf(account),
magnifiedDividendCorrections[account]
);
}
/**
* computes the dividend that is owed given the dividend per share, token balance, and correction from transfers
* @param magDividendPerShare is the targeted magnitudeDividendPerShare, must be passed in since it is variable on the contract
* @param balance the token balance of the address in question
* @param correction the correction of the address in question which takes into account transfers over a given magnitude
* @notice the magnitude will almost never divide evenly into the correct
* product of the balance * dividend per share value, so the remainder is returned
* this is useful for anyone who wants to know if there is any token
* being left in the contract due to rounding errors
*/
function dividendFrom(
uint256 magDividendPerShare,
uint256 balance,
int256 correction
) public pure returns(uint256 claimableDividend, uint256 productRemainder) {
uint256 product = uint256(toInt256(magDividendPerShare * balance) + correction);
return (product / magnitude, product % magnitude);
}
/**
* @dev This private function claims the dividend for `_msgSender()`
* @param recipient Account to receive dividend from account
* @param amount the amount to distribute - 0 is recognized as all
* @return claimed true if the claim is successful, false otherwise
* @notice if zero is passed for amount, all of the available tokens are released
* @notice the account distributing to must be payable
*/
function claimDividend(
address payable recipient,
uint256 amount
) public returns (uint256) {
address account = _msgSender();
uint256 claimable = clamp(amount, claimableDividendOf(account));
if (claimable == 0) {
// return if we can't claim anything
return 0;
}
cumulativeDividendClaimed[account] += claimable;
recipient.sendValue(claimable);
emit ClaimDividend(account, recipient, claimable);
return claimable;
}
}
Address.sol 244 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://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 functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
Multicall.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol)
pragma solidity ^0.8.0;
import "./Address.sol";
/**
* @dev Provides a function to batch together multiple calls in a single external call.
*
* _Available since v4.1._
*/
abstract contract Multicall {
/**
* @dev Receives and executes a batch of function calls on this contract.
*/
function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {
results = new bytes[](data.length);
for (uint256 i = 0; i < data.length; i++) {
results[i] = Address.functionDelegateCall(address(this), data[i]);
}
return results;
}
}
ERC20.sol 389 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, 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}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, 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}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, 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) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, 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) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* 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:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, 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;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_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;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_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 Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - 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 {}
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
IInternetMoneySwapRouter.sol 33 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
interface IInternetMoneySwapRouter {
function fee() external returns(uint256);
function wNative() external returns(address payable);
function distributeAll(uint256 amount) external;
function distribute(uint256 amount) external;
function swapTokenV2(
uint256 _dexId,
address recipient,
address[] calldata _path,
uint256 _amountIn,
uint256 _minAmountOut,
uint256 _deadline
) external payable;
function swapNativeToV2(
uint256 _dexId,
address recipient,
address[] calldata _path,
uint256 _amountIn,
uint256 _minAmountOut,
uint256 _deadline
) external payable;
function swapToNativeV2(
uint256 _dexId,
address payable recipient,
address[] calldata _path,
uint256 _amountIn,
uint256 _minAmountOut,
uint256 _deadline
) external payable;
}
ERC20Burnable.sol 39 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)
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 {
_spendAllowance(account, _msgSender(), amount);
_burn(account, amount);
}
}
IERC20Metadata.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
Read Contract
accumulativeDividendOf 0x27ce0147 → uint256, uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
claimableDividendOf 0x7e1c4273 → uint256
clamp 0xd63a4d5c → uint256
cumulativeDividendClaimed 0x0396933a → uint256
decimals 0x313ce567 → uint8
dividendFrom 0xe0880b56 → uint256, uint256
magnifiedDividendCorrections 0x97a06724 → int256
magnifiedDividendPerShare 0x3a7960e0 → uint256
magnitude 0x19123c1f → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
Write Contract 11 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
burn 0x42966c68
uint256 amount
burnFrom 0x79cc6790
address account
uint256 amount
claimDividend 0x5247ab05
address recipient
uint256 amount
returns: uint256
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
multicall 0xac9650d8
bytes[] data
returns: bytes[]
renounceOwnership 0x715018a6
No parameters
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
Token Balances (2)
View Transfers →Recent Transactions
No transactions found for this address