You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for the following transactions and persist to the token_airdrop table:
TokenAirdrop
TokenCancelAirdrop
TokenClaimAirdrop
Solution
Add a TokenAirdrop domain object with the same fields as the schema below.
Add onTokenAirdrop method to EntityListener to handle inserts to the token_airdrop table.
Add TokenAirdropTransactionHandler which will add a new entry to the token_airdrop table with the default state of PENDING.
Add TokenCancelAirdropTransactionHandler which will set the state of the airdrop to CANCELLED
Add TokenClaimAirdropTransactionHandler which will set the state of the airdrop to CLAIMED
If a TokenAirdrop transaction occurs for a fungible token that already exists in the token_airdrop table then the existing entry should have the timestamp range closed, and it should be moved into the token_airdrop_history table. If the entry was in the PENDING state, then the new entry should be updated with amount set to the sum of the existing amount and the new amount. If the existing entry is in any other state, then the amount should be set to the amount of the new entry.
If a TokenAirdrop transaction occurs for a nft that already exists in the token_airdrop table i.e matching sender, receiver, token_id and serial_number, then the existing entry should have the timestamp range closed, and it should be moved into the token_airdrop_history table.
Token airdrop schema:
create type airdrop_state as enum ('PENDING', 'CANCELLED', 'CLAIMED');
create table if not exists token_airdrop
(
amount bigint,
receiver_account_id bigint not null,
sender_account_id bigint not null,
serial_number bigint,
state airdrop_state not null default 'PENDING',
timestamp_range int8range not null,
token_id bigint not null
);
create unique index if not exists token_airdrop__sender_id on token_airdrop (sender_account_id, receiver_account_id, token_id, serial_number);
create index if not exists token_airdrop__receiver_id on token_airdrop (receiver_account_id, sender_account_id, token_id, serial_number);
create table if not exists token_airdrop_history
(
like token_airdrop including defaults
);
create index if not exists token_airdrop_history__token_serial_lower_timestamp
on token_airdrop_history using gist (timestamp_range);
Alternatives
No response
The text was updated successfully, but these errors were encountered:
Problem
Add support for the following transactions and persist to the
token_airdrop
table:TokenAirdrop
TokenCancelAirdrop
TokenClaimAirdrop
Solution
TokenAirdrop
domain object with the same fields as the schema below.onTokenAirdrop
method to EntityListener to handle inserts to thetoken_airdrop
table.TokenAirdropTransactionHandler
which will add a new entry to thetoken_airdrop
table with the default state ofPENDING
.TokenCancelAirdropTransactionHandler
which will set the state of the airdrop toCANCELLED
TokenClaimAirdropTransactionHandler
which will set the state of the airdrop toCLAIMED
If a
TokenAirdrop
transaction occurs for a fungible token that already exists in thetoken_airdrop
table then the existing entry should have the timestamp range closed, and it should be moved into thetoken_airdrop_history
table. If the entry was in thePENDING
state, then the new entry should be updated withamount
set to the sum of the existing amount and the new amount. If the existing entry is in any other state, then theamount
should be set to the amount of the new entry.If a
TokenAirdrop
transaction occurs for a nft that already exists in thetoken_airdrop
table i.e matching sender, receiver, token_id and serial_number, then the existing entry should have the timestamp range closed, and it should be moved into thetoken_airdrop_history
table.Token airdrop schema:
Alternatives
No response
The text was updated successfully, but these errors were encountered: