Skip to main content

IPrimitiveFactory.sol

Read code on GitHub

Methods

MIN_LIQUIDITY_FACTOR

Used to scale the minimum amount of liquidity to lowest precision

Solidity
function MIN_LIQUIDITY_FACTOR() external pure returns (uint256)
Details

E.g. if the lowest decimal token is 6, min liquidity w/ 18 decimals cannot be 1000 wei, therefore the token decimals divided by the min liquidity factor is the amount of minimum liquidity MIN_LIQUIDITY = 10 ^ (Decimals / MIN_LIQUIDITY_FACTOR)

Returns

NameTypeDescription
_0uint256undefined

args

Called within Engine constructor so Engine can set immutable variables without constructor args

Solidity
function args() external view returns (address factory, address risky, address stable, uint256 scaleFactorRisky, uint256 scaleFactorStable, uint256 minLiquidity)

Returns

NameTypeDescription
factoryaddressSmart contract deploying the Engine contract
riskyaddressRisky token
stableaddressStable token
scaleFactorRiskyuint256Scale factor of the risky token, 10^(18 - riskyTokenDecimals)
scaleFactorStableuint256Scale factor of the stable token, 10^(18 - stableTokenDecimals)
minLiquidityuint256Minimum amount of liquidity on pool creation

deploy

Deploys a new Engine contract and sets the getEngine mapping for the tokens

Solidity
function deploy(address risky, address stable) external nonpayable returns (address engine)

Parameters

NameTypeDescription
riskyaddressRisky token, the underlying token
stableaddressStable token, the quote token

Returns

NameTypeDescription
engineaddressundefined

deployer

Deployer does not have any access controls to wield

Solidity
function deployer() external view returns (address)

Returns

NameTypeDescription
_0addressDeployer of this factory contract

getEngine

Fetches engine address of a token pair which has been deployed from this factory

Solidity
function getEngine(address risky, address stable) external view returns (address engine)

Parameters

NameTypeDescription
riskyaddressRisky token, the underlying token
stableaddressStable token, the quote token

Returns

NameTypeDescription
engineaddressEngine address for a risky and stable token

Events

DeployEngine

Created a new engine contract!

Solidity
event DeployEngine(address indexed from, address indexed risky, address indexed stable, address engine)

Parameters

NameTypeDescription
from indexedaddressCalling msg.sender of deploy
risky indexedaddressRisky token of Engine to deploy
stable indexedaddressStable token of Engine to deploy
engineaddressDeployed engine address