Skip to content

Commit 8dce3d3

Browse files
committed
feat(stake): add api
1 parent cf5df08 commit 8dce3d3

3 files changed

Lines changed: 23 additions & 2 deletions

File tree

api/api.proto

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ service Wallet {
4242
};
4343

4444
rpc GetAccountBalance (AccountBalanceRequest) returns (AccountBalanceResponse) {
45-
option (google.api.http) = {
45+
option (google.api.http) = {
4646
post: "/wallet/getaccountbalance"
4747
body: "*"
4848
additional_bindings {
@@ -480,6 +480,9 @@ service Wallet {
480480
rpc TriggerConstantContract (TriggerSmartContract) returns (TransactionExtention) {
481481
}
482482

483+
rpc EstimateEnergy (TriggerSmartContract) returns (EstimateEnergyMessage) {
484+
}
485+
483486
rpc ClearContractABI (ClearABIContract) returns (TransactionExtention) {
484487
}
485488

@@ -1009,6 +1012,9 @@ service WalletSolidity {
10091012
rpc TriggerConstantContract (TriggerSmartContract) returns (TransactionExtention) {
10101013
}
10111014

1015+
rpc EstimateEnergy (TriggerSmartContract) returns (EstimateEnergyMessage) {
1016+
}
1017+
10121018
rpc GetTransactionInfoByBlockNum (NumberMessage) returns (TransactionInfoList) {
10131019
}
10141020

@@ -1310,6 +1316,12 @@ message TransactionExtention {
13101316
int64 energy_used = 5;
13111317
repeated TransactionInfo.Log logs = 6;
13121318
repeated InternalTransaction internal_transactions = 7;
1319+
int64 energy_penalty = 8;
1320+
}
1321+
1322+
message EstimateEnergyMessage {
1323+
Return result = 1;
1324+
int64 energy_required = 2;
13131325
}
13141326

13151327
message BlockExtention {

core/Tron.proto

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ message ResourceReceipt {
321321
int64 net_usage = 5;
322322
int64 net_fee = 6;
323323
Transaction.Result.contractResult result = 7;
324+
int64 energy_penalty_total = 8;
324325
}
325326

326327
message MarketOrderDetail {
@@ -580,7 +581,7 @@ enum ReasonCode {
580581
TOO_MANY_PEERS = 0x04;
581582
DUPLICATE_PEER = 0x05;
582583
INCOMPATIBLE_PROTOCOL = 0x06;
583-
NULL_IDENTITY = 0x07;
584+
RANDOM_ELIMINATION = 0x07;
584585
PEER_QUITING = 0x08;
585586
UNEXPECTED_IDENTITY = 0x09;
586587
LOCAL_IDENTITY = 0x0A;

core/contract/smart_contract.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ message SmartContract {
5555
int64 origin_energy_limit = 8;
5656
bytes code_hash = 9;
5757
bytes trx_hash = 10;
58+
int32 version = 11;
59+
}
60+
61+
message ContractState {
62+
int64 energy_usage = 1;
63+
int64 energy_factor = 2;
64+
int64 update_cycle = 3;
5865
}
5966

6067
message CreateSmartContract {
@@ -93,4 +100,5 @@ message UpdateEnergyLimitContract {
93100
message SmartContractDataWrapper {
94101
SmartContract smart_contract = 1;
95102
bytes runtimecode = 2;
103+
ContractState contract_state = 3;
96104
}

0 commit comments

Comments
 (0)