ETH Price: $2,528.95 (+0.69%)

Transaction Decoder

Block:
15399823 at Aug-24-2022 12:39:36 AM +UTC
Transaction Fee:
0.000787993604351586 ETH $1.99
Gas Used:
62,373 Gas / 12.633569082 Gwei

Emitted Events:

190 AXIATOKEN.Transfer( from=[Receiver] ASP, to=[Sender] 0x01c2a6eb1568c1a3e0b8fe864056fac8b4867f77, value=895175541972352038017 )
191 ASP.RewardEvent( staker=[Sender] 0x01c2a6eb1568c1a3e0b8fe864056fac8b4867f77, pool=[Receiver] ASP, amount=895175541972352038017 )

Account State Difference:

  Address   Before After State Difference Code
0x01C2a6EB...8B4867f77
0.315030787930777367 Eth
Nonce: 106
0.314242794326425781 Eth
Nonce: 107
0.000787993604351586
0x793786e2...9ba5E7546
(F2Pool Old)
4,681.613731758396288695 Eth4,681.613825317896288695 Eth0.0000935595
0x9dEd3b9d...f0033c0C8

Execution Trace

ASP.CALL( )
  • AXIATOKEN.transfer( to=0x01C2a6EB1568C1A3E0B8fE864056FaC8B4867f77, value=895175541972352038017 ) => ( success=True )
    File 1 of 2: ASP
    /*
    
    * @dev This is the Axia Protocol Staking pool contract (AXIA LONE Pool), a part of the protocol where stakers are rewarded in AXIA tokens 
    * when they make stakes of Axia tokens.
    
    * stakers reward come from the daily emission from the total supply into circulation,
    * this happens daily and upon the reach of a new epoch each made of 180 days, 
    * halvings are experienced on the emitting amount of tokens.
    
    
    * on the 11th epoch all the tokens would have been completed emitted into circulation,
    * from here on, the stakers will still be earning from daily emissions
    * which would now be coming from the accumulated basis points over the epochs.
    
    * upon unstaking, stakers are charged a fee of 1% of their unstaking sum which is
    * burnt forever, thereby reducing the total supply. this gives the Axia token its deflationary feature.
    
    
    */
    pragma solidity 0.6.4;
    
    
    interface IERC20 {
    
        function totalSupply() external view returns (uint256);
    
        function balanceOf(address account) external view returns (uint256);
    
        function transfer(address recipient, uint256 amount) external returns (bool);
    
        function allowance(address owner, address spender) external view returns (uint256);
    
        function approve(address spender, uint256 amount) external returns (bool);
    
        function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
        
        function supplyeffect(uint _amount) external returns (bool);
    
        event Transfer(address indexed from, address indexed to, uint256 value);
    
        event Approval(address indexed owner, address indexed spender, uint256 value);
    }
    
    
    library SafeMath {
        /**
         * @dev Returns the addition of two unsigned integers, reverting on
         * overflow.
         *
         * Counterpart to Solidity's `+` operator.
         *
         * Requirements:
         *
         * - Addition cannot overflow.
         */
        function add(uint256 a, uint256 b) internal pure returns (uint256) {
            uint256 c = a + b;
            require(c >= a, "SafeMath: addition overflow");
    
            return c;
        }
     
        /**
         * @dev Returns the subtraction of two unsigned integers, reverting on
         * overflow (when the result is negative).
         *
         * Counterpart to Solidity's `-` operator.
         *
         * Requirements:
         *
         * - Subtraction cannot overflow.
         */
        function sub(uint256 a, uint256 b) internal pure returns (uint256) {
            return sub(a, b, "SafeMath: subtraction overflow");
        }
    
        /**
         * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
         * overflow (when the result is negative).
         *
         * Counterpart to Solidity's `-` operator.
         *
         * Requirements:
         *
         * - Subtraction cannot overflow.
         */
        function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
            require(b <= a, errorMessage);
            uint256 c = a - b;
    
            return c;
        }
    
        /**
         * @dev Returns the multiplication of two unsigned integers, reverting on
         * overflow.
         *
         * Counterpart to Solidity's `*` operator.
         *
         * Requirements:
         *
         * - Multiplication cannot overflow.
         */
        function mul(uint256 a, uint256 b) internal pure returns (uint256) {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) {
                return 0;
            }
    
            uint256 c = a * b;
            require(c / a == b, "SafeMath: multiplication overflow");
    
            return c;
        }
    
        /**
         * @dev Returns the integer division of two unsigned integers. Reverts on
         * division by zero. The result is rounded towards zero.
         *
         * Counterpart to Solidity's `/` operator. Note: this function uses a
         * `revert` opcode (which leaves remaining gas untouched) while Solidity
         * uses an invalid opcode to revert (consuming all remaining gas).
         *
         * Requirements:
         *
         * - The divisor cannot be zero.
         */
        function div(uint256 a, uint256 b) internal pure returns (uint256) {
            return div(a, b, "SafeMath: division by zero");
        }
    
        /**
         * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
         * division by zero. The result is rounded towards zero.
         *
         * Counterpart to Solidity's `/` operator. Note: this function uses a
         * `revert` opcode (which leaves remaining gas untouched) while Solidity
         * uses an invalid opcode to revert (consuming all remaining gas).
         *
         * Requirements:
         *
         * - The divisor cannot be zero.
         */
        function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
            require(b > 0, errorMessage);
            uint256 c = a / b;
            // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    
            return c;
        }
    
        /**
         * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
         * Reverts when dividing by zero.
         *
         * Counterpart to Solidity's `%` operator. This function uses a `revert`
         * opcode (which leaves remaining gas untouched) while Solidity uses an
         * invalid opcode to revert (consuming all remaining gas).
         *
         * Requirements:
         *
         * - The divisor cannot be zero.
         */
        function mod(uint256 a, uint256 b) internal pure returns (uint256) {
            return mod(a, b, "SafeMath: modulo by zero");
        }
    
        /**
         * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
         * Reverts with custom message when dividing by zero.
         *
         * Counterpart to Solidity's `%` operator. This function uses a `revert`
         * opcode (which leaves remaining gas untouched) while Solidity uses an
         * invalid opcode to revert (consuming all remaining gas).
         *
         * Requirements:
         *
         * - The divisor cannot be zero.
         */
        function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
            require(b != 0, errorMessage);
            return a % b;
        }
    }
    
    
    
    contract ASP{
        
        using SafeMath for uint256;
        
        //======================================EVENTS=========================================//
        event StakeEvent(address indexed staker, address indexed pool, uint amount);
        event UnstakeEvent(address indexed unstaker, address indexed pool, uint amount);
        event RewardEvent(address indexed staker, address indexed pool, uint amount);
        event RewardStake(address indexed staker, address indexed pool, uint amount);
        
        
        //======================================STAKING POOL=========================================//
        address public Axiatoken;
        
        bool public stakingEnabled;
        
        uint256 constant private FLOAT_SCALAR = 2**64;
        uint256 public MINIMUM_STAKE = 1000000000000000000; // 1000 AXIA Tokens
    	uint256 public MIN_DIVIDENDS_DUR = 18 hours;
    	uint256 private  UNSTAKE_FEE = 1; //1% burns when you unstake
    	uint public infocheck;
    	uint _burnedAmount;
    	uint actualValue;
        
        struct User {
    		uint256 balance;
    		uint256 frozen;
    		int256 scaledPayout;  
    		uint256 staketime;
    	}
    
    	struct Info {
    		uint256 totalSupply;
    		uint256 totalFrozen;
    		mapping(address => User) users;
    		uint256 scaledPayoutPerToken; //pool balance 
    		address admin;
    	}
    	
    	Info private info;
    	
    	
    	constructor() public {
           
    	    info.admin = msg.sender;
    		stakingEnabled = false;
    		
    	}
    	
    //======================================ADMINSTRATION=========================================//
    
    	modifier onlyCreator() {
            require(msg.sender == info.admin, "Ownable: caller is not the administrator");
            _;
        }
        
        modifier onlyAxiaToken() {
            require(msg.sender == Axiatoken, "Authorization: only token contract can call");
            _;
        }
        
    	 function tokenconfigs(address _axiatoken) public onlyCreator returns (bool success) {
            Axiatoken = _axiatoken;
            return true;
        }
    	
    	function _minStakeAmount(uint256 _number) onlyCreator public {
    		
    		MINIMUM_STAKE = _number*1000000000000000000;
    		
    	}
        
        function stakingStatus(bool _status) public onlyCreator {
        require(Axiatoken != address(0), "Pool address is not yet setup");
    	stakingEnabled = _status;
        }
        
        function unstakeburnrate(uint _rate) public onlyCreator returns (bool success) {
            UNSTAKE_FEE = _rate;
            return true;
        }
        
        
        function MIN_DIVIDENDS_DUR_TIME(uint256 _minDuration) public onlyCreator {
            
    	MIN_DIVIDENDS_DUR = _minDuration;
    	
        }
    //======================================USER WRITE=========================================//
    
    	function StakeAxiaTokens(uint256 _tokens) external {
    		_stake(_tokens);
    	}
        
        function UnstakeAxiaTokens(uint256 _tokens) external {
    		_unstake(_tokens);
    	}
    	
    //======================================USER READ=========================================//
    
    	function totalFrozen() public view returns (uint256) {
    		return info.totalFrozen;
    	}
    	
        function frozenOf(address _user) public view returns (uint256) {
    		return info.users[_user].frozen;
    	}
    
    	function dividendsOf(address _user) public view returns (uint256) {
    	    
    	    if(info.users[_user].staketime < MIN_DIVIDENDS_DUR){
    	        return 0;
    	    }else{
    	     return uint256(int256(info.scaledPayoutPerToken * info.users[_user].frozen) - info.users[_user].scaledPayout) / FLOAT_SCALAR;   
    	    }
    	}
    	
    
    	function userData(address _user) public view 
    	returns (uint256 totalTokensFrozen, uint256 userFrozen, 
    	uint256 userDividends, uint256 userStaketime, int256 scaledPayout) {
    	    
    		return (totalFrozen(), frozenOf(_user), dividendsOf(_user), info.users[_user].staketime, info.users[_user].scaledPayout);
    	
    	    
    	}
    	
    
    //======================================ACTION CALLS=========================================//	
    	
    	function _stake(uint256 _amount) internal {
    	    
    	    require(stakingEnabled, "Staking not yet initialized");
    	    
    		require(IERC20(Axiatoken).balanceOf(msg.sender) >= _amount, "Insufficient Axia token balance");
    		require(frozenOf(msg.sender) + _amount >= MINIMUM_STAKE, "Your amount is lower than the minimum amount allowed to stake");
    		require(IERC20(Axiatoken).allowance(msg.sender, address(this)) >= _amount, "Not enough allowance given to contract yet to spend by user");
    		
    		info.users[msg.sender].staketime = now;
    		info.totalFrozen += _amount;
    		info.users[msg.sender].frozen += _amount;
    		
    		info.users[msg.sender].scaledPayout += int256(_amount * info.scaledPayoutPerToken); 
    		IERC20(Axiatoken).transferFrom(msg.sender, address(this), _amount);      // Transfer liquidity tokens from the sender to this contract
    		
            emit StakeEvent(msg.sender, address(this), _amount);
    	}
    	
    	    
    	
    	function _unstake(uint256 _amount) internal {
    	    
    		require(frozenOf(msg.sender) >= _amount, "You currently do not have up to that amount staked");
    		
    		info.totalFrozen -= _amount;
    		info.users[msg.sender].frozen -= _amount;
    		info.users[msg.sender].scaledPayout -= int256(_amount * info.scaledPayoutPerToken);
    		
    		_burnedAmount = mulDiv(_amount, UNSTAKE_FEE, 100);
    		actualValue = _amount.sub(_burnedAmount);
    		
    		require(IERC20(Axiatoken).transfer(msg.sender, actualValue), "Transaction failed");
            emit UnstakeEvent(address(this), msg.sender, actualValue);
    		
    		
    		require(IERC20(Axiatoken).transfer(address(0x0), _burnedAmount), "Transaction failed");
     		IERC20(Axiatoken).supplyeffect(_burnedAmount);
     		
     		TakeDividends();
     		
    		
    	}
    	
    	
    
    		
    		
    	function TakeDividends() public returns (uint256) {
    		    
    		uint256 _dividends = dividendsOf(msg.sender);
    		require(_dividends >= 0, "you do not have any dividend yet");
    		info.users[msg.sender].scaledPayout += int256(_dividends * FLOAT_SCALAR);
    		
    		require(IERC20(Axiatoken).transfer(msg.sender, _dividends), "Transaction Failed");    // Transfer dividends to msg.sender
    		emit RewardEvent(msg.sender, address(this), _dividends);
    		
    		return _dividends;
    	    
    		    
    	}
    		
    		
    	function scaledToken(uint _amount) external onlyAxiaToken returns(bool){
                
        		info.scaledPayoutPerToken += _amount * FLOAT_SCALAR / info.totalFrozen;
        		infocheck = info.scaledPayoutPerToken;
        		return true;
                
        }
     
            
        function mulDiv (uint x, uint y, uint z) public pure returns (uint) {
                  (uint l, uint h) = fullMul (x, y);
                  assert (h < z);
                  uint mm = mulmod (x, y, z);
                  if (mm > l) h -= 1;
                  l -= mm;
                  uint pow2 = z & -z;
                  z /= pow2;
                  l /= pow2;
                  l += h * ((-pow2) / pow2 + 1);
                  uint r = 1;
                  r *= 2 - z * r;
                  r *= 2 - z * r;
                  r *= 2 - z * r;
                  r *= 2 - z * r;
                  r *= 2 - z * r;
                  r *= 2 - z * r;
                  r *= 2 - z * r;
                  r *= 2 - z * r;
                  return l * r;
        }
            
        function fullMul (uint x, uint y) private pure returns (uint l, uint h) {
                  uint mm = mulmod (x, y, uint (-1));
                  l = x * y;
                  h = mm - l;
                  if (mm < l) h -= 1;
        }
     
        
    }

    File 2 of 2: AXIATOKEN
    pragma solidity 0.6.4;
    library SafeMath {
        /**
         * @dev Returns the addition of two unsigned integers, reverting on
         * overflow.
         *
         * Counterpart to Solidity's `+` operator.
         *
         * Requirements:
         *
         * - Addition cannot overflow.
         */
        function add(uint256 a, uint256 b) internal pure returns (uint256) {
            uint256 c = a + b;
            require(c >= a, "SafeMath: addition overflow");
    
            return c;
        }
     
        /**
         * @dev Returns the subtraction of two unsigned integers, reverting on
         * overflow (when the result is negative).
         *
         * Counterpart to Solidity's `-` operator.
         *
         * Requirements:
         *
         * - Subtraction cannot overflow.
         */
        function sub(uint256 a, uint256 b) internal pure returns (uint256) {
            return sub(a, b, "SafeMath: subtraction overflow");
        }
    
        /**
         * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
         * overflow (when the result is negative).
         *
         * Counterpart to Solidity's `-` operator.
         *
         * Requirements:
         *
         * - Subtraction cannot overflow.
         */
        function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
            require(b <= a, errorMessage);
            uint256 c = a - b;
    
            return c;
        }
    
        /**
         * @dev Returns the multiplication of two unsigned integers, reverting on
         * overflow.
         *
         * Counterpart to Solidity's `*` operator.
         *
         * Requirements:
         *
         * - Multiplication cannot overflow.
         */
        function mul(uint256 a, uint256 b) internal pure returns (uint256) {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) {
                return 0;
            }
    
            uint256 c = a * b;
            require(c / a == b, "SafeMath: multiplication overflow");
    
            return c;
        }
    
        /**
         * @dev Returns the integer division of two unsigned integers. Reverts on
         * division by zero. The result is rounded towards zero.
         *
         * Counterpart to Solidity's `/` operator. Note: this function uses a
         * `revert` opcode (which leaves remaining gas untouched) while Solidity
         * uses an invalid opcode to revert (consuming all remaining gas).
         *
         * Requirements:
         *
         * - The divisor cannot be zero.
         */
        function div(uint256 a, uint256 b) internal pure returns (uint256) {
            return div(a, b, "SafeMath: division by zero");
        }
    
        /**
         * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
         * division by zero. The result is rounded towards zero.
         *
         * Counterpart to Solidity's `/` operator. Note: this function uses a
         * `revert` opcode (which leaves remaining gas untouched) while Solidity
         * uses an invalid opcode to revert (consuming all remaining gas).
         *
         * Requirements:
         *
         * - The divisor cannot be zero.
         */
        function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
            require(b > 0, errorMessage);
            uint256 c = a / b;
            // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    
            return c;
        }
    
        /**
         * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
         * Reverts when dividing by zero.
         *
         * Counterpart to Solidity's `%` operator. This function uses a `revert`
         * opcode (which leaves remaining gas untouched) while Solidity uses an
         * invalid opcode to revert (consuming all remaining gas).
         *
         * Requirements:
         *
         * - The divisor cannot be zero.
         */
        function mod(uint256 a, uint256 b) internal pure returns (uint256) {
            return mod(a, b, "SafeMath: modulo by zero");
        }
    
        /**
         * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
         * Reverts with custom message when dividing by zero.
         *
         * Counterpart to Solidity's `%` operator. This function uses a `revert`
         * opcode (which leaves remaining gas untouched) while Solidity uses an
         * invalid opcode to revert (consuming all remaining gas).
         *
         * Requirements:
         *
         * - The divisor cannot be zero.
         */
        function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
            require(b != 0, errorMessage);
            return a % b;
        }
    }
    
    //ERC20 Interface
    interface ERC20 {
        function totalSupply() external view returns (uint);
        function balanceOf(address account) external view returns (uint);
        function transfer(address, uint) external returns (bool);
        function allowance(address owner, address spender) external view returns (uint);
        function approve(address, uint) external returns (bool);
        function transferFrom(address, address, uint) external returns (bool);
        event Transfer(address indexed from, address indexed to, uint value);
        event Approval(address indexed owner, address indexed spender, uint value);
        }
        
    interface ASP {
        
       function scaledToken(uint amount) external returns(bool);
       function totalFrozen() external view returns (uint256);
     }
    
    interface OSP {
        
       function scaledToken(uint amount) external returns(bool);
       function totalFrozen() external view returns (uint256);
     }
     
    interface DSP {
        
       function scaledToken(uint amount) external returns(bool);
       function totalFrozen() external view returns (uint256);
     }
    
    interface USP {
        
       function scaledToken(uint amount) external returns(bool);
       function totalFrozen() external view returns (uint256);
     }
        
    //======================================AXIA CONTRACT=========================================//
    contract AXIATOKEN is ERC20 {
        
        using SafeMath for uint256;
        
    //======================================AXIA EVENTS=========================================//
    
        event NewEpoch(uint epoch, uint emission, uint nextepoch);
        event NewDay(uint epoch, uint day, uint nextday);
        event BurnEvent(address indexed pool, address indexed burnaddress, uint amount);
        event emissions(address indexed root, address indexed pool, uint value);
        event TrigRewardEvent(address indexed root, address indexed receiver, uint value);
        event BasisPointAdded(uint value);
        
        
       // ERC-20 Parameters
        string public name; 
        string public symbol;
        uint public decimals; 
        uint public startdecimal;
        uint public override totalSupply;
        uint public initialsupply;
        
         //======================================STAKING POOLS=========================================//
        
        address public lonePool;
        address public swapPool;
        address public DefiPool;
        address public OraclePool;
        
        address public burningPool;
        
        uint public pool1Amount;
        uint public pool2Amount;
        uint public pool3Amount;
        uint public pool4Amount;
        uint public basisAmount;
        uint public poolAmountTrig;
        
        
        uint public TrigAmount;
        
        
        // ERC-20 Mappings
        mapping(address => uint) public override balanceOf;
        mapping(address => mapping(address => uint)) public override allowance;
        
        
        // Public Parameters
        uint crypto; 
        uint startcrypto;
        uint public emission;
        uint public currentEpoch; 
        uint public currentDay;
        uint public daysPerEpoch; 
        uint public secondsPerDay;
        uint public genesis;
        uint public nextEpochTime; 
        uint public nextDayTime;
        uint public amountToEmit;
        uint public BPE;
        
        //======================================BASIS POINT VARIABLES=========================================//
        uint public bpValue;
        uint public actualValue;
        uint public TrigReward;
        uint public burnAmount;
        address administrator;
        uint totalEmitted;
        
        uint256 public pool1percentage = 500;
        uint256 public pool2percentage = 4500;
        uint256 public pool3percentage = 2500;
        uint256 public pool4percentage = 2500;
        uint256 public basispercentage = 500;
        uint256 public trigRewardpercentage = 20;
        
        
        address public messagesender;
         
        // Public Mappings
        
        mapping(address=>bool) public emission_Whitelisted;
        
    
        //=====================================CREATION=========================================//
        // Constructor
        constructor() public {
            name = "AXIA TOKEN (axiaprotocol.io)"; 
            symbol = "AXIAv3"; 
            decimals = 18; 
            startdecimal = 16;
            crypto = 1*10**decimals; 
            startcrypto =  1*10**startdecimal; 
            totalSupply = 3800000*crypto;                                 
            initialsupply = 120000000*startcrypto;
            emission = 7200*crypto; 
            currentEpoch = 1; 
            currentDay = 1;                             
            genesis = now;
            
            daysPerEpoch = 180; 
            secondsPerDay = 86400; 
           
            administrator = msg.sender;
            balanceOf[administrator] = initialsupply; 
            emit Transfer(administrator, address(this), initialsupply);                                
            nextEpochTime = genesis + (secondsPerDay * daysPerEpoch);                                   
            nextDayTime = genesis + secondsPerDay;                                                      
            
            emission_Whitelisted[administrator] = true;
            
            
            
        }
        
    //========================================CONFIGURATIONS=========================================//
        
        function poolconfigs(address _axia, address _swap, address _defi, address _oracle) public onlyAdministrator returns (bool success) {
            
            lonePool = _axia;
            swapPool = _swap;
            DefiPool = _defi;
            OraclePool = _oracle;
            
            
            
            return true;
        }
        
        function burningPoolconfigs(address _pooladdress) public onlyAdministrator returns (bool success) {
               
            burningPool = _pooladdress;
            
            return true;
        }
        
        
        modifier onlyAdministrator() {
            require(msg.sender == administrator, "Ownable: caller is not the owner");
            _;
        }
        
        modifier onlyBurningPool() {
            require(msg.sender == burningPool, "Authorization: Only the pool that allows burn can call on this");
            _;
        }
        
        function secondAndDay(uint _secondsperday, uint _daysperepoch) public onlyAdministrator returns (bool success) {
           secondsPerDay = _secondsperday;
           daysPerEpoch = _daysperepoch;
            return true;
        }
        
        function nextEpoch(uint _nextepoch) public onlyAdministrator returns (bool success) {
           nextEpochTime = _nextepoch;
           
            return true;
        }
        
        function whitelistOnEmission(address _address) public onlyAdministrator returns (bool success) {
           emission_Whitelisted[_address] = true;
            return true;
        }
        
        function unwhitelistOnEmission(address _address) public onlyAdministrator returns (bool success) {
           emission_Whitelisted[_address] = false;
            return true;
        }
        
        
        function supplyeffect(uint _amount) public onlyBurningPool returns (bool success) {
           totalSupply -= _amount;
           emit BurnEvent(burningPool, address(0x0), _amount);
            return true;
        }
        
        function poolpercentages(uint _p1, uint _p2, uint _p3, uint _p4, uint _basispercent, uint trigRe) public onlyAdministrator returns (bool success) {
           
           pool1percentage = _p1;
           pool2percentage = _p2;
           pool3percentage = _p3;
           pool4percentage = _p4;
           basispercentage = _basispercent;
           trigRewardpercentage = trigRe;
           
           return true;
        }
        
        function Burn(uint _amount) public returns (bool success) {
           
           require(balanceOf[msg.sender] >= _amount, "You do not have the amount of tokens you wanna burn in your wallet");
           balanceOf[msg.sender] -= _amount;
           totalSupply -= _amount;
           emit BurnEvent(msg.sender, address(0x0), _amount);
           return true;
           
        }
        
       //========================================ERC20=========================================//
        // ERC20 Transfer function
        function transfer(address to, uint value) public override returns (bool success) {
            _transfer(msg.sender, to, value);
            return true;
        }
        // ERC20 Approve function
        function approve(address spender, uint value) public override returns (bool success) {
            allowance[msg.sender][spender] = value;
            emit Approval(msg.sender, spender, value);
            return true;
        }
        // ERC20 TransferFrom function
        function transferFrom(address from, address to, uint value) public override returns (bool success) {
            require(value <= allowance[from][msg.sender], 'Must not send more than allowance');
            allowance[from][msg.sender] -= value;
            _transfer(from, to, value);
            return true;
        }
        
      
        
        // Internal transfer function which includes the Fee
        function _transfer(address _from, address _to, uint _value) private {
            
            messagesender = msg.sender; //this is the person actually making the call on this function
            
            
            require(balanceOf[_from] >= _value, 'Must not send more than balance');
            require(balanceOf[_to] + _value >= balanceOf[_to], 'Balance overflow');
            
            balanceOf[_from] -= _value;
            
            
            if(emission_Whitelisted[messagesender] == false){ 
              
                    if(now >= nextDayTime){
                    
                    amountToEmit = emittingAmount();
                    
                    
                    uint basisAmountQuota = mulDiv(amountToEmit, basispercentage, 10000);
                    amountToEmit = amountToEmit - basisAmountQuota;
                    basisAmount = basisAmountQuota;
                    
                    pool1Amount = mulDiv(amountToEmit, pool1percentage, 10000);
                    pool2Amount = mulDiv(amountToEmit, pool2percentage, 10000);
                    pool3Amount = mulDiv(amountToEmit, pool3percentage, 10000);
                    pool4Amount = mulDiv(amountToEmit, pool4percentage, 10000);
                    
                    
                    
                    poolAmountTrig = mulDiv(amountToEmit, trigRewardpercentage, 10000);
                    TrigAmount = poolAmountTrig.div(2);
                    
                    pool1Amount = pool1Amount.sub(TrigAmount);
                    pool2Amount = pool2Amount.sub(TrigAmount);
                    
                    TrigReward = poolAmountTrig;
                    
                    uint Ofrozenamount = ospfrozen();
                    uint Dfrozenamount = dspfrozen();
                    uint Ufrozenamount = uspfrozen();
                    uint Afrozenamount = aspfrozen();
                    
                    balanceOf[address(this)] += basisAmount;
                    emit Transfer(address(this), address(this), basisAmount);
                    BPE += basisAmount;
                    
                    
                    if(Ofrozenamount > 0){
                        
                    OSP(OraclePool).scaledToken(pool4Amount);
                    balanceOf[OraclePool] += pool4Amount;
                    emit Transfer(address(this), OraclePool, pool4Amount);
                    
                    
                        
                    }else{
                      
                     balanceOf[address(this)] += pool4Amount; 
                     emit Transfer(address(this), address(this), pool4Amount);
                     
                     BPE += pool4Amount;
                        
                    }
                    
                    if(Dfrozenamount > 0){
                        
                    DSP(DefiPool).scaledToken(pool3Amount);
                    balanceOf[DefiPool] += pool3Amount;
                    emit Transfer(address(this), DefiPool, pool3Amount);
                    
                    
                        
                    }else{
                      
                     balanceOf[address(this)] += pool3Amount; 
                     emit Transfer(address(this), address(this), pool3Amount);
                     BPE += pool3Amount;
                        
                    }
                    
                    if(Ufrozenamount > 0){
                        
                    USP(swapPool).scaledToken(pool2Amount);
                    balanceOf[swapPool] += pool2Amount;
                    emit Transfer(address(this), swapPool, pool2Amount);
                    
                        
                    }else{
                      
                     balanceOf[address(this)] += pool2Amount; 
                     emit Transfer(address(this), address(this), pool2Amount);
                     BPE += pool2Amount;
                        
                    }
                    
                    if(Afrozenamount > 0){
                        
                     ASP(lonePool).scaledToken(pool1Amount);
                     balanceOf[lonePool] += pool1Amount;
                     emit Transfer(address(this), lonePool, pool1Amount);
                    
                    }else{
                      
                     balanceOf[address(this)] += pool1Amount; 
                     emit Transfer(address(this), address(this), pool1Amount);
                     BPE += pool1Amount;
                        
                    }
                    
                    nextDayTime += secondsPerDay;
                    currentDay += 1; 
                    emit NewDay(currentEpoch, currentDay, nextDayTime);
                    
                    //reward the wallet that triggered the EMISSION
                    balanceOf[_from] += TrigReward; //this is rewardig the person that triggered the emission
                    emit Transfer(address(this), _from, TrigReward);
                    emit TrigRewardEvent(address(this), msg.sender, TrigReward);
                    
                }
            
                
            }
           
           balanceOf[_to] += _value;
           emit Transfer(_from, _to, _value);
        }
        
        
    
        
       
        //======================================EMISSION========================================//
        // Internal - Update emission function
        
        function emittingAmount() internal returns(uint){
           
            if(now >= nextEpochTime){
                
                currentEpoch += 1;
                
                if(currentEpoch > 10){
                
                   emission = BPE;
                   BPE -= emission.div(2);
                   balanceOf[address(this)] -= emission.div(2);
                
                   
                }
                emission = emission/2;
                nextEpochTime += (secondsPerDay * daysPerEpoch);
                emit NewEpoch(currentEpoch, emission, nextEpochTime);
              
            }
            
            return emission;
            
            
        }
      
      
      
        function ospfrozen() public view returns(uint){
            
            return OSP(OraclePool).totalFrozen();
           
        }
        
        function dspfrozen() public view returns(uint){
            
            return DSP(DefiPool).totalFrozen();
           
        }
        
        function uspfrozen() public view returns(uint){
            
            return USP(swapPool).totalFrozen();
           
        } 
        
        function aspfrozen() public view returns(uint){
            
            return ASP(lonePool).totalFrozen();
           
        }
        
         function mulDiv (uint x, uint y, uint z) public pure returns (uint) {
              (uint l, uint h) = fullMul (x, y);
              assert (h < z);
              uint mm = mulmod (x, y, z);
              if (mm > l) h -= 1;
              l -= mm;
              uint pow2 = z & -z;
              z /= pow2;
              l /= pow2;
              l += h * ((-pow2) / pow2 + 1);
              uint r = 1;
              r *= 2 - z * r;
              r *= 2 - z * r;
              r *= 2 - z * r;
              r *= 2 - z * r;
              r *= 2 - z * r;
              r *= 2 - z * r;
              r *= 2 - z * r;
              r *= 2 - z * r;
              return l * r;
        }
        
         function fullMul (uint x, uint y) private pure returns (uint l, uint h) {
              uint mm = mulmod (x, y, uint (-1));
              l = x * y;
              h = mm - l;
              if (mm < l) h -= 1;
        }
        
       
    }