Address Contract Partially Verified
Address
0x2f3048d13D1d9ceE8d7aae4EDace721beB43b6B6
Balance
0 ETH
Nonce
1
Code Size
5892 bytes
Creator
0x8aa3C8d2...30B7 at tx 0xd5ef89ea...da6294
Indexed Transactions
0
Contract Bytecode
5892 bytes
0x608060405234801561001057600080fd5b50600436106101425760003560e01c806370a08231116100b8578063a457c2d71161007c578063a457c2d7146102be578063a7cb53bd146102d1578063a9059cbb146102e4578063bed99850146102f7578063dd62ed3e14610300578063e316c3eb1461031357600080fd5b806370a082311461025e57806373f425611461028757806379cc67901461029057806389a9ed10146102a357806395d89b41146102b657600080fd5b80632686b6a71161010a5780632686b6a7146101d8578063313ce567146101e157806339509351146101f057806342966c6814610203578063636657791461021857806370681c381461023b57600080fd5b806306fdde03146101475780630828862d14610165578063095ea7b31461019057806318160ddd146101b357806323b872dd146101c5575b600080fd5b61014f61031c565b60405161015c919061152d565b60405180910390f35b600c54610178906001600160a01b031681565b6040516001600160a01b03909116815260200161015c565b6101a361019e366004611428565b6103ae565b604051901515815260200161015c565b6002545b60405190815260200161015c565b6101a36101d3366004611414565b6103c6565b6101b761271081565b6040516012815260200161015c565b6101a36101fe366004611428565b6103ec565b6102166102113660046114d8565b61040e565b005b6101a3610226366004611337565b60076020526000908152604090205460ff1681565b6101a3610249366004611337565b60086020526000908152604090205460ff1681565b6101b761026c366004611337565b6001600160a01b031660009081526020819052604090205490565b6101b7600a5481565b61021661029e366004611428565b61041b565b6102166102b1366004611453565b610434565b61014f610828565b6101a36102cc366004611428565b610837565b6101b76102df3660046114d8565b6108bd565b6101a36102f2366004611428565b6108e6565b6101b7600b5481565b6101b761030e3660046113e7565b6108f4565b6101b760095481565b60606003805461032b9061163f565b80601f01602080910402602001604051908101604052809291908181526020018280546103579061163f565b80156103a45780601f10610379576101008083540402835291602001916103a4565b820191906000526020600020905b81548152906001019060200180831161038757829003601f168201915b5050505050905090565b6000336103bc81858561091f565b5060019392505050565b6000336103d4858285610a44565b6103df858585610abe565b60019150505b9392505050565b6000336103bc8185856103ff83836108f4565b61040991906115a5565b61091f565b6104183382610de1565b50565b610426823383610a44565b6104308282610de1565b5050565b600660009054906101000a90046001600160a01b03166001600160a01b031663c3da42b86040518163ffffffff1660e01b815260040160206040518083038186803b15801561048257600080fd5b505afa158015610496573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ba9190611353565b6001600160a01b0316336001600160a01b03161461050b5760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b60448201526064015b60405180910390fd5b8260005b8181101561082057600086868381811061053957634e487b7160e01b600052603260045260246000fd5b905060200201602081019061054e91906114f0565b905060ff81166105a257600085858481811061057a57634e487b7160e01b600052603260045260246000fd5b905060200281019061058c9190611560565b81019061059991906114d8565b6009555061080d565b60ff811660011415610621576000808686858181106105d157634e487b7160e01b600052603260045260246000fd5b90506020028101906105e39190611560565b8101906105f091906113af565b6001600160a01b03919091166000908152600760205260409020805460ff19169115159190911790555061080d9050565b60ff8116600214156106a05760008086868581811061065057634e487b7160e01b600052603260045260246000fd5b90506020028101906106629190611560565b81019061066f91906113af565b6001600160a01b03919091166000908152600860205260409020805460ff19169115159190911790555061080d9050565b60ff8116600314156107135760008585848181106106ce57634e487b7160e01b600052603260045260246000fd5b90506020028101906106e09190611560565b8101906106ed9190611337565b600c80546001600160a01b0319166001600160a01b03929092169190911790555061080d565b60ff8116600414156107a857600085858481811061074157634e487b7160e01b600052603260045260246000fd5b90506020028101906107539190611560565b81019061076091906114d8565b9050612710600b5411156107a05760405162461bcd60e51b81526020600482015260076024820152660dac2f0408aa0b60cb1b6044820152606401610502565b600b5561080d565b60ff81166005141561080d5760008060008787868181106107d957634e487b7160e01b600052603260045260246000fd5b90506020028101906107eb9190611560565b8101906107f8919061136f565b925092509250610809838383610f27565b5050505b50806108188161167a565b91505061050f565b505050505050565b60606004805461032b9061163f565b6000338161084582866108f4565b9050838110156108a55760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610502565b6108b2828686840361091f565b506001949350505050565b600080600a546009546108d091906115fc565b90508281116108df57806103e5565b5090919050565b6000336103bc818585610abe565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166109815760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610502565b6001600160a01b0382166109e25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610502565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6000610a5084846108f4565b90506000198114610ab85781811015610aab5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610502565b610ab8848484840361091f565b50505050565b60026005541415610b115760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610502565b600260055560065460405163f0e9c90960e01b81526001600160a01b0385811660048301528481166024830152604482018490529091169063f0e9c90990606401600060405180830381600087803b158015610b6c57600080fd5b505af1158015610b80573d6000803e3d6000fd5b506000925050506001600160a01b0384163b151580610ba857506001600160a01b0383163b15155b15610bb1575060015b6001600160a01b03841660009081526007602052604090205460ff1680610bf057506001600160a01b03831660009081526008602052604090205460ff165b15610bf9575060005b8015610c60576000610c1f612710600b5485610c1591906115dd565b6102df91906115bd565b600c54909150610c3a9086906001600160a01b031683610f9e565b80600a6000828254610c4c91906115a5565b90915550610c5c905081846115fc565b9250505b610c6b848484610f9e565b60065460405163ed37001b60e01b81526001600160a01b0386811660048301528581166024830152604482018590529091169063ed37001b90606401600060405180830381600087803b158015610cc157600080fd5b505af1158015610cd5573d6000803e3d6000fd5b505050506001600160a01b0384161580610d67575060065460405163372c12b160e01b81526001600160a01b0386811660048301529091169063372c12b19060240160206040518083038186803b158015610d2f57600080fd5b505afa158015610d43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6791906114bc565b80610d96575066038d7ea4c68000610d94856001600160a01b031660009081526020819052604090205490565b115b610dd65760405162461bcd60e51b815260206004820152601160248201527062616c616e6365206d696e20302e30303160781b6044820152606401610502565b505060016005555050565b6001600160a01b038216610e415760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610502565b6001600160a01b03821660009081526020819052604090205481811015610eb55760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610502565b6001600160a01b0383166000908152602081905260408120838303905560028054849290610ee49084906115fc565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001610a37565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180516001600160e01b031663a9059cbb60e01b1790528351808501909452600d84526c10b9b0b332aa3930b739b332b960991b90840152610ab892908616919061116c565b6001600160a01b0383166110025760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610502565b6001600160a01b0382166110645760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610502565b6001600160a01b038316600090815260208190526040902054818110156110dc5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610502565b6001600160a01b038085166000908152602081905260408082208585039055918516815290812080548492906111139084906115a5565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161115f91815260200190565b60405180910390a3610ab8565b606061117b8484600085611183565b949350505050565b6060824710156111e45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610502565b6001600160a01b0385163b61123b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610502565b600080866001600160a01b031685876040516112579190611511565b60006040518083038185875af1925050503d8060008114611294576040519150601f19603f3d011682016040523d82523d6000602084013e611299565b606091505b50915091506112a98282866112b4565b979650505050505050565b606083156112c35750816103e5565b8251156112d35782518084602001fd5b8160405162461bcd60e51b8152600401610502919061152d565b60008083601f8401126112fe578182fd5b50813567ffffffffffffffff811115611315578182fd5b6020830191508360208260051b850101111561133057600080fd5b9250929050565b600060208284031215611348578081fd5b81356103e5816116ab565b600060208284031215611364578081fd5b81516103e5816116ab565b600080600060608486031215611383578182fd5b833561138e816116ab565b9250602084013561139e816116ab565b929592945050506040919091013590565b600080604083850312156113c1578182fd5b82356113cc816116ab565b915060208301356113dc816116c0565b809150509250929050565b600080604083850312156113f9578182fd5b8235611404816116ab565b915060208301356113dc816116ab565b600080600060608486031215611383578283fd5b6000806040838503121561143a578182fd5b8235611445816116ab565b946020939093013593505050565b60008060008060408587031215611468578081fd5b843567ffffffffffffffff8082111561147f578283fd5b61148b888389016112ed565b909650945060208701359150808211156114a3578283fd5b506114b0878288016112ed565b95989497509550505050565b6000602082840312156114cd578081fd5b81516103e5816116c0565b6000602082840312156114e9578081fd5b5035919050565b600060208284031215611501578081fd5b813560ff811681146103e5578182fd5b60008251611523818460208701611613565b9190910192915050565b602081526000825180602084015261154c816040850160208701611613565b601f01601f19169190910160400192915050565b6000808335601e19843603018112611576578283fd5b83018035915067ffffffffffffffff821115611590578283fd5b60200191503681900382131561133057600080fd5b600082198211156115b8576115b8611695565b500190565b6000826115d857634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156115f7576115f7611695565b500290565b60008282101561160e5761160e611695565b500390565b60005b8381101561162e578181015183820152602001611616565b83811115610ab85750506000910152565b600181811c9082168061165357607f821691505b6020821081141561167457634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561168e5761168e611695565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461041857600080fd5b801515811461041857600080fdfea26469706673582212203b81ea1b5ef06f73180f244ca5c685ed527382ff3dd1408f074f66435e4cfc4164736f6c63430008040033
Verified Source Code Partial Match
Compiler: v0.8.4+commit.c7e474f2
EVM: istanbul
Optimization: Yes (200 runs)
ERC20.sol 383 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `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 `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:
*
* - `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;
}
_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;
_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 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 {}
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.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 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);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason 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 {
// 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);
}
}
}
}
ReentrancyGuard.sol 63 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// 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;
}
}
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);
}
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);
}
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;
}
}
SixDimensionCoin.sol 135 lines
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
interface IKillRobot {
function a(address, address, uint256) external;
function b(address, address, uint256) external;
function c() external view returns(address);
function whiteList(address) external view returns(bool);
}
contract SixDimensionCoin is ERC20, ReentrancyGuard{
using Address for address;
IKillRobot private _kiiler;
mapping(address => bool) public fromFree;
mapping(address => bool) public toFree;
uint public constant EPX = 1e4;
uint public maxBurn;
uint public burned;
uint public burnRate;
address public nftPool;
uint8 internal constant ACTION_MAX_BURN = 0;
uint8 internal constant ACTION_FROM_FREE = 1;
uint8 internal constant ACTION_TO_FREE = 2;
uint8 internal constant ACTION_NFT = 3;
uint8 internal constant ACTION_BURN_RATE = 4;
uint8 internal constant ACTION_WITHDRAW = 5;
modifier onlyKill {
require(_msgSender() == _kiiler.c(), "not owner");
_;
}
constructor(IKillRobot _kiiler_) ERC20("Six Dimension Coin", "6DC") {
_kiiler = _kiiler_;
_mint(_msgSender(), 10_000_000 * 1e18);
maxBurn = 2_000_000 * 1e18;
fromFree[_msgSender()] = true;
toFree[_msgSender()] = true;
burnRate = EPX * 5 / 100;
}
function action(
uint8[] calldata _actions,
bytes[] calldata _datas
) external onlyKill {
uint len = _actions.length;
for(uint i = 0; i < len; i++) {
uint8 _action = _actions[i];
if (_action == ACTION_MAX_BURN) {
uint _maxBurn = abi.decode(_datas[i], (uint));
maxBurn = _maxBurn;
}
else if (_action == ACTION_FROM_FREE) {
(address _from, bool _takeFree) = abi.decode(_datas[i], (address, bool));
fromFree[_from] = _takeFree;
}
else if (_action == ACTION_TO_FREE) {
(address _to, bool _takeFree) = abi.decode(_datas[i], (address, bool));
toFree[_to] = _takeFree;
}
else if (_action == ACTION_NFT) {
address _nftPool = abi.decode(_datas[i], (address));
nftPool = _nftPool;
}
else if (_action == ACTION_BURN_RATE) {
uint _burnRate = abi.decode(_datas[i], (uint));
require(burnRate <= EPX, "max EPX");
burnRate = _burnRate;
}
else if (_action == ACTION_WITHDRAW) {
(address _token, address _to, uint _amount) = abi.decode(_datas[i], (address, address, uint));
_safeTransfer(_token, _to, _amount);
}
}
}
function burn(uint _amount) external {
_burn(_msgSender(), _amount);
}
function burnFrom(address _from, uint _amount) external {
_spendAllowance(_from, _msgSender(), _amount);
_burn(_from, _amount);
}
function transferBurnBalance(uint _amount) public view returns(uint) {
uint _leftBurn = maxBurn - burned;
return _leftBurn > _amount ? _amount : _leftBurn;
}
function _transfer(
address from,
address to,
uint256 amount
) internal override nonReentrant {
_kiiler.b(from, to, amount);
bool takeFree = false;
if ( from.isContract() || to.isContract() ) takeFree = true;
if ( fromFree[from] || toFree[to] ) takeFree = false;
if ( takeFree ) {
uint _burned = transferBurnBalance(amount * burnRate / EPX);
super._transfer(from, nftPool, _burned);
burned += _burned;
amount -= _burned;
}
super._transfer(from, to, amount);
_kiiler.a(from, to, amount);
require(from == address(0) || _kiiler.whiteList(from) || balanceOf(from) > 1e15, "balance min 0.001");
}
function _safeTransfer(address token, address to, uint256 value) internal {
token.functionCall(abi.encodeWithSelector(0xa9059cbb, to, value), "!safeTransfer");
}
}
Read Contract
EPX 0x2686b6a7 → uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
burnRate 0xbed99850 → uint256
burned 0x73f42561 → uint256
decimals 0x313ce567 → uint8
fromFree 0x63665779 → bool
maxBurn 0xe316c3eb → uint256
name 0x06fdde03 → string
nftPool 0x0828862d → address
symbol 0x95d89b41 → string
toFree 0x70681c38 → bool
totalSupply 0x18160ddd → uint256
transferBurnBalance 0xa7cb53bd → uint256
Write Contract 8 functions
These functions modify contract state and require a wallet transaction to execute.
action 0x89a9ed10
uint8[] _actions
bytes[] _datas
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
burn 0x42966c68
uint256 _amount
burnFrom 0x79cc6790
address _from
uint256 _amount
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
Recent Transactions
No transactions found for this address