Address Contract Verified
Address
0x24BCeC1AFda63E622a97F17cFf9a61FFCfd9b735
Balance
0 ETH
Nonce
1
Code Size
8180 bytes
Creator
0x9867cc78...3E01 at tx 0x10c12cdb...285531
Indexed Transactions
0 (1 on-chain, 0.7% indexed)
Contract Bytecode
8180 bytes
0x608060405234801561001057600080fd5b50600436106101da5760003560e01c806370a0823111610104578063a9059cbb116100a2578063dd62ed3e11610071578063dd62ed3e14610563578063e7a1e3ec14610591578063e86f1b5c146105ae578063ec33001a146105b6576101da565b8063a9059cbb146104e5578063bd15b66914610511578063d3681b9514610519578063d650694c1461053d576101da565b806382e4eda4116100de57806382e4eda41461044057806395d89b41146104a9578063a457c2d7146104b1578063a4e2d634146104dd576101da565b806370a08231146103ec5780637f700d2114610412578063817b1cd214610438576101da565b80633149432c1161017c5780633e8310cc1161014b5780633e8310cc1461039357806357e3aec41461039b57806365759af2146103b85780637048dca6146103e4576101da565b80633149432c1461033157806338a058711461035757806339267f091461035f5780633950935114610367576101da565b806318160ddd116101b857806318160ddd146102a657806321a358f1146102c057806323b872dd146102dd578063313ce56714610313576101da565b806306fdde03146101df578063095ea7b31461025c5780630d6aef041461029c575b600080fd5b6101e76105dc565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610221578181015183820152602001610209565b50505050905090810190601f16801561024e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102886004803603604081101561027257600080fd5b506001600160a01b038135169060200135610603565b604080519115158252519081900360200190f35b6102a461061a565b005b6102ae61067c565b60408051918252519081900360200190f35b6102a4600480360360208110156102d657600080fd5b5035610682565b610288600480360360608110156102f357600080fd5b506001600160a01b03813581169160208101359091169060400135610732565b61031b6107a1565b6040805160ff9092168252519081900360200190f35b6102ae6004803603602081101561034757600080fd5b50356001600160a01b03166107a6565b6102a461087b565b6102a4610949565b6102886004803603604081101561037d57600080fd5b506001600160a01b038135169060200135610a0a565b6102ae610a46565b6102a4600480360360208110156103b157600080fd5b5035610a4c565b6102a4600480360360408110156103ce57600080fd5b50803590602001356001600160a01b0316610afc565b6102ae610d44565b6102ae6004803603602081101561040257600080fd5b50356001600160a01b0316610d54565b6102a46004803603602081101561042857600080fd5b50356001600160a01b0316610d6f565b6102ae610e3c565b6104666004803603602081101561045657600080fd5b50356001600160a01b0316610e42565b60408051978852602088019690965286860194909452606086019290925260808501526001600160a01b031660a0840152151560c0830152519081900360e00190f35b6101e7610e8c565b610288600480360360408110156104c757600080fd5b506001600160a01b038135169060200135610eac565b610288610f01565b610288600480360360408110156104fb57600080fd5b506001600160a01b038135169060200135610f0a565b6102ae610f17565b610521610f1d565b604080516001600160a01b039092168252519081900360200190f35b6102ae6004803603602081101561055357600080fd5b50356001600160a01b0316610f2c565b6102ae6004803603604081101561057957600080fd5b506001600160a01b0381358116916020013516610fa3565b6102a4600480360360208110156105a757600080fd5b5035610fce565b6102a46113b0565b610288600480360360208110156105cc57600080fd5b50356001600160a01b031661152b565b6040518060400160405280600b81526020016a10dc98588813585c9ad95d60aa1b81525081565b600061061033848461159c565b5060015b92915050565b3360009081526008602052604090205460ff1661066d576040805162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71030b236b4b760a11b604482015290519081900360640190fd5b6007805460ff19166001179055565b60065490565b3360009081526008602052604090205460ff166106d5576040805162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71030b236b4b760a11b604482015290519081900360640190fd5b60075460ff161561072d576040805162461bcd60e51b815260206004820152601c60248201527f63616e6e6f74206368616e676520706f6f6c206275726e207261746500000000604482015290519081900360640190fd5b600455565b600061073f848484611688565b610797843361079285604051806060016040528060288152602001611ea4602891396001600160a01b038a166000908152600160209081526040808320338452909152902054919063ffffffff6117e416565b61159c565b5060019392505050565b601281565b6001600160a01b0381166000908152600960205260408120600381015490546127108215610841576107ef6107e283600a63ffffffff61187b16565b839063ffffffff6118c416565b83106107fe57506103e8610841565b60008261081285606463ffffffff61190616565b8161081957fe5b04905060648282020461082c83826118c4565b92506103e883101561083e576103e892505b50505b6108706104e3610864836108646108578a610f2c565b879063ffffffff61190616565b9063ffffffff61187b16565b93505050505b919050565b600754610100900460ff16156108c4576040805162461bcd60e51b815260206004820152600960248201526853796e63206c6f636b60b81b604482015290519081900360640190fd5b6007805461ff00191661010017905533600090815260096020526040902054610934576040805162461bcd60e51b815260206004820152601a60248201527f796f752068617665206e6f207374616b65642062616c616e6365000000000000604482015290519081900360640190fd5b61093c61195f565b6007805461ff0019169055565b600754610100900460ff1615610992576040805162461bcd60e51b815260206004820152600960248201526853796e63206c6f636b60b81b604482015290519081900360640190fd5b6007805461ff00191661010017905533600090815260096020526040902054610a02576040805162461bcd60e51b815260206004820152601a60248201527f796f752068617665206e6f207374616b65642062616c616e6365000000000000604482015290519081900360640190fd5b61093c611a61565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610610918590610792908663ffffffff611b2616565b60035481565b3360009081526008602052604090205460ff16610a9f576040805162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71030b236b4b760a11b604482015290519081900360640190fd5b60075460ff1615610af7576040805162461bcd60e51b815260206004820152601760248201527f63616e6e6f74206368616e6765206275726e2072617465000000000000000000604482015290519081900360640190fd5b600355565b600754610100900460ff1615610b45576040805162461bcd60e51b815260206004820152600960248201526853796e63206c6f636b60b81b604482015290519081900360640190fd5b6007805461ff00191661010017905581610b93576040805162461bcd60e51b815260206004820152600a6024820152691e995c9bc81a5b9c1d5d60b21b604482015290519081900360640190fd5b81610b9c610d44565b1015610bef576040805162461bcd60e51b815260206004820152601b60248201527f4572726f723a20696e73756666696369656e742062616c616e63650000000000604482015290519081900360640190fd5b6001600160a01b03811615801590610c1057506001600160a01b0381163314155b15610c91576001600160a01b038116600090815260096020526040902060050154600160a01b900460ff168015610c605750336000908152600960205260409020600501546001600160a01b0316155b15610c915733600090815260096020526040902060050180546001600160a01b0319166001600160a01b0383161790555b610c9961195f565b33600090815260096020526040902060058101805460ff60a01b1916600160a01b17905554610cce908363ffffffff611b2616565b33600090815260096020526040902055600554610cf1908363ffffffff611b2616565b600555610cff333084611688565b60408051838152905133917facf5378a9125b9a91e37c0cad37a66b4b63bc3494776388fc87056260e031576919081900360200190a250506007805461ff0019169055565b6000610d4f33610d54565b905090565b6001600160a01b031660009081526020819052604090205490565b3360009081526008602052604090205460ff16610dc2576040805162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71030b236b4b760a11b604482015290519081900360640190fd5b60075460ff1615610e1a576040805162461bcd60e51b815260206004820152601960248201527f63616e6e6f74206368616e6765206e617469766520706f6f6c00000000000000604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60055481565b60096020526000908152604090208054600182015460028301546003840154600485015460059095015493949293919290916001600160a01b03811690600160a01b900460ff1687565b6040518060400160405280600481526020016321a920a160e11b81525081565b6000610610338461079285604051806060016040528060258152602001611f9a602591393360009081526001602090815260408083206001600160a01b038d168452909152902054919063ffffffff6117e416565b60075460ff1681565b6000610610338484611688565b60045481565b6002546001600160a01b031681565b6001600160a01b038116600090815260096020526040812060010154610f5457506000610876565b6001600160a01b038216600090815260096020526040812060010154610f8890603c9061086490429063ffffffff6118c416565b905060018110610f99579050610876565b6000915050610876565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600754610100900460ff1615611017576040805162461bcd60e51b815260206004820152600960248201526853796e63206c6f636b60b81b604482015290519081900360640190fd5b6007805461ff0019166101001790556003543360009081526009602052604090206002015461104b9163ffffffff61190616565b3360009081526009602052604090206003015461106e908363ffffffff611b2616565b11156110ab5760405162461bcd60e51b8152600401808060200182810382526036815260200180611f646036913960400191505060405180910390fd5b60008111611100576040805162461bcd60e51b815260206004820152601c60248201527f76616c7565206d7573742062652067726561746572207468616e203000000000604482015290519081900360640190fd5b8061110a33610d54565b101561114f576040805162461bcd60e51b815260206004820152600f60248201526e62616c616e636520746f6f206c6f7760881b604482015290519081900360640190fd5b6111593382611b80565b3360009081526009602090815260408083206003018054850190556004546002546001600160a01b031684529183905282205461119b9163ffffffff61187b16565b905081811115611256576111ea82604051806060016040528060228152602001611df7602291396002546001600160a01b0316600090815260208190526040902054919063ffffffff6117e416565b6002546001600160a01b0316600090815260208190526040902055600654611218908363ffffffff6118c416565b60065560408051838152905133917fab85194d35c4ea153d0b51f3a304d1d22cb8023e499a6503fb6c28c5864ae90e919081900360200190a2611303565b61129b81604051806060016040528060228152602001611df7602291396002546001600160a01b0316600090815260208190526040902054919063ffffffff6117e416565b6002546001600160a01b03166000908152602081905260409020556006546112c9908263ffffffff6118c416565b60065560408051828152905133917fab85194d35c4ea153d0b51f3a304d1d22cb8023e499a6503fb6c28c5864ae90e919081900360200190a25b600260009054906101000a90046001600160a01b03166001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561135357600080fd5b505af1158015611367573d6000803e3d6000fd5b50506040805185815290513393507fab85194d35c4ea153d0b51f3a304d1d22cb8023e499a6503fb6c28c5864ae90e92509081900360200190a250506007805461ff0019169055565b600754610100900460ff16156113f9576040805162461bcd60e51b815260206004820152600960248201526853796e63206c6f636b60b81b604482015290519081900360640190fd5b6007805461ff001916610100179055336000908152600960205260409020546114535760405162461bcd60e51b8152600401808060200182810382526022815260200180611e616022913960400191505060405180910390fd5b61145c3361152b565b6114975760405162461bcd60e51b815260040180806020018281038252602e815260200180611f36602e913960400191505060405180910390fd5b336000908152600960205260409020546114af61195f565b33600090815260096020526040812060018101829055556005546114d9908263ffffffff6118c416565b6005556114e7303383611688565b60408051828152905133917f43a932fdc9d096891853e1e003cefbdaa5f14e174721aa1f9668616323afa334919081900360200190a2506007805461ff0019169055565b6001600160a01b03811660009081526009602052604081206001015461155357506000610876565b4261159361156b62015180600763ffffffff61190616565b6001600160a01b0385166000908152600960205260409020600101549063ffffffff611b2616565b11159050610876565b6001600160a01b0383166115e15760405162461bcd60e51b8152600401808060200182810382526024815260200180611f126024913960400191505060405180910390fd5b6001600160a01b0382166116265760405162461bcd60e51b8152600401808060200182810382526022815260200180611e196022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166116cd5760405162461bcd60e51b8152600401808060200182810382526025815260200180611eed6025913960400191505060405180910390fd5b6001600160a01b0382166117125760405162461bcd60e51b8152600401808060200182810382526023815260200180611dd46023913960400191505060405180910390fd5b61175581604051806060016040528060268152602001611e3b602691396001600160a01b038616600090815260208190526040902054919063ffffffff6117e416565b6001600160a01b03808516600090815260208190526040808220939093559084168152205461178a908263ffffffff611b2616565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156118735760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611838578181015183820152602001611820565b50505050905090810190601f1680156118655780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60006118bd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c7c565b9392505050565b60006118bd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117e4565b60008261191557506000610614565b8282028284828161192257fe5b04146118bd5760405162461bcd60e51b8152600401808060200182810382526021815260200180611e836021913960400191505060405180910390fd5b600061196a336107a6565b3360009081526009602052604090204260019091015590508015611a5e576119923382611ce1565b33600090815260096020526040902060028101805483019055600501546001600160a01b031615611a3057336000908152600960205260409020600501546119f3906001600160a01b03166119ee83601463ffffffff61187b16565b611ce1565b611a0481601463ffffffff61187b16565b33600090815260096020526040808220600501546001600160a01b031682529020600401805490910190555b611a5e73670628750f15c42c9924880c69f54f1b168e89236119ee606461086485600363ffffffff61190616565b50565b6000611a6c336107a6565b90508015611a5e57611a7e3082611ce1565b33600090815260096020526040902054611a9e908263ffffffff611b2616565b33600090815260096020526040902055600554611ac1908263ffffffff611b2616565b60059081553360009081526009602052604090206002810180548401905542600182015501546001600160a01b031615611a3057336000908152600960205260409020600501546119f3906001600160a01b03166119ee83601463ffffffff61187b16565b6000828201838110156118bd576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b038216611bc55760405162461bcd60e51b8152600401808060200182810382526021815260200180611ecc6021913960400191505060405180910390fd5b611c0881604051806060016040528060228152602001611df7602291396001600160a01b038516600090815260208190526040902054919063ffffffff6117e416565b6001600160a01b038316600090815260208190526040902055600654611c34908263ffffffff6118c416565b6006556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b60008183611ccb5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611838578181015183820152602001611820565b506000838581611cd757fe5b0495945050505050565b806001600160a01b038316611d3d576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600654611d50908263ffffffff611b2616565b6006556001600160a01b038316600090815260208190526040902054611d7c908263ffffffff611b2616565b6001600160a01b0384166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654572726f723a20756e73756666696369656e742066726f7a656e2062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373746f6b656e732063616e6e6f7420626520756e7374616b6564207965742e206d696e203720646179207374616b6563616e206f6e6c79206275726e206571756976616c656e74206f662078313020746f74616c207374616b696e6720696e74657265737445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220fada843a4ecfab2c6b4c3a8d8f3c5842fd216c58c5f0e5ca3d61f000a9f0c5a364736f6c63430006040033
Verified Source Code Full Match
Compiler: v0.6.4+commit.1dca32f3
EVM: istanbul
Optimization: Yes (200 runs)
Address.sol 58 lines
pragma solidity 0.6.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) {
// 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.
*
* 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");
}
}
crabmarket.sol 826 lines
//crab-market.sol
// ___ ___
// .i .-' `-. i.
// .' `/ \' _`.
// |,-../ o o \.' `|
// (| | / _\ /_ \ | |)
// \\\ (_.'.'"`.`._) ///
// \\`._(..: :..)_.'//
// \`.__\ .:-:. /__.'/
// `-i-->.___.<--i-'
// .'.-'/.=^=.\`-.`.
// /.' // \\ `.\
// || || || ||
// \) || || (/
// \) (/
// 888
// 888
// 888
// .d8888b888d888 8888b. 88888b.
// d88P" 888P" "88b888 "88b
// 888 888 .d888888888 888
// Y88b. 888 888 888888 d88P
// "Y8888P888 "Y88888888888P"
pragma solidity 0.6.4;
import "./SafeMath.sol";
import "./IERC20.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 ERC20;` 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 safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_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.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "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");
}
}
}
//Uniswap v2 interface
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
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;
}
////////////////////////////////////////////////
////////////////////EVENTS/////////////////////
//////////////////////////////////////////////
contract TokenEvents {
//when a user stakes tokens
event TokenStake(
address indexed user,
uint value
);
//when a user unstakes tokens
event TokenUnstake(
address indexed user,
uint value
);
//when a user burns tokens
event TokenBurn(
address indexed user,
uint value
);
}
//////////////////////////////////////
//////////CRABMARKET TOKEN CONTRACT////////
////////////////////////////////////
contract CRABMARKET is IERC20, TokenEvents {
using SafeMath for uint256;
using SafeMath for uint64;
using SafeMath for uint32;
using SafeMath for uint16;
using SafeMath for uint8;
using SafeERC20 for CRABMARKET;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
//uniswap setup
address public uniPool;
//burn setup
uint256 public burnAdjust = 10;
uint256 public poolBurnAdjust = 100;
//stake setup
uint constant internal MINUTESECONDS = 60;
uint constant internal DAYSECONDS = 86400;
uint constant internal MINSTAKEDAYLENGTH = 7;
uint256 public totalStaked;
//tokenomics
uint256 internal _totalSupply;
string public constant name = "Crab Market";
string public constant symbol = "CRAB";
uint8 public constant decimals = 18;
//admin
address constant internal _P1 = 0x670628750F15c42c9924880c69F54F1B168E8923;
bool public isLocked = false;
bool private sync;
mapping(address => bool) admins;
mapping (address => Staker) public staker;
struct Staker{
uint256 stakedBalance;
uint256 stakeStartTimestamp;
uint256 totalStakingInterest;
uint256 totalBurnt;
uint256 totalReferralBonus;
address referrer;
bool activeUser;
}
modifier onlyAdmins(){
require(admins[msg.sender], "not an admin");
_;
}
//protects against potential reentrancy
modifier synchronized {
require(!sync, "Sync lock");
sync = true;
_;
sync = false;
}
constructor(uint256 initialTokens) public {
admins[_P1] = true;
admins[msg.sender] = true;
//mint initial tokens
mintInitialTokens(initialTokens);
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) external override returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) external view override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) external 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) external override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].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) external returns (bool) {
_approve(msg.sender, spender, _allowances[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) external returns (bool) {
_approve(msg.sender, spender, _allowances[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 {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply unless mintBLock is true
*
* 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 {
uint256 amt = amount;
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amt);
_balances[account] = _balances[account].add(amt);
emit Transfer(address(0), account, amt);
}
/**
* @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 {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[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 is 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 {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount, "ERC20: burn amount exceeds allowance"));
}
/**
* @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);//from address(0) for minting
/**
* @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);
//mint crab initial tokens (only ever called in constructor)
function mintInitialTokens(uint amount)
internal
synchronized
{
_mint(_P1, amount);
}
////////////////////////////////////////////////////////
/////////////////PUBLIC FACING - CRAB CONTROL//////////
//////////////////////////////////////////////////////
////////STAKING FUNCTIONS/////////
//stake CRAB tokens to contract and claims any accrued interest
function StakeTokens(uint amt, address _referrer)
external
synchronized
{
require(amt > 0, "zero input");
require(crabBalance() >= amt, "Error: insufficient balance");//ensure user has enough funds
if(_referrer != address(0) && _referrer != msg.sender){
if(staker[_referrer].activeUser && staker[msg.sender].referrer == address(0)){
staker[msg.sender].referrer = _referrer;
}
}
//claim any accrued interest
claimInterest();
//update balances
staker[msg.sender].activeUser = true;
staker[msg.sender].stakedBalance = staker[msg.sender].stakedBalance.add(amt);
totalStaked = totalStaked.add(amt);
_transfer(msg.sender, address(this), amt);//make transfer
emit TokenStake(msg.sender, amt);
}
//unstake CRAB tokens from contract and claims any accrued interest
function UnstakeTokens()
external
synchronized
{
require(staker[msg.sender].stakedBalance > 0,"Error: unsufficient frozen balance");//ensure user has enough staked funds
require(isStakeFinished(msg.sender), "tokens cannot be unstaked yet. min 7 day stake");
uint amt = staker[msg.sender].stakedBalance;
//claim any accrued interest
claimInterest();
//zero out staking timestamp
staker[msg.sender].stakeStartTimestamp = 0;
staker[msg.sender].stakedBalance = 0;
totalStaked = totalStaked.sub(amt);
_transfer(address(this), msg.sender, amt);//make transfer
emit TokenUnstake(msg.sender, amt);
}
//claim any accrued interest
function ClaimStakeInterest()
external
synchronized
{
require(staker[msg.sender].stakedBalance > 0, "you have no staked balance");
claimInterest();
}
//roll any accrued interest
function RollStakeInterest()
external
synchronized
{
require(staker[msg.sender].stakedBalance > 0, "you have no staked balance");
rollInterest();
}
function rollInterest()
internal
{
//calculate staking interest
uint256 interest = calcStakingRewards(msg.sender);
//mint interest to contract, ref and devs
if(interest > 0){
_mint(address(this), interest);
//roll interest
staker[msg.sender].stakedBalance = staker[msg.sender].stakedBalance.add(interest);
totalStaked = totalStaked.add(interest);
staker[msg.sender].totalStakingInterest += interest;
//reset staking timestamp
staker[msg.sender].stakeStartTimestamp = now;
if(staker[msg.sender].referrer != address(0)){
_mint(staker[msg.sender].referrer, interest.div(20));//5% bonus for referrer
staker[staker[msg.sender].referrer].totalReferralBonus += interest.div(20);
}
_mint(_P1, interest.mul(3).div(100));//3% dev copy
}
}
function claimInterest()
internal
{
//calculate staking interest
uint256 interest = calcStakingRewards(msg.sender);
//reset staking timestamp
staker[msg.sender].stakeStartTimestamp = now;
//mint interest if any
if(interest > 0){
_mint(msg.sender, interest);
staker[msg.sender].totalStakingInterest += interest;
if(staker[msg.sender].referrer != address(0)){
_mint(staker[msg.sender].referrer, interest.div(20));//5% bonus for referrer
staker[staker[msg.sender].referrer].totalReferralBonus += interest.div(20);
}
_mint(_P1, interest.mul(3).div(100));//3% dev copy
}
}
function BurnCrab(uint amt)
external
synchronized
{
require(staker[msg.sender].totalBurnt.add(amt) <= staker[msg.sender].totalStakingInterest.mul(burnAdjust), "can only burn equivalent of x10 total staking interest");
require(amt > 0, "value must be greater than 0");
require(balanceOf(msg.sender) >= amt, "balance too low");
//burn tokens of user
_burn(msg.sender, amt);
staker[msg.sender].totalBurnt += amt;
//burn tokens of uniswap liquidity - pamp it (minimize vamp bots by keeping max burn pamp slippage low)
uint256 poolDiv = _balances[uniPool].div(poolBurnAdjust);
if(poolDiv > amt)
{
_balances[uniPool] = _balances[uniPool].sub(amt, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amt);
emit TokenBurn(msg.sender, amt);
}
else{
_balances[uniPool] = _balances[uniPool].sub(poolDiv, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(poolDiv);
emit TokenBurn(msg.sender, poolDiv);
}
IUniswapV2Pair(uniPool).sync();
emit TokenBurn(msg.sender, amt);
}
///////////////////////////////
////////VIEW ONLY//////////////
///////////////////////////////
//returns staking rewards in CRAB
function calcStakingRewards(address _user)
public
view
returns(uint)
{
// totalstaked * minutesPast / 10000 / 1251 @ 4.20% APY
// (adjustments up to a max of 42.0% APY via burning of CRAB)
uint crabBurnt = staker[_user].totalBurnt;
uint staked = staker[_user].stakedBalance;
uint apyAdjust = 10000;
if(crabBurnt > 0){
if(crabBurnt >= staked.sub(staked.div(10)))
{
apyAdjust = 1000;
}
else{
uint burntPercentage = ((crabBurnt.mul(100) / staked));
uint v = (apyAdjust * burntPercentage) / 100;
apyAdjust = apyAdjust.sub(v);
if(apyAdjust < 1000)
{
apyAdjust = 1000;
}
}
}
return (staked.mul(minsPastStakeTime(_user)).div(apyAdjust).div(1251));
}
//returns amount of minutes past since stake start
function minsPastStakeTime(address _user)
public
view
returns(uint)
{
if(staker[_user].stakeStartTimestamp == 0){
return 0;
}
uint minsPast = now.sub(staker[_user].stakeStartTimestamp).div(MINUTESECONDS);
if(minsPast >= 1){
return minsPast;// returns 0 if under 1 min passed
}
else{
return 0;
}
}
//check is stake is finished, min 7 days
function isStakeFinished(address _user)
public
view
returns(bool)
{
if(staker[_user].stakeStartTimestamp == 0){
return false;
}
else{
return staker[_user].stakeStartTimestamp.add((DAYSECONDS).mul(MINSTAKEDAYLENGTH)) <= now;
}
}
//CRAB balance of caller
function crabBalance()
public
view
returns (uint256)
{
return balanceOf(msg.sender);
}
///////////////////////////////
////////ADMIN ONLY//////////////
///////////////////////////////
function setUnipool(address _lpAddress)
external
onlyAdmins
{
require(!isLocked, "cannot change native pool");
uniPool = _lpAddress;
}
//adjusts amount users are eligible to burn over time
function setBurnAdjust(uint _v)
external
onlyAdmins
{
require(!isLocked, "cannot change burn rate");
burnAdjust = _v;
}
//adjusts max % of liquidity tokens that can be burnt from pool
function uniPoolBurnAdjust(uint _v)
external
onlyAdmins
{
require(!isLocked, "cannot change pool burn rate");
poolBurnAdjust = _v;
}
function revokeAdmin()
external
onlyAdmins
{
isLocked = true;
}
}
IERC20.sol 77 lines
pragma solidity 0.6.4;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);//from address(0) for minting
/**
* @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);
}
SafeMath.sol 156 lines
pragma solidity 0.6.4;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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.
*
* _Available since v2.4.0._
*/
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) {
// 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;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts 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) 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.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
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.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
Read Contract
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
burnAdjust 0x3e8310cc → uint256
calcStakingRewards 0x3149432c → uint256
crabBalance 0x7048dca6 → uint256
decimals 0x313ce567 → uint8
isLocked 0xa4e2d634 → bool
isStakeFinished 0xec33001a → bool
minsPastStakeTime 0xd650694c → uint256
name 0x06fdde03 → string
poolBurnAdjust 0xbd15b669 → uint256
staker 0x82e4eda4 → uint256, uint256, uint256, uint256, uint256, address, bool
symbol 0x95d89b41 → string
totalStaked 0x817b1cd2 → uint256
totalSupply 0x18160ddd → uint256
uniPool 0xd3681b95 → address
Write Contract 14 functions
These functions modify contract state and require a wallet transaction to execute.
BurnCrab 0xe7a1e3ec
uint256 amt
ClaimStakeInterest 0x38a05871
No parameters
RollStakeInterest 0x39267f09
No parameters
StakeTokens 0x65759af2
uint256 amt
address _referrer
UnstakeTokens 0xe86f1b5c
No parameters
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
revokeAdmin 0x0d6aef04
No parameters
setBurnAdjust 0x57e3aec4
uint256 _v
setUnipool 0x7f700d21
address _lpAddress
transfer 0xa9059cbb
address recipient
uint256 amount
returns: bool
transferFrom 0x23b872dd
address sender
address recipient
uint256 amount
returns: bool
uniPoolBurnAdjust 0x21a358f1
uint256 _v
Recent Transactions
This address has 1 on-chain transactions, but only 0.7% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →