Address Contract Partially Verified
Address
0x12a06769C5a8881aafb4eA0F6D8b7Ad79EaEBc35
Balance
0 ETH
Nonce
1
Code Size
6749 bytes
Creator
0x804CC8D4...ABdf at tx 0xb3531ffb...e729b2
Indexed Transactions
0
Contract Bytecode
6749 bytes
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c80638da5cb5b116100c3578063a9059cbb1161007c578063a9059cbb146103f6578063b12a22a214610422578063cd2bc59514610448578063dd49756e14610450578063dd62ed3e1461046d578063f2fde38b1461049b5761014d565b80638da5cb5b1461034a57806393ee5b611461036e57806395d89b4114610394578063996c6cc31461039c578063a457c2d7146103a4578063a5b98a5a146103d05761014d565b8063313ce56711610115578063313ce56714610287578063315a095d146102a557806339509351146102c2578063485e7ba5146102ee5780634e71e0c81461031c57806370a08231146103245761014d565b806306fdde0314610152578063095ea7b3146101cf57806316114acd1461020f57806318160ddd1461023757806323b872dd14610251575b600080fd5b61015a6104c1565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561019457818101518382015260200161017c565b50505050905090810190601f1680156101c15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101fb600480360360408110156101e557600080fd5b506001600160a01b03813516906020013561054f565b604080519115158252519081900360200190f35b6102356004803603602081101561022557600080fd5b50356001600160a01b0316610565565b005b61023f610659565b60408051918252519081900360200190f35b6101fb6004803603606081101561026757600080fd5b506001600160a01b0381358116916020810135909116906040013561065f565b61028f6106d5565b6040805160ff9092168252519081900360200190f35b610235600480360360208110156102bb57600080fd5b50356106de565b6101fb600480360360408110156102d857600080fd5b506001600160a01b0381351690602001356108df565b6102356004803603604081101561030457600080fd5b506001600160a01b0381351690602001351515610915565b610235610991565b61023f6004803603602081101561033a57600080fd5b50356001600160a01b0316610a0e565b610352610a20565b604080516001600160a01b039092168252519081900360200190f35b6101fb6004803603602081101561038457600080fd5b50356001600160a01b0316610a34565b61015a610a49565b610352610aa4565b6101fb600480360360408110156103ba57600080fd5b506001600160a01b038135169060200135610ac8565b610235600480360360208110156103e657600080fd5b50356001600160a01b0316610b17565b6101fb6004803603604081101561040c57600080fd5b506001600160a01b038135169060200135610b8a565b61023f6004803603602081101561043857600080fd5b50356001600160a01b0316610b97565b610352610ce0565b6102356004803603602081101561046657600080fd5b5035610cef565b61023f6004803603604081101561048357600080fd5b506001600160a01b0381358116916020013516610eb6565b610235600480360360208110156104b157600080fd5b50356001600160a01b0316610ed3565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105475780601f1061051c57610100808354040283529160200191610547565b820191906000526020600020905b81548152906001019060200180831161052a57829003601f168201915b505050505081565b600061055c338484610f46565b50600192915050565b60055461010090046001600160a01b031633146105b6576040805162461bcd60e51b815260206004820152600a6024820152694f776e6572206f6e6c7960b01b604482015290519081900360640190fd5b6105bf81611032565b6105c857600080fd5b61065633826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561061957600080fd5b505afa15801561062d573d6000803e3d6000fd5b505050506040513d602081101561064357600080fd5b50516001600160a01b0384169190611085565b50565b60025481565b600061066c8484846110dc565b6001600160a01b038416600090815260016020908152604080832033845290915290205460001981146106c8576106c885336106c38660405180606001604052806028815260200161194760289139869190611237565b610f46565b60019150505b9392505050565b60055460ff1681565b6106e7816112ce565b6106f1338261131b565b60007f00000000000000000000000001f8989c1e556f5c89c7d46786db98eeaae82c336001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561076057600080fd5b505afa158015610774573d6000803e3d6000fd5b505050506040513d602081101561078a57600080fd5b505190506107c26001600160a01b037f00000000000000000000000001f8989c1e556f5c89c7d46786db98eeaae82c33163384611085565b6107cc8183611417565b604080516370a0823160e01b815230600482015290516001600160a01b037f00000000000000000000000001f8989c1e556f5c89c7d46786db98eeaae82c3316916370a08231916024808301926020929190829003018186803b15801561083257600080fd5b505afa158015610846573d6000803e3d6000fd5b505050506040513d602081101561085c57600080fd5b5051146108a5576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd9995c881b9bdd08195e1858dd60721b604482015290519081900360640190fd5b60408051838152905133917f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65919081900360200190a25050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161055c9185906106c39086611459565b60055461010090046001600160a01b03163314610966576040805162461bcd60e51b815260206004820152600a6024820152694f776e6572206f6e6c7960b01b604482015290519081900360640190fd5b6001600160a01b03919091166000908152600860205260409020805460ff1916911515919091179055565b6006546001600160a01b031633146109a857600080fd5b600680546001600160a01b0319169055600554604051339161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a360058054610100600160a81b0319163361010002179055565b60006020819052908152604090205481565b60055461010090046001600160a01b031681565b60086020526000908152604090205460ff1681565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105475780601f1061051c57610100808354040283529160200191610547565b7f00000000000000000000000001f8989c1e556f5c89c7d46786db98eeaae82c3381565b600061055c33846106c385604051806060016040528060258152602001611a03602591393360009081526001602090815260408083206001600160a01b038d1684529091529020549190611237565b60055461010090046001600160a01b03163314610b68576040805162461bcd60e51b815260206004820152600a6024820152694f776e6572206f6e6c7960b01b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b600061055c3384846110dc565b60006001600160a01b038216610bac57600080fd5b3360009081526008602052604090205460ff16610c00576040805162461bcd60e51b815260206004820152600d60248201526c5377656570657273206f6e6c7960981b604482015290519081900360640190fd5b60075460408051630326fdf560e31b81526001600160a01b037f00000000000000000000000001f8989c1e556f5c89c7d46786db98eeaae82c338116600483015230602483015291519190921691631937efa8916044808301926020929190829003018186803b158015610c7357600080fd5b505afa158015610c87573d6000803e3d6000fd5b505050506040513d6020811015610c9d57600080fd5b505190508015610cdb57610cdb6001600160a01b037f00000000000000000000000001f8989c1e556f5c89c7d46786db98eeaae82c33168383611085565b919050565b6007546001600160a01b031681565b610cf881610656565b60007f00000000000000000000000001f8989c1e556f5c89c7d46786db98eeaae82c336001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610d6757600080fd5b505afa158015610d7b573d6000803e3d6000fd5b505050506040513d6020811015610d9157600080fd5b50519050610dca6001600160a01b037f00000000000000000000000001f8989c1e556f5c89c7d46786db98eeaae82c33163330856114b3565b6000610e6f827f00000000000000000000000001f8989c1e556f5c89c7d46786db98eeaae82c336001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610e3d57600080fd5b505afa158015610e51573d6000803e3d6000fd5b505050506040513d6020811015610e6757600080fd5b505190611417565b9050610e7b3382611513565b60408051848152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a2505050565b600160209081526000928352604080842090915290825290205481565b60055461010090046001600160a01b03163314610f24576040805162461bcd60e51b815260206004820152600a6024820152694f776e6572206f6e6c7960b01b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610f8b5760405162461bcd60e51b81526004018080602001828103825260248152602001806119b56024913960400191505060405180910390fd5b6001600160a01b038216610fd05760405162461bcd60e51b81526004018080602001828103825260228152602001806118d96022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60006001600160a01b038216301480159061107f57507f00000000000000000000000001f8989c1e556f5c89c7d46786db98eeaae82c336001600160a01b0316826001600160a01b031614155b92915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526110d7908490611603565b505050565b6001600160a01b0383166111215760405162461bcd60e51b81526004018080602001828103825260258152602001806119906025913960400191505060405180910390fd5b6001600160a01b0382166111665760405162461bcd60e51b81526004018080602001828103825260238152602001806118946023913960400191505060405180910390fd5b6111718383836110d7565b6111ae816040518060600160405280602681526020016118fb602691396001600160a01b0386166000908152602081905260409020549190611237565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546111dd9082611459565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156112c65760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561128b578181015183820152602001611273565b50505050905090810190601f1680156112b85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6040805162461bcd60e51b815260206004820152601b60248201527f526f6f744b6974206c6971756964697479206973206c6f636b65640000000000604482015290519081900360640190fd5b6001600160a01b0382166113605760405162461bcd60e51b815260040180806020018281038252602181526020018061196f6021913960400191505060405180910390fd5b61136c826000836110d7565b6113a9816040518060600160405280602281526020016118b7602291396001600160a01b0385166000908152602081905260409020549190611237565b6001600160a01b0383166000908152602081905260409020556002546113cf9082611417565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b60006106ce83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611237565b6000828201838110156106ce576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261150d908590611603565b50505050565b6001600160a01b03821661156e576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b61157a600083836110d7565b6002546115879082611459565b6002556001600160a01b0382166000908152602081905260409020546115ad9082611459565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6060611658826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116b49092919063ffffffff16565b8051909150156110d75780806020019051602081101561167757600080fd5b50516110d75760405162461bcd60e51b815260040180806020018281038252602a8152602001806119d9602a913960400191505060405180910390fd5b60606116c384846000856116cb565b949350505050565b60608247101561170c5760405162461bcd60e51b81526004018080602001828103825260268152602001806119216026913960400191505060405180910390fd5b61171585611827565b611766576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106117a55780518252601f199092019160209182019101611786565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611807576040519150601f19603f3d011682016040523d82523d6000602084013e61180c565b606091505b509150915061181c82828661182d565b979650505050505050565b3b151590565b6060831561183c5750816106ce565b82511561184c5782518084602001fd5b60405162461bcd60e51b815260206004820181815284516024840152845185939192839260440191908501908083836000831561128b57818101518382015260200161127356fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212209f134c9bd16fd0c7b797d3b6901d8bce7f58c6b21cd4889972f710b8887b6bfa64736f6c63430007040033
Verified Source Code Partial Match
Compiler: v0.7.4+commit.3f05b770
EVM: istanbul
Optimization: Yes (200 runs)
ERC20.sol 260 lines
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
/* ROOTKIT:
Simplified thanks to higher solidity version
But same functionality
*/
import "./IERC20.sol";
import "./SafeMath.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
abstract contract ERC20 is IERC20
{
using SafeMath for uint256;
mapping (address => uint256) public override balanceOf;
mapping (address => mapping (address => uint256)) public override allowance;
uint256 public override totalSupply;
string public override name;
string public override symbol;
uint8 public override decimals = 18;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three 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 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(msg.sender, recipient, amount);
return true;
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(msg.sender, 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 oldAllowance = allowance[sender][msg.sender];
if (oldAllowance != uint256(-1)) {
_approve(sender, msg.sender, oldAllowance.sub(amount, "ERC20: transfer amount exceeds allowance"));
}
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(msg.sender, spender, allowance[msg.sender][spender].add(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) {
_approve(msg.sender, spender, allowance[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
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);
balanceOf[sender] = balanceOf[sender].sub(amount, "ERC20: transfer amount exceeds balance");
balanceOf[recipient] = balanceOf[recipient].add(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 = totalSupply.add(amount);
balanceOf[account] = balanceOf[account].add(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);
balanceOf[account] = balanceOf[account].sub(amount, "ERC20: burn amount exceeds balance");
totalSupply = totalSupply.sub(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");
allowance[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 _decimals) internal {
decimals = _decimals;
}
/**
* @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 { }
}
Owned.sol 36 lines
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
/* ROOTKIT:
Provides ownerOnly() modifier
Allows for ownership transfer but requires the new
owner to claim (accept) ownership
Safer because no accidental transfers or renouncing
*/
import "./IOwned.sol";
abstract contract Owned is IOwned
{
address public override owner = msg.sender;
address internal pendingOwner;
modifier ownerOnly()
{
require (msg.sender == owner, "Owner only");
_;
}
function transferOwnership(address newOwner) public override ownerOnly()
{
pendingOwner = newOwner;
}
function claimOwnership() public override
{
require (pendingOwner == msg.sender);
pendingOwner = address(0);
emit OwnershipTransferred(owner, msg.sender);
owner = msg.sender;
}
}
IERC20.sol 19 lines
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
interface IERC20
{
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function totalSupply() external view returns (uint256);
function balanceOf(address _account) external view returns (uint256);
function transfer(address _recipient, uint256 _amount) external returns (bool);
function allowance(address _owner, address _spender) external view returns (uint256);
function approve(address _spender, uint256 _amount) external returns (bool);
function transferFrom(address _sender, address _recipient, uint256 _amount) external returns (bool);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
IOwned.sol 12 lines
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
interface IOwned
{
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owner() external view returns (address);
function transferOwnership(address newOwner) external;
function claimOwnership() external;
}
Address.sol 188 lines
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(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");
// solhint-disable-next-line avoid-low-level-calls
(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");
// solhint-disable-next-line avoid-low-level-calls
(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.3._
*/
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.3._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
ERC31337.sol 50 lines
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
/* ROOTKIT:
A wrapped token, where the underlying token can be swept
and used for other purposes
Governed by an installable floor calculator contract
Sweepable by designated sweeper addresses
*/
import "./IERC20.sol";
import "./SafeERC20.sol";
import "./Owned.sol";
import "./IFloorCalculator.sol";
import "./WrappedERC20.sol";
import "./IERC31337.sol";
contract ERC31337 is Owned, WrappedERC20, IERC31337
{
using SafeERC20 for IERC20;
IFloorCalculator public override floorCalculator;
mapping (address => bool) public override sweepers;
constructor(IERC20 _wrappedToken, string memory _name, string memory _symbol)
WrappedERC20(_wrappedToken, _name, _symbol)
{
}
function setFloorCalculator(IFloorCalculator _floorCalculator) public override ownerOnly()
{
floorCalculator = _floorCalculator;
}
function setSweeper(address sweeper, bool allow) public override ownerOnly()
{
sweepers[sweeper] = allow;
}
function sweepFloor(address to) public override returns (uint256 amountSwept)
{
require (to != address(0));
require (sweepers[msg.sender], "Sweepers only");
amountSwept = floorCalculator.calculateSubFloor(wrappedToken, this);
if (amountSwept > 0) {
wrappedToken.safeTransfer(to, amountSwept);
}
}
}
SafeMath.sol 66 lines
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
/* ROOTKIT:
O wherefore art thou 8 point O
*/
library SafeMath
{
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256)
{
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256)
{
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0)
{
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256)
{
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256)
{
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256)
{
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256)
{
require(b != 0, errorMessage);
return a % b;
}
}
IERC31337.sol 15 lines
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
import "./IWrappedERC20.sol";
import "./IFloorCalculator.sol";
interface IERC31337 is IWrappedERC20
{
function floorCalculator() external view returns (IFloorCalculator);
function sweepers(address _sweeper) external view returns (bool);
function setFloorCalculator(IFloorCalculator _floorCalculator) external;
function setSweeper(address _sweeper, bool _allow) external;
function sweepFloor(address _to) external returns (uint256 amountSwept);
}
SafeERC20.sol 62 lines
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
/* ROOTKIT:
Modified to remove some junk
Also modified to remove silly restrictions (traps!) within safeApprove
*/
import "./IERC20.sol";
import "./SafeMath.sol";
import "./Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
WrappedERC20.sol 62 lines
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
/* ROOTKIT:
Wraps any ERC20
Similar to WETH except for ERC20 tokens instead of ETH
depositTokens/withdrawTokens are like deposit/withdraw in WETH
Inheriters can hook into depositTokens and withdrawTokens
by overriding _beforeDepositTokens and _beforeWithdrawTokens
*/
import "./IERC20.sol";
import "./ERC20.sol";
import "./IWrappedERC20.sol";
import "./TokensRecoverable.sol";
import "./SafeERC20.sol";
import "./SafeMath.sol";
contract WrappedERC20 is ERC20, IWrappedERC20, TokensRecoverable
{
using SafeERC20 for IERC20;
using SafeMath for uint256;
IERC20 public immutable override wrappedToken;
constructor (IERC20 _wrappedToken, string memory _name, string memory _symbol)
ERC20(_name, _symbol)
{
if (_wrappedToken.decimals() != 18) {
_setupDecimals(_wrappedToken.decimals());
}
wrappedToken = _wrappedToken;
}
function depositTokens(uint256 _amount) public override
{
_beforeDepositTokens(_amount);
uint256 myBalance = wrappedToken.balanceOf(address(this));
wrappedToken.safeTransferFrom(msg.sender, address(this), _amount);
uint256 received = wrappedToken.balanceOf(address(this)).sub(myBalance);
_mint(msg.sender, received);
emit Deposit(msg.sender, _amount);
}
function withdrawTokens(uint256 _amount) public override
{
_beforeWithdrawTokens(_amount);
_burn(msg.sender, _amount);
uint256 myBalance = wrappedToken.balanceOf(address(this));
wrappedToken.safeTransfer(msg.sender, _amount);
require (wrappedToken.balanceOf(address(this)) == myBalance.sub(_amount), "Transfer not exact");
emit Withdrawal(msg.sender, _amount);
}
function canRecoverTokens(IERC20 token) internal virtual override view returns (bool)
{
return token != this && token != wrappedToken;
}
function _beforeDepositTokens(uint256 _amount) internal virtual view { }
function _beforeWithdrawTokens(uint256 _amount) internal virtual view { }
}
IWrappedERC20.sol 12 lines
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
import "./IERC20.sol";
import "./IWrappedERC20Events.sol";
interface IWrappedERC20 is IERC20, IWrappedERC20Events
{
function wrappedToken() external view returns (IERC20);
function depositTokens(uint256 _amount) external;
function withdrawTokens(uint256 _amount) external;
}
IUniswapV2Pair.sol 53 lines
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
IFloorCalculator.sol 9 lines
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
import "./IERC20.sol";
interface IFloorCalculator
{
function calculateSubFloor(IERC20 wrappedToken, IERC20 backingToken) external view returns (uint256);
}
RootKitLiquidity.sol 24 lines
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
/* ROOTKIT:
A wrapper for liquidity tokens so they can be distributed
but not allowing for removal of liquidity
*/
import "./ERC31337.sol";
import "./IUniswapV2Pair.sol";
import "./IERC20.sol";
contract RootKitLiquidity is ERC31337
{
constructor(IUniswapV2Pair _pair, string memory _name, string memory _symbol)
ERC31337(IERC20(address(_pair)), _name, _symbol)
{
}
function _beforeWithdrawTokens(uint256) internal override pure
{
revert("RootKit liquidity is locked");
}
}
TokensRecoverable.sol 28 lines
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
/* ROOTKIT:
Allows recovery of unexpected tokens (airdrops, etc)
Inheriters can customize logic by overriding canRecoverTokens
*/
import "./IERC20.sol";
import "./SafeERC20.sol";
import "./Owned.sol";
import "./ITokensRecoverable.sol";
abstract contract TokensRecoverable is Owned, ITokensRecoverable
{
using SafeERC20 for IERC20;
function recoverTokens(IERC20 token) public override ownerOnly()
{
require (canRecoverTokens(token));
token.safeTransfer(msg.sender, token.balanceOf(address(this)));
}
function canRecoverTokens(IERC20 token) internal virtual view returns (bool)
{
return address(token) != address(this);
}
}
ITokensRecoverable.sol 9 lines
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
import "./IERC20.sol";
interface ITokensRecoverable
{
function recoverTokens(IERC20 token) external;
}
IWrappedERC20Events.sol 8 lines
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
interface IWrappedERC20Events
{
event Deposit(address indexed from, uint256 amount);
event Withdrawal(address indexed to, uint256 amount);
}
Read Contract
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
floorCalculator 0xcd2bc595 → address
name 0x06fdde03 → string
owner 0x8da5cb5b → address
sweepers 0x93ee5b61 → bool
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
wrappedToken 0x996c6cc3 → address
Write Contract 13 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
claimOwnership 0x4e71e0c8
No parameters
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
depositTokens 0xdd49756e
uint256 _amount
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
recoverTokens 0x16114acd
address token
setFloorCalculator 0xa5b98a5a
address _floorCalculator
setSweeper 0x485e7ba5
address sweeper
bool allow
sweepFloor 0xb12a22a2
address to
returns: uint256
transfer 0xa9059cbb
address recipient
uint256 amount
returns: bool
transferFrom 0x23b872dd
address sender
address recipient
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
withdrawTokens 0x315a095d
uint256 _amount
Recent Transactions
No transactions found for this address