Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance schedule creation #95

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>com.hedera.hashgraph</groupId>
<artifactId>hedera-protobuf-java-api</artifactId>
<packaging>jar</packaging>
<version>0.19.0-SNAPSHOT</version>
<version>0.19.0-alpha.2</version>

<name>hedera-protobuf-java-api</name>
<description>Hedera Protobuf Java API</description>
Expand All @@ -30,7 +30,7 @@
<connection>scm:git:[email protected]:hashgraph/hedera-protobuf.git</connection>
<developerConnection>scm:git:[email protected]:hashgraph/hedera-protobuf.git</developerConnection>
<url>https://github.com/hashgraph/hedera-protobuf</url>
<tag>v0.18.1</tag>
<tag>v0.19.0-alpha.2</tag>
</scm>

<distributionManagement>
Expand Down
40 changes: 38 additions & 2 deletions src/main/proto/basic_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,27 @@ enum TokenKycStatus {
Revoked = 2;
}

/**
* Possible Pause statuses returned on TokenGetInfoQuery
*/
enum TokenPauseStatus {
/**
* Indicates that a Token has no pauseKey
*/
PauseNotApplicable = 0;

/**
* Indicates that a Token is Paused
*/
Paused = 1;

/**
* Indicates that a Token is Unpaused.
*/
Unpaused = 2;
}


/**
* A Key can be a public key from one of the three supported systems (ed25519, RSA-3072, ECDSA with
* p384). Or, it can be the ID of a smart contract instance, which is authorized to act as if it had
Expand Down Expand Up @@ -986,6 +1007,16 @@ enum HederaFunctionality {
* Get execution time(s) by TransactionID, if available
*/
NetworkGetExecutionTime = 78;

/**
* Pause the Token
*/
TokenPause = 79;

/**
* Unpause the Token
*/
TokenUnpause = 80;
}

/**
Expand Down Expand Up @@ -1179,7 +1210,9 @@ message NodeAddress {
bytes memo = 3 [deprecated=true];

/**
* The node's hex-encoded X509 RSA public key
* The node's X509 RSA public key used to sign stream files (e.g., record stream
* files). Precisely, this field is a string of hexadecimal characters which,
* translated to binary, are the public key's DER encoding.
*/
string RSA_PubKey = 4;

