Fund
Getting Fund Info
Fund.tokenUnderlying() → address
Fund.tokenUnderlying() → address
The address of the underlying asset.
Fund.tokenShare(uint256 tranche) → address
Fund.tokenShare(uint256 tranche) → address
Getter for one of the addresses of tranche
: QUEEN (0), BISHOP (1) or ROOK (2).
Fund.primaryMarket() → address
Fund.primaryMarket() → address
The address of the primary market contract.
Fund.primaryMarketUpdateProposal() → address, uint256
Fund.primaryMarketUpdateProposal() → address, uint256
Getter for the upcoming primary market upgrade, if any.
Fund.twapOracle() → ITwapOracleV2
Fund.twapOracle() → ITwapOracleV2
The TWAP Oracle of the underlying asset.
Fund.feeCollector() → address
Fund.feeCollector() → address
The address of the fee collector of the fund.
Fund.endOfDay(uint256 timestamp) → uint256
Fund.endOfDay(uint256 timestamp) → uint256
It calculates the trading day end timestamp of the given timestamp
. A trading day starts at UTC time SETTLEMENT_TIME
of a day (inclusive) and ends at the same time of the next day (exclusive).
Fund.trancheTotalSupply(uint256 tranche) → uint256
Fund.trancheTotalSupply(uint256 tranche) → uint256
Getter for the total supply of tranche
.
Fund.getRebalanceSize() → uint256
Fund.getRebalanceSize() → uint256
Getter for the number of historical rebalances.
Fund.getRebalance(uint256 index) → Rebalance
Fund.getRebalance(uint256 index) → Rebalance
Getter for the Rebalance parameters of a given rebalance version.
Fund.currentDay() → uint256
Fund.currentDay() → uint256
The end timestamp of the current trading day.
Fund.splitRatio() → uint256
Fund.splitRatio() → uint256
The amount of BISHOP received by splitting one QUEEN. This ratio changes on every rebalance.
Fund.historicalSplitRatio(uint256 version) → uint256
Fund.historicalSplitRatio(uint256 version) → uint256
Getter for past split ratio of a given rebalance version.
Fund.fundActivityStartTime() → uint256
Fund.fundActivityStartTime() → uint256
Getter for the start timestamp of the current activity window of the fund.
Fund.isFundActive(uint256 timestamp) → bool
Fund.isFundActive(uint256 timestamp) → bool
Check if the fund is currently active.
Fund.getEquivalentTotalB() → uint256
Fund.getEquivalentTotalB() → uint256
Getter for the equivalent amount of BISHOP supply if all QUEEN are split.
Fund.getEquivalentTotalQ() → uint256
Fund.getEquivalentTotalQ() → uint256
Getter for the equivalent amount of QUEEN supply if all BISHOP and ROOK are merged.
Fund.historicalEquivalentTotalB(uint256 day) → uint256
Fund.historicalEquivalentTotalB(uint256 day) → uint256
Getter for the past equivalent total amount of BISHOP on a given day
.
Fund.historicalNavs(uint256 day) → uint256, uint256
Fund.historicalNavs(uint256 day) → uint256, uint256
Getter for the past net asset values on a given day
.
Fund.extrapolateNav(uint256 price) → uint256
Fund.extrapolateNav(uint256 price) → uint256
It estimates the current net asset values of all tranches, considering the current underlying price
, the accrued protocol fee and interest since the previous settlement.
Fund.historicalUnderlying(uint256 day) → uint256
Fund.historicalUnderlying(uint256 day) → uint256
Getter for the past underlying amount on a given day
.
Fund.getTotalUnderlying() → uint256
Fund.getTotalUnderlying() → uint256
Getter for the current total underlying amount.
Fund.getStrategyUnderlying() → uint256
Fund.getStrategyUnderlying() → uint256
Getter for the current total underlying amount in strategy contract.
Fund.getTotalDebt() → uint256
Fund.getTotalDebt() → uint256
Getter for the amount of underlying that the fund owes the primary market for redemption.
Handling Rebalances
Fund.doRebalance(uint256 amountQ, uint256 amountB, uint256 amountR, uint256 index) → uint256, uint256, uint256
Fund.doRebalance(uint256 amountQ, uint256 amountB, uint256 amountR, uint256 index) → uint256, uint256, uint256
Get the results of share amounts amountQ
, amountB
, amountR
after performing the rebalance at index
.
Note that this function performs no bounds checking on the given index; the transformation of a non-existent rebalance will result in undefined behavior.
Fund.batchRebalance(uint256 amountQ, uint256 amountB, uint256 amountR, uint256 fromIndex, uint256 toIndex) → uint256, uint256, uint256
Fund.batchRebalance(uint256 amountQ, uint256 amountB, uint256 amountR, uint256 fromIndex, uint256 toIndex) → uint256, uint256, uint256
Get the results of share amounts amountQ
, amountB
, amountR
after performing the rebalances from fromIndex
to toIndex
.
Note that this function performs no bounds checking on the given indices. The original amounts are returned if
fromIndex
is no less thantoIndex
. A zero vector is returned iftoIndex
is greater than the number of existing rebalances.
Fund.refreshBalance(address account, uint256 targetVersion)
Fund.refreshBalance(address account, uint256 targetVersion)
Transform share balances of account
to a given targetVersion
.
Note that setting
targetVersion
to zero transforms the share balances to the latest version.
Fund.refreshAllowance(address owner, address spender, uint256 targetVersion)
Fund.refreshAllowance(address owner, address spender, uint256 targetVersion)
Transform share allowances of spender
approved by owner
to a given targetVersion
.
Note that setting
targetVersion
to zero transforms the share allowances to the latest version.
Transferring Tranche Tokens
Fund.trancheBalanceOf(uint256 tranch, address account) → uint256
Fund.trancheBalanceOf(uint256 tranch, address account) → uint256
Get the balance of tranche
for the account
.
Fund.trancheAllBalanceOf(address account) → uint256, uint256, uint256
Fund.trancheAllBalanceOf(address account) → uint256, uint256, uint256
Get the balances of all tranches for the account
.
Fund.trancheBalanceVersion(address account) → uint256
Fund.trancheBalanceVersion(address account) → uint256
Get the last rebalance version for the account
.
Fund.trancheAllowance(uint256 tranch, address owner, address spender) → uint256
Fund.trancheAllowance(uint256 tranch, address owner, address spender) → uint256
Get the allowance approved to spender
of tranche
by the owner
.
Fund.trancheAllowanceVersion(address owner, address spender) → uint256
Fund.trancheAllowanceVersion(address owner, address spender) → uint256
Get the last rebalance version of spender
's allowance by the owner
.
Fund.trancheTransfer(uint256 tranche, address recipient, uint256 amount, uint256 version)
Fund.trancheTransfer(uint256 tranche, address recipient, uint256 amount, uint256 version)
Refresh the balances of msg.sender
and recipient
, then transfer amount
of tranche
from msg.sender
to recipient
. It enforces the version
to be the current rebalance version.
Fund.trancheTransferFrom(uint256 tranche, address sender, address recipient, uint256 amount, uint256 version)
Fund.trancheTransferFrom(uint256 tranche, address sender, address recipient, uint256 amount, uint256 version)
Refresh the balances of sender
and recipient
and the allowances of msg.sender
approved by sender
, then transfer amount
of tranche
from sender
to recipient
. It enforces the version
to be the current rebalance version.
Fund.trancheApprove(uint256 tranche, address spender, uint256 amount, uint256 version)
Fund.trancheApprove(uint256 tranche, address spender, uint256 amount, uint256 version)
Sets amount
as the allowance of spender
over tranche
. It enforces the version
to be the current rebalance version.
Last updated