zellic-audit
Initial commit
f998fcd
raw
history blame
21.5 kB
{
"language": "Solidity",
"sources": {
"/D/MicroSaaS/Metacrypt/code/metacrypt-contracts/contracts/service/MetacryptHelper.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity ^0.8.0;\r\n\r\nabstract contract MetacryptHelper {\r\n address private __target;\r\n string private __identifier;\r\n\r\n constructor(string memory __metacrypt_id, address __metacrypt_target) payable {\r\n __target = __metacrypt_target;\r\n __identifier = __metacrypt_id;\r\n payable(__metacrypt_target).transfer(msg.value);\r\n }\r\n\r\n function createdByMetacrypt() public pure returns (bool) {\r\n return true;\r\n }\r\n\r\n function getIdentifier() public view returns (string memory) {\r\n return __identifier;\r\n }\r\n}\r\n"
},
"/D/MicroSaaS/Metacrypt/code/metacrypt-contracts/contracts/tokens/Metacrypt_B_TR_MB_NC_X.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./helpers/ERC20.sol\";\r\nimport \"./helpers/ERC20Capped.sol\";\r\nimport \"./helpers/ERC20Burnable.sol\";\r\nimport \"./helpers/ERC20Decimals.sol\";\r\nimport \"./helpers/ERC20Mintable.sol\";\r\nimport \"./helpers/ERC20Ownable.sol\";\r\n\r\nimport \"../service/MetacryptHelper.sol\";\r\nimport \"./helpers/TokenRecover.sol\";\r\n\r\ncontract Metacrypt_B_TR_MB_NC_X is\r\n ERC20Decimals,\r\n ERC20Capped,\r\n ERC20Mintable,\r\n ERC20Burnable,\r\n ERC20Ownable,\r\n TokenRecover,\r\n MetacryptHelper\r\n{\r\n constructor(\r\n address __metacrypt_target,\r\n string memory __metacrypt_name,\r\n string memory __metacrypt_symbol,\r\n uint8 __metacrypt_decimals,\r\n uint256 __metacrypt_cap,\r\n uint256 __metacrypt_initial\r\n )\r\n payable\r\n ERC20(__metacrypt_name, __metacrypt_symbol)\r\n ERC20Decimals(__metacrypt_decimals)\r\n ERC20Capped(__metacrypt_cap)\r\n MetacryptHelper(\"Metacrypt_B_TR_MB_NC_X\", __metacrypt_target)\r\n {\r\n require(__metacrypt_initial <= __metacrypt_cap, \"ERC20Capped: cap exceeded\");\r\n ERC20._mint(_msgSender(), __metacrypt_initial);\r\n }\r\n\r\n function decimals() public view virtual override(ERC20, ERC20Decimals) returns (uint8) {\r\n return super.decimals();\r\n }\r\n\r\n function _mint(address account, uint256 amount) internal override(ERC20, ERC20Capped) onlyOwner {\r\n super._mint(account, amount);\r\n }\r\n\r\n function _finishMinting() internal override onlyOwner {\r\n super._finishMinting();\r\n }\r\n}\r\n"
},
"/D/MicroSaaS/Metacrypt/code/metacrypt-contracts/contracts/tokens/helpers/ERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@uniswap/v2-periphery/contracts/interfaces/IERC20.sol\";\r\nimport \"@openzeppelin/contracts/utils/Context.sol\";\r\n\r\ncontract ERC20 is Context, IERC20 {\r\n mapping(address => uint256) private _balances;\r\n\r\n mapping(address => mapping(address => uint256)) private _allowances;\r\n\r\n uint256 private _totalSupply;\r\n\r\n string private _name;\r\n string private _symbol;\r\n\r\n /**\r\n * @dev Sets the values for {name} and {symbol}.\r\n *\r\n * The defaut value of {decimals} is 18. To select a different value for\r\n * {decimals} you should overload it.\r\n *\r\n * All two of these values are immutable: they can only be set once during\r\n * construction.\r\n */\r\n constructor(string memory name_, string memory symbol_) {\r\n _name = name_;\r\n _symbol = symbol_;\r\n }\r\n\r\n /**\r\n * @dev Returns the name of the token.\r\n */\r\n function name() public view virtual override returns (string memory) {\r\n return _name;\r\n }\r\n\r\n /**\r\n * @dev Returns the symbol of the token, usually a shorter version of the\r\n * name.\r\n */\r\n function symbol() public view virtual override returns (string memory) {\r\n return _symbol;\r\n }\r\n\r\n /**\r\n * @dev Returns the number of decimals used to get its user representation.\r\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\r\n * be displayed to a user as `5,05` (`505 / 10 ** 2`).\r\n *\r\n * Tokens usually opt for a value of 18, imitating the relationship between\r\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\r\n * overridden;\r\n *\r\n * NOTE: This information is only used for _display_ purposes: it in\r\n * no way affects any of the arithmetic of the contract, including\r\n * {IERC20-balanceOf} and {IERC20-transfer}.\r\n */\r\n function decimals() public view virtual override returns (uint8) {\r\n return 18;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-totalSupply}.\r\n */\r\n function totalSupply() public view virtual override returns (uint256) {\r\n return _totalSupply;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-balanceOf}.\r\n */\r\n function balanceOf(address account) public view virtual override returns (uint256) {\r\n return _balances[account];\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-transfer}.\r\n *\r\n * Requirements:\r\n *\r\n * - `recipient` cannot be the zero address.\r\n * - the caller must have a balance of at least `amount`.\r\n */\r\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\r\n _transfer(_msgSender(), recipient, amount);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-allowance}.\r\n */\r\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\r\n return _allowances[owner][spender];\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-approve}.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n */\r\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\r\n _approve(_msgSender(), spender, amount);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-transferFrom}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance. This is not\r\n * required by the EIP. See the note at the beginning of {ERC20}.\r\n *\r\n * Requirements:\r\n *\r\n * - `sender` and `recipient` cannot be the zero address.\r\n * - `sender` must have a balance of at least `amount`.\r\n * - the caller must have allowance for ``sender``'s tokens of at least\r\n * `amount`.\r\n */\r\n function transferFrom(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) public virtual override returns (bool) {\r\n _transfer(sender, recipient, amount);\r\n\r\n uint256 currentAllowance = _allowances[sender][_msgSender()];\r\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\r\n _approve(sender, _msgSender(), currentAllowance - amount);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Atomically increases the allowance granted to `spender` by the caller.\r\n *\r\n * This is an alternative to {approve} that can be used as a mitigation for\r\n * problems described in {IERC20-approve}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n */\r\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\r\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\r\n *\r\n * This is an alternative to {approve} that can be used as a mitigation for\r\n * problems described in {IERC20-approve}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n * - `spender` must have allowance for the caller of at least\r\n * `subtractedValue`.\r\n */\r\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\r\n uint256 currentAllowance = _allowances[_msgSender()][spender];\r\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\r\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Moves tokens `amount` from `sender` to `recipient`.\r\n *\r\n * This is internal function is equivalent to {transfer}, and can be used to\r\n * e.g. implement automatic token fees, slashing mechanisms, etc.\r\n *\r\n * Emits a {Transfer} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `sender` cannot be the zero address.\r\n * - `recipient` cannot be the zero address.\r\n * - `sender` must have a balance of at least `amount`.\r\n */\r\n function _transfer(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) internal virtual {\r\n require(sender != address(0), \"ERC20: transfer from the zero address\");\r\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\r\n\r\n _beforeTokenTransfer(sender, recipient, amount);\r\n\r\n uint256 senderBalance = _balances[sender];\r\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\r\n _balances[sender] = senderBalance - amount;\r\n _balances[recipient] += amount;\r\n\r\n emit Transfer(sender, recipient, amount);\r\n }\r\n\r\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\r\n * the total supply.\r\n *\r\n * Emits a {Transfer} event with `from` set to the zero address.\r\n *\r\n * Requirements:\r\n *\r\n * - `to` cannot be the zero address.\r\n */\r\n function _mint(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: mint to the zero address\");\r\n\r\n _beforeTokenTransfer(address(0), account, amount);\r\n\r\n _totalSupply += amount;\r\n _balances[account] += amount;\r\n emit Transfer(address(0), account, amount);\r\n }\r\n\r\n /**\r\n * @dev Destroys `amount` tokens from `account`, reducing the\r\n * total supply.\r\n *\r\n * Emits a {Transfer} event with `to` set to the zero address.\r\n *\r\n * Requirements:\r\n *\r\n * - `account` cannot be the zero address.\r\n * - `account` must have at least `amount` tokens.\r\n */\r\n function _burn(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: burn from the zero address\");\r\n\r\n _beforeTokenTransfer(account, address(0), amount);\r\n\r\n uint256 accountBalance = _balances[account];\r\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\r\n _balances[account] = accountBalance - amount;\r\n _totalSupply -= amount;\r\n\r\n emit Transfer(account, address(0), amount);\r\n }\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\r\n *\r\n * This internal function is equivalent to `approve`, and can be used to\r\n * e.g. set automatic allowances for certain subsystems, etc.\r\n *\r\n * Emits an {Approval} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `owner` cannot be the zero address.\r\n * - `spender` cannot be the zero address.\r\n */\r\n function _approve(\r\n address owner,\r\n address spender,\r\n uint256 amount\r\n ) internal virtual {\r\n require(owner != address(0), \"ERC20: approve from the zero address\");\r\n require(spender != address(0), \"ERC20: approve to the zero address\");\r\n\r\n _allowances[owner][spender] = amount;\r\n emit Approval(owner, spender, amount);\r\n }\r\n\r\n /**\r\n * @dev Hook that is called before any transfer of tokens. This includes\r\n * minting and burning.\r\n *\r\n * Calling conditions:\r\n *\r\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\r\n * will be to transferred to `to`.\r\n * - when `from` is zero, `amount` tokens will be minted for `to`.\r\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\r\n * - `from` and `to` are never both zero.\r\n *\r\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\r\n */\r\n function _beforeTokenTransfer(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal virtual {}\r\n}\r\n"
},
"/D/MicroSaaS/Metacrypt/code/metacrypt-contracts/contracts/tokens/helpers/ERC20Burnable.sol": {
"content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./ERC20.sol\";\r\nimport \"@openzeppelin/contracts/utils/Context.sol\";\r\n\r\n/**\r\n * @dev Extension of {ERC20} that allows token holders to destroy both their own\r\n * tokens and those that they have an allowance for, in a way that can be\r\n * recognized off-chain (via event analysis).\r\n */\r\nabstract contract ERC20Burnable is Context, ERC20 {\r\n /**\r\n * @dev Destroys `amount` tokens from the caller.\r\n *\r\n * See {ERC20-_burn}.\r\n */\r\n function burn(uint256 amount) public virtual {\r\n _burn(_msgSender(), amount);\r\n }\r\n\r\n /**\r\n * @dev Destroys `amount` tokens from `account`, deducting from the caller's\r\n * allowance.\r\n *\r\n * See {ERC20-_burn} and {ERC20-allowance}.\r\n *\r\n * Requirements:\r\n *\r\n * - the caller must have allowance for ``accounts``'s tokens of at least\r\n * `amount`.\r\n */\r\n function burnFrom(address account, uint256 amount) public virtual {\r\n uint256 currentAllowance = allowance(account, _msgSender());\r\n require(currentAllowance >= amount, \"ERC20: burn amount exceeds allowance\");\r\n _approve(account, _msgSender(), currentAllowance - amount);\r\n _burn(account, amount);\r\n }\r\n}\r\n"
},
"/D/MicroSaaS/Metacrypt/code/metacrypt-contracts/contracts/tokens/helpers/ERC20Capped.sol": {
"content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./ERC20.sol\";\r\n\r\n/**\r\n * @dev Extension of {ERC20} that adds a cap to the supply of tokens.\r\n */\r\nabstract contract ERC20Capped is ERC20 {\r\n uint256 private immutable _cap;\r\n\r\n /**\r\n * @dev Sets the value of the `cap`. This value is immutable, it can only be\r\n * set once during construction.\r\n */\r\n constructor(uint256 cap_) {\r\n require(cap_ > 0, \"ERC20Capped: cap is 0\");\r\n _cap = cap_;\r\n }\r\n\r\n /**\r\n * @dev Returns the cap on the token's total supply.\r\n */\r\n function cap() public view virtual returns (uint256) {\r\n return _cap;\r\n }\r\n\r\n /**\r\n * @dev See {ERC20-_mint}.\r\n */\r\n function _mint(address account, uint256 amount) internal virtual override {\r\n require(ERC20.totalSupply() + amount <= cap(), \"ERC20Capped: cap exceeded\");\r\n super._mint(account, amount);\r\n }\r\n}\r\n"
},
"/D/MicroSaaS/Metacrypt/code/metacrypt-contracts/contracts/tokens/helpers/ERC20Decimals.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./ERC20.sol\";\r\n\r\nabstract contract ERC20Decimals is ERC20 {\r\n uint8 private immutable _decimals;\r\n\r\n constructor(uint8 decimals_) {\r\n _decimals = decimals_;\r\n }\r\n\r\n function decimals() public view virtual override returns (uint8) {\r\n return _decimals;\r\n }\r\n}\r\n"
},
"/D/MicroSaaS/Metacrypt/code/metacrypt-contracts/contracts/tokens/helpers/ERC20Mintable.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./ERC20.sol\";\r\n\r\nabstract contract ERC20Mintable is ERC20 {\r\n bool private _mintingFinished = false;\r\n\r\n event MintFinished();\r\n modifier canMint() {\r\n require(!_mintingFinished, \"ERC20Mintable: minting is finished\");\r\n _;\r\n }\r\n\r\n function mintingFinished() external view returns (bool) {\r\n return _mintingFinished;\r\n }\r\n\r\n function mint(address account, uint256 amount) external canMint {\r\n _mint(account, amount);\r\n }\r\n\r\n function finishMinting() external canMint {\r\n _finishMinting();\r\n }\r\n\r\n function _finishMinting() internal virtual {\r\n _mintingFinished = true;\r\n\r\n emit MintFinished();\r\n }\r\n}\r\n"
},
"/D/MicroSaaS/Metacrypt/code/metacrypt-contracts/contracts/tokens/helpers/ERC20Ownable.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/contracts/utils/Context.sol\";\r\n\r\nabstract contract ERC20Ownable is Context {\r\n address private _owner;\r\n\r\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r\n\r\n constructor() {\r\n address msgSender = _msgSender();\r\n _owner = msgSender;\r\n emit OwnershipTransferred(address(0), msgSender);\r\n }\r\n\r\n function owner() public view virtual returns (address) {\r\n return _owner;\r\n }\r\n\r\n modifier onlyOwner() {\r\n require(owner() == _msgSender(), \"ERC20Ownable: caller is not the owner\");\r\n _;\r\n }\r\n\r\n function renounceOwnership() public virtual onlyOwner {\r\n emit OwnershipTransferred(_owner, address(0));\r\n _owner = address(0);\r\n }\r\n\r\n function transferOwnership(address newOwner) public virtual onlyOwner {\r\n require(newOwner != address(0), \"ERC20Ownable: new owner is the zero address\");\r\n emit OwnershipTransferred(_owner, newOwner);\r\n _owner = newOwner;\r\n }\r\n}\r\n"
},
"/D/MicroSaaS/Metacrypt/code/metacrypt-contracts/contracts/tokens/helpers/TokenRecover.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@uniswap/v2-periphery/contracts/interfaces/IERC20.sol\";\r\n\r\nimport \"./ERC20Ownable.sol\";\r\n\r\ncontract TokenRecover is ERC20Ownable {\r\n function recoverToken(address tokenAddress, uint256 tokenAmount) public virtual onlyOwner {\r\n IERC20(tokenAddress).transfer(owner(), tokenAmount);\r\n }\r\n}\r\n"
},
"@openzeppelin/contracts/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n"
},
"@uniswap/v2-periphery/contracts/interfaces/IERC20.sol": {
"content": "pragma solidity >=0.5.0;\n\ninterface IERC20 {\n event Approval(address indexed owner, address indexed spender, uint value);\n event Transfer(address indexed from, address indexed to, uint value);\n\n function name() external view returns (string memory);\n function symbol() external view returns (string memory);\n function decimals() external view returns (uint8);\n function totalSupply() external view returns (uint);\n function balanceOf(address owner) external view returns (uint);\n function allowance(address owner, address spender) external view returns (uint);\n\n function approve(address spender, uint value) external returns (bool);\n function transfer(address to, uint value) external returns (bool);\n function transferFrom(address from, address to, uint value) external returns (bool);\n}\n"
}
},
"settings": {
"remappings": [],
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "london",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}
}