Skip to content

Commit

Permalink
Added Eth and EVM proto files to @sei-js (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
codebycarson authored May 3, 2024
1 parent cc7841c commit 2acf2d2
Show file tree
Hide file tree
Showing 37 changed files with 5,641 additions and 267 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-singers-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sei-js/proto": patch
---

Added Eth and EVM proto files to @sei-js/proto
157 changes: 157 additions & 0 deletions packages/proto/proto/eth/tx.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
syntax = "proto3";
package seiprotocol.seichain.eth;

import "gogoproto/gogo.proto";

option go_package = "github.com/sei-protocol/sei-chain/x/evm/types/ethtx";

// Source: https://github.com/evmos/evmos/blob/main/proto/ethermint/evm/v1/tx.proto

message AccessTuple {
option (gogoproto.goproto_getters) = false;

string address = 1;
repeated string storage_keys = 2 [
(gogoproto.jsontag) = "storageKeys"
];
}

message AssociateTx {
option (gogoproto.goproto_getters) = false;
// signature values
bytes v = 1;
bytes r = 2;
bytes s = 3;
string custom_message = 4;
}

message LegacyTx {
option (gogoproto.goproto_getters) = false;

uint64 nonce = 1;
string gas_price = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"
];
uint64 gas_limit = 3;
string to = 4;
string value = 5 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.customname) = "Amount"
];
bytes data = 6;
// signature values
bytes v = 7;
bytes r = 8;
bytes s = 9;
}

message AccessListTx {
option (gogoproto.goproto_getters) = false;

string chain_id = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.customname) = "ChainID",
(gogoproto.jsontag) = "chainID"
];
uint64 nonce = 2;
string gas_price = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"
];
uint64 gas_limit = 4;
string to = 5;
string value = 6 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.customname) = "Amount"
];
bytes data = 7;
repeated AccessTuple accesses = 8 [
(gogoproto.castrepeated) = "AccessList",
(gogoproto.jsontag) = "accessList",
(gogoproto.nullable) = false
];
// signature values
bytes v = 9;
bytes r = 10;
bytes s = 11;
}

message DynamicFeeTx {
option (gogoproto.goproto_getters) = false;

string chain_id = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.customname) = "ChainID",
(gogoproto.jsontag) = "chainID"
];
uint64 nonce = 2;
string gas_tip_cap = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"
];
string gas_fee_cap = 4 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"
];
uint64 gas_limit = 5;
string to = 6;
string value = 7 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.customname) = "Amount"
];
bytes data = 8;
repeated AccessTuple accesses = 9 [
(gogoproto.castrepeated) = "AccessList",
(gogoproto.jsontag) = "accessList",
(gogoproto.nullable) = false
];
// signature values
bytes v = 10;
bytes r = 11;
bytes s = 12;
}

message BlobTx {
option (gogoproto.goproto_getters) = false;

string chain_id = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.customname) = "ChainID",
(gogoproto.jsontag) = "chainID"
];
uint64 nonce = 2;
string gas_tip_cap = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"
];
string gas_fee_cap = 4 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"
];
uint64 gas_limit = 5;
string to = 6;
string value = 7 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.customname) = "Amount"
];
bytes data = 8;
repeated AccessTuple accesses = 9 [
(gogoproto.castrepeated) = "AccessList",
(gogoproto.jsontag) = "accessList",
(gogoproto.nullable) = false
];
string blob_fee_cap = 10 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"
];
repeated bytes blob_hashes = 11;
BlobTxSidecar sidecar = 12;
// signature values
bytes v = 13;
bytes r = 14;
bytes s = 15;
}

message BlobTxSidecar {
repeated bytes blobs = 1;
repeated bytes commitments = 2;
repeated bytes proofs = 3;
}

message ExtensionOptionsEthereumTx {
option (gogoproto.goproto_getters) = false;
}
25 changes: 25 additions & 0 deletions packages/proto/proto/evm/config.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
syntax = "proto3";
package seiprotocol.seichain.evm;

import "gogoproto/gogo.proto";

option go_package = "github.com/sei-protocol/sei-chain/x/evm/types";

/*
*
XXTime fields indicate upgrade timestamps. For example, a ShanghaiTime
of 42198537129 means the chain upgraded to the Shanghai version at timestamp 42198537129.
A value of 0 means the upgrade is included in the genesis of the EVM on Sei.
-1 means upgrade not reached yet.
*/
message ChainConfig {
int64 cancun_time = 1 [
(gogoproto.moretags) = "yaml:\"cancun_time\""
];
int64 prague_time = 2 [
(gogoproto.moretags) = "yaml:\"prague_time\""
];
int64 verkle_time = 3 [
(gogoproto.moretags) = "yaml:\"verkle_time\""
];
}
12 changes: 12 additions & 0 deletions packages/proto/proto/evm/enums.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
syntax = "proto3";
package seiprotocol.seichain.evm;

option go_package = "github.com/sei-protocol/sei-chain/x/evm/types";

enum PointerType {
ERC20 = 0;
ERC721 = 1;
NATIVE = 2;
CW20 = 3;
CW721 = 4;
}
19 changes: 19 additions & 0 deletions packages/proto/proto/evm/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
syntax = "proto3";
package seiprotocol.seichain.evm;

import "gogoproto/gogo.proto";
import "evm/params.proto";

option go_package = "github.com/sei-protocol/sei-chain/x/evm/types";

// AddressAssociation represents an association between a Cosmos and an Ethereum address.
message AddressAssociation {
string sei_address = 1; // Sei address
string eth_address = 2; // Ethereum address
}

