Token

 

Overview

Max Total Supply:
0

Holders:
0

Transfers:
-

 
Loading
[ Download CSV Export  ] 
Loading
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TokenikV1Rewards

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 2 : TokenikV1Rewards.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity >0.8.0;

import './interfaces/ITokenikV1Rewards.sol';

contract TokenikV1Rewards is ITokenikV1Rewards{

    event ClaimAirdrop(
        address user,
        uint256 amount,
        address ref,
        uint256 refAmount
    );

    address public callerSetter;
    bool public addRewardPaused; //to be paused on Tokenik v2 launch
    bool public removeRewardPaused; //to be paused on Tokenik v2 launch
    bool public airdropEnabled; //false on contract launch
    uint256 public airdropAmount; //free airdrop amount
    uint256 public airdropRefBonus; //airdrop referral bonus
    uint256 public totalRewards; //total rewards supply
    uint256 public totalAirdropClaims; //number of individual addresses that claimed the airdrop
    uint256 public swapRewardPercentage; // 1 decimal, 10 is 1%

    mapping(address => uint256) public tradingRewards; //RNIK balance with 18 decimals
    mapping(address => bool) public approvedCallers; //approved callers list
    mapping(address => bool) public approvedTokens; //stable tokens approved to receive trading rewards
    mapping(address => bool) public claimedAirdrop; //track airdrop claims

    modifier onlySetter() {
        require(msg.sender == callerSetter, 'TokenikV1: FORBIDDEN');
        _;
    }

    modifier onlyCaller() {
        require(approvedCallers[msg.sender], 'TokenikV1: Forbidden');
        _;
    }

    constructor() {
        callerSetter = msg.sender;
        approvedCallers[msg.sender] = true;
        airdropAmount = 250 * 1e18; //250 RNIK
        airdropRefBonus = 50 * 1e18; //50 RNIK
        swapRewardPercentage = 10; //1%
    }


    function addReward(address _user, uint256 _amount) external override onlyCaller {
        
        if(!addRewardPaused){
            tradingRewards[_user] += _amount; 
            totalRewards += _amount; 
        }    
    }

    function addSwapReward(address _user, uint256 _amount, address _token) external override onlyCaller {
        //valid if pair is caller and token is approved
        
        if(!approvedTokens[_token]) return; //ensure the token is approved

        if(!addRewardPaused){
            uint256 rewardOffer = _amount * swapRewardPercentage / 1000;
            tradingRewards[_user] += rewardOffer; 
            totalRewards += rewardOffer; 
        }    
    }

    function addLiquidityReward(address _user, address _token0, address _token1, uint256 _amount0, uint256 _amount1) external override onlyCaller {
        //valid if pair is caller and token is approved

        if(addRewardPaused) return; //rewards is paused

        if(approvedTokens[_token0]){
                tradingRewards[_user] += _amount0; 
                totalRewards += _amount0; 
        } else{
            if(approvedTokens[_token1]){
                tradingRewards[_user] += _amount1; 
                totalRewards += _amount1;  
            }
        }
  
    }

    function removeReward(address _user, uint256 _amount) external override onlyCaller returns(bool) {
        
        if(!removeRewardPaused){
            //ensure the _amount is not greater than user balance
            if(_amount > tradingRewards[_user]){
                return false;
            }
            else{
                tradingRewards[_user] -= _amount;
                totalRewards -= _amount;
                return true;
            }
        }
        else{
            return false;
        }
    }

    function removeSwapReward(address _user, uint256 _amount, address _token) external override onlyCaller returns(bool) {
               
        if(removeRewardPaused) return false; //rewards is paused
        if(!approvedTokens[_token]) return false; //token is not approved

        if(_amount > tradingRewards[_user]){
                return false;
            }
            else{
                tradingRewards[_user] -= _amount;
                totalRewards -= _amount;
                return true;
            }
    }

    function claimAirdrop(address _ref) external override {
        require(airdropEnabled, 'TokenikV1: Airdrop is disabled.');
        require(!claimedAirdrop[msg.sender], 'TokenikV1: Already claimed airdrop.');

        claimedAirdrop[msg.sender] = true;
        totalAirdropClaims +=1;

        uint256 amountToClaim = airdropAmount;        

        if((_ref != address(0)) && (_ref != msg.sender)){
            amountToClaim +=airdropRefBonus;
            tradingRewards[msg.sender] += amountToClaim;
            tradingRewards[_ref] += airdropRefBonus;

            uint256 mintedRewards = amountToClaim + airdropRefBonus;
            totalRewards += mintedRewards;

            emit ClaimAirdrop(msg.sender, amountToClaim, _ref, airdropRefBonus);
        }
        else{
            tradingRewards[msg.sender] += amountToClaim;
            totalRewards += amountToClaim;

            emit ClaimAirdrop(msg.sender, amountToClaim, address(0), 0);
        }
    }

    //getter functions

    function getRewards(address _address) external view override returns(uint256){
        return tradingRewards[_address];
    }

    function getClaimedAirdrop(address _address) external view override returns(bool){
        return claimedAirdrop[_address];
    }

    function getApprovedCaller(address _address) override view external returns(bool){
        return approvedCallers[_address];
    }

    function getApprovedToken(address _address) external view override returns(bool){
        return approvedTokens[_address];
    }

    function getApprovedTokens(address _token0, address _token1) external view override returns(bool,bool){
        return (approvedTokens[_token0], approvedTokens[_token1]);
    }

    //setter functions

    function setCallerSetter(address _callerSetter) external override onlySetter{
        
        callerSetter = _callerSetter; //intentionally not checking against address(0) as callerSetter will be set to zero address once Tokenik v2 launches and rewards get paused
    }

    function setApprovedCaller(address _caller, bool _approved) external override onlySetter{
        
        approvedCallers[_caller] = _approved;
    }

    function setApprovedTokens(address _token, bool _approved) external override onlySetter{
        
        approvedTokens[_token] = _approved;
    }

    function setAddRewardPaused(bool  _paused) external override onlySetter{
        
        addRewardPaused = _paused;
    }

    function setRemoveRewardPaused(bool  _paused) external override onlySetter{
        
        removeRewardPaused = _paused;
    }

    function setAirdropAmounts(uint256 _amount, uint256 _refAmount) external override onlySetter{
        
        airdropAmount = _amount;
        airdropRefBonus = _refAmount;
    }

    function enableAirdrop(bool  _enabled) external override onlySetter{
        
        airdropEnabled = _enabled;
    }
}

