Spectra Developer Docs
  • Developers Documentation
  • Getting Started
  • Guides
    • Tokenizing Yield
    • Providing Liquidity
    • Deploy PT and Curve Pool
    • Routing
    • IBT Additional Rewards
    • Locking APW for veAPW
    • Voting and Earning Rewards
  • Technical Reference
    • Deployed Contracts
    • Contract Functions
      • Principal Token
      • Yield Token
      • Registry
      • RateOracle
      • Factory
      • Access Manager
      • RouterUtil
      • Router
      • GovernanceRegistry
      • Voter
      • VotingReward
        • BribeVotingReward
        • FeesVotingReward
      • FeeDistributor
      • Spectra4626Wrapper
    • Yield Calculations
    • Spectra's Automated Market Makers
      • Rate Adjusted StableSwap pools
  • Glossary
  • INTEGRATION REFERENCE
    • Spectra Oracles
      • TWAP Oracles
      • Deterministic Oracles
        • Linear APR model
        • Linear Discount Model
        • Zero Coupon Bond Model
        • Comparison
      • Oracle Deployment
        • Deterministic Oracles Deployment
        • TWAP Oracles Deployment
Powered by GitBook
On this page
  • Methods
  • deployPT
  • deployCurvePool
  • deployAll
  • View Methods
  • getRegistry
  • getCurveAddressProvider
  • getCurveFactory
  • getInitialPrice
  • getCurveFactoryAddress
  1. Technical Reference
  2. Contract Functions

Factory

PreviousRateOracleNextAccess Manager

Last updated 11 months ago

The Factory is used to deploy any and Curve pools permissionlessly.

Factory.sol code can be .

Methods

deployPT

function deployPT(address _ibt, uint256 _duration) external returns (address pt)

Deploys the PrincipalToken contract implementation.

See also .

Input Parameter
Type
Description

_ibt

address

duration

uint256

The duration of the pt

Return Parameter
Type
Description

pt

address

deployCurvePool

function deployCurvePool(
        address _pt
        CurvePoolParams calldata curvePoolParams
) external returns (address curvePoolAddr)

Deploy a curve pool for the specific _pt instance with the specified curvePoolParams

Input Parameter
Type
Description

_ibt

address

curvePoolParams

The parameters of the curve pool to be deployed

Return Parameter
Type
Description

curvePoolAddr

address

The address of the curve pool that was deployed

CurvePoolParams

Struct Parameter
Type
Description

A

uint256

Amplification Parameter [4,000 to 4,000,000,000] Larger values of A make the curve better resemble a straight line in the center (when pool is near balance). Highly volatile assets should use a lower value, while assets that are closer together may be best with a higher value.

gamma

uint256

The gamma parameter can further adjust the shape of the curve. Default values recommend .000145 for volatile assets and .0001 for less volatile assets.

mid_fee

uint256

[.005% to 1%] Percentage. Fee when the pool is maximally balanced. This is the minimum fee. The fee is calculated as mid_fee * f + out_fee * (10^18 - f)

out_fee

uint256

[Mid Fee to 1%] Fee when the pool is imbalanced. Must be larger than the Mid Fee and represents the maximum fee.

allowed_extra_profit

uint256

[0 to .01] As the pool takes profit, the allowed extra profit parameter allows for greater values. Recommended 0.000002 for volatile assets and 0.00000001 for less volatile assets.

fee_gamma

uint256

[0 to 1] Adjusts how fast the fee increases from Mid Fee to Out Fee. Lower values cause fees to increase faster with imbalance. Recommended value of .0023 for volatile assets and .005 for less volatile assets.

adjustment_step

uint256

[0 to 1] As the pool rebalances, it will must do so in units larger than the adjustment step size. Volatile assets are suggested to use larger values (0.000146), while less volatile assets do not move as frequently and may use smaller step sizes (default 0.0000055)

admin_fee

uint256

ma_half_time

uint256

[0 to 604,800] In seconds -- the price oracle uses an exponential moving average to dampen the effect of changes. This parameter adjusts the half life used.

initial_price

uint256

The price of coin0 with respect to coin1. This price set the initial liquidity concentration

deployAll

function deployAll(
        address _ibt,
        uint256 _duration,
        CurvePoolParams calldata curvePoolParams
    ) external returns (address pt, address curvePoolAddr, address lpv)
Input Parameter
Type
Description

_ibt

address

_duration

uint256

curvePoolParams

The parameters of the curve pool to be deployed

Return Parameter
Type
Description

pt

address

curvePoolAddr

address

The address of the curve pool that was deployed

lpv

address

The address of the LP Vault that was deployed

View Methods

getRegistry

function getRegistry() external view returns (address)

getCurveAddressProvider

function getCurveAddressProvider() external view returns (address)

getCurveFactory

function getCurveFactory() external view returns (address)

Returns the address of the Curve Factory.

getInitialPrice

function getInitialPrice(address curvePool) external view returns (uint256)

getCurveFactoryAddress

function getCurveFactoryAddress() public view returns (address)

The of the PrincipalToken to be deployed

The address of the that was deployed

The of the PrincipalToken to be deployed

The curve pool parameters as defined in the is a struct that hold the curve pool parameters.

Deploy a , a curve pool and a LP Vault associated with the PT and the deployed curve pool in a single transaction.

The of the PrincipalToken to be deployed

The duration of the contract to deploy

The address of the that was deployed

Returns the address of contract.

Returns the address of the .

Return the of the curvePool.

Returns the address of the associated Factory.

PrincipalToken
found on GitHub
PrincipalToken
curve pool documentation
Principal Token
Registry
Curve address provider
Curve
initial_price parameter
PrincipalToken
PT
PT
CurvePoolParams
CurvePoolParam
IBT
IBT
IBT