Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix the compatibility issues with daphne #539

Merged
merged 59 commits into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
96a1565
feat: define proto for x/token
0Tech May 11, 2022
c507c68
feat: update proto
0Tech May 12, 2022
3faf2d8
feat: add event type enum
0Tech May 13, 2022
f4e3288
feat: add spent and received event
0Tech May 13, 2022
8d5756f
style: lint
0Tech May 13, 2022
4a94769
refactor: rename file
0Tech May 13, 2022
72fd050
refactor: refactor send
0Tech May 13, 2022
b876ea5
refactor: update msgs.go
0Tech May 13, 2022
ba83354
refactor: update codec
0Tech May 13, 2022
454d457
refactor: update genesis
0Tech May 13, 2022
6f804a6
refactor: update keys
0Tech May 13, 2022
ee7db39
refactor: update genesis and query proto
0Tech May 16, 2022
1b62757
refactor: update types
0Tech May 16, 2022
32a15bf
refactor: update genesis and grant
0Tech May 18, 2022
acb3e35
refactor: update servers
0Tech May 19, 2022
222c8b5
feat: add low level events to ease the tracking
0Tech May 19, 2022
2e6a63c
refactor: emit legacy events
0Tech May 19, 2022
13983f2
refactor: update logics
0Tech May 19, 2022
07325be
style: lint
0Tech May 19, 2022
30ec20f
fix: update test and fix bugs
0Tech May 23, 2022
41ca630
test: increase coverage of msgs.go
0Tech May 23, 2022
4b1013f
test: increase coverage of supply.go
0Tech May 23, 2022
b2f0f81
Merge branch 'main' into token
0Tech May 24, 2022
b89e01c
style: lint
0Tech May 24, 2022
7196e3b
test: increase coverage of genesis.go
0Tech May 26, 2022
e16264b
test: increase coverage of the servers
0Tech May 26, 2022
96cc2b1
chore: use shorter variation
0Tech May 27, 2022
a745f21
fix: create account on mint, burn and send (daphne compat)
0Tech May 27, 2022
d990be0
feat: add operator field to EventModified
0Tech May 27, 2022
8fce084
fix: make queries for statistics to return errors on not found
0Tech May 30, 2022
e89c1a8
docs: update CHANGELOG.md
0Tech May 30, 2022
2305550
fix: make key prefixes to start from 0x00
0Tech May 30, 2022
ba1d240
docs: update comments in tx.proto
0Tech May 31, 2022
a3fa4d5
docs: update comments in event.proto
0Tech May 31, 2022
3886ceb
docs: update comments in query.proto
0Tech May 31, 2022
ec18289
docs: update comments on genesis.proto
0Tech May 31, 2022
80fa6a6
refactor: add new apis and deprecate the old ones
0Tech Jun 2, 2022
fc85d6f
Merge branch 'main' into token
0Tech Jun 2, 2022
6da81ea
chore: replace class with contract
0Tech Jun 2, 2022
4d8b6d6
refactor: add new queries and deprecate the old ones
0Tech Jun 2, 2022
809e91f
fix: set fields of the queries as not nullable
0Tech Jun 13, 2022
8490e2b
fix: remove event_received and event_spent
0Tech Jun 14, 2022
b3df5a1
refactor: panic if it's not the user's fault
0Tech Jun 14, 2022
7d4dac6
docs: update documentation on tx
0Tech Jun 14, 2022
acf5997
docs: update documentation on event
0Tech Jun 14, 2022
67bd785
test: fix errors on tests
0Tech Jun 15, 2022
bcbf3f1
fix: set granter address of the event empty on issuance.
0Tech Jun 15, 2022
a1f30ee
docs: update comments on ERC777 related specs
0Tech Jun 15, 2022
fd6c1a7
docs: update event proto document format
0Tech Jun 15, 2022
80f0a3e
Merge branch 'main' into token
0Tech Jun 17, 2022
547eec5
docs: add a comment about empty granter address in the event
0Tech Jun 17, 2022
51c9b4e
docs: update comments in proto
0Tech Jun 21, 2022
630e374
fix: emit client-friendly errors on the queries
0Tech Jun 21, 2022
afea9a6
feat: return the id of the created token class
0Tech Jun 24, 2022
cb305ba
chore: rename files
0Tech Jun 29, 2022
abea98c
docs: fix comment
0Tech Jun 30, 2022
07def03
refactor: introduce ValidateContractID()
0Tech Jun 30, 2022
cc76ba5
Update x/token/keeper/send.go
0Tech Jun 30, 2022
1fb1c07
lint: lint test files
0Tech Jun 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

868 changes: 558 additions & 310 deletions client/docs/swagger-ui/swagger.yaml

Large diffs are not rendered by default.

781 changes: 508 additions & 273 deletions docs/core/proto-docs.md