File 2 of 2 : ITokenikV1Rewards.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity >0.8.0;

interface ITokenikV1Rewards {

    function addReward(address _user, uint256 _amount) external;
    function addSwapReward(address _user, uint256 _amount, address _token) external;
    function removeReward(address _user, uint256 _amount) external returns(bool);
    function claimAirdrop(address _ref) external;
    function getRewards(address _address) external view returns(uint256);
    function getClaimedAirdrop(address _address) external view returns(bool);
    function getApprovedCaller(address _address) external view returns(bool);
    function setCallerSetter(address _callerSetter) external;
    function setApprovedCaller(address _caller, bool _approved) external;
    function setAddRewardPaused(bool  _paused) external;
    function setRemoveRewardPaused(bool  _paused) external;
    function setAirdropAmounts(uint256 _amount, uint256 _refAmount) external;
    function enableAirdrop(bool  _enabled) external;
    function addLiquidityReward(address _user, address _token0, address _token1, uint256 _amount0, uint256 _amount1) external;
    function removeSwapReward(address _user, uint256 _amount, address _token) external returns(bool);
    function getApprovedToken(address _address) external view returns(bool);
    function getApprovedTokens(address _token0, address _token1) external view returns(bool,bool);
    function setApprovedTokens(address _token, bool _approved) external;
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"ref","type":"address"},{"indexed":false,"internalType":"uint256","name":"refAmount","type":"uint256"}],"name":"ClaimAirdrop","type":"event"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_token0","type":"address"},{"internalType":"address","name":"_token1","type":"address"},{"internalType":"uint256","name":"_amount0","type":"uint256"},{"internalType":"uint256","name":"_amount1","type":"uint256"}],"name":"addLiquidityReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"addReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"addRewardPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_token","type":"address"}],"name":"addSwapReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"airdropAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"airdropEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"airdropRefBonus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"approvedCallers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"approvedTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"callerSetter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_ref","type":"address"}],"name":"claimAirdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimedAirdrop","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_enabled","type":"bool"}],"name":"enableAirdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getApprovedCaller","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getApprovedToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token0","type":"address"},{"internalType":"address","name":"_token1","type":"address"}],"name":"getApprovedTokens","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getClaimedAirdrop","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"removeReward","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"removeRewardPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_token","type":"address"}],"name":"removeSwapReward","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setAddRewardPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_refAmount","type":"uint256"}],"name":"setAirdropAmounts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"}],"name":"setApprovedCaller","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"}],"name":"setApprovedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_callerSetter","type":"address"}],"name":"setCallerSetter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setRemoveRewardPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapRewardPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAirdropClaims","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tradingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50600080546001600160a01b0319163390811782558152600760205260409020805460ff19166001908117909155680d8d726b7177a8000090556802b5e3af16b1880000600255600a6005556110aa8061006b6000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80637ecf7b741161010f578063b6230abc116100a2578063df903f0011610071578063df903f00146104ee578063e0b6b27214610501578063e4b3063b14610514578063fc2ea8a51461051d57600080fd5b8063b6230abc14610489578063b6a16aed1461049c578063bff9da36146104c8578063c2130bfe146104db57600080fd5b80639c0ce1b2116100de5780639c0ce1b2146103ea5780639feb8f5014610440578063a61b729514610453578063a71975af1461046657600080fd5b80637ecf7b741461038f5780637f10ee3b146103a257806381ecd3a2146103b557806394546b84146103be57600080fd5b806329b0eeaa1161018757806367d2a0b21161015657806367d2a0b21461030f5780636d1ea3fa1461031857806379ee54f71461033b5780637c1e34111461036457600080fd5b806329b0eeaa146102a95780633721ecae146102bc5780634e976acb146102e857806365f8c6c5146102fc57600080fd5b806318f7ce4d116101c357806318f7ce4d1461022e5780631b93f66d1461024e5780632010428914610281578063271a56ab1461029557600080fd5b80630e15561a146101ea57806313957cfd14610206578063174af0f41461021b575b600080fd5b6101f360035481565b6040519081526020015b60405180910390f35b610219610214366004610ec5565b610526565b005b610219610229366004610ec5565b610584565b6101f361023c366004610e22565b60066020526000908152604090205481565b61027161025c366004610e22565b60096020526000908152604090205460ff1681565b60405190151581526020016101fd565b60005461027190600160b01b900460ff1681565b60005461027190600160a81b900460ff1681565b6102716102b7366004610f19565b6105d9565b6102716102ca366004610e22565b6001600160a01b031660009081526009602052604090205460ff1690565b60005461027190600160a01b900460ff1681565b61021961030a366004610e22565b6106c9565b6101f360055481565b610271610326366004610e22565b60086020526000908152604090205460ff1681565b6101f3610349366004610e22565b6001600160a01b031660009081526006602052604090205490565b600054610377906001600160a01b031681565b6040516001600160a01b0390911681526020016101fd565b61021961039d366004610f70565b61095b565b6102196103b0366004610e22565b610990565b6101f360025481565b6102716103cc366004610e22565b6001600160a01b031660009081526008602052604090205460ff1690565b6104296103f8366004610e3d565b6001600160a01b0380831660009081526008602052604080822054928416825290205460ff91821691169250929050565b6040805192151583529015156020830152016101fd565b61021961044e366004610eef565b6109dc565b610219610461366004610f55565b610a66565b610271610474366004610e22565b60076020526000908152604090205460ff1681565b610219610497366004610f55565b610aae565b6102716104aa366004610e22565b6001600160a01b031660009081526007602052604090205460ff1690565b6102196104d6366004610f55565b610af6565b6102716104e9366004610eef565b610b3e565b6102196104fc366004610e70565b610c00565b61021961050f366004610f19565b610d22565b6101f360045481565b6101f360015481565b6000546001600160a01b031633146105595760405162461bcd60e51b815260040161055090610fc0565b60405180910390fd5b6001600160a01b03919091166000908152600760205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146105ae5760405162461bcd60e51b815260040161055090610fc0565b6001600160a01b03919091166000908152600860205260409020805460ff1916911515919091179055565b3360009081526007602052604081205460ff166106085760405162461bcd60e51b815260040161055090610f92565b600054600160a81b900460ff1615610622575060006106c2565b6001600160a01b03821660009081526008602052604090205460ff1661064a575060006106c2565b6001600160a01b038416600090815260066020526040902054831115610672575060006106c2565b6001600160a01b0384166000908152600660205260408120805485929061069a908490611047565b9250508190555082600360008282546106b39190611047565b90915550600191506106c29050565b9392505050565b600054600160b01b900460ff166107225760405162461bcd60e51b815260206004820152601f60248201527f546f6b656e696b56313a2041697264726f702069732064697361626c65642e006044820152606401610550565b3360009081526009602052604090205460ff161561078e5760405162461bcd60e51b815260206004820152602360248201527f546f6b656e696b56313a20416c726561647920636c61696d656420616972647260448201526237b81760e91b6064820152608401610550565b336000908152600960205260408120805460ff1916600190811790915560048054919290916107be908490610fee565b90915550506001546001600160a01b038216158015906107e757506001600160a01b0382163314155b156108d2576002546107f99082610fee565b3360009081526006602052604081208054929350839290919061081d908490610fee565b90915550506002546001600160a01b0383166000908152600660205260408120805490919061084d908490610fee565b90915550506002546000906108629083610fee565b905080600360008282546108769190610fee565b909155505060025460408051338152602081018590526001600160a01b038616818301526060810192909252517f48f860272fdd1bbc708b839f87ae78f2f8a74dd31384976c3ad78e0c88053de49181900360800190a1505050565b33600090815260066020526040812080548392906108f1908490610fee565b92505081905550806003600082825461090a9190610fee565b909155505060408051338152602081018390526000818301819052606082015290517f48f860272fdd1bbc708b839f87ae78f2f8a74dd31384976c3ad78e0c88053de49181900360800190a15b5050565b6000546001600160a01b031633146109855760405162461bcd60e51b815260040161055090610fc0565b600191909155600255565b6000546001600160a01b031633146109ba5760405162461bcd60e51b815260040161055090610fc0565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b3360009081526007602052604090205460ff16610a0b5760405162461bcd60e51b815260040161055090610f92565b600054600160a01b900460ff16610957576001600160a01b03821660009081526006602052604081208054839290610a44908490610fee565b925050819055508060036000828254610a5d9190610fee565b90915550505050565b6000546001600160a01b03163314610a905760405162461bcd60e51b815260040161055090610fc0565b60008054911515600160b01b0260ff60b01b19909216919091179055565b6000546001600160a01b03163314610ad85760405162461bcd60e51b815260040161055090610fc0565b60008054911515600160a81b0260ff60a81b19909216919091179055565b6000546001600160a01b03163314610b205760405162461bcd60e51b815260040161055090610fc0565b60008054911515600160a01b0260ff60a01b19909216919091179055565b3360009081526007602052604081205460ff16610b6d5760405162461bcd60e51b815260040161055090610f92565b600054600160a81b900460ff16610bf6576001600160a01b038316600090815260066020526040902054821115610ba657506000610bfa565b6001600160a01b03831660009081526006602052604081208054849290610bce908490611047565b925050819055508160036000828254610be79190611047565b9091555060019150610bfa9050565b5060005b92915050565b3360009081526007602052604090205460ff16610c2f5760405162461bcd60e51b815260040161055090610f92565b600054600160a01b900460ff1615610c4657610d1b565b6001600160a01b03841660009081526008602052604090205460ff1615610cb3576001600160a01b03851660009081526006602052604081208054849290610c8f908490610fee565b925050819055508160036000828254610ca89190610fee565b90915550610d1b9050565b6001600160a01b03831660009081526008602052604090205460ff1615610d1b576001600160a01b03851660009081526006602052604081208054839290610cfc908490610fee565b925050819055508060036000828254610d159190610fee565b90915550505b5050505050565b3360009081526007602052604090205460ff16610d515760405162461bcd60e51b815260040161055090610f92565b6001600160a01b03811660009081526008602052604090205460ff16610d7657505050565b600054600160a01b900460ff16610df15760006103e860055484610d9a9190611028565b610da49190611006565b6001600160a01b038516600090815260066020526040812080549293508392909190610dd1908490610fee565b925050819055508060036000828254610dea9190610fee565b9091555050505b505050565b80356001600160a01b0381168114610e0d57600080fd5b919050565b80358015158114610e0d57600080fd5b600060208284031215610e3457600080fd5b6106c282610df6565b60008060408385031215610e5057600080fd5b610e5983610df6565b9150610e6760208401610df6565b90509250929050565b600080600080600060a08688031215610e8857600080fd5b610e9186610df6565b9450610e9f60208701610df6565b9350610ead60408701610df6565b94979396509394606081013594506080013592915050565b60008060408385031215610ed857600080fd5b610ee183610df6565b9150610e6760208401610e12565b60008060408385031215610f0257600080fd5b610f0b83610df6565b946020939093013593505050565b600080600060608486031215610f2e57600080fd5b610f3784610df6565b925060208401359150610f4c60408501610df6565b90509250925092565b600060208284031215610f6757600080fd5b6106c282610e12565b60008060408385031215610f8357600080fd5b50508035926020909101359150565b6020808252601490820152732a37b5b2b734b5ab189d102337b93134b23232b760611b604082015260600190565b6020808252601490820152732a37b5b2b734b5ab189d102327a92124a22222a760611b604082015260600190565b600082198211156110015761100161105e565b500190565b60008261102357634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156110425761104261105e565b500290565b6000828210156110595761105961105e565b500390565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220c05977eefab278fc864a04b138cdfeddca7319f4ed659e46acd7fc4321b049ea64736f6c63430008070033

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.