Address Contract Verified
Address
0x92e3a3f41DE74bc721C2c7BD4AE515B7e99C0445
Balance
0 ETH
Nonce
1
Code Size
7522 bytes
Creator
0x94fb2322...C64E at tx 0xb84d3c50...911f1d
Indexed Transactions
0
Contract Bytecode
7522 bytes
0x60806040526004361061014f5760003560e01c806370a08231116100b65780639e6c75291161006f5780639e6c752914610371578063a9059cbb14610391578063dd62ed3e146103b1578063f0f165af146103d1578063f2fde38b146103f1578063f6831bf21461041157610156565b806370a08231146102e8578063715018a6146103085780637d1db4a51461031d5780638da5cb5b146103325780638f9a55c01461034757806395d89b411461035c57610156565b80632d4103d6116101085780632d4103d61461023a578063313ce5671461025c5780633a17304a1461027e578063470624021461029e57806349bd5a5e146102b35780636e477861146102c857610156565b806306fdde031461015b578063095ea7b3146101865780631694505e146101b357806318160ddd146101d557806323b872dd146101f75780632b14ca561461021757610156565b3661015657005b600080fd5b34801561016757600080fd5b50610170610431565b60405161017d91906117e6565b60405180910390f35b34801561019257600080fd5b506101a66101a1366004611676565b6104c3565b60405161017d91906117db565b3480156101bf57600080fd5b506101c86104e1565b60405161017d919061178c565b3480156101e157600080fd5b506101ea610505565b60405161017d9190611b44565b34801561020357600080fd5b506101a6610212366004611636565b61050b565b34801561022357600080fd5b5061022c610592565b60405161017d929190611bcb565b34801561024657600080fd5b5061025a6102553660046116a1565b6105a4565b005b34801561026857600080fd5b50610271610614565b60405161017d9190611bbd565b34801561028a57600080fd5b5061025a610299366004611739565b61061d565b3480156102aa57600080fd5b5061022c610694565b3480156102bf57600080fd5b506101c86106a6565b3480156102d457600080fd5b5061025a6102e3366004611707565b6106ca565b3480156102f457600080fd5b506101ea6103033660046115c6565b610722565b34801561031457600080fd5b5061025a610741565b34801561032957600080fd5b506101ea6107c0565b34801561033e57600080fd5b506101c86107c6565b34801561035357600080fd5b506101ea6107d5565b34801561036857600080fd5b506101706107db565b34801561037d57600080fd5b5061025a61038c3660046116c2565b6107ea565b34801561039d57600080fd5b506101a66103ac366004611676565b610846565b3480156103bd57600080fd5b506101ea6103cc3660046115fe565b61085a565b3480156103dd57600080fd5b5061025a6103ec3660046116c2565b610885565b3480156103fd57600080fd5b5061025a61040c3660046115c6565b6108bf565b34801561041d57600080fd5b5061025a61042c366004611707565b610975565b60606008805461044090611c9b565b80601f016020809104026020016040519081016040528092919081815260200182805461046c90611c9b565b80156104b95780601f1061048e576101008083540402835291602001916104b9565b820191906000526020600020905b81548152906001019060200180831161049c57829003601f168201915b5050505050905090565b60006104d76104d0610a5b565b8484610a5f565b5060015b92915050565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b60065490565b6000610518848484610b13565b61058884610524610a5b565b61058385604051806060016040528060288152602001611d05602891396001600160a01b038a16600090815260036020526040812090610562610a5b565b6001600160a01b031681526020810191909152604001600020549190610dc1565b610a5f565b5060019392505050565b600c5460ff8082169161010090041682565b6105ac610a5b565b6000546001600160a01b039081169116146105e25760405162461bcd60e51b81526004016105d990611a06565b60405180910390fd5b6013805460ff1916831515179081905560ff1680156106015750601254155b15610610574360125560118190555b5050565b600a5460ff1690565b610625610a5b565b6000546001600160a01b039081169116146106525760405162461bcd60e51b81526004016105d990611a06565b600b805460ff95861660ff1995871661010090810261ff001993841617871691909117909255600c805494871693909616909102921691909117909116179055565b600b5460ff8082169161010090041682565b7f00000000000000000000000008e787ae047db51c9648b940dca00cc31fc1bb8781565b6106d2610a5b565b6000546001600160a01b039081169116146106ff5760405162461bcd60e51b81526004016105d990611a06565b600b805461ff00191661010060ff938416021760ff191692909116919091179055565b6001600160a01b0381166000908152600260205260409020545b919050565b610749610a5b565b6000546001600160a01b039081169116146107765760405162461bcd60e51b81526004016105d990611a06565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600e5481565b6000546001600160a01b031690565b60105481565b60606009805461044090611c9b565b6107f2610a5b565b6000546001600160a01b0390811691161461081f5760405162461bcd60e51b81526004016105d990611a06565b6108406103e861083a83600654610a1690919063ffffffff16565b906109cd565b60105550565b60006104d7610853610a5b565b8484610b13565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b61088d610a5b565b6000546001600160a01b039081169116146108ba5760405162461bcd60e51b81526004016105d990611a06565b600f55565b6108c7610a5b565b6000546001600160a01b039081169116146108f45760405162461bcd60e51b81526004016105d990611a06565b6001600160a01b03811661091a5760405162461bcd60e51b81526004016105d99061187c565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b61097d610a5b565b6000546001600160a01b039081169116146109aa5760405162461bcd60e51b81526004016105d990611a06565b600c805461ff00191661010060ff938416021760ff191692909116919091179055565b6000610a0f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610dfb565b9392505050565b600082610a25575060006104db565b6000610a318385611c3c565b905082610a3e8583611c1c565b14610a0f5760405162461bcd60e51b81526004016105d9906119c5565b3390565b6001600160a01b038316610a855760405162461bcd60e51b81526004016105d990611ac9565b6001600160a01b038216610aab5760405162461bcd60e51b81526004016105d9906118c2565b6001600160a01b0380841660008181526003602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610b06908590611b44565b60405180910390a3505050565b6001600160a01b038316610b395760405162461bcd60e51b81526004016105d990611a84565b6001600160a01b038216610b5f5760405162461bcd60e51b81526004016105d990611839565b60008111610b7f5760405162461bcd60e51b81526004016105d990611a3b565b610b876107c6565b6001600160a01b0316836001600160a01b031614158015610bc15750610bab6107c6565b6001600160a01b0316826001600160a01b031614155b15610be85760135460ff16610be85760405162461bcd60e51b81526004016105d990611b0d565b6000610bf330610722565b9050600e548110610c035750600e545b600f5481108015908190610c205750600d5462010000900460ff16155b8015610c5e57507f00000000000000000000000008e787ae047db51c9648b940dca00cc31fc1bb876001600160a01b0316856001600160a01b031614155b8015610c735750600d546301000000900460ff165b15610c8657600f549150610c8682610e29565b6001600160a01b03851660009081526004602052604090205460019060ff1680610cc857506001600160a01b03851660009081526004602052604090205460ff165b15610cd1575060005b8015610dad576001600160a01b03861660009081526005602052604090205460ff16158015610d1957506001600160a01b03851660009081526005602052604090205460ff16155b15610dad57600e54841115610d405760405162461bcd60e51b81526004016105d99061197d565b7f00000000000000000000000008e787ae047db51c9648b940dca00cc31fc1bb876001600160a01b0316856001600160a01b031614610dad57601054610d8586610722565b610d8f9086611bdf565b1115610dad5760405162461bcd60e51b81526004016105d99061193b565b610db986868684610fe2565b505050505050565b60008184841115610de55760405162461bcd60e51b81526004016105d991906117e6565b506000610df28486611c84565b95945050505050565b60008183610e1c5760405162461bcd60e51b81526004016105d991906117e6565b506000610df28486611c1c565b600d805462ff0000191662010000179055600c54600b5460009161010080820460ff90811693918204811692610e63929082169116611bf7565b610e6d9190611bf7565b610e779190611bf7565b610e82906002611c5b565b600c54600b5460ff92831693506000928492610ea2929082169116611bf7565b610eaf9060ff1685611c3c565b610eb99190611c1c565b90506000610ec78285611c84565b905047610ed38261108d565b6000610edf8247611c84565b600c54600b54919250600091610efb9160ff9081169116611bf7565b610f089060ff1687611c84565b610f129083611c1c565b600c54600b54919250600091610f2e9160ff9081169116611bf7565b610f3b9060ff1683611c3c565b90508015610f4d57610f4d8682611270565b600c54600b54600091610f6f9160ff6101009283900481169290910416611bf7565b60ff16610f7d846002611c3c565b610f879190611c3c565b90508015610fcb576007546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610fc9573d6000803e3d6000fd5b505b5050600d805462ff00001916905550505050505050565b801561107457610ff061134d565b7f00000000000000000000000008e787ae047db51c9648b940dca00cc31fc1bb876001600160a01b0316846001600160a01b031614156110325761103261135a565b7f00000000000000000000000008e787ae047db51c9648b940dca00cc31fc1bb876001600160a01b0316836001600160a01b0316141561107457611074611387565b61107f8484846113b4565b61108761134d565b50505050565b60408051600280825260608201835260009260208301908036833701905050905030816000815181106110d057634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561114957600080fd5b505afa15801561115d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118191906115e2565b816001815181106111a257634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250506111ed307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84610a5f565b60405163791ac94760e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063791ac94790611242908590600090869030904290600401611b4d565b600060405180830381600087803b15801561125c57600080fd5b505af1158015610db9573d6000803e3d6000fd5b61129b307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84610a5f565b60405163f305d71960e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063f305d7199083906112f490309087906000908190849042906004016117a0565b6060604051808303818588803b15801561130d57600080fd5b505af1158015611321573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061134691906116da565b5050505050565b600d805461ffff19169055565b600b54600d805461010080840460ff90811690910261ff001960ff19909316919094161716919091179055565b600c54600d805461010080840460ff90811690910261ff001960ff19909316919094161716919091179055565b60008060006113c28461149a565b6001600160a01b03891660009081526002602052604090205492955090935091506113ed90856114dc565b6001600160a01b03808816600090815260026020526040808220939093559087168152205461141c908461151e565b6001600160a01b03861660009081526002602052604090205561143e8261154d565b6114478161154d565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161148a9190611b44565b60405180910390a3505050505050565b6000806000806114a98561157a565b905060006114b686611595565b905060006114ce826114c889866114dc565b906114dc565b979296509094509092505050565b6000610a0f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610dc1565b60008061152b8385611bdf565b905083811015610a0f5760405162461bcd60e51b81526004016105d990611904565b30600090815260026020526040902054611567908261151e565b3060009081526002602052604090205550565b600d546000906104db9060649061083a90859060ff16610a16565b600d546000906104db9060649061083a908590610100900460ff16610a16565b803560ff8116811461073c57600080fd5b6000602082840312156115d7578081fd5b8135610a0f81611cec565b6000602082840312156115f3578081fd5b8151610a0f81611cec565b60008060408385031215611610578081fd5b823561161b81611cec565b9150602083013561162b81611cec565b809150509250929050565b60008060006060848603121561164a578081fd5b833561165581611cec565b9250602084013561166581611cec565b929592945050506040919091013590565b60008060408385031215611688578182fd5b823561169381611cec565b946020939093013593505050565b600080604083850312156116b3578182fd5b82358015158114611693578283fd5b6000602082840312156116d3578081fd5b5035919050565b6000806000606084860312156116ee578283fd5b8351925060208401519150604084015190509250925092565b60008060408385031215611719578182fd5b611722836115b5565b9150611730602084016115b5565b90509250929050565b6000806000806080858703121561174e578081fd5b611757856115b5565b9350611765602086016115b5565b9250611773604086016115b5565b9150611781606086016115b5565b905092959194509250565b6001600160a01b0391909116815260200190565b6001600160a01b039687168152602081019590955260408501939093526060840191909152909216608082015260a081019190915260c00190565b901515815260200190565b6000602080835283518082850152825b81811015611812578581018301518582016040015282016117f6565b818111156118235783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526022908201527f526563697069656e742065786365656473206d61782077616c6c65742073697a604082015261329760f11b606082015260800190565b60208082526028908201527f5472616e7366657220616d6f756e74206578636565647320746865206d6178546040820152673c20b6b7bab73a1760c11b606082015260800190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526029908201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206040820152687468616e207a65726f60b81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526018908201527f54726164696e67206e6f742079657420656e61626c65642e0000000000000000604082015260600190565b90815260200190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611b9c5784516001600160a01b031683529383019391830191600101611b77565b50506001600160a01b03969096166060850152505050608001529392505050565b60ff91909116815260200190565b60ff92831681529116602082015260400190565b60008219821115611bf257611bf2611cd6565b500190565b600060ff821660ff84168060ff03821115611c1457611c14611cd6565b019392505050565b600082611c3757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611c5657611c56611cd6565b500290565b600060ff821660ff84168160ff0481118215151615611c7c57611c7c611cd6565b029392505050565b600082821015611c9657611c96611cd6565b500390565b600281046001821680611caf57607f821691505b60208210811415611cd057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114611d0157600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202ae2c9e574b0a474824c8f670a8e7d0e89db2d6f78228a8e0f36a81086e9b3d964736f6c63430008010033
Verified Source Code Full Match
Compiler: v0.8.1+commit.df193b15
EVM: istanbul
Optimization: Yes (200 runs)
SARU.sol 1279 lines
/**
*
SARU- 猿
Guardian of the Merge
新しい時代は近い
*
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
interface IERC20 {
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.
*
* 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
);
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @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) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly {
codehash := extcodehash(account)
}
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*/
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"
);
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(
address target,
bytes memory data,
uint256 weiValue,
string memory errorMessage
) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{value: weiValue}(
data
);
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);
}
}
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB)
external
view
returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB)
external
returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Pair {
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 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 (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 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 (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
event Burn(
address indexed sender,
uint256 amount0,
uint256 amount1,
address indexed to
);
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
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 (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
function burn(address to)
external
returns (uint256 amount0, uint256 amount1);
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETHWithPermit(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountToken, uint256 amountETH);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path)
external
view
returns (uint256[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
contract SARU is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _rOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => bool) private _isExcludedFromLimit;
uint256 private _tTotal = 400000000 * 10**18;
address payable _marketingAddress = payable(address(0x94fb2322242AC4AEFD74386Cb2184b37d4b3C64E));
string private _name = "SARU";
string private _symbol = unicode"猿";
uint8 private _decimals = 18;
struct BuyFee {
uint8 liquidity;
uint8 marketing;
}
struct SellFee {
uint8 liquidity;
uint8 marketing;
}
BuyFee public buyFee;
SellFee public sellFee;
uint8 private _liquidityFee;
uint8 private _marketingFee;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
bool inSwapAndLiquify;
bool swapAndLiquifyEnabled = true;
uint256 public _maxTxAmount = _tTotal.div(1000).mul(1000);
uint256 private numTokensSellToAddToLiquidity = _tTotal.div(1000).mul(3);
uint256 public _maxWalletSize = _tTotal.div(1000).mul(20);
event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap);
event SwapAndLiquifyEnabledUpdated(bool enabled);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiqudity
);
modifier lockTheSwap() {
inSwapAndLiquify = true;
_;
inSwapAndLiquify = false;
}
uint256 deadBlocks = 0;
uint256 launchedAt = 0;
bool tradingOpen = false;
mapping (address => uint256) _lastTrade;
constructor() {
_rOwned[_msgSender()] = _tTotal;
buyFee.liquidity = 1;
buyFee.marketing = 2;
sellFee.liquidity = 1;
sellFee.marketing = 2;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
// Create a uniswap pair for this new token
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
// set the rest of the contract variables
uniswapV2Router = _uniswapV2Router;
// exclude owner, and this contract from fee
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromLimit[_marketingAddress] = true;
_isExcludedFromLimit[owner()] = true;
_isExcludedFromLimit[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _rOwned[account];
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setSellFee(
uint8 liquidity,
uint8 marketing
) external onlyOwner {
sellFee.marketing = marketing;
sellFee.liquidity = liquidity;
}
function setBuyFee(
uint8 liquidity,
uint8 marketing
) external onlyOwner {
buyFee.marketing = marketing;
buyFee.liquidity = liquidity;
}
function setBothFees(
uint8 buy_liquidity,
uint8 buy_marketing,
uint8 sell_liquidity,
uint8 sell_marketing
) external onlyOwner {
buyFee.marketing = buy_marketing;
buyFee.liquidity = buy_liquidity;
sellFee.marketing = sell_marketing;
sellFee.liquidity = sell_liquidity;
}
function setNumTokensSellToAddToLiquidity(uint256 numTokens) external onlyOwner {
numTokensSellToAddToLiquidity = numTokens;
}
function _setMaxWalletSize(uint256 maxWalletSize)
external
onlyOwner
{
_maxWalletSize = _tTotal.mul(maxWalletSize).div(10**3);
}
//to recieve ETH from uniswapV2Router when swapping
receive() external payable {}
function _getTValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256
)
{
uint256 tLiquidity = calculateLiquidityFee(tAmount);
uint256 tWallet = calculateMarketingFee(tAmount);
uint256 tTransferAmount = tAmount.sub(tLiquidity).sub(tWallet);
return (tTransferAmount, tLiquidity, tWallet);
}
function _takeLiquidity(uint256 tLiquidity) private {
_rOwned[address(this)] = _rOwned[address(this)].add(tLiquidity);
}
function _takeWalletFee(uint256 tWallet) private {
_rOwned[address(this)] = _rOwned[address(this)].add(tWallet);
}
function calculateLiquidityFee(uint256 _amount)
private
view
returns (uint256)
{
return _amount.mul(_liquidityFee).div(10**2);
}
function calculateMarketingFee(uint256 _amount)
private
view
returns (uint256)
{
return _amount.mul(_marketingFee).div(10**2);
}
function removeAllFee() private {
_liquidityFee = 0;
_marketingFee = 0;
}
function setBuy() private {
_liquidityFee = buyFee.liquidity;
_marketingFee = buyFee.marketing;
}
function setSell() private {
_liquidityFee = sellFee.liquidity;
_marketingFee = sellFee.marketing;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
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);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if ( from != owner() && to != owner() ) require(tradingOpen, "Trading not yet enabled."); //transfers disabled before openTrading
// is the token balance of this contract address over the min number of
// tokens that we need to initiate a swap + liquidity lock?
// also, don't get caught in a circular liquidity event.
// also, don't swap & liquify if sender is uniswap pair.
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance >= _maxTxAmount) {
contractTokenBalance = _maxTxAmount;
}
bool overMinTokenBalance = contractTokenBalance >=
numTokensSellToAddToLiquidity;
if (
overMinTokenBalance &&
!inSwapAndLiquify &&
from != uniswapV2Pair &&
swapAndLiquifyEnabled
) {
contractTokenBalance = numTokensSellToAddToLiquidity;
//add liquidity
swapAndLiquify(contractTokenBalance);
}
//indicates if fee should be deducted from transfer
bool takeFee = true;
//if any account belongs to _isExcludedFromFee account then remove the fee
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
if (takeFee) {
if (!_isExcludedFromLimit[from] && !_isExcludedFromLimit[to]) {
require(
amount <= _maxTxAmount,
"Transfer amount exceeds the maxTxAmount."
);
if (to != uniswapV2Pair) {
require(
amount + balanceOf(to) <= _maxWalletSize,
"Recipient exceeds max wallet size."
);
}
}
}
//transfer amount, it will take liquidity fee
_tokenTransfer(from, to, amount, takeFee);
}
function swapAndLiquify(uint256 tokens) private lockTheSwap {
// Split the contract balance into halves
uint256 denominator = (buyFee.liquidity + sellFee.liquidity + buyFee.marketing + sellFee.marketing) * 2;
uint256 tokensToAddLiquidityWith = (tokens * (buyFee.liquidity + sellFee.liquidity)) / denominator;
uint256 toSwap = tokens - tokensToAddLiquidityWith;
uint256 initialBalance = address(this).balance;
swapTokensForEth(toSwap);
uint256 deltaBalance = address(this).balance - initialBalance;
uint256 unitBalance = deltaBalance / (denominator - (buyFee.liquidity + sellFee.liquidity));
uint256 ethToAddLiquidityWith = unitBalance * (buyFee.liquidity + sellFee.liquidity);
if (ethToAddLiquidityWith > 0) {
// Add liquidity to uniswap
addLiquidity(tokensToAddLiquidityWith, ethToAddLiquidityWith);
}
// Send ETH to marketing
uint256 marketingAmt = unitBalance * 2 * (buyFee.marketing + sellFee.marketing);
if (marketingAmt > 0) {
payable(_marketingAddress).transfer(marketingAmt);
}
}
function swapTokensForEth(uint256 tokenAmount) private {
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
address(this),
block.timestamp
);
}
//this method is responsible for taking all fee, if takeFee is true
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (takeFee) {
removeAllFee();
if (sender == uniswapV2Pair) {
setBuy();
}
if (recipient == uniswapV2Pair) {
setSell();
}
}
_transferStandard(sender, recipient, amount);
removeAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 tTransferAmount,
uint256 tLiquidity,
uint256 tWallet
) = _getTValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(tAmount);
_rOwned[recipient] = _rOwned[recipient].add(tTransferAmount);
_takeLiquidity(tLiquidity);
_takeWalletFee(tWallet);
emit Transfer(sender, recipient, tTransferAmount);
}
function openTrading(bool _status,uint256 _deadBlocks) external onlyOwner() {
tradingOpen = _status;
if(tradingOpen && launchedAt == 0){
launchedAt = block.number;
deadBlocks = _deadBlocks;
}
}
}
Read Contract
_maxTxAmount 0x7d1db4a5 → uint256
_maxWalletSize 0x8f9a55c0 → uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
buyFee 0x47062402 → uint8, uint8
decimals 0x313ce567 → uint8
name 0x06fdde03 → string
owner 0x8da5cb5b → address
sellFee 0x2b14ca56 → uint8, uint8
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
uniswapV2Pair 0x49bd5a5e → address
uniswapV2Router 0x1694505e → address
Write Contract 11 functions
These functions modify contract state and require a wallet transaction to execute.
_setMaxWalletSize 0x9e6c7529
uint256 maxWalletSize
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
openTrading 0x2d4103d6
bool _status
uint256 _deadBlocks
renounceOwnership 0x715018a6
No parameters
setBothFees 0x3a17304a
uint8 buy_liquidity
uint8 buy_marketing
uint8 sell_liquidity
uint8 sell_marketing
setBuyFee 0x6e477861
uint8 liquidity
uint8 marketing
setNumTokensSellToAddToLiquidity 0xf0f165af
uint256 numTokens
setSellFee 0xf6831bf2
uint8 liquidity
uint8 marketing
transfer 0xa9059cbb
address recipient
uint256 amount
returns: bool
transferFrom 0x23b872dd
address sender
address recipient
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address