There was an error while loading. Please reload this page.
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);