Skip to main content

Factory

GitHub: link

Errors​

Error_ProtocolFeeRecipientIsZero​

error Error_ProtocolFeeRecipientIsZero()

Events​

SetProtocolFee​

event SetProtocolFee(struct Factory.ProtocolFeeInfo protocolFeeInfo_)

DeployYieldTokenPair​

event DeployYieldTokenPair(contract Gate gate, address vault, contract NegativeYieldToken nyt, contract PerpetualYieldToken pyt)

Structs​

ProtocolFeeInfo​

struct ProtocolFeeInfo {
uint8 fee;
address recipient;
}

State variables​

protocolFeeInfo​

struct Factory.ProtocolFeeInfo protocolFeeInfo

The protocol fee and the fee recipient address.

State-mutating functions​

deployYieldTokenPair​

function deployYieldTokenPair(contract Gate gate, address vault) public virtual returns (contract NegativeYieldToken nyt, contract PerpetualYieldToken pyt)

Deploys the NegativeYieldToken and PerpetualYieldToken associated with a vault.

Will revert if they have already been deployed.

NameTypeDescription
gatecontract GateThe gate that will use the NYT and PYT
vaultaddressThe vault to deploy NYT and PYT for
NameTypeDescription
nytcontract NegativeYieldTokenThe deployed NegativeYieldToken
pytcontract PerpetualYieldTokenThe deployed PerpetualYieldToken

View functions​

getNegativeYieldToken​

function getNegativeYieldToken(contract Gate gate, address vault) public view virtual returns (contract NegativeYieldToken)

Returns the NegativeYieldToken associated with a gate & vault pair.

Returns non-zero value even if the contract hasn't been deployed yet.

NameTypeDescription
gatecontract GateThe gate to query
vaultaddressThe vault to query
NameTypeDescription
[0]contract NegativeYieldTokenThe NegativeYieldToken address

getPerpetualYieldToken​

function getPerpetualYieldToken(contract Gate gate, address vault) public view virtual returns (contract PerpetualYieldToken)

Returns the PerpetualYieldToken associated with a gate & vault pair.

Returns non-zero value even if the contract hasn't been deployed yet.

NameTypeDescription
gatecontract GateThe gate to query
vaultaddressThe vault to query
NameTypeDescription
[0]contract PerpetualYieldTokenThe PerpetualYieldToken address

Owner functions​

ownerSetProtocolFee​

function ownerSetProtocolFee(struct Factory.ProtocolFeeInfo protocolFeeInfo_) external virtual

Updates the protocol fee and/or the protocol fee recipient. Only callable by the owner.

NameTypeDescription
protocolFeeInfo_struct Factory.ProtocolFeeInfoThe new protocol fee info

Internal functions​

_computeYieldTokenAddress​

function _computeYieldTokenAddress(contract Gate gate, address vault, bool isPerpetualYieldToken) internal view virtual returns (address)

Computes the address of PYTs and NYTs using CREATE2.