Skip to content

Commit

Permalink
Merge pull request #214 from forfreeday/feature/update_stake
Browse files Browse the repository at this point in the history
feat(stake): add api
  • Loading branch information
forfreeday authored Jan 11, 2023
2 parents cf5df08 + 8dce3d3 commit 2ed8f8c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
14 changes: 13 additions & 1 deletion api/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ service Wallet {
};

rpc GetAccountBalance (AccountBalanceRequest) returns (AccountBalanceResponse) {
option (google.api.http) = {
option (google.api.http) = {
post: "/wallet/getaccountbalance"
body: "*"
additional_bindings {
Expand Down Expand Up @@ -480,6 +480,9 @@ service Wallet {
rpc TriggerConstantContract (TriggerSmartContract) returns (TransactionExtention) {
}

rpc EstimateEnergy (TriggerSmartContract) returns (EstimateEnergyMessage) {
}

rpc ClearContractABI (ClearABIContract) returns (TransactionExtention) {
}

Expand Down Expand Up @@ -1009,6 +1012,9 @@ service WalletSolidity {
rpc TriggerConstantContract (TriggerSmartContract) returns (TransactionExtention) {
}

rpc EstimateEnergy (TriggerSmartContract) returns (EstimateEnergyMessage) {
}

rpc GetTransactionInfoByBlockNum (NumberMessage) returns (TransactionInfoList) {
}

Expand Down Expand Up @@ -1310,6 +1316,12 @@ message TransactionExtention {
int64 energy_used = 5;
repeated TransactionInfo.Log logs = 6;
repeated InternalTransaction internal_transactions = 7;
int64 energy_penalty = 8;
}

message EstimateEnergyMessage {
Return result = 1;
int64 energy_required = 2;
}

message BlockExtention {
Expand Down
3 changes: 2 additions & 1 deletion core/Tron.proto
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ message ResourceReceipt {
int64 net_usage = 5;
int64 net_fee = 6;
Transaction.Result.contractResult result = 7;
int64 energy_penalty_total = 8;
}

message MarketOrderDetail {
Expand Down Expand Up @@ -580,7 +581,7 @@ enum ReasonCode {
TOO_MANY_PEERS = 0x04;
DUPLICATE_PEER = 0x05;
INCOMPATIBLE_PROTOCOL = 0x06;
NULL_IDENTITY = 0x07;
RANDOM_ELIMINATION = 0x07;
PEER_QUITING = 0x08;
UNEXPECTED_IDENTITY = 0x09;
LOCAL_IDENTITY = 0x0A;
Expand Down
8 changes: 8 additions & 0 deletions core/contract/smart_contract.proto
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ message SmartContract {
int64 origin_energy_limit = 8;
bytes code_hash = 9;
bytes trx_hash = 10;
int32 version = 11;
}

message ContractState {
int64 energy_usage = 1;
int64 energy_factor = 2;
int64 update_cycle = 3;
}

message CreateSmartContract {
Expand Down Expand Up @@ -93,4 +100,5 @@ message UpdateEnergyLimitContract {
message SmartContractDataWrapper {
SmartContract smart_contract = 1;
bytes runtimecode = 2;
ContractState contract_state = 3;
}

0 comments on commit 2ed8f8c

Please sign in to comment.