Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WBTC Is Hard To Implement Contract Size 1:1 Due To The Lack Of Precision #46

Closed
osp-ng opened this issue Jul 17, 2019 · 0 comments
Closed

Comments

@osp-ng
Copy link
Contributor

osp-ng commented Jul 17, 2019

Currently, the collateral token is the WBTC and its precision is defined by the "decimal point" in the ERC20. WBTC’s decimals = 8 (which is far away from the DAI who has decimals = 18). This feature limits the precision of the Synthetic BTC Mining Contract.

In the "mint" routine of the MARTKETProtocol, the required collateral token is calculated by:

Note:

  • CTK: Collateral token. Is is the WBTC in this project so far. WTC.decimals = 8
  • INDEX: The BME in this project. According to the BME84 design, (Cap - Floor) = 1.6e-5. So INDEX.decimals should be >= 6. Considering the decline in the BME caused by production reducing, the better INDEX.decimals is >= 9
  • qtyMultiplier: A constant ratio
  • qtyToMint: How many position pairs can we get after the "mint" routine
  • The contract multiplier(also called contract size) = 1 according to the previous discussions

It is impossible to implement the protocol under the above constraints.

For example, if we have (Cap - Floor) = 1.6e-5 which means Value(1 contract) = 1.6e-5 BTC. Even if we set every factors to the minimum value (ie. INDEX.decimals = 6, qtyMultiplier = 1, qtyToMint = 1), we still have to pay 1.6e-2 BTC which is wrong.

Proposal 1: Set the contract multiplier(also called contract size)

Adopt issue #44: Value(1 contract) = Multiplier * the index value

I propose the following settings:

  • INDEX.decimals = 9. It has 4 significance digits until 3 years later
  • The contract multiplier in Adopt the concept of contract size from index futures #44 = 1e6, which means Value(1 contract) = 1.6e-5 * 1e6 = 16 BTC
  • Note that you can buy 1e-5 contracts. So the minimum collateral could be 0.00016 WBTC
  • qtyMultiplier = 1

So that 9(INDEX.decimals) - 6(contract multiplier) + 5(POSITION.decimals) = 8(WBTC.decimals).

ADVANTAGE: It uses a standard financial term.
ADVANTAGE: This is the only method to increase the significance digits of the BMC.
DISADVANTAGE: Make it harder for users to understand the meaning of the value of 1 contract.

Proposal 2: Use pBTC instead

Deploy a new contract which atomicly exchange the WBTC(decimals = 8) with pBTC(decimals = 18).

ADVANTAGE: It is a more complete implementation.
DISADVANTAGE: One more step is involved for the user.

Proposal 3: Modify the index

Modifing the index by times the BME by 1e3 and keep contract multiplier = 1.

For example: index = 1.6e-5 * 1e3 = 1.6e-2 BTC, which means Value(1 contract) = 1.6e-2 BTC

So that 3(INDEX.decimals) + 5(POSITION.decimals) = 8(WBTC.decimals).

ADVANTAGE: The simplest method to make this project implemented.
DISADVANTAGE: It seems the significance digits is not enough even today. I think the issue #44 is still required.

Proposal 4: Modify the MARTKETProtocol code

The core formula in the 'mint' routine only allows multiplication. The contract multiplier(also called contract size) is a "division" function in the 'mint' routine. So adding a division function will allow INDEX.decimals > CTK.decimals.

In MarketContract.sol,
add a QTY_DENOMINATOR after the QTY_MULTIPLIER.

In MarketCollateralPool.sol,

uint neededCollateral = MathLib.multiply(qtyToMint, marketContract.COLLATERAL_PER_UNIT());

will be

uint neededCollateral = MathLib.divideFractional(qtyToMint, marketContract.COLLATERAL_PER_UNIT(), marketContract.QTY_DENOMINATOR());
@osp-ng osp-ng changed the title wBTC Is Hard To Implement This Protocol Due To The Lack Of Precision WBTC Is Hard To Implement Contract Size 1:1 Due To The Lack Of Precision Jul 18, 2019
0xSSoul pushed a commit that referenced this issue Jul 28, 2019
@tzhan28 tzhan28 closed this as completed Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants