-
Notifications
You must be signed in to change notification settings - Fork 259
Expand file tree
/
Copy pathtoken_contract_impl.proto
More file actions
463 lines (384 loc) · 14.8 KB
/
Copy pathtoken_contract_impl.proto
File metadata and controls
463 lines (384 loc) · 14.8 KB
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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
/**
* MultiToken contract.
*
* The MultiToken contract is mainly used to manage the user's account and transaction fees related Settings.
*
* Implement AElf Standards ACS1 and ACS2.
*/
syntax = "proto3";
package tokenimpl;
import "aelf/core.proto";
import "acs1.proto";
import "acs2.proto";
import "token_contract.proto";
// Because implementation uses this proto file.
import "transaction_fee.proto";
import "authority_info.proto";
option csharp_namespace = "AElf.Contracts.MultiToken";
service TokenContractImpl {
option (aelf.csharp_state) = "AElf.Contracts.MultiToken.TokenContractState";
option (aelf.base) = "acs1.proto";
option (aelf.base) = "acs2.proto";
option (aelf.base) = "token_contract.proto";
// Transfer resource tokens to designated contract address.
rpc AdvanceResourceToken (AdvanceResourceTokenInput) returns (google.protobuf.Empty) {
}
// Take token from contract address.
rpc TakeResourceTokenBack (TakeResourceTokenBackInput) returns (google.protobuf.Empty) {
}
// Register the token contract address for cross chain.
rpc RegisterCrossChainTokenContractAddress (RegisterCrossChainTokenContractAddressInput) returns (google.protobuf.Empty) {
}
// Set the receiver address of the side chain transaction fee.
rpc SetFeeReceiver (aelf.Address) returns (google.protobuf.Empty) {
}
// Validates if the token exist.
rpc ValidateTokenInfoExists(ValidateTokenInfoExistsInput) returns (google.protobuf.Empty){
}
// Update the rental unit price of the side chain.
rpc UpdateRental (UpdateRentalInput) returns (google.protobuf.Empty) {
}
// Set the amount of resources fee per minute for the side chain.
rpc UpdateRentedResources (UpdateRentedResourcesInput) returns (google.protobuf.Empty) {
}
// Transfer Token to the specified contract.
rpc TransferToContract (TransferToContractInput) returns (google.protobuf.Empty) {
}
// Change the governance organization of side chain rental.
rpc ChangeSideChainRentalController (AuthorityInfo) returns (google.protobuf.Empty) {
}
// Change the governance organization for tokens to pay transaction fees.
rpc ChangeSymbolsToPayTXSizeFeeController(AuthorityInfo) returns (google.protobuf.Empty){
}
// Change the governance organization for cross-chain token contract address registration.
rpc ChangeCrossChainTokenContractRegistrationController (AuthorityInfo) returns (google.protobuf.Empty) {
}
// Change the governance organization of the coefficient of the user transaction fee calculation formula.
rpc ChangeUserFeeController (AuthorityInfo) returns (google.protobuf.Empty) {
}
// Change the governance organization of the coefficient of the developer's transaction resource fee calculation formula.
rpc ChangeDeveloperController (AuthorityInfo) returns (google.protobuf.Empty) {
}
rpc ConfigTransactionFeeFreeAllowances (ConfigTransactionFeeFreeAllowancesInput) returns (google.protobuf.Empty) {
}
rpc RemoveTransactionFeeFreeAllowancesConfig (RemoveTransactionFeeFreeAllowancesConfigInput) returns (google.protobuf.Empty) {
}
rpc SetMaxBatchApproveCount (google.protobuf.Int32Value) returns (google.protobuf.Empty) {
}
// Delegatee sets the delegation and related information of the delegator based on a transaction.
rpc SetTransactionFeeDelegateInfos (SetTransactionFeeDelegateInfosInput) returns (google.protobuf.Empty){
}
// Delegatee remove delegator info based on a transaction.
rpc RemoveTransactionFeeDelegatorInfos (RemoveTransactionFeeDelegatorInfosInput) returns (google.protobuf.Empty){
}
// Delegator remove delegatee info based on a transaction.
rpc RemoveTransactionFeeDelegateeInfos (RemoveTransactionFeeDelegateeInfosInput) returns (google.protobuf.Empty){
}
// Get the address of fee receiver.
rpc GetFeeReceiver (google.protobuf.Empty) returns (aelf.Address){
option (aelf.is_view) = true;
}
// Query the amount of resources usage currently.
rpc GetResourceUsage (google.protobuf.Empty) returns (ResourceUsage) {
option (aelf.is_view) = true;
}
// Query the governance organization for tokens to pay transaction fees.
rpc GetSymbolsToPayTXSizeFeeController(google.protobuf.Empty) returns (AuthorityInfo){
option (aelf.is_view) = true;
}
// Query the governance organization of the
rpc GetCrossChainTokenContractRegistrationController (google.protobuf.Empty) returns (AuthorityInfo) {
option (aelf.is_view) = true;
}
// Query the governance organization that calculates the formula coefficient
// for the transaction cost the user sends the contract.
rpc GetUserFeeController(google.protobuf.Empty) returns (UserFeeController){
option (aelf.is_view) = true;
}
// Query the governing organization of the formula coefficients for calculating developer contract transaction fee.
rpc GetDeveloperFeeController (google.protobuf.Empty) returns (DeveloperFeeController) {
option (aelf.is_view) = true;
}
// Query the organization that governs the side chain rental fee.
rpc GetSideChainRentalControllerCreateInfo (google.protobuf.Empty) returns (AuthorityInfo) {
option (aelf.is_view) = true;
}
// Compute the virtual address for locking.
rpc GetVirtualAddressForLocking (GetVirtualAddressForLockingInput) returns (aelf.Address) {
option (aelf.is_view) = true;
}
// Query how much resource tokens should be paid currently.
rpc GetOwningRental (google.protobuf.Empty) returns (OwningRental) {
option (aelf.is_view) = true;
}
// Query the unit price of the side chain resource cost, resource cost = unit price * quantity,
// the quantity can be queried through GetResourceUsage.
rpc GetOwningRentalUnitValue (google.protobuf.Empty) returns (OwningRentalUnitValue) {
option (aelf.is_view) = true;
}
// Query
rpc GetTransactionFeeFreeAllowances (aelf.Address) returns (TransactionFeeFreeAllowancesMap) {
option (aelf.is_view) = true;
}
rpc GetTransactionFeeFreeAllowancesConfig (google.protobuf.Empty) returns (GetTransactionFeeFreeAllowancesConfigOutput) {
option (aelf.is_view) = true;
}
// Get delegatee info list according to the delegator and transaction.
rpc GetTransactionFeeDelegateeList (GetTransactionFeeDelegateeListInput) returns (GetTransactionFeeDelegateeListOutput) {
option (aelf.is_view) = true;
}
// Get delegation according to the delegator,transaction and delegatee.
rpc GetTransactionFeeDelegateInfo(GetTransactionFeeDelegateInfoInput) returns (token.TransactionFeeDelegations){
option (aelf.is_view) = true;
}
rpc ModifyTokenIssuerAndOwner(ModifyTokenIssuerAndOwnerInput) returns (google.protobuf.Empty) {
}
rpc SetTokenIssuerAndOwnerModificationEnabled(SetTokenIssuerAndOwnerModificationEnabledInput) returns (google.protobuf.Empty) {
}
rpc GetTokenIssuerAndOwnerModificationEnabled(google.protobuf.Empty) returns (google.protobuf.BoolValue) {
option (aelf.is_view) = true;
}
rpc GetMaxBatchApproveCount (google.protobuf.Empty) returns (google.protobuf.Int32Value) {
}
rpc ExtendSeedExpirationTime (ExtendSeedExpirationTimeInput) returns (google.protobuf.Empty) {
}
}
message AdvanceResourceTokenInput {
// The contract address to transfer.
aelf.Address contract_address = 1;
// The resource token symbol to transfer.
string resource_token_symbol = 2;
// The amount of resource token to transfer.
int64 amount = 3;
}
message TakeResourceTokenBackInput {
// The contract address to take back.
aelf.Address contract_address = 1;
// The resource token symbol to take back.
string resource_token_symbol = 2;
// The amount of resource token to take back.
int64 amount = 3;
}
message RegisterCrossChainTokenContractAddressInput{
// The source chain id.
int32 from_chain_id = 1;
// The parent chain height of the transaction.
int64 parent_chain_height = 2;
// The raw bytes of the transfer transaction.
bytes transaction_bytes = 3;
// The merkle path created from the transaction.
aelf.MerklePath merkle_path = 4;
// The token contract address.
aelf.Address token_contract_address = 5;
}
message ValidateTokenInfoExistsInput{
// The symbol of the token.
string symbol = 1;
// The full name of the token.
string token_name = 2;
// The total supply of the token.
int64 total_supply = 3;
// The precision of the token.
int32 decimals = 4;
// The address that has permission to issue the token.
aelf.Address issuer = 5;
// A flag indicating if this token is burnable.
bool is_burnable = 6;
// The chain id of the token.
int32 issue_chain_id = 7;
// The external information of the token.
map<string, string> external_info = 8;
// The address that owns the token.
aelf.Address owner = 9;
}
message UpdateRentalInput {
// The unit price of resource tokens, symbol -> unit price.
map<string, int64> rental = 1;
}
message UpdateRentedResourcesInput {
// Amount of resource tokens consumed per minute, symbol -> resource consumption.
map<string, int32> resource_amount = 1;
}
message ResourceUsage {
// The amount of resource tokens usage, symbol -> amount.
map<string, int32> value = 1;
}
message GetVirtualAddressForLockingInput {
// The address of the lock.
aelf.Address address = 1;
// The id of the lock.
aelf.Hash lock_id = 2;
}
message OwningRental {
// The amount of resource tokens owed, symbol -> amount.
map<string, int64> resource_amount = 1;
}
message OwningRentalUnitValue {
// Resource unit price, symbol -> unit price.
map<string, int64> resource_unit_value = 1;
}
message TransferToContractInput {
// The symbol of token.
string symbol = 1;
// The amount of token.
int64 amount = 2;
// The memo.
string memo = 3;
}
message UserFeeController{
// The association that governs the organization.
AuthorityInfo root_controller = 1;
// The parliament organization of members.
AuthorityInfo parliament_controller = 2;
// The referendum organization of members.
AuthorityInfo referendum_controller = 3;
}
message DeveloperFeeController {
// The association that governs the organization.
AuthorityInfo root_controller = 1;
// The parliament organization of members.
AuthorityInfo parliament_controller = 2;
// The developer organization of members.
AuthorityInfo developer_controller = 3;
}
enum SymbolType {
TOKEN = 0;
NFT = 1;
NFT_COLLECTION = 2;
}
message MethodFeeFreeAllowancesConfig {
MethodFeeFreeAllowances free_allowances = 1;
int64 refresh_seconds = 2;
int64 threshold = 3;
}
message MethodFeeFreeAllowances{
repeated MethodFeeFreeAllowance value = 1;
}
message MethodFeeFreeAllowance {
string symbol = 1;
int64 amount = 2;
}
message TransactionFeeFreeAllowances{
repeated TransactionFeeFreeAllowance value = 1;
}
message TransactionFeeFreeAllowance {
string symbol = 1;
int64 amount = 2;
}
message TransactionFeeFreeAllowancesSymbolList {
repeated string symbols = 1;
}
message ConfigTransactionFeeFreeAllowancesInput {
repeated ConfigTransactionFeeFreeAllowance value = 1;
}
message ConfigTransactionFeeFreeAllowance {
string symbol = 1;
TransactionFeeFreeAllowances transaction_fee_free_allowances = 2;
int64 refresh_seconds = 3;
int64 threshold = 4;
}
message RemoveTransactionFeeFreeAllowancesConfigInput {
repeated string symbols = 1;
}
message GetTransactionFeeFreeAllowancesConfigOutput {
repeated TransactionFeeFreeAllowanceConfig value = 1;
}
message TransactionFeeFreeAllowanceConfig {
string symbol = 1;
TransactionFeeFreeAllowanceMap free_allowances = 2;
int64 refresh_seconds = 3;
int64 threshold = 4;
}
message TransactionFeeFreeAllowanceMap {
map<string, TransactionFeeFreeAllowance> map = 1;
}
message TransactionFeeFreeAllowancesMap {
map<string, TransactionFeeFreeAllowanceMap> map = 1;
}
message SetTransactionFeeDelegateInfosInput{
// the delegator address
aelf.Address delegator_address = 1;
//delegate info list (support batch)
repeated DelegateInfo delegate_info_list = 2;
}
message DelegateInfo{
//symbol->amount
map<string, int64> delegations = 1;
aelf.Address contract_address = 2;
string method_name = 3;
//Whether to pay transaction fee continuously
bool isUnlimitedDelegate = 4;
}
message RemoveTransactionFeeDelegatorInfosInput{
// the delegator address
aelf.Address delegator_address = 1;
// delegate transaction info (support batch)
repeated DelegateTransaction delegate_transaction_list = 2;
}
message DelegateTransaction{
aelf.Address contract_address = 1;
string method_name = 2;
}
message DelegateTransactionList{
repeated DelegateTransaction value = 1;
}
message RemoveTransactionFeeDelegateeInfosInput {
// the delegatee address
aelf.Address delegatee_address = 1;
// delegate transaction info (support batch)
repeated DelegateTransaction delegate_transaction_list = 2;
}
message GetTransactionFeeDelegateInfoInput {
aelf.Address delegator_address = 1;
aelf.Address delegatee_address = 2;
aelf.Address contract_address = 3;
string method_name = 4;
}
message GetTransactionFeeDelegateeListInput {
aelf.Address delegator_address = 1;
aelf.Address contract_address = 2;
string method_name = 3;
}
message GetTransactionFeeDelegateeListOutput {
repeated aelf.Address delegatee_addresses = 1;
}
message TransactionFeeDelegateInfoAdded {
option (aelf.is_event) = true;
aelf.Address delegator = 1;
aelf.Address delegatee = 2;
aelf.Address caller = 3;
DelegateTransactionList delegate_transaction_list = 4;
}
message TransactionFeeDelegateInfoUpdated {
option (aelf.is_event) = true;
aelf.Address delegator = 1 ;
aelf.Address delegatee = 2 ;
aelf.Address caller = 3 ;
DelegateTransactionList delegate_transaction_list = 4;
}
message TransactionFeeDelegateInfoCancelled {
option (aelf.is_event) = true;
aelf.Address delegator = 1 ;
aelf.Address delegatee = 2 ;
aelf.Address caller = 3 ;
DelegateTransactionList delegate_transaction_list = 4;
}
message ModifyTokenIssuerAndOwnerInput {
string symbol = 1;
aelf.Address issuer = 2;
aelf.Address owner = 3;
}
message SetTokenIssuerAndOwnerModificationEnabledInput{
bool enabled = 1;
}
message ExtendSeedExpirationTimeInput {
string symbol = 1;
int64 expiration_time = 2;
}
message SeedExpirationTimeUpdated {
option (aelf.is_event) = true;
int32 chain_id = 1;
string symbol = 2;
int64 old_expiration_time = 3;
int64 new_expiration_time = 4;
}