Address Contract Verified
Address
0x27D395e7C5727DeAE1ff7CcFc0D4163307491b9C
Balance
0 ETH
Nonce
1
Code Size
8335 bytes
Creator
0xd6ca3708...45a8 at tx 0x623fff05...d1657d
Indexed Transactions
0
Contract Bytecode
8335 bytes
0x608060405234801561001057600080fd5b506004361061016a5760003560e01c806306fdde031461016f578063095ea7b31461018d5780630db9ef3c146101b05780630e63d807146101c657806312a8e566146101db57806318160ddd146101e45780631be6dd64146101ec5780631d4eaead146101f557806323b872dd146101fd578063299a8c4714610210578063313ce5671461021857806331d7a26214610227578063395093511461023a5780633e032a3b1461024d5780634667d6fc14610255578063480ea6281461026a5780636e5c59ae1461027257806370a082311461027a578063715018a61461028d57806377ec0feb146102955780638da5cb5b1461029d57806395d89b41146102a5578063a1bd8105146102ad578063a1de2582146102b5578063a457c2d7146102bd578063a9059cbb146102d0578063b88a802f146102e3578063c45a0155146102eb578063dd62ed3e146102fe578063f2fde38b14610311575b600080fd5b610177610324565b6040516101849190611c44565b60405180910390f35b6101a061019b366004611cae565b6103b6565b6040519015158152602001610184565b6101b86103d0565b604051908152602001610184565b6101ce610452565b6040516101849190611cda565b6101b860085481565b6002546101b8565b6101b860075481565b6101b86104cf565b6101a061020b366004611cee565b610514565b6101ce610538565b60405160128152602001610184565b6101b8610235366004611d2f565b61057d565b6101a0610248366004611cae565b610668565b6101b861068a565b610268610263366004611cae565b6106cf565b005b6101ce6109dc565b6101b8610a21565b6101b8610288366004611d2f565b610a66565b610268610a81565b6101b8610a95565b6101ce610ade565b610177610aed565b6101ce610afc565b6101b8610b41565b6101a06102cb366004611cae565b610b86565b6101a06102de366004611cae565b610c06565b610268610c14565b6009546101ce906001600160a01b031681565b6101b861030c366004611d4c565b610c88565b61026861031f366004611d2f565b610cb3565b60606003805461033390611d85565b80601f016020809104026020016040519081016040528092919081815260200182805461035f90611d85565b80156103ac5780601f10610381576101008083540402835291602001916103ac565b820191906000526020600020905b81548152906001019060200180831161038f57829003601f168201915b5050505050905090565b6000336103c4818585610d2c565b60019150505b92915050565b6009546040805163036e7bcf60e21b815290516000926001600160a01b031691630db9ef3c916004808301926020929190829003018186803b15801561041557600080fd5b505afa158015610429573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044d9190611dc0565b905090565b60095460408051630e63d80760e01b815290516000926001600160a01b031691630e63d807916004808301926020929190829003018186803b15801561049757600080fd5b505afa1580156104ab573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044d9190611dd9565b60095460408051631d4eaead60e01b815290516000926001600160a01b031691631d4eaead916004808301926020929190829003018186803b15801561041557600080fd5b600033610522858285610e50565b61052d858585610eca565b506001949350505050565b6009546040805163299a8c4760e01b815290516000926001600160a01b03169163299a8c47916004808301926020929190829003018186803b15801561049757600080fd5b6000806105983060008051602061203a833981519152611257565b90506001600160a01b03831661dead14806105c45750806001600160a01b0316836001600160a01b0316145b156105d25750600092915050565b60006105dd84610a66565b9050806105ee575060009392505050565b6001600160a01b0384166000908152600b6020526040812054670de0b6b3a764000090839061061b610a95565b6106259190611e0c565b61062f9190611e23565b6106399190611e42565b6001600160a01b0386166000908152600a602052604090205490915061065f9082611e64565b95945050505050565b6000336103c481858561067b8383610c88565b6106859190611e64565b610d2c565b60095460408051633e032a3b60e01b815290516000926001600160a01b031691633e032a3b916004808301926020929190829003018186803b15801561041557600080fd5b60095460405163431cdf6f60e11b81526000916001600160a01b031690638639bede90610700903090600401611cda565b60206040518083038186803b15801561071857600080fd5b505afa15801561072c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107509190611e7c565b90508015610770576040516225ca6360e61b815260040160405180910390fd5b610778610afc565b6001600160a01b0316836001600160a01b0316141580156107b2575061079c6109dc565b6001600160a01b0316836001600160a01b031614155b806107c257506107c0610b41565b155b806107d257506107d06103d0565b155b156107f05760405163616cc25760e11b815260040160405180910390fd5b816107fb84336112f4565b101561081a5760405163569d45cf60e11b815260040160405180910390fd5b600061082684306112f4565b6040516323b872dd60e01b8152336004820152306024820152604481018590529091506001600160a01b038516906323b872dd90606401602060405180830381600087803b15801561087757600080fd5b505af115801561088b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108af9190611e7c565b506000816108bd86306112f4565b6108c79190611e0c565b905060006108d6600283611e42565b905060006108e48284611e0c565b90506108f38761dead84611373565b506108fc6109dc565b6001600160a01b0316876001600160a01b031614156109305761092e6109206109dc565b610928610538565b83611373565b505b610938610afc565b6001600160a01b0316876001600160a01b031614156109665761096461095c610afc565b610928610452565b505b6002610973876003611e23565b61097d9190611e42565b6007600082825461098e9190611e64565b909155505060405186815230906001600160a01b038916907faea49e2dd4d971c9c36e1011f70a6ca29f70d86768e01c8d652da99f0230e6909060200160405180910390a350505050505050565b60095460408051630901d4c560e31b815290516000926001600160a01b03169163480ea628916004808301926020929190829003018186803b15801561049757600080fd5b6009546040805163372e2cd760e11b815290516000926001600160a01b031691636e5c59ae916004808301926020929190829003018186803b15801561041557600080fd5b6001600160a01b031660009081526020819052604090205490565b610a896113fe565b610a93600061145d565b565b60095460405163c241f88960e01b81526000916001600160a01b03169063c241f88990610ac6903090600401611cda565b60206040518083038186803b15801561041557600080fd5b6005546001600160a01b031690565b60606004805461033390611d85565b6009546040805163a1bd810560e01b815290516000926001600160a01b03169163a1bd8105916004808301926020929190829003018186803b15801561049757600080fd5b600954604080516350ef12c160e11b815290516000926001600160a01b03169163a1de2582916004808301926020929190829003018186803b15801561041557600080fd5b60003381610b948286610c88565b905083811015610bf95760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b61052d8286868403610d2c565b6000336103c4818585610eca565b6000610c1f3361057d565b905080610c3f57604051631e6918b160e01b815260040160405180910390fd5b336000908152600a6020526040812055610c57610a95565b336000818152600b6020526040902091909155610c849060008051602061203a8339815191529083611373565b5050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610cbb6113fe565b6001600160a01b038116610d205760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610bf0565b610d298161145d565b50565b6001600160a01b038316610d8e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610bf0565b6001600160a01b038216610def5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610bf0565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610e5c8484610c88565b90506000198114610ec45781811015610eb75760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610bf0565b610ec48484848403610d2c565b50505050565b6000610ee43060008051602061203a833981519152611257565b9050806001600160a01b0316836001600160a01b031614158015610f1157506001600160a01b0383163014155b8015610f2b57506009546001600160a01b03848116911614155b15610f7f576000610f3b84610a66565b6064610f4660025490565b610f509190611e42565b610f5a9190611e0c565b905080831115610f7d57604051633525bb0b60e01b815260040160405180910390fd5b505b610f88846114af565b610f91836114af565b826001600160a01b0316816001600160a01b0316148015610fbb57506001600160a01b0384163014155b8015610fd557506009546001600160a01b03858116911614155b8061101f5750836001600160a01b0316816001600160a01b031614801561100557506001600160a01b0383163014155b801561101f57506009546001600160a01b03848116911614155b1561124c57600061102e610b41565b611036610a21565b61103e6103d0565b6110466104cf565b6110509190611e64565b61105a9190611e64565b6110649190611e64565b905060006127106110758386611e23565b61107f9190611e42565b905061108c8630836115cc565b806006600082825461109e9190611e64565b90915550506001600160a01b03868116908416146111e15760006110e86110c3610afc565b846110cc6103d0565b6006546110d99190611e23565b6110e39190611e42565b611770565b905060006111006110f76109dc565b856110cc610b41565b905060006111503060008051602061203a83398151915287611120610a21565b60065461112d9190611e23565b6111379190611e42565b61113f61068a565b6009546001600160a01b03166117ae565b905060008561115d6104cf565b60065461116a9190611e23565b6111749190611e42565b90506111833061dead836115cc565b81600860008282546111959190611e64565b909155506111a8905081620186a0611e23565b6111b28486611e64565b6111bc9190611e64565b600760008282546111cd9190611e64565b909155505060006006555061123092505050565b60006111ec86610a66565b60646111f760025490565b6112019190611e42565b61120b9190611e0c565b90508085111561122e57604051633525bb0b60e01b815260040160405180910390fd5b505b611244868661123f8488611e0c565b6115cc565b505050505050565b610ec48484846115cc565b60405163e6a4390560e01b81526001600160a01b03808416600483015282166024820152600090735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9063e6a439059060440160206040518083038186803b1580156112b557600080fd5b505afa1580156112c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ed9190611dd9565b9392505050565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190611323908590600401611cda565b60206040518083038186803b15801561133b57600080fd5b505afa15801561134f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ed9190611dc0565b60405163a9059cbb60e01b81526000906001600160a01b0385169063a9059cbb906113a49086908690600401611e9e565b602060405180830381600087803b1580156113be57600080fd5b505af11580156113d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f69190611e7c565b949350505050565b33611407610ade565b6001600160a01b031614610a935760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610bf0565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006114c93060008051602061203a833981519152611257565b9050806001600160a01b0316826001600160a01b031614806114f557506001600160a01b03821661dead145b8061150857506001600160a01b03821630145b15611511575050565b600061151c83610a66565b905080156115a3576001600160a01b0383166000908152600b6020526040812054670de0b6b3a7640000908390611551610a95565b61155b9190611e0c565b6115659190611e23565b61156f9190611e42565b6001600160a01b0385166000908152600a602052604081208054929350839290919061159c908490611e64565b9091555050505b6115ab610a95565b6001600160a01b039093166000908152600b60205260409020929092555050565b6001600160a01b0383166116305760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610bf0565b6001600160a01b0382166116925760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610bf0565b6001600160a01b0383166000908152602081905260409020548181101561170a5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610bf0565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610ec4565b600081156117a557600061178e30858561178861068a565b306117ae565b905061179d8461dead83611373565b5090506103ca565b50600092915050565b60405163095ea7b360e01b81526000906001600160a01b0387169063095ea7b3906117f390737a250d5630b4cf539739df2c5dacb4c659f2488d908890600401611e9e565b602060405180830381600087803b15801561180d57600080fd5b505af1158015611821573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118459190611e7c565b5060606001600160a01b03871660008051602061203a833981519152148061188357506001600160a01b03861660008051602061203a833981519152145b1561191557604080516002808252606082018352909160208301908036833701905050905086816000815181106118bc576118bc611ecd565b60200260200101906001600160a01b031690816001600160a01b03168152505085816001815181106118f0576118f0611ecd565b60200260200101906001600160a01b031690816001600160a01b0316815250506119e1565b604080516003808252608082019092529060208201606080368337019050509050868160008151811061194a5761194a611ecd565b60200260200101906001600160a01b031690816001600160a01b03168152505060008051602061203a8339815191528160018151811061198c5761198c611ecd565b60200260200101906001600160a01b031690816001600160a01b03168152505085816002815181106119c0576119c0611ecd565b60200260200101906001600160a01b031690816001600160a01b0316815250505b60006103e86119f08682611e0c565b60405163d06ca61f60e01b8152737a250d5630b4cf539739df2c5dacb4c659f2488d9063d06ca61f90611a29908b908890600401611f27565b60006040518083038186803b158015611a4157600080fd5b505afa158015611a55573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611a7d9190810190611f40565b60018551611a8b9190611e0c565b81518110611a9b57611a9b611ecd565b6020026020010151611aad9190611e23565b611ab79190611e42565b90506000876001600160a01b03166370a08231866040518263ffffffff1660e01b8152600401611ae79190611cda565b60206040518083038186803b158015611aff57600080fd5b505afa158015611b13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b379190611dc0565b604051635c11d79560e01b8152909150737a250d5630b4cf539739df2c5dacb4c659f2488d90635c11d79590611b79908a90869088908b904290600401611ffd565b600060405180830381600087803b158015611b9357600080fd5b505af1158015611ba7573d6000803e3d6000fd5b50506040516370a0823160e01b8152600092506001600160a01b038b1691506370a0823190611bda908990600401611cda565b60206040518083038186803b158015611bf257600080fd5b505afa158015611c06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c2a9190611dc0565b9050611c368282611e0c565b9a9950505050505050505050565b600060208083528351808285015260005b81811015611c7157858101830151858201604001528201611c55565b81811115611c83576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610d2957600080fd5b60008060408385031215611cc157600080fd5b8235611ccc81611c99565b946020939093013593505050565b6001600160a01b0391909116815260200190565b600080600060608486031215611d0357600080fd5b8335611d0e81611c99565b92506020840135611d1e81611c99565b929592945050506040919091013590565b600060208284031215611d4157600080fd5b81356112ed81611c99565b60008060408385031215611d5f57600080fd5b8235611d6a81611c99565b91506020830135611d7a81611c99565b809150509250929050565b600181811c90821680611d9957607f821691505b60208210811415611dba57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611dd257600080fd5b5051919050565b600060208284031215611deb57600080fd5b81516112ed81611c99565b634e487b7160e01b600052601160045260246000fd5b600082821015611e1e57611e1e611df6565b500390565b6000816000190483118215151615611e3d57611e3d611df6565b500290565b600082611e5f57634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611e7757611e77611df6565b500190565b600060208284031215611e8e57600080fd5b815180151581146112ed57600080fd5b6001600160a01b03929092168252602082015260400190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b83811015611f1c5781516001600160a01b031687529582019590820190600101611ef7565b509495945050505050565b8281526040602082015260006113f66040830184611ee3565b60006020808385031215611f5357600080fd5b82516001600160401b0380821115611f6a57600080fd5b818501915085601f830112611f7e57600080fd5b815181811115611f9057611f90611eb7565b8060051b604051601f19603f83011681018181108582111715611fb557611fb5611eb7565b604052918252848201925083810185019188831115611fd357600080fd5b938501935b82851015611ff157845184529385019392850192611fd8565b98975050505050505050565b85815284602082015260a06040820152600061201c60a0830186611ee3565b6001600160a01b039490941660608301525060800152939250505056fe000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2a264697066735822122048958516223e5c28889f272c156c2ac7d3cafb8910712b1b840a3b2a6d9cbaa164736f6c63430008090033
Verified Source Code Full Match
Compiler: v0.8.9+commit.e5eed63a
EVM: london
Optimization: Yes (1 runs)
Liquidity.sol 110 lines
// SPDX-License-Identifier: MIT
pragma solidity =0.8.9;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IUniswap.sol";
library Liquidity {
address public constant FACTORY =
0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
address public constant ROUTER = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address public constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
address public constant DEAD_ADDRESS =
0x000000000000000000000000000000000000dEaD;
function addLiquidity(
address _tokenA,
address _tokenB,
uint256 _amountA,
uint256 _amountB,
address _to
)
internal
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
)
{
IERC20(_tokenA).approve(ROUTER, _amountA);
IERC20(_tokenB).approve(ROUTER, _amountB);
(amountA, amountB, liquidity) = IUniswapV2Router(ROUTER).addLiquidity(
_tokenA,
_tokenB,
_amountA,
_amountB,
0,
0,
_to,
block.timestamp
);
}
function removeLiquidity(
address _tokenA,
address _tokenB,
address _to
) internal returns (uint256 amountA, uint256 amountB) {
address pair = getPair(_tokenA, _tokenB);
uint256 liquidity = IERC20(pair).balanceOf(address(this));
IERC20(pair).approve(ROUTER, liquidity);
(amountA, amountB) = IUniswapV2Router(ROUTER).removeLiquidity(
_tokenA,
_tokenB,
liquidity,
0,
0,
_to,
block.timestamp
);
}
function swap(
address _tokenIn,
address _tokenOut,
uint256 _amountIn,
uint256 _slippage,
address _to
) internal returns (uint256) {
IERC20(_tokenIn).approve(ROUTER, _amountIn);
address[] memory path;
if (_tokenIn == WETH || _tokenOut == WETH) {
path = new address[](2);
path[0] = _tokenIn;
path[1] = _tokenOut;
} else {
path = new address[](3);
path[0] = _tokenIn;
path[1] = WETH;
path[2] = _tokenOut;
}
uint256 _amountOutMin = (IUniswapV2Router(ROUTER).getAmountsOut(
_amountIn,
path
)[path.length - 1] * (1000 - _slippage)) / 1000;
uint256 balanceBefore = IERC20(_tokenOut).balanceOf(_to);
IUniswapV2Router(ROUTER)
.swapExactTokensForTokensSupportingFeeOnTransferTokens(
_amountIn,
_amountOutMin,
path,
_to,
block.timestamp
);
uint256 balanceAfter = IERC20(_tokenOut).balanceOf(_to);
return balanceAfter - balanceBefore;
}
function getPair(address _tokenA, address _tokenB)
internal
view
returns (address)
{
return IUniswapV2Factory(FACTORY).getPair(_tokenA, _tokenB);
}
}
THERUGGAME.sol 244 lines
// SPDX-License-Identifier: MIT
pragma solidity =0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "../interfaces/IFactory.sol";
import "../Liquidity.sol";
contract THERUGGAME is ERC20, Ownable {
uint256 private _feesOnContract;
uint256 public points;
uint256 public wethReward;
address public factory;
mapping(address => uint256) private _credit;
mapping(address => uint256) private _xDividendPerToken;
error EliminatedToken();
error InvalidBribeToken();
error NotEnoughBalance();
error NotEnoughRewards();
error TransferLimitExceeded();
event Bribe(
address indexed tokenUsedForBribe,
address indexed tokenBribed,
uint256 amount
);
constructor(
string memory _name,
string memory _symbol,
uint256 _supply,
address _factory
) ERC20(_name, _symbol) {
_mint(msg.sender, _supply);
factory = _factory;
}
function _transfer(
address from,
address to,
uint256 amount
) internal virtual override {
address pair = Liquidity.getPair(address(this), Liquidity.WETH);
if (to != pair && to != address(this) && to != factory) {
uint256 validTokenTransfer = (totalSupply() / 100) - balanceOf(to);
if (amount > validTokenTransfer) revert TransferLimitExceeded();
}
_withdrawToCredit(from);
_withdrawToCredit(to);
if (
(pair == to && from != address(this) && from != factory) ||
(pair == from && to != address(this) && to != factory)
) {
uint256 totalTax = burnTax() + cultTax() + rewardTax() + trgTax();
uint256 feeAmount = (amount * totalTax) / 10000;
super._transfer(from, address(this), feeAmount);
_feesOnContract += feeAmount;
if (from != pair) {
uint256 swappedCult = _buyAndBurnToken(
cult(),
(_feesOnContract * cultTax()) / totalTax
);
uint256 swappedTrg = _buyAndBurnToken(
trg(),
(_feesOnContract * trgTax()) / totalTax
);
uint256 swappedWeth = Liquidity.swap(
address(this),
Liquidity.WETH,
(_feesOnContract * rewardTax()) / totalTax,
slippage(),
factory
);
uint256 burnAmount = (_feesOnContract * burnTax()) / totalTax;
super._transfer(
address(this),
Liquidity.DEAD_ADDRESS,
burnAmount
);
wethReward += swappedWeth;
points += swappedCult + swappedTrg + (burnAmount * 100000);
_feesOnContract = 0;
} else {
uint256 validTokenTransfer = (totalSupply() / 100) -
balanceOf(to);
if (amount > validTokenTransfer) revert TransferLimitExceeded();
}
return super._transfer(from, to, amount - feeAmount);
} else return super._transfer(from, to, amount);
}
function _buyAndBurnToken(address _tokenOut, uint256 _amountIn)
private
returns (uint256)
{
if (_amountIn > 0) {
uint256 swappedAmount = Liquidity.swap(
address(this),
_tokenOut,
_amountIn,
slippage(),
address(this)
);
transferIERC20(_tokenOut, Liquidity.DEAD_ADDRESS, swappedAmount);
return swappedAmount;
}
return 0;
}
function _withdrawToCredit(address _user) private {
address pair = Liquidity.getPair(address(this), Liquidity.WETH);
if (
_user == pair ||
_user == Liquidity.DEAD_ADDRESS ||
_user == address(this)
) return;
uint256 recipientBalance = balanceOf(_user);
if (recipientBalance != 0) {
uint256 amount = ((dividendPerToken() - _xDividendPerToken[_user]) *
recipientBalance) / 1e18;
_credit[_user] += amount;
}
_xDividendPerToken[_user] = dividendPerToken();
}
function pendingRewards(address _user) public view returns (uint256) {
address pair = Liquidity.getPair(address(this), Liquidity.WETH);
if (_user == Liquidity.DEAD_ADDRESS || _user == pair) return 0;
uint256 userBalance = balanceOf(_user);
if (userBalance == 0) return 0;
uint256 amount = ((dividendPerToken() - _xDividendPerToken[_user]) *
userBalance) / 1e18;
return amount += _credit[_user];
}
function claimReward() external {
uint256 userReward = pendingRewards(msg.sender);
if (userReward == 0) revert NotEnoughRewards();
_credit[msg.sender] = 0;
_xDividendPerToken[msg.sender] = dividendPerToken();
transferIERC20(Liquidity.WETH, msg.sender, userReward);
}
function bribe(address _token, uint256 _amount) external {
bool isRugged = IFactory(factory).isValidBribe(address(this));
if (isRugged) revert EliminatedToken();
if (
(_token != cult() && _token != trg()) ||
trgTax() == 0 ||
cultTax() == 0
) revert InvalidBribeToken();
if (balanceOfIERC20(_token, msg.sender) < _amount)
revert NotEnoughBalance();
uint256 beforeBalance = balanceOfIERC20(_token, address(this));
IERC20(_token).transferFrom(msg.sender, address(this), _amount);
uint256 balanceDifference = balanceOfIERC20(_token, address(this)) -
beforeBalance;
uint256 amountToBurn = balanceDifference / 2;
uint256 amountForHolders = balanceDifference - amountToBurn;
transferIERC20(_token, Liquidity.DEAD_ADDRESS, amountToBurn);
if (_token == trg()) transferIERC20(trg(), sTrg(), amountForHolders);
if (_token == cult()) transferIERC20(cult(), dCult(), amountForHolders);
points += (_amount * 3) / 2;
emit Bribe(_token, address(this), _amount);
}
function balanceOfIERC20(address _token, address _user)
private
view
returns (uint256)
{
return IERC20(_token).balanceOf(_user);
}
function transferIERC20(
address _token,
address _to,
uint256 _amount
) private returns (bool) {
return IERC20(_token).transfer(_to, _amount);
}
function dividendPerToken() public view returns (uint256) {
return IFactory(factory).dividendPerToken(address(this));
}
function cult() public view returns (address) {
return IFactory(factory).cult();
}
function dCult() public view returns (address) {
return IFactory(factory).dCult();
}
function trg() public view returns (address) {
return IFactory(factory).trg();
}
function sTrg() public view returns (address) {
return IFactory(factory).sTrg();
}
function slippage() public view returns (uint256) {
return IFactory(factory).slippage();
}
function burnTax() public view returns (uint256) {
return IFactory(factory).burnTax();
}
function cultTax() public view returns (uint256) {
return IFactory(factory).cultTax();
}
function rewardTax() public view returns (uint256) {
return IFactory(factory).rewardTax();
}
function trgTax() public view returns (uint256) {
return IFactory(factory).trgTax();
}
}
IFactory.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity =0.8.9;
interface IFactory {
function cult() external view returns (address);
function dCult() external view returns (address);
function trg() external view returns (address);
function sTrg() external view returns (address);
function dividendPerToken(address) external view returns (uint256);
function burnTax() external view returns (uint256);
function cultTax() external view returns (uint256);
function rewardTax() external view returns (uint256);
function trgTax() external view returns (uint256);
function isValidBribe(address) external view returns (bool);
function slippage() external view returns (uint256);
}
IUniswap.sol 51 lines
// SPDX-License-Identifier: MIT
pragma solidity =0.8.9;
interface IUniswapV2Router {
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function getAmountsOut(uint256 amountIn, address[] memory path)
external
view
returns (uint256[] memory amounts);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
interface IUniswapV2Factory {
function getPair(address tokenA, address tokenB)
external
view
returns (address pair);
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^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 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) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^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() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
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 {
_transferOwnership(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");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
ERC20.sol 389 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.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.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead 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, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override 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 this function is
* overridden;
*
* 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 override returns (uint8) {
return 18;
}
/**
* @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:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, 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}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, 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}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
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) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + 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) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* This 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:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, 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:
*
* - `account` 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 += amount;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(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);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_totalSupply -= amount;
}
emit Transfer(account, address(0), amount);
_afterTokenTransfer(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 Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @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 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 {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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);
/**
* @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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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 from,
address to,
uint256 amount
) external returns (bool);
}
IERC20Metadata.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
Read Contract
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
burnTax 0x1d4eaead → uint256
cult 0xa1bd8105 → address
cultTax 0x0db9ef3c → uint256
dCult 0x0e63d807 → address
decimals 0x313ce567 → uint8
dividendPerToken 0x77ec0feb → uint256
factory 0xc45a0155 → address
name 0x06fdde03 → string
owner 0x8da5cb5b → address
pendingRewards 0x31d7a262 → uint256
points 0x1be6dd64 → uint256
rewardTax 0x6e5c59ae → uint256
sTrg 0x299a8c47 → address
slippage 0x3e032a3b → uint256
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
trg 0x480ea628 → address
trgTax 0xa1de2582 → uint256
wethReward 0x12a8e566 → uint256
Write Contract 9 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
bribe 0x4667d6fc
address _token
uint256 _amount
claimReward 0xb88a802f
No parameters
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
renounceOwnership 0x715018a6
No parameters
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address