TWAP Oracles Deployment
Overview
To deploy a standard TWAP Oracle, you can use the TwapOracleFactoryNG
and TwapOracleFactorySNG
, depending on whether your underlyiong market usestwocrypto-ng
or stableswap-ng
AMMs.
Deployment
Deployment of Spectra TWAP oracles is done through the deployOracle()
method
/**
* @notice Deploys an oracle for a given principal token, pool, and oracle type
* @param _pt The address of the principal token
* @param _pool The address of the pool
* @param _oracleType The type of oracle
* @param _initialOwner The address of the initial owner of the oracle
* @return oracleAddress The address of the deployed oracle
*/
function deployOracle(
address _pt,
address _pool,
OracleType _oracleType,
address _initialOwner
) external returns (address oracleAddress);
It deploys an oracle of _oracleType
for a market composed of a PT of address _pt
and of market address _pool
. The OracleType _oracleType
field allows you to choose the type of oracle you want to deploy. The possible types are
enum OracleType {
PTIBT,
PTUND,
YTIBT,
YTUND,
LPIBT,
LPUND
}
The possible types specify the base asset (PT, YT, LP) followed by the quote asset (IBT, Underlying).
Setting yourself as the _initialOwner
allows you to upgrade the oracle implementation.
Deployment can be done through the common interface ITwapOracleFactory
, since both TwapOracleFactoryNG
and TwapOracleFactorySNG
both implement it.
Last updated