pair()

CarbonController.sol
    function pair(Token token0, Token token1) external view returns (Pair memory);

This function is used to get the metadata for the pair of the indicated tokens. This includes the ID of the pair, token0, and token1.

Function Arguments

NameTypeDescription

token0

Token

The first token address.

token1

Token

The second token address.

Returns

This function returns a Pair object, containing the pair ID and the addresses of token0 and token1.

NameTypeDescription

id

uint256

The ID of the pair

token0

Token

The first token address

token1

Token

The second token address

Example

pair(
 0x514910771AF9Ca656af840dff83E8264EcF986CA, //token0
 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE //token1
)

// Returns:
// struct Pair {
//    uint128 id;
//    Token[2] tokens;
// }

For the ETH token, use the contract address: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE

Last updated