Skip to content

Commit

Permalink
HIP-904: add airdrop claim protos (#391)
Browse files Browse the repository at this point in the history
* feat: HIP-904 account changes

Signed-off-by: ibankov <[email protected]>

* add account id to account_airdrop.proto

Signed-off-by: ibankov <[email protected]>

* Refactor account_airdrop.proto

Signed-off-by: ibankov <[email protected]>

* Change Airdrop record value

Signed-off-by: ibankov <[email protected]>

* Doc fixes

Signed-off-by: ibankov <[email protected]>

* Reverting airdrop record to use pending airdrop value

Signed-off-by: ibankov <[email protected]>

* feat: add airdrop claim protos

Signed-off-by: Valentin Tronkov <[email protected]>

* Update services/basic_types.proto layout

Co-authored-by: Joseph S. <[email protected]>
Signed-off-by: Valentin Tronkov <[email protected]>

* Update services/basic_types.proto layout

Co-authored-by: Joseph S. <[email protected]>
Signed-off-by: Valentin Tronkov <[email protected]>

* Update services/token_service.proto layout

Co-authored-by: Joseph S. <[email protected]>
Signed-off-by: Valentin Tronkov <[email protected]>

* feat: add token claim functionality enum

Signed-off-by: Valentin Tronkov <[email protected]>

* feat: add TokenClaimAirdropTransactionBody to transaction body proto

Signed-off-by: Valentin Tronkov <[email protected]>

* refactor: move token claim airdrop to a separate file

Signed-off-by: Valentin Tronkov <[email protected]>

* fix: import the claim proto into transaction body proto

Signed-off-by: Valentin Tronkov <[email protected]>

* feat: add token claim body in the scheduled transaction body proto

Signed-off-by: Valentin Tronkov <[email protected]>

* feat: add token airdrop body in the scheduled transaction body proto

Signed-off-by: Valentin Tronkov <[email protected]>

* nit: add empty lines at the end of the files

Signed-off-by: Valentin Tronkov <[email protected]>

* Addressing comments

Signed-off-by: ibankov <[email protected]>

* Fixing numeration

Signed-off-by: ibankov <[email protected]>

---------

Signed-off-by: ibankov <[email protected]>
Signed-off-by: Valentin Tronkov <[email protected]>
Signed-off-by: Valentin Tronkov <[email protected]>
Co-authored-by: ibankov <[email protected]>
Co-authored-by: Joseph S. <[email protected]>
  • Loading branch information
3 people authored Jul 22, 2024
1 parent 565b0f1 commit 47d111d
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 0 deletions.
5 changes: 5 additions & 0 deletions services/basic_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,11 @@ enum HederaFunctionality {
* Remove one or more pending airdrops from state on behalf of the sender(s) for each airdrop.
*/
TokenCancelAirdrop = 94;

/**
* Claim one or more pending airdrops
*/
TokenClaimAirdrop = 95;
}

/**
Expand Down
12 changes: 12 additions & 0 deletions services/schedulable_transaction_body.proto
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ import "token_unpause.proto";
import "token_update_nfts.proto";
import "token_reject.proto";
import "token_cancel_airdrop.proto";
import "token_claim_airdrop.proto";
import "token_airdrop.proto";

import "schedule_delete.proto";
import "util_prng.proto";
Expand Down Expand Up @@ -330,5 +332,15 @@ message SchedulableTransactionBody {
* Transaction body for a scheduled transaction to cancel an airdrop.
*/
TokenCancelAirdropTransactionBody tokenCancelAirdrop = 46;

/**
* Transaction body for a scheduled transaction to claim an airdrop.
*/
TokenClaimAirdropTransactionBody tokenClaimAirdrop = 47;

/**
* Transaction body for a scheduled transaction to airdrop tokens.
*/
TokenAirdropTransactionBody tokenAirdrop = 48;
}
}
64 changes: 64 additions & 0 deletions services/token_claim_airdrop.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* # Token Claim Airdrop
* Messages used to implement a transaction to claim a pending airdrop.
*
* ### Keywords
* The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
* "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
* document are to be interpreted as described in [RFC2119](https://www.ietf.org/rfc/rfc2119).
*/
syntax = "proto3";

package proto;

/*
* Copyright (C) 2024 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";
// <<<pbj.java_package = "com.hedera.hapi.node.token">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

import "basic_types.proto";

/**
* Token claim airdrop<br/>
* Complete one or more pending transfers on behalf of the
* recipient(s) for an airdrop.
*
* The sender MUST have sufficient balance to fulfill the airdrop at the
* time of claim. If the sender does not have sufficient balance, the
* claim SHALL fail.<br/>
* Each pending airdrop successfully claimed SHALL be removed from state and
* SHALL NOT be available to claim again.<br/>
* Each claim SHALL be represented in the transaction body and
* SHALL NOT be restated in the record file.<br/>
* All claims MUST succeed for this transaction to succeed.
*
* ### Record Stream Effects
* The completed transfers SHALL be present in the transfer list.
*/
message TokenClaimAirdropTransactionBody {
/**
* A list of one or more pending airdrop identifiers.
* <p>
* This transaction MUST be signed by the account identified by
* the `receiver_id` for each entry in this list.<br/>
* This list MUST contain between 1 and 10 entries, inclusive.<br/>
* This list MUST NOT have any duplicate entries.
*/
repeated PendingAirdropId pending_airdrops = 1;
}
11 changes: 11 additions & 0 deletions services/token_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,15 @@ service TokenService {
* This transaction MUST be signed by _each_ account *sending* an airdrop to be canceled.
*/
rpc cancelAirdrop (Transaction) returns (TransactionResponse);

/**
* Claim one or more pending airdrops.
* <p>
* This transaction MUST be signed by _each_ account **receiving** an
* airdrop to be claimed.<br>
* If a "Sender" lacks sufficient balance to fulfill the airdrop at the
* time the claim is made, that claim SHALL fail.
*/
rpc claimAirdrop (Transaction) returns (TransactionResponse);

}
6 changes: 6 additions & 0 deletions services/transaction_body.proto
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import "token_update_nfts.proto";
import "token_reject.proto";
import "token_airdrop.proto";
import "token_cancel_airdrop.proto";
import "token_claim_airdrop.proto";

import "schedule_create.proto";
import "schedule_delete.proto";
Expand Down Expand Up @@ -412,5 +413,10 @@ message TransactionBody {
* A transaction body for a `cancelAirdrop` request.
*/
TokenCancelAirdropTransactionBody tokenCancelAirdrop = 59;

/**
* A transaction body for a `claimAirdrop` request.
*/
TokenClaimAirdropTransactionBody tokenClaimAirdrop = 60;
}
}

0 comments on commit 47d111d

Please sign in to comment.