Forkchoice Ethereum Mainnet

Address Contract Partially Verified

Address 0x9dEd3b9d0bd9cc4DE698dcebeBb68b1f0033c0C8
Balance 0 ETH
Nonce 1
Code Size 4454 bytes
Indexed Transactions 0 (1 on-chain, 0.7% indexed)
External Etherscan · Sourcify

Contract Bytecode

4454 bytes
0x608060405234801561001057600080fd5b50600436106101205760003560e01c806369c18e12116100ad578063ac3c853511610071578063ac3c8535146102bd578063b333de24146102dc578063b821b6bf146102e4578063c8910913146102ec578063e0287b3e1461033d57610120565b806369c18e12146102355780636b6b6aa41461023d5780637640cb9e1461025a578063a43fc87114610277578063aa9a09121461029457610120565b80631bf6e00d116100f45780631bf6e00d146101be5780631cfff51b146101e45780631e7f87bc146101ec57806321dee127146101f45780636387c9491461021157610120565b806265318b1461012557806305d872aa1461015d57806308dbbb03146101975780631495bf9a1461019f575b600080fd5b61014b6004803603602081101561013b57600080fd5b50356001600160a01b031661035a565b60408051918252519081900360200190f35b6101836004803603602081101561017357600080fd5b50356001600160a01b03166103c1565b604080519115158252519081900360200190f35b61014b610432565b6101bc600480360360208110156101b557600080fd5b5035610438565b005b61014b600480360360208110156101d457600080fd5b50356001600160a01b0316610444565b610183610462565b61014b610472565b6101836004803603602081101561020a57600080fd5b5035610478565b6102196104cd565b604080516001600160a01b039092168252519081900360200190f35b61014b6104dc565b6101bc6004803603602081101561025357600080fd5b50356104e2565b6101836004803603602081101561027057600080fd5b50356104eb565b6101bc6004803603602081101561028d57600080fd5b5035610560565b61014b600480360360608110156102aa57600080fd5b50803590602081013590604001356105b8565b6101bc600480360360208110156102d357600080fd5b5035151561066c565b61014b610730565b61014b61085a565b6103126004803603602081101561030257600080fd5b50356001600160a01b0316610860565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b6101bc6004803603602081101561035357600080fd5b50356108b7565b6002546001600160a01b03821660009081526009602052604081206003015490911115610389575060006103bc565b6001600160a01b03821660009081526009602052604090206002810154600190910154600a54600160401b929102030490505b919050565b600b546000906001600160a01b0316331461040d5760405162461bcd60e51b81526004018080602001828103825260288152602001806111096028913960400191505060405180910390fd5b50600080546001600160a01b0383166001600160a01b03199091161790556001919050565b60015481565b61044181610905565b50565b6001600160a01b031660009081526009602052604090206001015490565b600054600160a01b900460ff1681565b60085490565b600b546000906001600160a01b031633146104c45760405162461bcd60e51b81526004018080602001828103825260288152602001806111096028913960400191505060405180910390fd5b50600355600190565b6000546001600160a01b031681565b60045481565b61044181610c27565b600080546001600160a01b031633146105355760405162461bcd60e51b815260040180806020018281038252602b815260200180611066602b913960400191505060405180910390fd5b600854600160401b83028161054657fe5b600a80549290910490910190819055600455506001919050565b600b546001600160a01b031633146105a95760405162461bcd60e51b81526004018080602001828103825260288152602001806111096028913960400191505060405180910390fd5b670de0b6b3a764000002600155565b60008060006105c78686610f26565b915091508381106105d457fe5b600084806105de57fe5b8688099050828111156105f2576001820391505b91829003916000859003851680868161060757fe5b04955080848161061357fe5b04935080816000038161062257fe5b046001019290920292909201600285810380870282030280870282030280870282030280870282030280870282030280870282030295860290039094029390930295945050505050565b600b546001600160a01b031633146106b55760405162461bcd60e51b81526004018080602001828103825260288152602001806111096028913960400191505060405180910390fd5b6000546001600160a01b0316610712576040805162461bcd60e51b815260206004820152601d60248201527f506f6f6c2061646472657373206973206e6f7420796574207365747570000000604482015290519081900360640190fd5b60008054911515600160a01b0260ff60a01b19909216919091179055565b60008061073c3361035a565b3360008181526009602090815260408083206002018054600160401b87020190558254815163a9059cbb60e01b815260048101959095526024850186905290519495506001600160a01b03169363a9059cbb93604480820194918390030190829087803b1580156107ac57600080fd5b505af11580156107c0573d6000803e3d6000fd5b505050506040513d60208110156107d657600080fd5b505161081e576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8811985a5b195960721b604482015290519081900360640190fd5b604080518281529051309133917f8c998377165b6abd6e99f8b84a86ed2c92d0055aeef42626fedea45c2909f6eb9181900360200190a3905090565b60025481565b6000806000806000610870610472565b61087987610444565b6108828861035a565b6001600160a01b0398909816600090815260096020526040902060038101546002909101549299919897509550909350915050565b600b546001600160a01b031633146109005760405162461bcd60e51b81526004018080602001828103825260288152602001806111096028913960400191505060405180910390fd5b600255565b600054600160a01b900460ff16610963576040805162461bcd60e51b815260206004820152601b60248201527f5374616b696e67206e6f742079657420696e697469616c697a65640000000000604482015290519081900360640190fd5b600054604080516370a0823160e01b8152336004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156109ad57600080fd5b505afa1580156109c1573d6000803e3d6000fd5b505050506040513d60208110156109d757600080fd5b50511015610a2c576040805162461bcd60e51b815260206004820152601f60248201527f496e73756666696369656e74204178696120746f6b656e2062616c616e636500604482015290519081900360640190fd5b60015481610a3933610444565b011015610a775760405162461bcd60e51b815260040180806020018281038252603d8152602001806110cc603d913960400191505060405180910390fd5b60005460408051636eb1769f60e11b8152336004820152306024820152905183926001600160a01b03169163dd62ed3e916044808301926020929190829003018186803b158015610ac757600080fd5b505afa158015610adb573d6000803e3d6000fd5b505050506040513d6020811015610af157600080fd5b50511015610b305760405162461bcd60e51b815260040180806020018281038252603b815260200180611091603b913960400191505060405180910390fd5b336000818152600960209081526040808320426003820155600880548701905560018101805487019055600a54600290910180549187029091019055825481516323b872dd60e01b815260048101959095523060248601526044850186905290516001600160a01b03909116936323b872dd9360648083019493928390030190829087803b158015610bc157600080fd5b505af1158015610bd5573d6000803e3d6000fd5b505050506040513d6020811015610beb57600080fd5b5050604080518281529051309133917f160ffcaa807f78c8b4983836e2396338d073e75695ac448aa0b5e4a75b210b1d9181900360200190a350565b80610c3133610444565b1015610c6e5760405162461bcd60e51b81526004018080602001828103825260328152602001806110346032913960400191505060405180910390fd5b6008805482900390553360009081526009602052604090206001810180548390039055600a54600290910180549183029091039055600354610cb390829060646105b8565b6005819055610cc990829063ffffffff610f5316565b6006819055600080546040805163a9059cbb60e01b81523360048201526024810194909452516001600160a01b039091169263a9059cbb9260448083019360209390929083900390910190829087803b158015610d2557600080fd5b505af1158015610d39573d6000803e3d6000fd5b505050506040513d6020811015610d4f57600080fd5b5051610d97576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8819985a5b195960721b604482015290519081900360640190fd5b6006546040805191825251339130917f15fba2c381f32b0e84d073dd1adb9edbcfd33a033ee48aaea415ac61ca7d448d9181900360200190a3600080546005546040805163a9059cbb60e01b8152600481018590526024810192909252516001600160a01b039092169263a9059cbb926044808401936020939083900390910190829087803b158015610e2957600080fd5b505af1158015610e3d573d6000803e3d6000fd5b505050506040513d6020811015610e5357600080fd5b5051610e9b576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8819985a5b195960721b604482015290519081900360640190fd5b60008054600554604080516326796dd560e01b81526004810192909252516001600160a01b03909216926326796dd5926024808401936020939083900390910190829087803b158015610eed57600080fd5b505af1158015610f01573d6000803e3d6000fd5b505050506040513d6020811015610f1757600080fd5b50610f229050610730565b5050565b6000808060001984860990508385029250828103915082811015610f4b576001820391505b509250929050565b6000610f9583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f9c565b9392505050565b6000818484111561102b5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ff0578181015183820152602001610fd8565b50505050905090810190601f16801561101d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505090039056fe596f752063757272656e746c7920646f206e6f74206861766520757020746f207468617420616d6f756e74207374616b6564417574686f72697a6174696f6e3a206f6e6c7920746f6b656e20636f6e74726163742063616e2063616c6c4e6f7420656e6f75676820616c6c6f77616e636520676976656e20746f20636f6e74726163742079657420746f207370656e642062792075736572596f757220616d6f756e74206973206c6f776572207468616e20746865206d696e696d756d20616d6f756e7420616c6c6f77656420746f207374616b654f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f72a2646970667358221220829ed5041f5835822710304b2162bfc515c9408fc8d9c1d40281e861d84398e564736f6c63430006040033