// GenesisState defines the evm module's genesis state.
message GenesisState {
Params params = 1 [(gogoproto.nullable) = false];
repeated AddressAssociation address_associations = 2; // List of address associations
}
42 changes: 42 additions & 0 deletions packages/proto/proto/evm/gov.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
syntax = "proto3";
package seiprotocol.seichain.evm;

import "gogoproto/gogo.proto";

option go_package = "github.com/sei-protocol/sei-chain/x/evm/types";

message AddERCNativePointerProposal {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;

string title = 1 [ (gogoproto.moretags) = "yaml:\"title\"" ];
string description = 2 [ (gogoproto.moretags) = "yaml:\"description\"" ];
string token = 3 [(gogoproto.moretags) = "yaml:\"token\""];
string pointer = 4 [(gogoproto.moretags) = "yaml:\"pointer\""];
uint32 version = 5 [(gogoproto.moretags) = "yaml:\"version\""];
}

message AddERCCW20PointerProposal {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;

string title = 1 [ (gogoproto.moretags) = "yaml:\"title\"" ];
string description = 2 [ (gogoproto.moretags) = "yaml:\"description\"" ];
string pointee = 3 [(gogoproto.moretags) = "yaml:\"pointee\""];
string pointer = 4 [(gogoproto.moretags) = "yaml:\"pointer\""];
uint32 version = 5 [(gogoproto.moretags) = "yaml:\"version\""];
}

message AddERCCW721PointerProposal {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;

string title = 1 [ (gogoproto.moretags) = "yaml:\"title\"" ];
string description = 2 [ (gogoproto.moretags) = "yaml:\"description\"" ];
string pointee = 3 [(gogoproto.moretags) = "yaml:\"pointee\""];
string pointer = 4 [(gogoproto.moretags) = "yaml:\"pointer\""];
uint32 version = 5 [(gogoproto.moretags) = "yaml:\"version\""];
}
50 changes: 50 additions & 0 deletions packages/proto/proto/evm/params.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
syntax = "proto3";
package seiprotocol.seichain.evm;

import "gogoproto/gogo.proto";
import "evm/config.proto";

option go_package = "github.com/sei-protocol/sei-chain/x/evm/types";

// Params defines the parameters for the module.
message Params {
option (gogoproto.goproto_stringer) = false;

// string base_denom = 1 [
// (gogoproto.moretags) = "yaml:\"base_denom\"",
// (gogoproto.jsontag) = "base_denom"
// ];
string priority_normalizer = 2 [
(gogoproto.moretags) = "yaml:\"priority_normalizer\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "priority_normalizer"
];
string base_fee_per_gas = 3 [
(gogoproto.moretags) = "yaml:\"base_fee_per_gas\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "base_fee_per_gas"
];
string minimum_fee_per_gas = 4 [
(gogoproto.moretags) = "yaml:\"minimum_fee_per_gas\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "minimum_fee_per_gas"
];
// ChainConfig chain_config = 5 [(gogoproto.moretags) = "yaml:\"chain_config\"", (gogoproto.nullable) = false];
// string chain_id = 6 [
// (gogoproto.moretags) = "yaml:\"chain_id\"",
// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
// (gogoproto.nullable) = false,
// (gogoproto.jsontag) = "chain_id"
// ];
// repeated string whitelisted_codehashes_bank_send = 7 [
// (gogoproto.moretags) = "yaml:\"whitelisted_codehashes_bank_send\"",
// (gogoproto.jsontag) = "whitelisted_codehashes_bank_send"
// ];
repeated bytes whitelisted_cw_code_hashes_for_delegate_call = 8 [
(gogoproto.moretags) = "yaml:\"whitelisted_cw_code_hashes_for_delegate_call\"",
(gogoproto.jsontag) = "whitelisted_cw_code_hashes_for_delegate_call"
];
}
64 changes: 64 additions & 0 deletions packages/proto/proto/evm/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
syntax = "proto3";
package seiprotocol.seichain.evm;

import "google/api/annotations.proto";
import "evm/enums.proto";

option go_package = "github.com/sei-protocol/sei-chain/x/evm/types";

// Query defines the gRPC querier service.
service Query {
rpc SeiAddressByEVMAddress(QuerySeiAddressByEVMAddressRequest) returns (QuerySeiAddressByEVMAddressResponse) {
option (google.api.http).get = "/sei-protocol/seichain/evm/sei_address";
}

rpc EVMAddressBySeiAddress(QueryEVMAddressBySeiAddressRequest) returns (QueryEVMAddressBySeiAddressResponse) {
option (google.api.http).get = "/sei-protocol/seichain/evm/evm_address";
}

rpc StaticCall(QueryStaticCallRequest) returns (QueryStaticCallResponse) {
option (google.api.http).get = "/sei-protocol/seichain/evm/static_call";
}

rpc Pointer(QueryPointerRequest) returns (QueryPointerResponse) {
option (google.api.http).get = "/sei-protocol/seichain/evm/pointer";
}
}

message QuerySeiAddressByEVMAddressRequest {
string evm_address = 1;
}

message QuerySeiAddressByEVMAddressResponse {
string sei_address = 1;
bool associated = 2;
}

message QueryEVMAddressBySeiAddressRequest {
string sei_address = 1;
}

message QueryEVMAddressBySeiAddressResponse {
string evm_address = 1;
bool associated = 2;
}

message QueryStaticCallRequest {
bytes data = 1;
string to = 2;
}

message QueryStaticCallResponse {
bytes data = 1;
}

message QueryPointerRequest {
PointerType pointer_type = 1;
string pointee = 2;
}

message QueryPointerResponse {
string pointer = 1;
uint32 version = 2;
bool exists = 3;
}
Loading

0 comments on commit 2acf2d2

Please sign in to comment.