contract DarkAgentHall is ERC20("DarkAgentHall", "xDARK"){
    using SafeMath for uint256;
    IERC20 public dark;

    constructor() public {
        dark = IERC20(0x3108ccFd96816F9E663baA0E8c5951D229E8C6da);
    }

    // Enter the Hall. Pay some DARK. Earn some shares.
    function enter(uint256 _amount) public {
        uint256 totalDark = dark.balanceOf(address(this));
        uint256 totalShares = totalSupply();
        if (totalShares == 0 || totalDark == 0) {
            _mint(msg.sender, _amount);
        } else {
            uint256 what = _amount.mul(totalShares).div(totalDark);
            _mint(msg.sender, what);
        }
        dark.transferFrom(msg.sender, address(this), _amount);
    }

    // Leave the Hall. Claim back your DARK.
    function leave(uint256 _share) public {
        uint256 totalShares = totalSupply();
        uint256 what = _share.mul(dark.balanceOf(address(this))).div(totalShares);
        _burn(msg.sender, _share);
        dark.transfer(msg.sender, what);
    }
}
function leave(uint256 _share) public {
    uint256 totalShares = totalSupply();
    uint256 what = _share.mul(dark.balanceOf(address(this))).div(totalShares);
    _burn(msg.sender, _share);
    dark.transfer(msg.sender, what);
}

// Leave the Hall. Claim back your DARK.