Verified Source Code Partial Match

Compiler: v0.6.4+commit.1dca32f3 EVM: istanbul Optimization: Yes (200 runs)
ASP.sol 421 lines
/*

* @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;
    }
 
    
}

Read Contract

Axiatoken 0x6387c949 → address
MINIMUM_STAKE 0x08dbbb03 → uint256
MIN_DIVIDENDS_DUR 0xb821b6bf → uint256
dividendsOf 0x0065318b → uint256
frozenOf 0x1bf6e00d → uint256
infocheck 0x69c18e12 → uint256
mulDiv 0xaa9a0912 → uint256
stakingEnabled 0x1cfff51b → bool
totalFrozen 0x1e7f87bc → uint256
userData 0xc8910913 → uint256, uint256, uint256, uint256, int256

Write Contract 9 functions

These functions modify contract state and require a wallet transaction to execute.

MIN_DIVIDENDS_DUR_TIME 0xe0287b3e
uint256 _minDuration
StakeAxiaTokens 0x1495bf9a
uint256 _tokens
TakeDividends 0xb333de24
No parameters
returns: uint256
UnstakeAxiaTokens 0x6b6b6aa4
uint256 _tokens
_minStakeAmount 0xa43fc871
uint256 _number
scaledToken 0x7640cb9e
uint256 _amount
returns: bool
stakingStatus 0xac3c8535
bool _status
tokenconfigs 0x05d872aa
address _axiatoken
returns: bool
unstakeburnrate 0x21dee127
uint256 _rate
returns: bool

Recent Transactions

This address has 1 on-chain transactions, but only 0.7% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →