Address Contract Partially Verified
Address
0x43a89815F33747eDBeCC588d6BB7E1c10dDa5599
Balance
0 ETH
Nonce
1
Code Size
7282 bytes
Creator
0xF5488c25...9407 at tx 0x679f8010...afedf3
Indexed Transactions
0
Contract Bytecode
7282 bytes
0x608060405234801561001057600080fd5b50600436106101ae5760003560e01c806370a08231116100ee578063a9059cbb11610097578063d153b60c11610071578063d153b60c146103a7578063dd62ed3e146103ba578063e055555d146103f3578063f119f5671461044c57600080fd5b8063a9059cbb1461036e578063af9549e014610381578063b5ed298a1461039457600080fd5b8063a457c2d7116100c8578063a457c2d714610323578063a64e4f8a14610336578063a901dd921461035b57600080fd5b806370a08231146102df5780638da5cb5b1461030857806395d89b411461031b57600080fd5b8063313ce5671161015b5780633950935111610135578063395093511461028e57806342966c68146102a15780634e71e0c8146102b45780635342acb4146102bc57600080fd5b8063313ce5671461024157806334e731221461025057806338af3eed1461026357600080fd5b806318160ddd1161018c57806318160ddd146102095780631c31f7101461021b57806323b872dd1461022e57600080fd5b806306fdde03146101b3578063095727e0146101d1578063095ea7b3146101e6575b600080fd5b6101bb61045f565b6040516101c89190611a80565b60405180910390f35b6101e46101df366004611986565b6104f1565b005b6101f96101f4366004611923565b6105a6565b60405190151581526020016101c8565b6002545b6040519081526020016101c8565b6101e4610229366004611862565b6105bc565b6101f961023c3660046118b6565b61065f565b604051601281526020016101c8565b61020d61025e366004611a5f565b610744565b600c54610276906001600160a01b031681565b6040516001600160a01b0390911681526020016101c8565b6101f961029c366004611923565b610764565b6101e46102af366004611a2f565b61079b565b6101e46107a8565b6101f96102ca366004611862565b600d6020526000908152604090205460ff1681565b61020d6102ed366004611862565b6001600160a01b031660009081526020819052604090205490565b600554610276906001600160a01b031681565b6101bb61083a565b6101f9610331366004611923565b610849565b600c546101f99074010000000000000000000000000000000000000000900460ff1681565b6101e461036936600461194e565b610916565b6101f961037c366004611923565b6109ac565b6101e461038f3660046118f6565b6109b9565b6101e46103a2366004611862565b610a51565b600654610276906001600160a01b031681565b61020d6103c836600461187e565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600854600954600a54600b54610419936001600160a01b03908116938116928116911684565b604080516001600160a01b03958616815293851660208501529184169183019190915290911660608201526080016101c8565b6101e461045a366004611a2f565b610aa2565b60606003805461046e90611b96565b80601f016020809104026020016040519081016040528092919081815260200182805461049a90611b96565b80156104e75780601f106104bc576101008083540402835291602001916104e7565b820191906000526020600020905b8154815290600101906020018083116104ca57829003601f168201915b5050505050905090565b6005546001600160a01b0316331461050857600080fd5b6040517f3e85e06aae67714e679dacf3d57ddfb4bb18cb0b78ceeed5867b92fadb29397090600090a18051600880547fffffffffffffffffffffffff00000000000000000000000000000000000000009081166001600160a01b039384161790915560208301516009805483169184169190911790556040830151600a80548316918416919091179055606090920151600b80549093169116179055565b60006105b333848461103a565b50600192915050565b6005546001600160a01b031633146105d357600080fd5b6105de8160016109b9565b600c54604080516001600160a01b03928316815291831660208301527fe72eaf6addaa195f3c83095031dd08f3a96808dcf047babed1fe4e4f69d6c622910160405180910390a1600c80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b600061066c8484846111c7565b6001600160a01b038416600090815260016020908152604080832033845290915290205482811015610725576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e636500000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61073985336107348685611b7f565b61103a565b506001949350505050565b60006127106107538385611b42565b61075d9190611b09565b9392505050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916105b3918590610734908690611af1565b6107a53382611340565b50565b6006546001600160a01b031633146107bf57600080fd5b6006546005546040516001600160a01b0392831692909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600654600580547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03909216919091179055565b60606004805461046e90611b96565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156108fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161071c565b61090c33856107348685611b7f565b5060019392505050565b6005546001600160a01b0316331461092d57600080fd5b60405181151581527fba500994dffbabeeb9e430f03a978d7b975359a20c5bde3a6ccb5a0c454680c89060200160405180910390a1600c805491151574010000000000000000000000000000000000000000027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909216919091179055565b60006105b33384846111c7565b6005546001600160a01b031633146109d057600080fd5b6001600160a01b0382166000818152600d602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515159081179091558251938452908301527f318c131114339c004fff0a22fcdbbc0566bb2a7cd3aa1660e636ec5a66784ff2910160405180910390a15050565b6005546001600160a01b03163314610a6857600080fd5b600680547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6007546040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018390526001600160a01b03909116906323b872dd90606401602060405180830381600087803b158015610b0d57600080fd5b505af1158015610b21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b45919061196a565b506000610b5461271083611b09565b90506000610b64836109c4610744565b9050600760009054906101000a90046001600160a01b03166001600160a01b0316638fe6cae36040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610bb657600080fd5b505af1158015610bca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bee9190611a47565b600754604080517f18160ddd000000000000000000000000000000000000000000000000000000008152905184926001600160a01b0316916318160ddd916004808301926020929190829003018186803b158015610c4b57600080fd5b505afa158015610c5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c839190611a47565b610c8d9190611b7f565b10610d0e576007546040517f42966c68000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015610cf157600080fd5b505af1158015610d05573d6000803e3d6000fd5b50505050610d12565b5060005b6000610d1f846064610744565b90506000610d2e600483611b09565b600754600b546040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b03918216600482015260248101869052929350169063a9059cbb90604401602060405180830381600087803b158015610d9957600080fd5b505af1158015610dad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd1919061196a565b506007546009546040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201526024810184905291169063a9059cbb90604401602060405180830381600087803b158015610e3b57600080fd5b505af1158015610e4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e73919061196a565b506007546008546040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201526024810184905291169063a9059cbb90604401602060405180830381600087803b158015610edd57600080fd5b505af1158015610ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f15919061196a565b50600754600a546001600160a01b039182169163a9059cbb9116610f3a846002611b42565b85610f45888b611b7f565b610f4f9190611b7f565b610f599190611b7f565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015610fb757600080fd5b505af1158015610fcb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fef919061196a565b50610ffa33856114fa565b60408051868152602081018690527f831683a0a2794a398b7d69c2b83ba3c01f936a631165543a1a686a39e3164886910160405180910390a15050505050565b6001600160a01b0383166110cf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161071c565b6001600160a01b038216611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015260840161071c565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b03821630141561125f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e6e6f742073656e6420746f6b656e7320746f20746f6b656e20636f6e7460448201527f7261637400000000000000000000000000000000000000000000000000000000606482015260840161071c565b600c5474010000000000000000000000000000000000000000900460ff1615806112a157506001600160a01b0383166000908152600d602052604090205460ff165b806112c457506001600160a01b0382166000908152600d602052604090205460ff165b156112d9576112d48383836115f3565b505050565b60006112e6826019610744565b90506112f28482611340565b60006112ff8360c8610744565b600c5490915061131a9086906001600160a01b0316836115f3565b61133985858461132a8588611b7f565b6113349190611b7f565b6115f3565b5050505050565b6001600160a01b0382166113d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161071c565b6001600160a01b0382166000908152602081905260409020548181101561147f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f6365000000000000000000000000000000000000000000000000000000000000606482015260840161071c565b6114898282611b7f565b6001600160a01b038416600090815260208190526040812091909155600280548492906114b7908490611b7f565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016111ba565b6001600160a01b03821661156a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161071c565b806002600082825461157c9190611af1565b90915550506001600160a01b038216600090815260208190526040812080548392906115a9908490611af1565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b038316611689576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161071c565b6001600160a01b03821661171f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161071c565b6001600160a01b038316600090815260208190526040902054818110156117c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161071c565b6117d28282611b7f565b6001600160a01b038086166000908152602081905260408082209390935590851681529081208054849290611808908490611af1565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161185491815260200190565b60405180910390a350505050565b600060208284031215611873578081fd5b813561075d81611c19565b60008060408385031215611890578081fd5b823561189b81611c19565b915060208301356118ab81611c19565b809150509250929050565b6000806000606084860312156118ca578081fd5b83356118d581611c19565b925060208401356118e581611c19565b929592945050506040919091013590565b60008060408385031215611908578182fd5b823561191381611c19565b915060208301356118ab81611c2e565b60008060408385031215611935578182fd5b823561194081611c19565b946020939093013593505050565b60006020828403121561195f578081fd5b813561075d81611c2e565b60006020828403121561197b578081fd5b815161075d81611c2e565b600060808284031215611997578081fd5b6040516080810181811067ffffffffffffffff821117156119df577f4e487b710000000000000000000000000000000000000000000000000000000083526041600452602483fd5b60405282356119ed81611c19565b815260208301356119fd81611c19565b60208201526040830135611a1081611c19565b60408201526060830135611a2381611c19565b60608201529392505050565b600060208284031215611a40578081fd5b5035919050565b600060208284031215611a58578081fd5b5051919050565b60008060408385031215611a71578182fd5b50508035926020909101359150565b6000602080835283518082850152825b81811015611aac57858101830151858201604001528201611a90565b81811115611abd5783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60008219821115611b0457611b04611bea565b500190565b600082611b3d577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611b7a57611b7a611bea565b500290565b600082821015611b9157611b91611bea565b500390565b600181811c90821680611baa57607f821691505b60208210811415611be4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6001600160a01b03811681146107a557600080fd5b80151581146107a557600080fdfea2646970667358221220cab5754d60f1317f2e00057a741f552b7c60e3a75799ede7474a5bbf003cd0c364736f6c63430008040033
Verified Source Code Partial Match
Compiler: v0.8.4+commit.c7e474f2
EVM: istanbul
Optimization: Yes (10000 runs)
Thunder.sol 706 lines
// 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
);
}
/**
* @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);
}
/*
* @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) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @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 defaut 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"
);
_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"
);
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is 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"
);
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(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:
*
* - `to` 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);
}
/**
* @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");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(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 to 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 {}
}
contract Owned {
address public owner;
address public proposedOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() virtual {
require(msg.sender == owner);
_;
}
/**
* @dev propeses a new owner
* Can only be called by the current owner.
*/
function proposeOwner(address payable _newOwner) external onlyOwner {
proposedOwner = _newOwner;
}
/**
* @dev claims ownership of the contract
* Can only be called by the new proposed owner.
*/
function claimOwnership() external {
require(msg.sender == proposedOwner);
emit OwnershipTransferred(owner, proposedOwner);
owner = proposedOwner;
}
}
interface IPika {
function minSupply() external returns (uint256);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
function burn(uint256 value) external;
}
struct Wallets {
address team;
address charity;
address staking;
address liquidity;
}
contract Thunder is ERC20, Owned {
IPika pika;
Wallets public pikaWallets;
address public beneficiary;
bool public feesEnabled;
mapping(address => bool) public isExcludedFromFee;
event BeneficiaryUpdated(address oldBeneficiary, address newBeneficiary);
event FeesEnabledUpdated(bool enabled);
event ExcludedFromFeeUpdated(address account, bool excluded);
event PikaWalletsUpdated();
event Evolved(uint256 amountPika, uint256 amountThunder);
constructor(address _pika, Wallets memory _pikaWallets)
ERC20("THUNDER", "THUN")
{
pika = IPika(_pika);
pikaWallets = _pikaWallets;
// premine for uniswap liquidity
uint256 totalSupply = 70000000 ether;
feesEnabled = false;
_mint(_msgSender(), totalSupply);
isExcludedFromFee[msg.sender] = true;
isExcludedFromFee[0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D] = true;
beneficiary = msg.sender;
}
function evolve(uint256 _amountPika) external {
pika.transferFrom(msg.sender, address(this), _amountPika);
uint256 amountThunder = _amountPika / 10000;
uint256 burnedPika = calculateFee(_amountPika, 2500);
if (pika.totalSupply() - burnedPika >= pika.minSupply()) {
pika.burn(burnedPika);
} else {
burnedPika = 0;
}
uint256 lpRewards = calculateFee(_amountPika, 100);
uint256 charityTeamAmount = lpRewards / 4;
pika.transfer(pikaWallets.liquidity, lpRewards);
pika.transfer(pikaWallets.charity, charityTeamAmount);
pika.transfer(pikaWallets.team, charityTeamAmount);
pika.transfer(
pikaWallets.staking,
_amountPika - burnedPika - lpRewards - charityTeamAmount * 2
);
_mint(msg.sender, amountThunder);
emit Evolved(_amountPika, amountThunder);
}
/**
* @dev if fees are enabled, subtract 2.25% fee and send it to beneficiary
* @dev after a certain threshold, try to swap collected fees automatically
* @dev if automatic swap fails (or beneficiary does not implement swapTokens function) transfer should still succeed
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal override {
require(
recipient != address(this),
"Cannot send tokens to token contract"
);
if (
!feesEnabled ||
isExcludedFromFee[sender] ||
isExcludedFromFee[recipient]
) {
ERC20._transfer(sender, recipient, amount);
return;
}
uint256 burnedFee = calculateFee(amount, 25);
_burn(sender, burnedFee);
uint256 transferFee = calculateFee(amount, 200);
ERC20._transfer(sender, beneficiary, transferFee);
ERC20._transfer(sender, recipient, amount - transferFee - burnedFee);
}
function calculateFee(uint256 _amount, uint256 _fee)
public
pure
returns (uint256)
{
return (_amount * _fee) / 10000;
}
/**
* @notice allows to burn tokens from own balance
* @dev only allows burning tokens until minimum supply is reached
* @param value amount of tokens to burn
*/
function burn(uint256 value) public {
_burn(_msgSender(), value);
}
/**
* @notice sets recipient of transfer fee
* @dev only callable by owner
* @param _newBeneficiary new beneficiary
*/
function setBeneficiary(address _newBeneficiary) public onlyOwner {
setExcludeFromFee(_newBeneficiary, true);
emit BeneficiaryUpdated(beneficiary, _newBeneficiary);
beneficiary = _newBeneficiary;
}
/**
* @notice sets the wallets for the pika tokens
* @dev only callable by owner
* @param _newWallets updated wallets
*/
function setPikaWallets(Wallets memory _newWallets) public onlyOwner {
emit PikaWalletsUpdated();
pikaWallets = _newWallets;
}
/**
* @notice sets whether account collects fees on token transfer
* @dev only callable by owner
* @param _enabled bool whether fees are enabled
*/
function setFeesEnabled(bool _enabled) public onlyOwner {
emit FeesEnabledUpdated(_enabled);
feesEnabled = _enabled;
}
/**
* @notice adds or removes an account that is exempt from fee collection
* @dev only callable by owner
* @param _account account to modify
* @param _excluded new value
*/
function setExcludeFromFee(address _account, bool _excluded)
public
onlyOwner
{
isExcludedFromFee[_account] = _excluded;
emit ExcludedFromFeeUpdated(_account, _excluded);
}
}
Read Contract
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
beneficiary 0x38af3eed → address
calculateFee 0x34e73122 → uint256
decimals 0x313ce567 → uint8
feesEnabled 0xa64e4f8a → bool
isExcludedFromFee 0x5342acb4 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
pikaWallets 0xe055555d → address, address, address, address
proposedOwner 0xd153b60c → address
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
Write Contract 13 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
burn 0x42966c68
uint256 value
claimOwnership 0x4e71e0c8
No parameters
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
evolve 0xf119f567
uint256 _amountPika
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
proposeOwner 0xb5ed298a
address _newOwner
setBeneficiary 0x1c31f710
address _newBeneficiary
setExcludeFromFee 0xaf9549e0
address _account
bool _excluded
setFeesEnabled 0xa901dd92
bool _enabled
setPikaWallets 0xad98c222
tuple _newWallets
transfer 0xa9059cbb
address recipient
uint256 amount
returns: bool
transferFrom 0x23b872dd
address sender
address recipient
uint256 amount
returns: bool
Recent Transactions
No transactions found for this address