Large diffs are not rendered by default.

181 changes: 130 additions & 51 deletions proto/lbm/token/v1/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,75 +3,154 @@ package lbm.token.v1;

import "gogoproto/gogo.proto";

import "lbm/token/v1/token.proto";

option go_package = "github.com/line/lbm-sdk/x/token";

// EventTransfer is emitted on Msg/Transfer and Msg/TransferFrom
message EventTransfer {
// class id associated with the token.
string class_id = 1;
string from = 2;
string to = 3;
string amount = 4 [(gogoproto.customtype) = "github.com/line/lbm-sdk/types.Int", (gogoproto.nullable) = false];
// EventType enumerates the valid event types on x/token.
// For the legacy events.
enum EventType {
unspecified = 0 [(gogoproto.enumvalue_customname) = "Unspecified"];
issue = 1 [(gogoproto.enumvalue_customname) = "IssueToken"];
mint = 2 [(gogoproto.enumvalue_customname) = "MintToken"];
burn = 3 [(gogoproto.enumvalue_customname) = "BurnToken"];
burn_from = 4 [(gogoproto.enumvalue_customname) = "BurnTokenFrom"];
modify_token = 5 [(gogoproto.enumvalue_customname) = "ModifyToken"];
transfer = 6 [(gogoproto.enumvalue_customname) = "Transfer"];
transfer_from = 7 [(gogoproto.enumvalue_customname) = "TransferFrom"];
grant_perm = 8 [(gogoproto.enumvalue_customname) = "GrantPermToken"];
revoke_perm = 9 [(gogoproto.enumvalue_customname) = "RevokePermToken"];
approve_token = 10 [(gogoproto.enumvalue_customname) = "ApproveToken"];
}

// EventApprove is emitted on Msg/Approve
message EventApprove {
// class id associated with the token.
string class_id = 1;
string approver = 2;
string proxy = 3;
// AttributeKey enumerates the valid attribute keys on x/token.
// For the legacy events.
enum AttributeKey {
unspecified = 0 [(gogoproto.enumvalue_customname) = "Unspecified"];
name = 1 [(gogoproto.enumvalue_customname) = "Name"];
symbol = 2 [(gogoproto.enumvalue_customname) = "Symbol"];
meta = 3 [(gogoproto.enumvalue_customname) = "Meta"];
contract_id = 4 [(gogoproto.enumvalue_customname) = "ContractID"];
owner = 5 [(gogoproto.enumvalue_customname) = "Owner"];
amount = 6 [(gogoproto.enumvalue_customname) = "Amount"];
decimals = 7 [(gogoproto.enumvalue_customname) = "Decimals"];
img_uri = 8 [(gogoproto.enumvalue_customname) = "ImageURI"];
mintable = 9 [(gogoproto.enumvalue_customname) = "Mintable"];
from = 10 [(gogoproto.enumvalue_customname) = "From"];
to = 11 [(gogoproto.enumvalue_customname) = "To"];
perm = 12 [(gogoproto.enumvalue_customname) = "Perm"];
approver = 13 [(gogoproto.enumvalue_customname) = "Approver"];
proxy = 14 [(gogoproto.enumvalue_customname) = "Proxy"];
}

// EventIssue is emitted on Msg/Issue
message EventIssue {
// class id associated with the token.
string class_id = 1;
// EventSent is emitted on Msg/Send and Msg/OperatorSend.
// Since: finschia
message EventSent {
// contract id associated with the token class.
string contract_id = 1;
// address of the operator.
string operator = 2;
string from = 3;
string to = 4;
string amount = 5 [(gogoproto.customtype) = "github.com/line/lbm-sdk/types.Int", (gogoproto.nullable) = false];
}

// EventGrant is emitted on Msg/Grant
message EventGrant {
// class id associated with the token.
string class_id = 1;
// EventAuthorizedOperator is emitted on Msg/AuthorizeOperator.
// Since: finschia
message EventAuthorizedOperator {
// contract id associated with the token class.
string contract_id = 1;
// address of the token holder of the authorization.
string holder = 2;
// address of the operator which the authorization is granted to.
string operator = 3;
}

// address of the granted account.
string grantee = 2;
// EventRevokedOperator is emitted on Msg/RevokeOperator.
// Since: finschia
message EventRevokedOperator {
// contract id associated with the token class.
string contract_id = 1;
// address of the token holder of the authorization.
string holder = 2;
// address of the operator which the authorization is granted to.
string operator = 3;
}

// action on the token class. Must be one of "mint", "burn" and "modify".
string action = 3;
// EventIssue is emitted on Msg/Issue.
// Since: finschia
message EventIssue {
// contract id associated with the token class.
string contract_id = 1;
// name defines the human-readable name of the token class.
string name = 2;
// symbol is an abbreviated name for token class.
string symbol = 3;
// uri is an uri for the resource of the token class stored off chain.
string uri = 4;
// meta is a brief description of token class.
string meta = 5;
// decimals is the number of decimals which one must divide the amount by to get its user representation.
int32 decimals = 6;
// mintable represents whether the token is allowed to mint.
bool mintable = 7;
}

// EventRevoke is emitted on Msg/Revoke
message EventRevoke {
// class id associated with the token.
string class_id = 1;
// EventGrant is emitted on Msg/Grant.
// Since: finschia
message EventGrant {
0Tech marked this conversation as resolved.
Show resolved Hide resolved
// contract id associated with the token class.
string contract_id = 1;
// address of the granter.
string granter = 2;
// address of the grantee.
string grantee = 3;
// permission on the token class.
string permission = 4;
}

// address of the revoked account.
// EventAbandon is emitted on Msg/Abandon.
// Since: finschia
message EventAbandon {
// contract id associated with the token class.
string contract_id = 1;
// address of the grantee which abandons its grant.
string grantee = 2;

// action on the token class. Must be one of "mint", "burn" and "modify".
string action = 3;
// permission on the token class.
string permission = 3;
}

// EventMint is emitted on Msg/Mint
message EventMint {
// class id associated with the token.
string class_id = 1;
string to = 2;
string amount = 3 [(gogoproto.customtype) = "github.com/line/lbm-sdk/types.Int", (gogoproto.nullable) = false];
// EventMinted is emitted on Msg/Mint.
// Since: finschia
message EventMinted {
// contract id associated with the token class.
string contract_id = 1;
// the address of the operator.
string operator = 2;
// the address to send minted tokens to.
string to = 3;
// the amount of minted tokens.
string amount = 4 [(gogoproto.customtype) = "github.com/line/lbm-sdk/types.Int", (gogoproto.nullable) = false];
}

// EventBurn is emitted on Msg/Burn
message EventBurn {
// class id associated with the token.
string class_id = 1;
string from = 2;
string amount = 3 [(gogoproto.customtype) = "github.com/line/lbm-sdk/types.Int", (gogoproto.nullable) = false];
// EventBurned is emitted on Msg/Burn and Msg/OperatorBurn.
// Since: finschia
message EventBurned {
// contract id associated with the token class.
string contract_id = 1;
// address of the operator.
string operator = 2;
// address which the burnt tokens were from.
string from = 3;
// the amount of burnt token.
string amount = 4 [(gogoproto.customtype) = "github.com/line/lbm-sdk/types.Int", (gogoproto.nullable) = false];
}

// EventModify is emitted on Msg/Modify
message EventModify {
// class id associated with the token.
string class_id = 1;
string key = 2;
string value = 3;
// EventModified is emitted on Msg/Modify.
// Since: finschia
message EventModified {
// contract id associated with the token class.
string contract_id = 1;
// changes on the metadata of the class.
repeated Pair changes = 2 [(gogoproto.nullable) = false];
}
24 changes: 16 additions & 8 deletions proto/lbm/token/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ message GenesisState {
repeated Balance balances = 3 [(gogoproto.nullable) = false];

// classes defines the metadata of the differents tokens.
repeated Token classes = 4 [(gogoproto.nullable) = false];
repeated TokenClass classes = 4 [(gogoproto.nullable) = false];

// grants defines the grant information.
repeated Grant grants = 5 [(gogoproto.nullable) = false];

// approves defines the approve information.
repeated Approve approves = 6 [(gogoproto.nullable) = false];
// authorizations defines the approve information.
repeated Authorization authorizations = 6 [(gogoproto.nullable) = false];

// supplies represents the total supplies of tokens.
repeated FT supplies = 7 [(gogoproto.nullable) = false];
repeated Coin supplies = 7 [(gogoproto.nullable) = false];

// mints represents the total mints of tokens.
repeated FT mints = 8 [(gogoproto.nullable) = false];
repeated Coin mints = 8 [(gogoproto.nullable) = false];

// burns represents the total burns of tokens.
repeated FT burns = 9 [(gogoproto.nullable) = false];
repeated Coin burns = 9 [(gogoproto.nullable) = false];
}

// ClassGenesisState defines the classs keeper's genesis state.
Expand All @@ -48,6 +48,14 @@ message ClassGenesisState {
// Balance defines an account address and balance pair used in the token module's
// genesis state.
message Balance {
string address = 1;
repeated lbm.token.v1.FT tokens = 2 [(gogoproto.nullable) = false];
string address = 1;
repeated Coin coins = 2 [(gogoproto.nullable) = false];
}

// Coin defines a token with a contract id and an amount.
message Coin {
option (gogoproto.equal) = true;

string contract_id = 1;
string amount = 2 [(gogoproto.customtype) = "github.com/line/lbm-sdk/types.Int", (gogoproto.nullable) = false];
}
Loading