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

Hip-904 account changes supporting pending airdrops #389

Merged
merged 11 commits into from
Jul 22, 2024
13 changes: 13 additions & 0 deletions services/response_code.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1549,4 +1549,17 @@ enum ResponseCodeEnum {
* The transaction attempted to use more than the allowed number of `PendingAirdropId`.
*/
MAX_PENDING_AIRDROP_ID_EXCEEDED = 363;

/*
* A pending airdrop already exists for the specified NFT.
*/
PENDING_NFT_AIRDROP_ALREADY_EXISTS = 364;

/*
* The identified account is sender for one or more pending airdrop(s)
* and cannot be deleted.<br/>
* Requester should cancel all pending airdrops before resending
* this transaction.
*/
ACCOUNT_HAS_PENDING_AIRDROPS = 365;
}
11 changes: 11 additions & 0 deletions services/state/token/account.proto
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,17 @@ message Account {
* It will be null if if the account is not a contract or the contract has no storage mappings.
*/
bytes first_contract_storage_key = 33;

/**
* A pending airdrop ID at the head of the linked list for this account
* from the account airdrops map.<br/>
* The account airdrops are connected by including the "next" and "previous"
* `PendingAirdropID` in each `AccountAirdrop` message.
* <p>
* This value SHALL NOT be empty if this account is "sender" for any
* pending airdrop, and SHALL be empty otherwise.
*/
PendingAirdropId head_pending_airdrop_id = 34;
}

/**
Expand Down
70 changes: 70 additions & 0 deletions services/state/token/account_pending_airdrop.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
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.
*/

import "basic_types.proto";

option java_package = "com.hederahashgraph.api.proto.java";
// <<<pbj.java_package = "com.hedera.hapi.node.state.token">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;


/**
* A node within a doubly linked list of pending airdrop references.<br/>
* This internal state message forms the entries in a doubly-linked list
* of references to pending airdrop entries that are "owed" by a particular
* account as "sender".
*
* Each entry in this list MUST refer to an existing pending airdrop.<br/>
* The pending airdrop MUST NOT be claimed.<br/>
* The pending airdrop MUST NOT be canceled.<br/>
* The pending airdrop `sender` account's `head_pending_airdrop_id` field
* MUST match the `pending_airdrop_id` field in this message.
*
* ### Record Stream Effects
* This value is not currently published in the record stream.
*/
message AccountPendingAirdrop {
/**
* The value of the current airdrop id. SHALL NOT be set for non fungible tokens
*/
PendingAirdropValue pending_airdrop_value = 1;

/**
* A pending airdrop identifier.<br/>
* This identifies the specific pending airdrop that precedes this position
* within the doubly linked list of pending airdrops "owed" by the sending
* account associated with this account airdrop "list".
* <p>
* This SHALL match `pending_airdrop_id` if this is the only entry
* in the "list".
*/
PendingAirdropId previous_airdrop = 2;

/**
* A pending airdrop identifier.<br/>
* This identifies the specific pending airdrop that follows this position
* within the doubly linked list of pending airdrops "owed" by the sending
* account associated with this account airdrop "list".
* <p>
* This SHALL match `pending_airdrop_id` if this is the only entry
* in the "list".
*/
PendingAirdropId next_airdrop = 3;
}