contract StakedONX is ERC20("StakedONX", "sONX"){

    using SafeMath for uint256;
    IERC20 public onx;

    constructor(IERC20 _onx) public {
        onx = _onx;
    }

    // Enter to stake ONX. Pay some ONX. Earn some StakedONX
    function enter(uint256 _amount) public {
        uint256 totalONX = onx.balanceOf(address(this));
        uint256 totalShares = totalSupply();
        if (totalShares == 0 || totalONX == 0) {
            _mint(msg.sender, _amount);
        } else {
            uint256 what = _amount.mul(totalShares).div(totalONX);
            _mint(msg.sender, what);
        }
        onx.transferFrom(msg.sender, address(this), _amount);
    }

    // Leave and Claim back your ONX with rewards
    function leave(uint256 _share) public {
        uint256 totalShares = totalSupply();
        uint256 what = _share.mul(onx.balanceOf(address(this))).div(totalShares);
        _burn(msg.sender, _share);
        onx.transfer(msg.sender, what);
    }
}
function enter(uint256 _amount) public {
        uint256 totalONX = onx.balanceOf(address(this));
        uint256 totalShares = totalSupply();
        if (totalShares == 0 || totalONX == 0) {
            _mint(msg.sender, _amount);
        } else {
            uint256 what = _amount.mul(totalShares).div(totalONX);
            _mint(msg.sender, what);
        }
        onx.transferFrom(msg.sender, address(this), _amount);
    }
// Enter to stake ONX. Pay some ONX. Earn some StakedONX