Skip to main content

InteractionHelper

Git Source

Author: Axicon Labs Limited

Used to delegate logic with multiple external calls.

Generally employed when there is a need to save or reuse bytecode size on a core contract.

Functions

doApprovals

Function that performs approvals on behalf of the PanopticPool for CollateralTracker and SemiFungiblePositionManager.

function doApprovals(
SemiFungiblePositionManager sfpm,
CollateralTracker ct0,
CollateralTracker ct1,
address token0,
address token1
) external;

Parameters

NameTypeDescription
sfpmSemiFungiblePositionManagerThe SemiFungiblePositionManager being approved for both token0 and token1
ct0CollateralTrackerThe CollateralTracker (token0) being approved for token0
ct1CollateralTrackerThe CollateralTracker (token1) being approved for token1
token0addressThe token0 (in Uniswap) being approved for
token1addressThe token1 (in Uniswap) being approved for

computeName

Computes the name of a CollateralTracker based on the token composition and fee of the underlying Uniswap Pool.

Some tokens do not have proper symbols so error handling is required - this logic takes up significant bytecode size, which is why it is in a library.

function computeName(address token0, address token1, bool isToken0, uint24 fee, string memory prefix)
external
view
returns (string memory);

Parameters

NameTypeDescription
token0addressThe token0 of the Uniswap Pool
token1addressThe token1 of the Uniswap Pool
isToken0boolWhether the collateral token computing the name is for token0 or token1
feeuint24The fee of the Uniswap pool in hundredths of basis points
prefixstringA constant string appended to the start of the token name

Returns

NameTypeDescription
<none>stringThe complete name of the collateral token calling this function

computeSymbol

Returns collateral token symbol as prefix + underlying token symbol.

function computeSymbol(address token, string memory prefix) external view returns (string memory);

Parameters

NameTypeDescription
tokenaddressThe address of the underlying token used to compute the symbol
prefixstringA constant string prepended to the symbol of the underlying token to create the final symbol

Returns

NameTypeDescription
<none>stringThe symbol of the collateral token

computeDecimals

Returns decimals of underlying token (0 if not present).

function computeDecimals(address token) external view returns (uint8);

Parameters

NameTypeDescription
tokenaddressThe address of the underlying token used to compute the decimals

Returns

NameTypeDescription
<none>uint8The decimals of the token