1
1
// @ts -check
2
2
3
- export const CENTRAL_ISSUER_NAME = 'MOE ' ;
3
+ export const CENTRAL_ISSUER_NAME = 'RUN ' ;
4
4
5
5
/** @typedef {number | bigint } Bigish */
6
6
7
7
/**
8
8
* @typedef {Object } CollateralConfig
9
9
* @property {string } keyword
10
10
* @property {Bigish } collateralValue
11
- * @property {bigint } initialPricePercent
12
11
* @property {bigint } initialMarginPercent
13
12
* @property {bigint } liquidationMarginPercent
14
13
* @property {bigint } interestRateBasis
@@ -21,76 +20,160 @@ export const CENTRAL_ISSUER_NAME = 'MOE';
21
20
* @property {Brand } [brand]
22
21
* @property {Array<any> } [issuerArgs]
23
22
* @property {CollateralConfig } [collateralConfig]
24
- * @property {string } pursePetname
25
- * @property {Bigish } mintValue
26
- * @property {Array<[Bigish, Bigish]> } [fakeTradesGivenCentral]
23
+ * @property {Array<[string, Bigish]> } [defaultPurses]
24
+ * @property {Array<[Bigish, Bigish]> } [tradesGivenCentral]
27
25
*/
28
26
27
+ export const makeScaler = toDecimals => ( n , fromDecimals = 0 ) => {
28
+ if ( typeof n === 'bigint' ) {
29
+ return n * 10n ** BigInt ( toDecimals ) ;
30
+ }
31
+ return (
32
+ BigInt ( Math . floor ( n * 10 ** fromDecimals ) ) *
33
+ 10n ** BigInt ( toDecimals - fromDecimals )
34
+ ) ;
35
+ } ;
36
+ export const scaleMills = makeScaler ( 4 ) ;
37
+ export const scaleMicro = makeScaler ( 6 ) ;
38
+ export const scaleEth = makeScaler ( 18 ) ;
39
+ export const scaleCentral = scaleMicro ;
40
+
29
41
/** @type {Array<[string, IssuerInitializationRecord]> } */
30
- const fakeIssuerEntries = [
42
+ const fromCosmosIssuerEntries = [
43
+ [
44
+ 'BLD' ,
45
+ {
46
+ issuerArgs : [ undefined , { decimalPlaces : 6 } ] ,
47
+ defaultPurses : [ [ 'Agoric staking token' , scaleMicro ( 73 ) ] ] ,
48
+ collateralConfig : {
49
+ keyword : 'BLD' ,
50
+ collateralValue : scaleMicro ( 1000000n ) ,
51
+ initialMarginPercent : 150n ,
52
+ liquidationMarginPercent : 125n ,
53
+ interestRateBasis : 250n ,
54
+ loanFeeBasis : 50n ,
55
+ } ,
56
+ tradesGivenCentral : [
57
+ [ scaleCentral ( 27.9 , 1 ) , scaleMicro ( 1 ) ] ,
58
+ [ scaleCentral ( 25.7 , 1 ) , scaleMicro ( 1 ) ] ,
59
+ [ scaleCentral ( 26.8 , 1 ) , scaleMicro ( 1 ) ] ,
60
+ ] ,
61
+ } ,
62
+ ] ,
63
+ ] ;
64
+
65
+ harden ( fromCosmosIssuerEntries ) ;
66
+ export { fromCosmosIssuerEntries } ;
67
+
68
+ /** @type {Array<[string, IssuerInitializationRecord]> } */
69
+ const fromPegasusIssuerEntries = [
70
+ [
71
+ 'ATOM' ,
72
+ {
73
+ issuerArgs : [ undefined , { decimalPlaces : 6 } ] ,
74
+ defaultPurses : [ [ 'Cosmos Staking' , scaleMicro ( 68 ) ] ] ,
75
+ collateralConfig : {
76
+ keyword : 'ATOM' ,
77
+ collateralValue : scaleMicro ( 1000000n ) ,
78
+ initialMarginPercent : 150n ,
79
+ liquidationMarginPercent : 125n ,
80
+ interestRateBasis : 250n ,
81
+ loanFeeBasis : 50n ,
82
+ } ,
83
+ tradesGivenCentral : [
84
+ [ scaleCentral ( 18.61 , 2 ) , scaleMicro ( 1 ) ] ,
85
+ [ scaleCentral ( 19.97 , 2 ) , scaleMicro ( 1 ) ] ,
86
+ [ scaleCentral ( 19.17 , 2 ) , scaleMicro ( 1 ) ] ,
87
+ ] ,
88
+ } ,
89
+ ] ,
90
+ [
91
+ 'ETH' ,
92
+ {
93
+ issuerArgs : [ undefined , { decimalPlaces : 18 } ] ,
94
+ collateralConfig : {
95
+ keyword : 'ETH' ,
96
+ collateralValue : scaleEth ( 1000000n ) ,
97
+ initialMarginPercent : 150n ,
98
+ liquidationMarginPercent : 125n ,
99
+ interestRateBasis : 250n ,
100
+ loanFeeBasis : 50n ,
101
+ } ,
102
+ tradesGivenCentral : [
103
+ [ scaleCentral ( 1914.86 , 2 ) , scaleEth ( 1 ) ] ,
104
+ [ scaleCentral ( 1489.87 , 2 ) , scaleEth ( 1 ) ] ,
105
+ [ scaleCentral ( 1924.4 , 2 ) , scaleEth ( 1 ) ] ,
106
+ ] ,
107
+ } ,
108
+ ] ,
109
+ // FIXME: Either of these entries (LINK or USDC) screw up the bootstrap process.
110
+ // I'm not sure why.
111
+ /*
31
112
[
32
113
'LINK',
33
114
{
34
115
issuerArgs: [undefined, { decimalPlaces: 18 }],
35
- mintValue : 51n * 10n ** 18n ,
116
+ defaultPurses: [['Oracle fee', scaleEth(51n)]] ,
36
117
collateralConfig: {
37
118
keyword: 'LINK',
38
- collateralValue : 1000000n * 10n ** 18n ,
39
- initialPricePercent : 125n ,
119
+ collateralValue: scaleEth(1000000n),
40
120
initialMarginPercent: 150n,
41
121
liquidationMarginPercent: 125n,
42
122
interestRateBasis: 250n,
43
123
loanFeeBasis: 50n,
44
124
},
45
- pursePetname : 'Oracle fee' ,
46
- fakeTradesGivenCentral : [
47
- [ 279000n , 10n ** 18n ] ,
48
- [ 257000n , 10n ** 18n ] ,
49
- [ 268000n , 10n ** 18n ] ,
125
+ tradesGivenCentral: [
126
+ [scaleCentral(27.9, 2), scaleEth(1)],
127
+ [scaleCentral(25.7, 2), scaleEth(1)],
128
+ [scaleCentral(26.8, 2), scaleEth(1)],
50
129
],
51
130
},
52
131
],
53
132
[
54
- 'moola ' ,
133
+ 'USDC ',
55
134
{
56
- mintValue : 1900 ,
135
+ issuerArgs: [undefined, { decimalPlaces: 18 }],
136
+ defaultPurses: [['USD Coin', scaleEth(1323n)]],
57
137
collateralConfig: {
58
- collateralValue : 7400000 ,
59
- keyword : 'Moola' ,
60
- initialPricePercent : 150n ,
138
+ keyword: 'USDC',
139
+ collateralValue: scaleEth(1000000n),
61
140
initialMarginPercent: 150n,
62
- liquidationMarginPercent : 120n ,
63
- interestRateBasis : 200n ,
64
- loanFeeBasis : 150n ,
141
+ liquidationMarginPercent: 125n ,
142
+ interestRateBasis: 250n ,
143
+ loanFeeBasis: 50n ,
65
144
},
66
- pursePetname : 'Fun budget' ,
67
- fakeTradesGivenCentral : [
68
- [ 10000 , 1 ] ,
69
- [ 13000 , 1 ] ,
70
- [ 12000 , 1 ] ,
71
- [ 18000 , 1 ] ,
72
- [ 15000 , 1 ] ,
145
+ tradesGivenCentral: [[scaleCentral(1), scaleEth(1)]],
146
+ },
147
+ ],
148
+ */
149
+ ] ;
150
+
151
+ harden ( fromPegasusIssuerEntries ) ;
152
+ export { fromPegasusIssuerEntries } ;
153
+
154
+ /** @type {Array<[string, IssuerInitializationRecord]> } */
155
+ const fakeIssuerEntries = [
156
+ [
157
+ 'moola' ,
158
+ {
159
+ defaultPurses : [ [ 'Fun budget' , 1900 ] ] ,
160
+ tradesGivenCentral : [
161
+ [ scaleCentral ( 1 ) , 1 ] ,
162
+ [ scaleCentral ( 1.3 , 1 ) , 1 ] ,
163
+ [ scaleCentral ( 1.2 , 1 ) , 1 ] ,
164
+ [ scaleCentral ( 1.8 , 1 ) , 1 ] ,
165
+ [ scaleCentral ( 1.5 , 1 ) , 1 ] ,
73
166
] ,
74
167
} ,
75
168
] ,
76
169
[
77
170
'simolean' ,
78
171
{
79
- mintValue : 970 ,
80
- collateralConfig : {
81
- collateralValue : 968000 ,
82
- keyword : 'Simolean' ,
83
- initialPricePercent : 110n ,
84
- initialMarginPercent : 120n ,
85
- liquidationMarginPercent : 105n ,
86
- interestRateBasis : 100n ,
87
- loanFeeBasis : 225n ,
88
- } ,
89
- pursePetname : 'Nest egg' ,
90
- fakeTradesGivenCentral : [
91
- [ 213500 , 1 ] ,
92
- [ 217200 , 1 ] ,
93
- [ 212400 , 1 ] ,
172
+ defaultPurses : [ [ 'Nest egg' , 970 ] ] ,
173
+ tradesGivenCentral : [
174
+ [ scaleCentral ( 21.35 , 2 ) , 1 ] ,
175
+ [ scaleCentral ( 21.72 , 2 ) , 1 ] ,
176
+ [ scaleCentral ( 21.24 , 2 ) , 1 ] ,
94
177
] ,
95
178
} ,
96
179
] ,
0 commit comments