Address Contract Verified
Address
0x56de8BC61346321D4F2211e3aC3c0A7F00dB9b76
Balance
0 ETH
Nonce
1
Code Size
7956 bytes
Creator
0x1f7c453a...a466 at tx 0xc5782ca4...785549
Indexed Transactions
0
Contract Bytecode
7956 bytes
0x608060405234801561001057600080fd5b50600436106102745760003560e01c80636cfd155311610151578063a457c2d7116100c3578063c0240b7411610087578063c0240b741461063f578063ccfc2e8d14610665578063dd62ed3e1461068b578063ee4e2687146106b9578063f0c0289a146106df578063f2fde38b1461070057610274565b8063a457c2d7146105b1578063a9059cbb146105dd578063ad5c464814610609578063bb31b77b14610611578063bed0bb2c1461063757610274565b80637d7c2a1c116101155780637d7c2a1c146105815780638da5cb5b1461058957806395d89b41146105915780639a36f932146105995780639bf1401c146105a1578063a0e47bf6146105a957610274565b80636cfd1553146104ff57806370709a7c1461052557806370a082311461054b578063715018a61461057157806376771d4b1461057957610274565b80632dc17643116101ea57806339509351116101ae578063395093511461048157806340905cba146104ad5780634ae01965146104ca5780634e71d92d146104d25780635b241b21146104da57806361d027b3146104f757610274565b80632dc176431461041157806330a0f1e214610419578063313ce5671461043a57806332972e461461045857806334cb52e11461046057610274565b8063095ea7b31161023c578063095ea7b3146103695780630d43e8ad146103a9578063106b9ca1146103b157806316d1d916146103cb57806318160ddd146103d357806323b872dd146103db57610274565b806301d22ccd1461027957806302dd19d91461029d5780630457622a146102bc57806306fdde03146102c4578063079636cb14610341575b600080fd5b610281610726565b604080516001600160a01b039092168252519081900360200190f35b6102a5610735565b6040805161ffff9092168252519081900360200190f35b610281610746565b6102cc610755565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103065781810151838201526020016102ee565b50505050905090810190601f1680156103335780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103676004803603602081101561035757600080fd5b50356001600160a01b03166107eb565b005b6103956004803603604081101561037f57600080fd5b506001600160a01b03813516906020013561090d565b604080519115158252519081900360200190f35b61028161092a565b6103b9610939565b60408051918252519081900360200190f35b6103b961093f565b6103b9610945565b610395600480360360608110156103f157600080fd5b506001600160a01b0381358116916020810135909116906040013561094b565b6102816109d2565b6103676004803603602081101561042f57600080fd5b503561ffff166109e1565b610442610aa9565b6040805160ff9092168252519081900360200190f35b610281610ab2565b6103676004803603602081101561047657600080fd5b503561ffff16610ac1565b6103956004803603604081101561049757600080fd5b506001600160a01b038135169060200135610b89565b610367600480360360208110156104c357600080fd5b5035610bd7565b6102a5610c3e565b610281610c4f565b610367600480360360208110156104f057600080fd5b5035610c5e565b610281610d14565b6103676004803603602081101561051557600080fd5b50356001600160a01b0316610d23565b6103676004803603602081101561053b57600080fd5b50356001600160a01b0316610dbf565b6103b96004803603602081101561056157600080fd5b50356001600160a01b0316610e4a565b610367610e65565b610281610f17565b610367610f26565b6102816110b2565b6102cc6110c6565b6102a5611127565b610281611138565b610281611147565b610395600480360360408110156105c757600080fd5b506001600160a01b038135169060200135611156565b610395600480360360408110156105f357600080fd5b506001600160a01b0381351690602001356111be565b6102816111d2565b6103676004803603602081101561062757600080fd5b50356001600160a01b03166111e1565b6103b961127d565b6103676004803603602081101561065557600080fd5b50356001600160a01b0316611283565b6103676004803603602081101561067b57600080fd5b50356001600160a01b031661131f565b6103b9600480360360408110156106a157600080fd5b506001600160a01b03813581169160200135166113bb565b610367600480360360208110156106cf57600080fd5b50356001600160a01b03166113e6565b610367600480360360208110156106f557600080fd5b503561ffff166116b2565b6103676004803603602081101561071657600080fd5b50356001600160a01b031661177a565b600e546001600160a01b031681565b601154600160b01b900461ffff1681565b6008546001600160a01b031681565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156107e15780601f106107b6576101008083540402835291602001916107e1565b820191906000526020600020905b8154815290600101906020018083116107c457829003601f168201915b5050505050905090565b6107f36118e9565b6001600160a01b03166108046110b2565b6001600160a01b03161461084d576040805162461bcd60e51b81526020600482018190526024820152600080516020611e51833981519152604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0383811691909117918290556040805163c45a015560e01b81529051929091169163c45a015591600480820192602092909190829003018186803b1580156108a957600080fd5b505afa1580156108bd573d6000803e3d6000fd5b505050506040513d60208110156108d357600080fd5b5051600c80546001600160a01b0319166001600160a01b03928316179055166000908152601260205260409020805460ff19166001179055565b600061092161091a6118e9565b84846118ed565b50600192915050565b600f546001600160a01b031681565b60145481565b60155481565b60025490565b60006109588484846119d9565b6109c8846109646118e9565b6109c385604051806060016040528060288152602001611e29602891396001600160a01b038a166000908152600160205260408120906109a26118e9565b6001600160a01b031681526020810191909152604001600020549190611a99565b6118ed565b5060019392505050565b600c546001600160a01b031681565b6109e96118e9565b6001600160a01b03166109fa6110b2565b6001600160a01b031614610a43576040805162461bcd60e51b81526020600482018190526024820152600080516020611e51833981519152604482015290519081900360640190fd5b600a8161ffff161015610a875760405162461bcd60e51b8152600401808060200182810382526022815260200180611d736022913960400191505060405180910390fd5b6011805461ffff909216600160c01b0261ffff60c01b19909216919091179055565b60055460ff1690565b600b546001600160a01b031681565b610ac96118e9565b6001600160a01b0316610ada6110b2565b6001600160a01b031614610b23576040805162461bcd60e51b81526020600482018190526024820152600080516020611e51833981519152604482015290519081900360640190fd5b600a8161ffff161015610b675760405162461bcd60e51b8152600401808060200182810382526022815260200180611d736022913960400191505060405180910390fd5b6011805461ffff909216600160b01b0261ffff60b01b19909216919091179055565b6000610921610b966118e9565b846109c38560016000610ba76118e9565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490611888565b610bdf6118e9565b6001600160a01b0316610bf06110b2565b6001600160a01b031614610c39576040805162461bcd60e51b81526020600482018190526024820152600080516020611e51833981519152604482015290519081900360640190fd5b601555565b601154600160c01b900461ffff1681565b6010546001600160a01b031681565b610c666118e9565b6001600160a01b0316610c776110b2565b6001600160a01b031614610cc0576040805162461bcd60e51b81526020600482018190526024820152600080516020611e51833981519152604482015290519081900360640190fd5b6001811015610d0f576040805162461bcd60e51b81526020600482015260166024820152754d7573742062652067726561746572207468616e203160501b604482015290519081900360640190fd5b601355565b600d546001600160a01b031681565b610d2b6118e9565b6001600160a01b0316610d3c6110b2565b6001600160a01b031614610d85576040805162461bcd60e51b81526020600482018190526024820152600080516020611e51833981519152604482015290519081900360640190fd5b600e80546001600160a01b039092166001600160a01b0319909216821790556000908152601260205260409020805460ff19166001179055565b610dc76118e9565b6001600160a01b0316610dd86110b2565b6001600160a01b031614610e21576040805162461bcd60e51b81526020600482018190526024820152600080516020611e51833981519152604482015290519081900360640190fd5b6001600160a01b03166000908152601260205260409020805460ff19811660ff90911615179055565b6001600160a01b031660009081526020819052604090205490565b610e6d6118e9565b6001600160a01b0316610e7e6110b2565b6001600160a01b031614610ec7576040805162461bcd60e51b81526020600482018190526024820152600080516020611e51833981519152604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b600a546001600160a01b031681565b60026006541415610f7e576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600655601354610f8f33610e4a565b11610fe1576040805162461bcd60e51b815260206004820181905260248201527f596f75206172656e27742070617274206f66207468652073796e646963617465604482015290519081900360640190fd5b601554601454014211611026576040805162461bcd60e51b81526020600482015260086024820152672a37b79029b7b7b760c11b604482015290519081900360640190fd5b42601455600e5460115460408051639f882d1d60e01b815261ffff600160b01b840481166004830152600160c01b9093049092166024830152516001600160a01b0390921691639f882d1d9160448082019260009290919082900301818387803b15801561109357600080fd5b505af11580156110a7573d6000803e3d6000fd5b505060016006555050565b60055461010090046001600160a01b031690565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156107e15780601f106107b6576101008083540402835291602001916107e1565b601154600160a01b900461ffff1681565b6011546001600160a01b031681565b6009546001600160a01b031681565b60006109216111636118e9565b846109c385604051806060016040528060258152602001611eba602591396001600061118d6118e9565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190611a99565b60006109216111cb6118e9565b84846119d9565b6007546001600160a01b031681565b6111e96118e9565b6001600160a01b03166111fa6110b2565b6001600160a01b031614611243576040805162461bcd60e51b81526020600482018190526024820152600080516020611e51833981519152604482015290519081900360640190fd5b601080546001600160a01b039092166001600160a01b0319909216821790556000908152601260205260409020805460ff19166001179055565b60135481565b61128b6118e9565b6001600160a01b031661129c6110b2565b6001600160a01b0316146112e5576040805162461bcd60e51b81526020600482018190526024820152600080516020611e51833981519152604482015290519081900360640190fd5b601180546001600160a01b039092166001600160a01b0319909216821790556000908152601260205260409020805460ff19166001179055565b6113276118e9565b6001600160a01b03166113386110b2565b6001600160a01b031614611381576040805162461bcd60e51b81526020600482018190526024820152600080516020611e51833981519152604482015290519081900360640190fd5b600f80546001600160a01b039092166001600160a01b0319909216821790556000908152601260205260409020805460ff19166001179055565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6113ee6118e9565b6001600160a01b03166113ff6110b2565b6001600160a01b031614611448576040805162461bcd60e51b81526020600482018190526024820152600080516020611e51833981519152604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0383811691909117918290556040805163c45a015560e01b81529051929091169163c45a015591600480820192602092909190829003018186803b1580156114a457600080fd5b505afa1580156114b8573d6000803e3d6000fd5b505050506040513d60208110156114ce57600080fd5b5051600a80546001600160a01b0319166001600160a01b03928316179055600954604080516315ab88c960e31b81529051919092169163ad5c4648916004808301926020929190829003018186803b15801561152957600080fd5b505afa15801561153d573d6000803e3d6000fd5b505050506040513d602081101561155357600080fd5b5051600780546001600160a01b0319166001600160a01b039283161790819055600a546040805163e6a4390560e01b815292841660048401523060248401525192169163e6a4390591604480820192602092909190829003018186803b1580156115bc57600080fd5b505afa1580156115d0573d6000803e3d6000fd5b505050506040513d60208110156115e657600080fd5b5051600b80546001600160a01b0319166001600160a01b039283161790819055166116af57600a54600754604080516364e329cb60e11b81523060048201526001600160a01b0392831660248201529051919092169163c9c653969160448083019260209291908290030181600087803b15801561166357600080fd5b505af1158015611677573d6000803e3d6000fd5b505050506040513d602081101561168d57600080fd5b5051600b80546001600160a01b0319166001600160a01b039092169190911790555b50565b6116ba6118e9565b6001600160a01b03166116cb6110b2565b6001600160a01b031614611714576040805162461bcd60e51b81526020600482018190526024820152600080516020611e51833981519152604482015290519081900360640190fd5b600a8161ffff1610156117585760405162461bcd60e51b8152600401808060200182810382526026815260200180611e036026913960400191505060405180910390fd5b6011805461ffff909216600160a01b0261ffff60a01b19909216919091179055565b6117826118e9565b6001600160a01b03166117936110b2565b6001600160a01b0316146117dc576040805162461bcd60e51b81526020600482018190526024820152600080516020611e51833981519152604482015290519081900360640190fd5b6001600160a01b0381166118215760405162461bcd60e51b8152600401808060200182810382526026815260200180611d956026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6000828201838110156118e2576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b0383166119325760405162461bcd60e51b8152600401808060200182810382526024815260200180611e966024913960400191505060405180910390fd5b6001600160a01b0382166119775760405162461bcd60e51b8152600401808060200182810382526022815260200180611dbb6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b601154600160a01b900461ffff1615801590611a0e57506001600160a01b03831660009081526012602052604090205460ff16155b8015611a3357506001600160a01b03821660009081526012602052604090205460ff16155b15611a8957601154600090611a54908390600160a01b900461ffff16611b30565b600f54909150611a6f9085906001600160a01b031683611b97565b611a838484611a7e8585611cf2565b611b97565b50611a94565b611a94838383611b97565b505050565b60008184841115611b285760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611aed578181015183820152602001611ad5565b50505050905090810190601f168015611b1a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000808211611b86576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381611b8f57fe5b049392505050565b6001600160a01b038316611bdc5760405162461bcd60e51b8152600401808060200182810382526025815260200180611e716025913960400191505060405180910390fd5b6001600160a01b038216611c215760405162461bcd60e51b8152600401808060200182810382526023815260200180611d506023913960400191505060405180910390fd5b611c2c838383611a94565b611c6981604051806060016040528060268152602001611ddd602691396001600160a01b0386166000908152602081905260409020549190611a99565b6001600160a01b038085166000908152602081905260408082209390935590841681522054611c989082611888565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600082821115611d49576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b5090039056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734d757374206e6f742062652067726561746572207468616e2031302520746f74616c4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654d757374206e6f742062652067726561746572207468616e2031302520746f74616c2066656545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220a967a721c7b418568ea32ae86be5d35b5ba3bc2ac91f10ca08dcf9df3fca0ace64736f6c63430007060033
Verified Source Code Full Match
Compiler: v0.7.6+commit.7338295f
EVM: istanbul
Optimization: Yes (200 runs)
Rena.sol 159 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import './dependencies/uniswap-v2-periphery/contracts/dependencies/uniswap-v2-core/contracts/interfaces/IUniswapV2Pair.sol';
import './dependencies/uniswap-v2-periphery/contracts/dependencies/uniswap-v2-core/contracts/interfaces/IUniswapV2Factory.sol';
import './dependencies/uniswap-v2-periphery/contracts/interfaces/IUniswapV2Router02.sol';
import './interfaces/IRebalancer.sol';
import './interfaces/ILPStaking.sol';
contract Rena is ERC20("Rena", "RENA"), Ownable, ReentrancyGuard {
using SafeMath for uint256;
//Needed Addresses
address public WETH;
address public renaRouter;
address public uniRouter;
address public uniFactory;
address public uniPair;
address public renaFactory;
address payable public treasury;
//Objects
address payable public rebalancer;
address public feeDistributor;
address public claim;
address public lpStaking;
//Fee Divisors
uint16 public feeDivisor;
uint16 public callerRewardDivisor;
uint16 public rebalancerDivisor;
//Map toggles
mapping(address => bool) feeless;
//Overflow protected
uint256 public minimumRebalanceAmount;
uint256 public lastRebalance;
uint256 public rebalanceInterval;
constructor (
address renaRouter_,
address uniRouter_,
uint256 minimumReblanceAmount_,
uint256 rebalanceInterval_
) {
treasury = msg.sender;
feeDivisor = 100;
callerRewardDivisor = 40;
rebalancerDivisor = 200;
minimumRebalanceAmount = minimumReblanceAmount_;
renaRouter = renaRouter_;
uniRouter = uniRouter_;
WETH = IUniswapV2Router02(uniRouter).WETH();
uniFactory = IUniswapV2Router02(uniRouter).factory();
uniPair = IUniswapV2Factory(uniFactory).createPair(address(this), WETH);
feeless[address(this)] = true;
feeless[msg.sender] = true;
lastRebalance = block.timestamp;
rebalanceInterval = rebalanceInterval_;
_mint(msg.sender, 11000000 * 1e18);
}
function _transfer(address from, address to, uint256 amount) internal override {
if(feeDivisor > 0 && feeless[from] == false && feeless[to] == false) {
uint256 feeAmount = amount.div(feeDivisor);
super._transfer(from, address(feeDistributor), feeAmount);
super._transfer(from, to, amount.sub(feeAmount));
}
else {
super._transfer(from, to, amount);
}
}
function toggleFeeless(address addr_) external onlyOwner {
feeless[addr_] = !feeless[addr_];
}
function changeRebalanceInterval(uint256 interval_) external onlyOwner {
rebalanceInterval = interval_;
}
function changeFeeDivisor(uint16 feeDivisor_) external onlyOwner {
require(feeDivisor_ >= 10, "Must not be greater than 10% total fee");
feeDivisor = feeDivisor_;
}
function changeCallerRewardDivisor(uint16 callerRewardDivisor_) external onlyOwner {
require(callerRewardDivisor_ >= 10, "Must not be greater than 10% total");
callerRewardDivisor = callerRewardDivisor_;
}
function changeMinRebalancerAmount(uint256 minimumRebalanceAmount_) external onlyOwner {
require(minimumRebalanceAmount_ >= 1, "Must be greater than 1");
minimumRebalanceAmount = minimumRebalanceAmount_;
}
function changeRebalalncerDivisor(uint16 rebalancerDivisor_) external onlyOwner {
require(rebalancerDivisor_ >= 10, "Must not be greater than 10% total");
rebalancerDivisor = rebalancerDivisor_;
}
function setUniRouter(address uniRouter_) external onlyOwner {
uniRouter = uniRouter_;
uniFactory = IUniswapV2Router02(uniRouter).factory();
WETH = IUniswapV2Router02(uniRouter).WETH();
uniPair = IUniswapV2Factory(uniFactory).getPair(WETH, address(this));
if( uniPair == address(0))
uniPair = IUniswapV2Factory(uniFactory).createPair(address(this), WETH);
}
function setRenaRouter(address renaRouter_) external onlyOwner {
renaRouter = renaRouter_;
renaFactory = IUniswapV2Router02(renaRouter).factory();
feeless[renaRouter_] = true;
}
function setRebalancer(address payable rebalancer_) external onlyOwner {
rebalancer = rebalancer_;
feeless[rebalancer_] = true;
}
function setClaim(address claim_) external onlyOwner {
claim = claim_;
feeless[claim_] = true;
}
function setlpStaking(address lpStaking_) external onlyOwner {
lpStaking = lpStaking_;
feeless[lpStaking_] = true;
}
function setFeeDistributor(address payable feeDistributor_) external onlyOwner {
feeDistributor = feeDistributor_;
feeless[feeDistributor_] = true;
}
function rebalance() external nonReentrant {
require(balanceOf(msg.sender) > minimumRebalanceAmount, "You aren't part of the syndicate");
require(block.timestamp > lastRebalance + rebalanceInterval, "Too Soon");
lastRebalance = block.timestamp;
IRebalancer(rebalancer).rebalance(callerRewardDivisor, rebalancerDivisor);
}
}
ILPStaking.sol 10 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
interface ILPStaking {
function withdrawFromTo(address owner, uint256 _pid, uint256 _amount, address _to) external;
function claim(address _from, uint256 _pid) external;
function pendingrena(uint256 pid_, address account_) external view returns(uint256);
function addPendingRewards() external;
function massUpdatePools() external;
}
IRebalancer.sol 7 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
interface IRebalancer {
function rebalance(uint16 callerRewardDivisor, uint16 rebalanceDivisor) external;
function refill() payable external;
}
SafeMath.sol 214 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @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, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @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) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @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, reverting 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) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting 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) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* 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);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* 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);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* 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;
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return 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;
}
}
Ownable.sol 68 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/Context.sol";
/**
* @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.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual 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;
}
}
ERC20.sol 306 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../../utils/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_) public {
_name = name_;
_symbol = symbol_;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_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.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_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 internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal virtual {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
IERC20.sol 77 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
ReentrancyGuard.sol 62 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor () internal {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
IUniswapV2Router01.sol 96 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
interface IUniswapV2Router01 {
function factory() external view returns (address);
function WETH() external view 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);
}
IUniswapV2Router02.sol 45 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import './IUniswapV2Router01.sol';
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;
}
IUniswapV2Pair.sol 55 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "./IUniswapV2ERC20.sol";
interface IUniswapV2Pair is IUniswapV2ERC20 {
// event Approval(address indexed owner, address indexed spender, uint value);
// event Transfer(address indexed from, address indexed to, uint value);
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Sync(uint112 reserve0, uint112 reserve1);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
// 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;
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
IUniswapV2ERC20.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
interface IUniswapV2ERC20 {
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;
}
IUniswapV2Factory.sol 18 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
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(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
Read Contract
WETH 0xad5c4648 → address
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
callerRewardDivisor 0x02dd19d9 → uint16
claim 0x4e71d92d → address
decimals 0x313ce567 → uint8
feeDistributor 0x0d43e8ad → address
feeDivisor 0x9a36f932 → uint16
lastRebalance 0x106b9ca1 → uint256
lpStaking 0x9bf1401c → address
minimumRebalanceAmount 0xbed0bb2c → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
rebalanceInterval 0x16d1d916 → uint256
rebalancer 0x01d22ccd → address
rebalancerDivisor 0x4ae01965 → uint16
renaFactory 0x2dc17643 → address
renaRouter 0x0457622a → address
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
treasury 0x61d027b3 → address
uniFactory 0x76771d4b → address
uniPair 0x32972e46 → address
uniRouter 0xa0e47bf6 → address
Write Contract 20 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
changeCallerRewardDivisor 0x34cb52e1
uint16 callerRewardDivisor_
changeFeeDivisor 0xf0c0289a
uint16 feeDivisor_
changeMinRebalancerAmount 0x5b241b21
uint256 minimumRebalanceAmount_
changeRebalalncerDivisor 0x30a0f1e2
uint16 rebalancerDivisor_
changeRebalanceInterval 0x40905cba
uint256 interval_
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
rebalance 0x7d7c2a1c
No parameters
renounceOwnership 0x715018a6
No parameters
setClaim 0xbb31b77b
address claim_
setFeeDistributor 0xccfc2e8d
address feeDistributor_
setRebalancer 0x6cfd1553
address rebalancer_
setRenaRouter 0x079636cb
address renaRouter_
setUniRouter 0xee4e2687
address uniRouter_
setlpStaking 0xc0240b74
address lpStaking_
toggleFeeless 0x70709a7c
address addr_
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