Expand All @@ -1194,7 +1227,10 @@ message NodeAddress {
AccountID nodeAccountId = 6;

/**
* # The hex-encoded SHA-384 hash of the X509 cert used to encrypt gRPC traffic to the node
* # Hash of the node's TLS certificate. Precisely, this field is a string of
* hexadecimal characters which, translated to binary, are the SHA-384 hash of
* the UTF-8 NFKD encoding of the node's TLS cert in PEM format. Its value can be
* used to verify the node's certificate it presents during TLS negotiations.
*/
bytes nodeCertHash = 7;

Expand Down
25 changes: 24 additions & 1 deletion src/main/proto/response_code.proto
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ enum ResponseCodeEnum {
INVALID_TRANSACTION_START = 5;

/**
* valid transaction duration is a positive non zero number that does not exceed 120 seconds
* The given transactionValidDuration was either non-positive, or greater than the maximum
* valid duration of 180 secs.
*
*/
INVALID_TRANSACTION_DURATION = 6;

Expand Down Expand Up @@ -736,6 +738,7 @@ enum ResponseCodeEnum {

/**
* A schedule already exists with the same identifying fields of an attempted ScheduleCreate (that is, all fields other than scheduledPayerAccountID)
* and the merge_with_identical_schedule field of the schedule is set to false.
*/
IDENTICAL_SCHEDULE_ALREADY_CREATED = 210;

Expand Down Expand Up @@ -1008,4 +1011,24 @@ enum ResponseCodeEnum {
* Cannot set the number of automatic associations for an account more than the maximum allowed token associations <tt>tokens.maxPerAccount</tt>
*/
REQUESTED_NUM_AUTOMATIC_ASSOCIATIONS_EXCEEDS_ASSOCIATION_LIMIT = 264;

/**
* Token is paused. This Token cannot be a part of any kind of Transaction until unpaused.
*/
TOKEN_IS_PAUSED = 265;

/**
* Pause key is not set on token
*/
TOKEN_HAS_NO_PAUSE_KEY = 266;

/**
* The provided pause key was invalid
*/
INVALID_PAUSE_KEY = 267;

/**
* A schedule already exists with the same identifying fields of an attempted ScheduleCreate except for its payerAccountID
*/
IDENTICAL_SCHEDULE_ALREADY_EXISTS_WITH_DIFFERENT_PAYER = 268;
}
12 changes: 12 additions & 0 deletions src/main/proto/schedulable_transaction_body.proto
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ import "token_burn.proto";
import "token_wipe_account.proto";
import "token_associate.proto";
import "token_dissociate.proto";
import "token_pause.proto";
import "token_unpause.proto";

import "schedule_delete.proto";

Expand Down Expand Up @@ -239,6 +241,16 @@ message SchedulableTransactionBody {
*/
TokenDissociateTransactionBody tokenDissociate = 33;

/**
* Pauses the Token
*/
TokenPauseTransactionBody token_pause = 35;

/**
* Unpauses the Token
*/
TokenUnpauseTransactionBody token_unpause = 36;

/**
* Marks a schedule in the network's action queue as deleted, preventing it from executing
*/
Expand Down
9 changes: 9 additions & 0 deletions src/main/proto/schedule_create.proto
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,13 @@ message ScheduleCreateTransactionBody {
* given
*/
AccountID payerAccountID = 4;

/**
* Controls how the network will behave when there is an identical transaction already scheduled (but not yet executed).
*
* If true, this ScheduleCreate will resolve to SUCCESS, and the existing schedule entity will receives any signatures from this transaction.
*
* If false, this ScheduleCreate will resolve to IDENTICAL_SCHEDULE_ALREADY_CREATED, and the receipt will contain the id of the existing schedule entity.
*/
bool merge_with_identical_schedule = 5;
}
6 changes: 6 additions & 0 deletions src/main/proto/token_create.proto
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,10 @@ message TokenCreateTransactionBody {
* The custom fees to be assessed during a CryptoTransfer that transfers units of this token
*/
repeated CustomFee custom_fees = 21;

/**
* The Key which can pause and unpause the Token.
* If Empty the token pause status defaults to PauseNotApplicable, otherwise Unpaused.
*/
Key pause_key = 22;
}
10 changes: 10 additions & 0 deletions src/main/proto/token_get_info.proto
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ message TokenInfo {
* The custom fees to be assessed during a CryptoTransfer that transfers units of this token
*/
repeated CustomFee custom_fees = 23;

/**
* The Key which can pause and unpause the Token.
*/
Key pause_key = 24;

/**
* Specifies whether the token is paused or not. PauseNotApplicable is returned if pauseKey is not set.
*/
TokenPauseStatus pause_status = 25;
}

/**
Expand Down
44 changes: 44 additions & 0 deletions src/main/proto/token_pause.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
syntax = "proto3";

package proto;

/*-
* ‌
* Hedera Network Services Protobuf
* ​
* Copyright (C) 2018 - 2021 Hedera Hashgraph, LLC
* ​
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ‍
*/

option java_package = "com.hederahashgraph.api.proto.java";
option java_multiple_files = true;

import "basic_types.proto";

/**
* Pauses the Token from being involved in any kind of Transaction until it is unpaused.
* Must be signed with the Token's pause key.
* If the provided token is not found, the transaction will resolve to INVALID_TOKEN_ID.
* If the provided token has been deleted, the transaction will resolve to TOKEN_WAS_DELETED.
* If no Pause Key is defined, the transaction will resolve to TOKEN_HAS_NO_PAUSE_KEY.
* Once executed the Token is marked as paused and will be not able to be a part of any transaction.
* The operation is idempotent - becomes a no-op if the Token is already Paused.
*/
message TokenPauseTransactionBody {
/**
* The token to be paused.
*/
TokenID token = 1;
}
6 changes: 6 additions & 0 deletions src/main/proto/token_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,10 @@ service TokenService {
rpc getTokenNftInfos (Query) returns (Response) {
option deprecated = true;
};

// Pause the token
rpc pauseToken (Transaction) returns (TransactionResponse);

// Unpause the token
rpc unpauseToken (Transaction) returns (TransactionResponse);
}
43 changes: 43 additions & 0 deletions src/main/proto/token_unpause.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
syntax = "proto3";

package proto;

/*-
* ‌
* Hedera Network Services Protobuf
* ​
* Copyright (C) 2018 - 2021 Hedera Hashgraph, LLC
* ​
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ‍
*/

option java_package = "com.hederahashgraph.api.proto.java";
option java_multiple_files = true;

import "basic_types.proto";

/**
* Unpauses the Token. Must be signed with the Token's pause key.
* If the provided token is not found, the transaction will resolve to INVALID_TOKEN_ID.
* If the provided token has been deleted, the transaction will resolve to TOKEN_WAS_DELETED.
* If no Pause Key is defined, the transaction will resolve to TOKEN_HAS_NO_PAUSE_KEY.
* Once executed the Token is marked as Unpaused and can be used in Transactions.
* The operation is idempotent - becomes a no-op if the Token is already unpaused.
*/
message TokenUnpauseTransactionBody {
/**
* The token to be unpaused.
*/
TokenID token = 1;
}
6 changes: 6 additions & 0 deletions src/main/proto/token_update.proto
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,10 @@ message TokenUpdateTransactionBody {
* currently have this key, transaction will resolve to TOKEN_HAS_NO_FEE_SCHEDULE_KEY
*/
Key fee_schedule_key = 14;

/**
* The Key which can pause and unpause the Token. If the Token does not currently have a pause key,
* transaction will resolve to TOKEN_HAS_NO_PAUSE_KEY
*/
Key pause_key = 15;
}
12 changes: 12 additions & 0 deletions src/main/proto/transaction_body.proto
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ import "token_wipe_account.proto";
import "token_associate.proto";
import "token_dissociate.proto";
import "token_fee_schedule_update.proto";
import "token_pause.proto";
import "token_unpause.proto";

import "schedule_create.proto";
import "schedule_delete.proto";
Expand Down Expand Up @@ -288,6 +290,16 @@ message TransactionBody {
*/
TokenFeeScheduleUpdateTransactionBody token_fee_schedule_update = 45;

/**
* Pauses the Token
*/
TokenPauseTransactionBody token_pause = 46;

/**
* Unpauses the Token
*/
TokenUnpauseTransactionBody token_unpause = 47;

/**
* Creates a schedule in the network's action queue
*/
Expand Down