-
Notifications
You must be signed in to change notification settings - Fork 193
/
tx.proto
270 lines (234 loc) · 11 KB
/
tx.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
// Copyright (c) 2023-2024 Nibi, Inc.
syntax = "proto3";
package eth.evm.v1;
import "cosmos/msg/v1/msg.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "eth/evm/v1/evm.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "google/protobuf/any.proto";
option go_package = "github.com/NibiruChain/nibiru/v2/x/evm";
// Msg defines the evm Msg service.
service Msg {
// EthereumTx defines a method submitting Ethereum transactions.
rpc EthereumTx(MsgEthereumTx) returns (MsgEthereumTxResponse) {
option (google.api.http).post = "/nibiru/evm/v1/ethereum_tx";
};
// UpdateParams defined a governance operation for updating the x/evm module
// parameters. The authority is hard-coded to the x/gov module account
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// CreateFunToken: Create a "FunToken" mapping. Either the ERC20 contract
// address can be given to create the mapping to a Bank Coin, or the
// denomination for a Bank Coin can be given to create the mapping to an ERC20.
rpc CreateFunToken(MsgCreateFunToken) returns (MsgCreateFunTokenResponse);
// ConvertCoinToEvm: Sends a coin with a valid "FunToken" mapping to the
// given recipient address ("to_eth_addr") in the corresponding ERC20
// representation.
rpc ConvertCoinToEvm(MsgConvertCoinToEvm) returns (MsgConvertCoinToEvmResponse);
}
// MsgEthereumTx encapsulates an Ethereum transaction as an SDK message.
message MsgEthereumTx {
option (gogoproto.goproto_getters) = false;
// data is inner transaction data of the Ethereum transaction
google.protobuf.Any data = 1;
// size is the encoded storage size of the transaction (DEPRECATED)
double size = 2 [(gogoproto.jsontag) = "-"];
// hash of the transaction in hex format
string hash = 3 [(gogoproto.moretags) = "rlp:\"-\""];
// from is the ethereum signer address in hex format. This address value is checked
// against the address derived from the signature (V, R, S) using the
// secp256k1 elliptic curve
string from = 4;
}
// LegacyTx is the transaction data of regular Ethereum transactions.
//
// Note that setting "evm.Params.AllowUnprotectedTxs" to false will cause all
// non-EIP155 signed transactions to fail, as they'll lack replay protection.
//
// LegacyTx is a custom implementation of "LegacyTx" from
// "github.com/ethereum/go-ethereum/core/types".
message LegacyTx {
option (gogoproto.goproto_getters) = false;
option (cosmos_proto.implements_interface) = "TxData";
// nonce corresponds to the account nonce (transaction sequence).
uint64 nonce = 1;
// gas_price defines the value for each gas unit
string gas_price = 2 [(gogoproto.customtype) = "cosmossdk.io/math.Int"];
// gas defines the gas limit defined for the transaction.
uint64 gas = 3 [(gogoproto.customname) = "GasLimit"];
// to is the hex formatted address of the recipient
string to = 4;
// value defines the unsigned integer value of the transaction amount.
string value = 5 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.customname) = "Amount"];
// data is the data payload bytes of the transaction.
bytes data = 6;
// v defines the recovery id as the "v" signature value from the elliptic curve
// digital signatute algorithm (ECDSA). It indicates which of two possible
// solutions should be used to reconstruct the public key from the signature.
// In Ethereum, "v" takes the value 27 or 28 for transactions that are not
// relay-protected.
bytes v = 7;
// r defines the x-coordinate of a point on the elliptic curve in the elliptic curve
// digital signatute algorithm (ECDSA). It's crucial in ensuring uniqueness of
// the signature.
bytes r = 8;
// s define the signature value derived from the private key, message hash, and
// the value of "r". It ensures that the signature is tied to both the message
// and the private key of the sender.
bytes s = 9;
}
// AccessListTx is the data of EIP-2930 access list transactions.
// It is a custom implementation of "AccessListTx" from
// "github.com/ethereum/go-ethereum/core/types".
message AccessListTx {
option (gogoproto.goproto_getters) = false;
option (cosmos_proto.implements_interface) = "TxData";
// chain_id of the destination EVM chain
string chain_id = 1 [
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.customname) = "ChainID",
(gogoproto.jsontag) = "chainID"
];
// nonce corresponds to the account nonce (transaction sequence).
uint64 nonce = 2;
// gas_price defines the value for each gas unit
string gas_price = 3 [(gogoproto.customtype) = "cosmossdk.io/math.Int"];
// gas defines the gas limit defined for the transaction.
uint64 gas = 4 [(gogoproto.customname) = "GasLimit"];
// to is the recipient address in hex format
string to = 5;
// value defines the unsigned integer value of the transaction amount.
string value = 6 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.customname) = "Amount"];
// data is the data payload bytes of the transaction.
bytes data = 7;
// accesses is an array of access tuples
repeated AccessTuple accesses = 8
[(gogoproto.castrepeated) = "AccessList", (gogoproto.jsontag) = "accessList", (gogoproto.nullable) = false];
// v defines the recovery id and "v" signature value from the elliptic curve
// digital signatute algorithm (ECDSA). It indicates which of two possible
// solutions should be used to reconstruct the public key from the signature.
// In Ethereum, "v" takes the value 27 or 28 for transactions that are not
// relay-protected.
bytes v = 9;
// r defines the x-coordinate of a point on the elliptic curve in the elliptic curve
// digital signatute algorithm (ECDSA). It's crucial in ensuring uniqueness of
// the signature.
bytes r = 10;
// s define the signature value derived from the private key, message hash, and
// the value of "r". It ensures that the signature is tied to both the message
// and the private key of the sender.
bytes s = 11;
}
// DynamicFeeTx is the data of EIP-1559 dynamic fee transactions. It is a custom
// implementation of "DynamicFeeTx" from
// "github.com/ethereum/go-ethereum/core/types".
message DynamicFeeTx {
option (gogoproto.goproto_getters) = false;
option (cosmos_proto.implements_interface) = "TxData";
// chain_id of the destination EVM chain
string chain_id = 1 [
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.customname) = "ChainID",
(gogoproto.jsontag) = "chainID"
];
// nonce corresponds to the account nonce (transaction sequence).
uint64 nonce = 2;
// gas_tip_cap defines the max value for the gas tip
string gas_tip_cap = 3 [(gogoproto.customtype) = "cosmossdk.io/math.Int"];
// gas_fee_cap defines the max value for the gas fee
string gas_fee_cap = 4 [(gogoproto.customtype) = "cosmossdk.io/math.Int"];
// gas defines the gas limit defined for the transaction.
uint64 gas = 5 [(gogoproto.customname) = "GasLimit"];
// to is the hex formatted address of the recipient
string to = 6;
// value defines the the transaction amount.
string value = 7 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.customname) = "Amount"];
// data is the data payload bytes of the transaction.
bytes data = 8;
// accesses is an array of access tuples
repeated AccessTuple accesses = 9
[(gogoproto.castrepeated) = "AccessList", (gogoproto.jsontag) = "accessList", (gogoproto.nullable) = false];
// v defines the recovery id and "v" signature value from the elliptic curve
// digital signatute algorithm (ECDSA). It indicates which of two possible
// solutions should be used to reconstruct the public key from the signature.
// In Ethereum, "v" takes the value 27 or 28 for transactions that are not
// relay-protected.
bytes v = 10;
// r defines the x-coordinate of a point on the elliptic curve in the elliptic curve
// digital signatute algorithm (ECDSA). It's crucial in ensuring uniqueness of
// the signature.
bytes r = 11;
// s define the signature value derived from the private key, message hash, and
// the value of "r". It ensures that the signature is tied to both the message
// and the private key of the sender.
bytes s = 12;
}
// ExtensionOptionsEthereumTx is an extension option for ethereum transactions
message ExtensionOptionsEthereumTx {
option (gogoproto.goproto_getters) = false;
}
// MsgEthereumTxResponse defines the Msg/EthereumTx response type.
message MsgEthereumTxResponse {
option (gogoproto.goproto_getters) = false;
// hash of the ethereum transaction in hex format. This hash differs from the
// Tendermint sha256 hash of the transaction bytes. See
// https://github.com/tendermint/tendermint/issues/6539 for reference
string hash = 1;
// logs contains the transaction hash and the proto-compatible ethereum
// logs.
repeated Log logs = 2;
// ret is the returned data from evm function (result or data supplied with revert
// opcode)
bytes ret = 3;
// vm_error is the error returned by vm execution
string vm_error = 4;
// gas_used specifies how much gas was consumed by the transaction
uint64 gas_used = 5;
}
// MsgUpdateParams defines a Msg for updating the x/evm module parameters.
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// params defines the x/evm parameters to update.
// NOTE: All parameters must be supplied.
eth.evm.v1.Params params = 2 [(gogoproto.nullable) = false];
}
// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {}
// MsgCreateFunToken: Arguments to create a "FunToken" mapping. Either the ERC20
// contract address can be given to create the mapping to a Bank Coin, or the
// denomination for a Bank Coin can be given to create the mapping to an ERC20.
message MsgCreateFunToken {
// Hexadecimal address of the ERC20 token to which the `FunToken` maps
string from_erc20 = 1 [
(gogoproto.customtype) = "github.com/NibiruChain/nibiru/v2/eth.EIP55Addr",
(gogoproto.nullable) = true
];
// Coin denomination in the Bank Module.
string from_bank_denom = 2;
// Sender: Address for the signer of the transaction.
string sender = 3;
}
message MsgCreateFunTokenResponse {
// Fungible token mapping corresponding to ERC20 tokens.
eth.evm.v1.FunToken funtoken_mapping = 1 [(gogoproto.nullable) = false];
}
// MsgConvertCoinToEvm: Arguments to send a Bank Coin to ERC-20 representation
message MsgConvertCoinToEvm {
// Hexadecimal address of the ERC20 token to which the `FunToken` maps
string to_eth_addr = 1 [
(gogoproto.customtype) = "github.com/NibiruChain/nibiru/v2/eth.EIP55Addr",
(gogoproto.nullable) = false
];
// Sender: Address for the signer of the transaction.
string sender = 2;
// Bank Coin to get converted to ERC20
cosmos.base.v1beta1.Coin bank_coin = 3 [
(gogoproto.moretags) = "yaml:\"bank_coin\"",
(gogoproto.nullable) = false
];
}
message MsgConvertCoinToEvmResponse {}