Skip to content
This repository was archived by the owner on Jun 12, 2024. It is now read-only.

Commit 1cf8ec4

Browse files
authored
Yumin/v0.6.10 (#452)
* add IDA convert to lino Add convert LINO to IDA. * add grant free votes to lino validators * 1dunlock * fix
1 parent 6aba3c2 commit 1cf8ec4

File tree

18 files changed

+1429
-2
lines changed

18 files changed

+1429
-2
lines changed

types/const.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ const (
179179
// Fast Stake-out period
180180
Upgrade5Update1 = 110000
181181

182+
// Migration
183+
Upgrade5Update2 = 1670000
184+
182185
// TxSigLimit - max number of sigs in one transaction
183186
// XXX(yumin): This will actually limit the number of msg per tx to at most 2.
184187
TxSigLimit = 2

x/developer/handler.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ func NewHandler(dm DeveloperKeeper) sdk.Handler {
3030
return handleIDAAuthorizeMsg(ctx, dm, msg)
3131
case types.UpdateAffiliatedMsg:
3232
return handleUpdateAffiliatedMsg(ctx, dm, msg)
33+
case types.IDAConvertFromLinoMsg:
34+
if ctx.BlockHeight() >= linotypes.Upgrade5Update2 {
35+
return handleIDAConvertFromLinoMsg(ctx, dm, msg)
36+
} else {
37+
errMsg := fmt.Sprintf(
38+
"Unrecognized developer msg type: %v", reflect.TypeOf(msg).Name())
39+
return sdk.ErrUnknownRequest(errMsg).Result()
40+
}
3341
default:
3442
errMsg := fmt.Sprintf("Unrecognized developer msg type: %v", reflect.TypeOf(msg).Name())
3543
return sdk.ErrUnknownRequest(errMsg).Result()
@@ -83,6 +91,18 @@ func handleIDAMintMsg(
8391
return sdk.Result{}
8492
}
8593

94+
func handleIDAConvertFromLinoMsg(
95+
ctx sdk.Context, dm DeveloperKeeper, msg types.IDAConvertFromLinoMsg) sdk.Result {
96+
amount, err := linotypes.LinoToCoin(msg.Amount)
97+
if err != nil {
98+
return err.Result()
99+
}
100+
if err := dm.IDAConvertFromLino(ctx, msg.Username, msg.App, amount); err != nil {
101+
return err.Result()
102+
}
103+
return sdk.Result{}
104+
}
105+
86106
func handleIDATransferMsg(
87107
ctx sdk.Context, dm DeveloperKeeper, msg types.IDATransferMsg) sdk.Result {
88108
amount, err := msg.Amount.ToMiniIDA()

x/developer/keeper.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type DeveloperKeeper interface {
2828
// IDA
2929
IssueIDA(ctx sdk.Context, appname linotypes.AccountKey, idaName string, idaPrice int64) sdk.Error
3030
MintIDA(ctx sdk.Context, appname linotypes.AccountKey, amount linotypes.Coin) sdk.Error
31+
IDAConvertFromLino(ctx sdk.Context, username, appname linotypes.AccountKey, amount linotypes.Coin) sdk.Error
3132
GetMiniIDAPrice(ctx sdk.Context, app linotypes.AccountKey) (linotypes.MiniDollar, sdk.Error)
3233
AppTransferIDA(ctx sdk.Context, appname, signer linotypes.AccountKey, amount linotypes.MiniIDA, from, to linotypes.AccountKey) sdk.Error
3334
MoveIDA(ctx sdk.Context, app linotypes.AccountKey, from, to linotypes.AccountKey, amount linotypes.MiniDollar) sdk.Error
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
[
2+
{
3+
"prefix": "0",
4+
"key": "testapp",
5+
"val": {
6+
"type": "lino/developer",
7+
"value": {
8+
"username": "testapp",
9+
"deposit": {
10+
"amount": "0"
11+
},
12+
"app_consumption": "0",
13+
"web_site": "",
14+
"description": "",
15+
"app_meta_data": "",
16+
"is_deleted": false,
17+
"n_affiliated": "0"
18+
}
19+
}
20+
},
21+
{
22+
"prefix": "0",
23+
"key": "testapp-revoked-ida",
24+
"val": {
25+
"type": "lino/developer",
26+
"value": {
27+
"username": "testapp-revoked-ida",
28+
"deposit": {
29+
"amount": "0"
30+
},
31+
"app_consumption": "0",
32+
"web_site": "",
33+
"description": "",
34+
"app_meta_data": "",
35+
"is_deleted": false,
36+
"n_affiliated": "0"
37+
}
38+
}
39+
},
40+
{
41+
"prefix": "0",
42+
"key": "testapp-unauthed-bank",
43+
"val": {
44+
"type": "lino/developer",
45+
"value": {
46+
"username": "testapp-unauthed-bank",
47+
"deposit": {
48+
"amount": "0"
49+
},
50+
"app_consumption": "0",
51+
"web_site": "",
52+
"description": "",
53+
"app_meta_data": "",
54+
"is_deleted": false,
55+
"n_affiliated": "0"
56+
}
57+
}
58+
},
59+
{
60+
"prefix": "0",
61+
"key": "testapp-without-ida",
62+
"val": {
63+
"type": "lino/developer",
64+
"value": {
65+
"username": "testapp-without-ida",
66+
"deposit": {
67+
"amount": "0"
68+
},
69+
"app_consumption": "0",
70+
"web_site": "",
71+
"description": "",
72+
"app_meta_data": "",
73+
"is_deleted": false,
74+
"n_affiliated": "0"
75+
}
76+
}
77+
},
78+
{
79+
"prefix": "1",
80+
"key": "testapp",
81+
"val": {
82+
"type": "lino/appida",
83+
"value": {
84+
"app": "testapp",
85+
"name": "test-lemon",
86+
"price": "10000",
87+
"is_revoked": false,
88+
"revoke_coin_price": "0"
89+
}
90+
}
91+
},
92+
{
93+
"prefix": "1",
94+
"key": "testapp-revoked-ida",
95+
"val": {
96+
"type": "lino/appida",
97+
"value": {
98+
"app": "testapp-revoked-ida",
99+
"name": "test-lemon",
100+
"price": "10000",
101+
"is_revoked": true,
102+
"revoke_coin_price": "0"
103+
}
104+
}
105+
},
106+
{
107+
"prefix": "1",
108+
"key": "testapp-unauthed-bank",
109+
"val": {
110+
"type": "lino/appida",
111+
"value": {
112+
"app": "testapp-unauthed-bank",
113+
"name": "test-lemon",
114+
"price": "10000",
115+
"is_revoked": false,
116+
"revoke_coin_price": "0"
117+
}
118+
}
119+
},
120+
{
121+
"prefix": "2",
122+
"key": "testapp-unauthed-bank/testapp-unauthed-bank",
123+
"val": {
124+
"type": "lino/bank",
125+
"value": {
126+
"b": "10000",
127+
"unauthed": true
128+
}
129+
}
130+
},
131+
{
132+
"prefix": "2",
133+
"key": "testapp/testapp",
134+
"val": {
135+
"type": "lino/bank",
136+
"value": {
137+
"b": "10000"
138+
}
139+
}
140+
},
141+
{
142+
"prefix": "3",
143+
"key": "",
144+
"val": {
145+
"type": "lino/reservepool",
146+
"value": {
147+
"total": {
148+
"amount": "0"
149+
},
150+
"total_minidollar": "0"
151+
}
152+
}
153+
}
154+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
[
2+
{
3+
"prefix": "0",
4+
"key": "testapp",
5+
"val": {
6+
"type": "lino/developer",
7+
"value": {
8+
"username": "testapp",
9+
"deposit": {
10+
"amount": "0"
11+
},
12+
"app_consumption": "0",
13+
"web_site": "",
14+
"description": "",
15+
"app_meta_data": "",
16+
"is_deleted": false,
17+
"n_affiliated": "0"
18+
}
19+
}
20+
},
21+
{
22+
"prefix": "0",
23+
"key": "testapp-revoked-ida",
24+
"val": {
25+
"type": "lino/developer",
26+
"value": {
27+
"username": "testapp-revoked-ida",
28+
"deposit": {
29+
"amount": "0"
30+
},
31+
"app_consumption": "0",
32+
"web_site": "",
33+
"description": "",
34+
"app_meta_data": "",
35+
"is_deleted": false,
36+
"n_affiliated": "0"
37+
}
38+
}
39+
},
40+
{
41+
"prefix": "0",
42+
"key": "testapp-unauthed-bank",
43+
"val": {
44+
"type": "lino/developer",
45+
"value": {
46+
"username": "testapp-unauthed-bank",
47+
"deposit": {
48+
"amount": "0"
49+
},
50+
"app_consumption": "0",
51+
"web_site": "",
52+
"description": "",
53+
"app_meta_data": "",
54+
"is_deleted": false,
55+
"n_affiliated": "0"
56+
}
57+
}
58+
},
59+
{
60+
"prefix": "0",
61+
"key": "testapp-without-ida",
62+
"val": {
63+
"type": "lino/developer",
64+
"value": {
65+
"username": "testapp-without-ida",
66+
"deposit": {
67+
"amount": "0"
68+
},
69+
"app_consumption": "0",
70+
"web_site": "",
71+
"description": "",
72+
"app_meta_data": "",
73+
"is_deleted": false,
74+
"n_affiliated": "0"
75+
}
76+
}
77+
},
78+
{
79+
"prefix": "1",
80+
"key": "testapp",
81+
"val": {
82+
"type": "lino/appida",
83+
"value": {
84+
"app": "testapp",
85+
"name": "test-lemon",
86+
"price": "10000",
87+
"is_revoked": false,
88+
"revoke_coin_price": "0"
89+
}
90+
}
91+
},
92+
{
93+
"prefix": "1",
94+
"key": "testapp-revoked-ida",
95+
"val": {
96+
"type": "lino/appida",
97+
"value": {
98+
"app": "testapp-revoked-ida",
99+
"name": "test-lemon",
100+
"price": "10000",
101+
"is_revoked": true,
102+
"revoke_coin_price": "0"
103+
}
104+
}
105+
},
106+
{
107+
"prefix": "1",
108+
"key": "testapp-unauthed-bank",
109+
"val": {
110+
"type": "lino/appida",
111+
"value": {
112+
"app": "testapp-unauthed-bank",
113+
"name": "test-lemon",
114+
"price": "10000",
115+
"is_revoked": false,
116+
"revoke_coin_price": "0"
117+
}
118+
}
119+
},
120+
{
121+
"prefix": "2",
122+
"key": "testapp-unauthed-bank/testapp-unauthed-bank",
123+
"val": {
124+
"type": "lino/bank",
125+
"value": {
126+
"b": "10000",
127+
"unauthed": true
128+
}
129+
}
130+
},
131+
{
132+
"prefix": "2",
133+
"key": "testapp/testapp",
134+
"val": {
135+
"type": "lino/bank",
136+
"value": {
137+
"b": "10000"
138+
}
139+
}
140+
},
141+
{
142+
"prefix": "3",
143+
"key": "",
144+
"val": {
145+
"type": "lino/reservepool",
146+
"value": {
147+
"total": {
148+
"amount": "0"
149+
},
150+
"total_minidollar": "0"
151+
}
152+
}
153+
}
154+
]

0 commit comments

Comments
 (0)