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

Commit

Permalink
Yumin/v0.6.10 (#452)
Browse files Browse the repository at this point in the history
* add IDA convert to lino
Add convert LINO to IDA.

* add grant free votes to lino validators

* 1dunlock

* fix
  • Loading branch information
Stumble authored Jan 8, 2020
1 parent 6aba3c2 commit 1cf8ec4
Show file tree
Hide file tree
Showing 18 changed files with 1,429 additions and 2 deletions.
3 changes: 3 additions & 0 deletions types/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ const (
// Fast Stake-out period
Upgrade5Update1 = 110000

// Migration
Upgrade5Update2 = 1670000

// TxSigLimit - max number of sigs in one transaction
// XXX(yumin): This will actually limit the number of msg per tx to at most 2.
TxSigLimit = 2
Expand Down
20 changes: 20 additions & 0 deletions x/developer/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ func NewHandler(dm DeveloperKeeper) sdk.Handler {
return handleIDAAuthorizeMsg(ctx, dm, msg)
case types.UpdateAffiliatedMsg:
return handleUpdateAffiliatedMsg(ctx, dm, msg)
case types.IDAConvertFromLinoMsg:
if ctx.BlockHeight() >= linotypes.Upgrade5Update2 {
return handleIDAConvertFromLinoMsg(ctx, dm, msg)
} else {
errMsg := fmt.Sprintf(
"Unrecognized developer msg type: %v", reflect.TypeOf(msg).Name())
return sdk.ErrUnknownRequest(errMsg).Result()
}
default:
errMsg := fmt.Sprintf("Unrecognized developer msg type: %v", reflect.TypeOf(msg).Name())
return sdk.ErrUnknownRequest(errMsg).Result()
Expand Down Expand Up @@ -83,6 +91,18 @@ func handleIDAMintMsg(
return sdk.Result{}
}

func handleIDAConvertFromLinoMsg(
ctx sdk.Context, dm DeveloperKeeper, msg types.IDAConvertFromLinoMsg) sdk.Result {
amount, err := linotypes.LinoToCoin(msg.Amount)
if err != nil {
return err.Result()
}
if err := dm.IDAConvertFromLino(ctx, msg.Username, msg.App, amount); err != nil {
return err.Result()
}
return sdk.Result{}
}

func handleIDATransferMsg(
ctx sdk.Context, dm DeveloperKeeper, msg types.IDATransferMsg) sdk.Result {
amount, err := msg.Amount.ToMiniIDA()
Expand Down
1 change: 1 addition & 0 deletions x/developer/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type DeveloperKeeper interface {
// IDA
IssueIDA(ctx sdk.Context, appname linotypes.AccountKey, idaName string, idaPrice int64) sdk.Error
MintIDA(ctx sdk.Context, appname linotypes.AccountKey, amount linotypes.Coin) sdk.Error
IDAConvertFromLino(ctx sdk.Context, username, appname linotypes.AccountKey, amount linotypes.Coin) sdk.Error
GetMiniIDAPrice(ctx sdk.Context, app linotypes.AccountKey) (linotypes.MiniDollar, sdk.Error)
AppTransferIDA(ctx sdk.Context, appname, signer linotypes.AccountKey, amount linotypes.MiniIDA, from, to linotypes.AccountKey) sdk.Error
MoveIDA(ctx sdk.Context, app linotypes.AccountKey, from, to linotypes.AccountKey, amount linotypes.MiniDollar) sdk.Error
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
[
{
"prefix": "0",
"key": "testapp",
"val": {
"type": "lino/developer",
"value": {
"username": "testapp",
"deposit": {
"amount": "0"
},
"app_consumption": "0",
"web_site": "",
"description": "",
"app_meta_data": "",
"is_deleted": false,
"n_affiliated": "0"
}
}
},
{
"prefix": "0",
"key": "testapp-revoked-ida",
"val": {
"type": "lino/developer",
"value": {
"username": "testapp-revoked-ida",
"deposit": {
"amount": "0"
},
"app_consumption": "0",
"web_site": "",
"description": "",
"app_meta_data": "",
"is_deleted": false,
"n_affiliated": "0"
}
}
},
{
"prefix": "0",
"key": "testapp-unauthed-bank",
"val": {
"type": "lino/developer",
"value": {
"username": "testapp-unauthed-bank",
"deposit": {
"amount": "0"
},
"app_consumption": "0",
"web_site": "",
"description": "",
"app_meta_data": "",
"is_deleted": false,
"n_affiliated": "0"
}
}
},
{
"prefix": "0",
"key": "testapp-without-ida",
"val": {
"type": "lino/developer",
"value": {
"username": "testapp-without-ida",
"deposit": {
"amount": "0"
},
"app_consumption": "0",
"web_site": "",
"description": "",
"app_meta_data": "",
"is_deleted": false,
"n_affiliated": "0"
}
}
},
{
"prefix": "1",
"key": "testapp",
"val": {
"type": "lino/appida",
"value": {
"app": "testapp",
"name": "test-lemon",
"price": "10000",
"is_revoked": false,
"revoke_coin_price": "0"
}
}
},
{
"prefix": "1",
"key": "testapp-revoked-ida",
"val": {
"type": "lino/appida",
"value": {
"app": "testapp-revoked-ida",
"name": "test-lemon",
"price": "10000",
"is_revoked": true,
"revoke_coin_price": "0"
}
}
},
{
"prefix": "1",
"key": "testapp-unauthed-bank",
"val": {
"type": "lino/appida",
"value": {
"app": "testapp-unauthed-bank",
"name": "test-lemon",
"price": "10000",
"is_revoked": false,
"revoke_coin_price": "0"
}
}
},
{
"prefix": "2",
"key": "testapp-unauthed-bank/testapp-unauthed-bank",
"val": {
"type": "lino/bank",
"value": {
"b": "10000",
"unauthed": true
}
}
},
{
"prefix": "2",
"key": "testapp/testapp",
"val": {
"type": "lino/bank",
"value": {
"b": "10000"
}
}
},
{
"prefix": "3",
"key": "",
"val": {
"type": "lino/reservepool",
"value": {
"total": {
"amount": "0"
},
"total_minidollar": "0"
}
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
[
{
"prefix": "0",
"key": "testapp",
"val": {
"type": "lino/developer",
"value": {
"username": "testapp",
"deposit": {
"amount": "0"
},
"app_consumption": "0",
"web_site": "",
"description": "",
"app_meta_data": "",
"is_deleted": false,
"n_affiliated": "0"
}
}
},
{
"prefix": "0",
"key": "testapp-revoked-ida",
"val": {
"type": "lino/developer",
"value": {
"username": "testapp-revoked-ida",
"deposit": {
"amount": "0"
},
"app_consumption": "0",
"web_site": "",
"description": "",
"app_meta_data": "",
"is_deleted": false,
"n_affiliated": "0"
}
}
},
{
"prefix": "0",
"key": "testapp-unauthed-bank",
"val": {
"type": "lino/developer",
"value": {
"username": "testapp-unauthed-bank",
"deposit": {
"amount": "0"
},
"app_consumption": "0",
"web_site": "",
"description": "",
"app_meta_data": "",
"is_deleted": false,
"n_affiliated": "0"
}
}
},
{
"prefix": "0",
"key": "testapp-without-ida",
"val": {
"type": "lino/developer",
"value": {
"username": "testapp-without-ida",
"deposit": {
"amount": "0"
},
"app_consumption": "0",
"web_site": "",
"description": "",
"app_meta_data": "",
"is_deleted": false,
"n_affiliated": "0"
}
}
},
{
"prefix": "1",
"key": "testapp",
"val": {
"type": "lino/appida",
"value": {
"app": "testapp",
"name": "test-lemon",
"price": "10000",
"is_revoked": false,
"revoke_coin_price": "0"
}
}
},
{
"prefix": "1",
"key": "testapp-revoked-ida",
"val": {
"type": "lino/appida",
"value": {
"app": "testapp-revoked-ida",
"name": "test-lemon",
"price": "10000",
"is_revoked": true,
"revoke_coin_price": "0"
}
}
},
{
"prefix": "1",
"key": "testapp-unauthed-bank",
"val": {
"type": "lino/appida",
"value": {
"app": "testapp-unauthed-bank",
"name": "test-lemon",
"price": "10000",
"is_revoked": false,
"revoke_coin_price": "0"
}
}
},
{
"prefix": "2",
"key": "testapp-unauthed-bank/testapp-unauthed-bank",
"val": {
"type": "lino/bank",
"value": {
"b": "10000",
"unauthed": true
}
}
},
{
"prefix": "2",
"key": "testapp/testapp",
"val": {
"type": "lino/bank",
"value": {
"b": "10000"
}
}
},
{
"prefix": "3",
"key": "",
"val": {
"type": "lino/reservepool",
"value": {
"total": {
"amount": "0"
},
"total_minidollar": "0"
}
}
}
]
Loading

0 comments on commit 1cf8ec4

Please sign in to comment.