-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpool-deploy.txt
94 lines (73 loc) · 3.38 KB
/
pool-deploy.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
https://app.sorobanhub.com
https://raw.githubusercontent.com/Creit-Tech/SorobanHub-app/refs/heads/main/templates/project-views/blend/launch-pool.json
https://docs.blend.capital/pool-creators/tutorial-setting-up-a-pool
steps:
0. Deploy an oracle aggregator. This will often be a deployment of the
`oracle-aggregator` contract, set to use one source for USDC and
another as the default.
CBWL56K3NK6XHUNTKDZNSEL37FR5CZMB6PF33KXSNHIDD5LLD4OT6IXB (ybx public)
1. Deploy new pool
* contract address: pool factory contract id
* function: deploy()
* note that salt is a 64 character hex string
xxd -l32 -c 32 -ps /dev/random
* take rate is scaled to 7 decimals, so 20% = 2000000
example:
GDJS...P6OL invoked contract CBNG...EZDK deploy(GDJS...P6OL, "Sveiks"str, msepzeI6wq2hEQXuqkLkPC6oMyygqo9B9Y1xYCdNcY4=bytes, CAVL...6HLP, 20u32, 4u32) -> CCEY...GGL7
1a. Deposit backstop tokens
* contract address: backstop contract id
* function: deposit()
* this might not be required, but can help the UI to not error out in some cases
* contract address is the backstop contract, NOT the comet LP contract
CDJQJS3TLZ6LEWSBOZ2E6QEZZ4NS3JU5LDT2BT7A4UHWAXPLSNE6MM37 (testnet)
CAO3AGAMZVRMHITL36EJ2VZQWKYRPWMQAPDQD5YEOF3GIF7T44U4JAL3 (public)
2. Queue Set Reserve (for each asset)
* contract address: pool id, which is output of deployment (CCEY... in the example)
* function queue_set_reserve()
* assets ->
CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC (XLM testnet)
CAP5AMC2OHNVREO66DFIN6DHJMPOBAJ2KCDDIMFBR7WWJH5RZBFM3UEI (wBTC testnet)
CAZAQB3D7KSLSNOSQKYD2V4JP5V2Y3B4RDJZRLBFCCIXDCTE3WHSY3UE (wETH testnet)
CAQCFVLOBK5GIULPNZRGATJJMIZL5BSP7X5YJVMGCPTUEPFM4AVSRCJU (USDC testnet)
* metadata ->
index: 0
decimals: 7
c_factor: 8000000 = 0.80
l_factor: 8000000 = 0.80
util: 6000000 = 0.60 # util must be < max_util
max_util: 7000000 = 0.70
r_base: 100000 = 0.01
r_one: 500000 = 0.05
r_two: 500000 = 0.05
r_three: 50000000 = 5.00
react: 20 = 0.000002
3. Call set reserve (for each asset)
* contract address: pool id
* function set_reserve()
* asset list is the same as in step 2
* make note of the index returned from each call, as this is the res_index
* NOTE: you can call set_reserve() after each queue_set_reserve() call
if you want.
4. Set pool emissions
* contract address: pool id
* function set_emissions_config()
* vector -> [
res_index: 0
res_type: 0 # 0 for liabilities, 1 for supply
share: 1000000 = 10%
] etc...
5. Activate
* function: set_status()
* 0 = active, 2 = on ice, 4 = frozen
* status should be set to "on ice" first to allow deposits, then
updated to "active" once the threshold is met.
* IMPORTANT NOTE: there is a hard-coded backstop threshold of
200k product constant. The exact amount of shares varies depending
on value, and is defined by this formula:
x = blend amount for 1 LP share
y = usdc amount for 1 LP share
k = x^0.8 * y^0.8
At present 1 share equals 4.9158 BLND and 0.0555 USDC, so 1 share =
4.9158^0.8 * 0.0555^0.2 = 2.005090414527 PC
To meet the 200k PC threshold, you'd need about 99.8k LP shares
in the backstop.