This repository has been archived by the owner on Jan 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 59
Rebalancing Set Issuance Details
Felix Feng edited this page Oct 17, 2019
·
3 revisions
A Rebalancing SetToken is composed of a single base SetToken, and the base SetToken is composed of its components.
baseSetRequired = rebalancingSetQuantity * unitShares / rebalancingSetNaturalUnit
componentRequired = baseSetRequired * unit / baseSetNaturalUnit
baseSetIssuable = componentQuantity * baseSetNaturalUnit / unit
rebalancingSetIssuable = baseSetIssuable * rebalancingSetNaturalUnit / unitShares
Let's say you wanted to issue the 1 full unit of the 20 Day MACO Set. To calculate the underlying components required, you do the following:
// MACO Set is the instance of the rebalancing Set
const macoSetQuantity = new BigNumber(10 ** 18);
const macoSetUnitShares = await macoSet.unitShares.callAsync();
const macoSetNaturalUnit = await macoSet.naturalUnit.callAsync();
const requiredBaseSetQuantity = macoSetQuantity.mul(macoSetUnitShares).div(macoSetNaturalUnit);
const baseSet = await macoSet.currentSet.callAsync();
const baseSetNaturalUnit = await baseSet.naturalUnit.callAsync();
const baseSetUnits = await baseSet.units.callAsync();
// Calculate required amount of the component
const requiredComponent = requiredBaseSetQuantity.mul(baseSetUnits[0]).div(baseSetNaturalUnit);