/** * Dynamic staking depending on token price */ function dynamicStaking() public view returns (uint256) { // proof of stake is set at 5 tokens after price climbs to 1 ether uint256 stakingRequirement = 5e18; // before that we determine it according to token price uint256 tokenPrice = buyPrice(); uint256 tenCentsEth = 1e18/10; // before tokenPrice reaches 1 ether, if (tokenPrice < tenCentsEth) stakingRequirement = 100e18; else if (tokenPrice >= tenCentsEth * 1 && tokenPrice < tenCentsEth * 2 ) stakingRequirement = 90e18; else if (tokenPrice >= tenCentsEth * 2 && tokenPrice < tenCentsEth * 3 ) stakingRequirement = 80e18; else if (tokenPrice >= tenCentsEth * 3 && tokenPrice < tenCentsEth * 4 ) stakingRequirement = 70e18; else if (tokenPrice >= tenCentsEth * 4 && tokenPrice < tenCentsEth * 5 ) stakingRequirement = 60e18; else if (tokenPrice >= tenCentsEth * 5 && tokenPrice < tenCentsEth * 6 ) stakingRequirement = 50e18; else if (tokenPrice >= tenCentsEth * 6 && tokenPrice < tenCentsEth * 7 ) stakingRequirement = 40e18; else if (tokenPrice >= tenCentsEth * 7 && tokenPrice < tenCentsEth * 8 ) stakingRequirement = 30e18; else if (tokenPrice >= tenCentsEth * 8 && tokenPrice < tenCentsEth * 9 ) stakingRequirement = 20e18; else if (tokenPrice >= tenCentsEth * 9 && tokenPrice < 1e18 ) stakingRequirement = 10e18; // return stakingRequirement; }
0.4.18