IBCO Joystream
somewhat at high level, to be shared with Bedeho and the Design team.
Assumptions
✅ means confirmed by Bedeho / Design team
- AMM can be started at any time, even when users/creator have already CRTs at their disposal (eg from a Sale) ✅
- Creator cannot mint or burn tokens in a discretionary way ✅
- Once AMM is shut down it cannot be re-started ✅
- Bonded tokens are minted into user account
- Unbonded token are burned
- Patronage is the only concurrent minting event
- Burn token is the only concurrent burning event
- JOYs from bonding are not given to the CRT issuer, just stored during the AMM lifetime
- Curve will be linear
price(supply) = initial_price + sensitivity * supply, and sensitivity = 1 for now ✅. The correct amount of joy to be exchanged is obtained by integrating the price function from supply_before_bonding to supply_after_bonding when bonding (analogous when unbonding)
- AMM can be turned off only when JOY reserve amount equals
0 ✅
- Creator can set his initial allocation ✅
- Creator can unbond share of its own CRT, even when such amount is not backed by AMM reserve ✅
- AMM can be opened after sale ✅
User stories
Numerical values used are for sake of example, bonding and unbonding are theoretically inverse operations.
BC means bonding curve
User bonds with BC
Given
- CRT Bondig Curve (identified by
token_id = 1) supply value is supply = 1000
origin signed by user account sender
- CRT
1 total supply is total_supply = 10,000
- BC JOY reserve amount is
1,000,000
When
bond(origin, token_id = 1, crt_amount = 100) extrinsics executed with Ok(()) result
Then
- BC computes
joy_amount that user is required to transfer:
joy_amount = .5 * a * (1100^2 - 1000^2) + b * (1100 - 1000) = 105,100 using a,b = 1
joy_amount = 105100 is transferred from sender into BC reserve_account
crt_amount = 100 are minted into sender account
- BC supply value is set increased
crt_amount and set to 1,100
token_id total supply is also increased by crt_amount and set to 10,100
reserve amount for BC increased by joy_amount and set to 1,105,100
User unbonds with BC
Given
- CRT Bondig Curve (identified by
token_id = 1) supply value is supply = 1,100
origin signed by user account sender
- CRT
1 total supply is total_supply = 10,100
- BC JOY reserve amount is
1,105,100
When
unbond(origin, token_id = 1, crt_amount = 100) extrinsics executed with Ok(()) result
Then
- BC computes
joy_amount that BC is required to transfer back to the user:
joy_amount = .5 * a * (1000^2 - 1100^2) + b * (1000 - 1100) = -105,100 using a,b = 1
joy_amount = 105100 is transferred from BC reserve_account into sender account
crt_amount = 100 are burned
- BC supply value is set decreased
crt_amount and set to 1,100 - 100 = 1,000
token_id total supply is also decreased by crt_amount and set to 10,100 - 100 = 10,000
reserve amount for BC decreased by joy_amount = 105,100 and set to 1,105,100 - 105,100 = 1,000,000
Creator Story
Creator starts AMM
Given
token_id is a existing valid creator token.
When
activate_amm(token_id, initial_price = 100, sensitivity = 1) called with Ok(()) result
Then
- CRT offering state is set to
Bonding Curve (or `AMM')
- Bonding curve is set up with provided parameters
initial_price and sensitivity
reserve_account for the BC is set set to be a (sub)account of the project_token module
IBCO Joystream
somewhat at high level, to be shared with Bedeho and the Design team.
Assumptions
✅ means confirmed by Bedeho / Design team
price(supply) = initial_price + sensitivity * supply, andsensitivity = 1for now ✅. The correct amount of joy to be exchanged is obtained by integrating thepricefunction fromsupply_before_bondingtosupply_after_bondingwhen bonding (analogous when unbonding)0✅User stories
Numerical values used are for sake of example, bonding and unbonding are theoretically inverse operations.
BC means bonding curve
User bonds with BC
Given
token_id = 1) supply value issupply = 1000originsigned by user accountsender1total supply istotal_supply = 10,0001,000,000When
bond(origin, token_id = 1, crt_amount = 100)extrinsics executed withOk(())resultThen
joy_amountthat user is required to transfer:joy_amount = .5 * a * (1100^2 - 1000^2) + b * (1100 - 1000) = 105,100usinga,b = 1joy_amount = 105100is transferred fromsenderinto BCreserve_accountcrt_amount = 100are minted intosenderaccountcrt_amountand set to1,100token_idtotal supply is also increased bycrt_amountand set to10,100reserveamount for BC increased byjoy_amountand set to1,105,100User unbonds with BC
Given
token_id = 1) supply value issupply = 1,100originsigned by user accountsender1total supply istotal_supply = 10,1001,105,100When
unbond(origin, token_id = 1, crt_amount = 100)extrinsics executed withOk(())resultThen
joy_amountthat BC is required to transfer back to the user:joy_amount = .5 * a * (1000^2 - 1100^2) + b * (1000 - 1100) = -105,100usinga,b = 1joy_amount = 105100is transferred from BCreserve_accountintosenderaccountcrt_amount = 100are burnedcrt_amountand set to1,100 - 100 = 1,000token_idtotal supply is also decreased bycrt_amountand set to10,100 - 100 = 10,000reserveamount for BC decreased byjoy_amount = 105,100and set to1,105,100 - 105,100 = 1,000,000Creator Story
Creator starts AMM
Given
token_idis a existing valid creator token.When
activate_amm(token_id, initial_price = 100, sensitivity = 1)called withOk(())resultThen
Bonding Curve(or `AMM')initial_priceandsensitivityreserve_accountfor the BC is set set to be a (sub)account of theproject_tokenmodule