🛣️Router

sERC20 takes full control of the router and pair, when initialised we will automatically create the pair address for you. At the moment we only support Uniswap v2 compatible exchanges.

Restrictions

The router address must be passed to the SERC20 constructor method upon initialisation. This will create a pair for you using the relevant factory.

Accessing the router object

The router object can be accessed at any point using the following method. You should NEVER handle this yourself, always refer to our built in methods to maintain your sERC20 implementation integrity.

function _sercRouter() internal view return (IUniswapV2Router02)

// Usage
_sercRouter();

Reading the pair address

The sERC20 library exposes a getPair method for accessing the pair address. You should NEVER handle these yourself, always refer to our built in methods to maintain your sERC20 implementation integrity.

function _sercPair() internal view return (address)

// Usage
_sercPair();

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