🚦Trading Status

The sERC20 library takes full control when handling the trading status of your token. These built in methods control everything for your convenience.

Restrictions

Once enabled, trading can not be turned back off.

Enabling trading

The sERC20 contract takes full control of your tokens trading status. Under the hood the library exposes the following functions for your convenience. Unlike other methods provided by sERC20 however, the enable method is marked as virtual, thus allowing your to override it for more fine grained control. For example you may wish to capture the launch block.

Enabling trading

function sercSetTradingEnabled() public virtual onlyOwner

Overriding the enable trading method

As mentioned above, this method is marked as virtual. This means that you are free to override this method within your contract for finer control.

function sercSetTradingEnabled() public virtual override onlyOwner {
    
    // Parent call - IMPORTANT
    super.sercSetTradingEnabled();
    
    // Additional functionality...
    launchedBlock = block.number;
    ...
}

Make sure to call the parent sercSetTraingEnabled method so that we can update the block/timestamp trading was enabled.

Checking if trading is enabled

The sERC20 contract exposes functions for reading trading status of your token. You should NEVER handle these yourself, always refer to our built in methods to maintain your sERC20 implementation integrity.

Retrieve the trading status

// External usage
function sercTradingEnabled() public view returns (bool)

// Internal usage
function _sercTradingEnabled() internal view returns (bool)

Remember! ALWAYS use our build in methods any time you access state that can be controlled by sERC20, doing otherwise compromises your implementation integrity.

Last updated