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

feat: Token Airdrop Transaction #2492

Merged
merged 33 commits into from
Sep 12, 2024
Merged

Conversation

ivaylonikolov7
Copy link
Contributor

@ivaylonikolov7 ivaylonikolov7 commented Aug 27, 2024

Description:
HIP 904 - Token Airdrop Transaction

This PR introduces AirdropTokenTransaction transaction. Adds AccountAmount and AirdropTokenTransfer helper classes.

Related issue(s):
Fixes #2465

Notes for reviewer:
Needs to have integration tests to be ready.

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit)
  • Tested (integration tests)

@ivaylonikolov7 ivaylonikolov7 changed the title Feat/tokenairdroptransaction Feat: Token Airdrop Transaction Aug 27, 2024
@ivaylonikolov7 ivaylonikolov7 self-assigned this Aug 27, 2024
@ivaylonikolov7 ivaylonikolov7 added this to the v2.51.0 milestone Aug 27, 2024
src/token/AirdropTokenTransfer.js Outdated Show resolved Hide resolved
src/token/AirdropNftTransfer.js Outdated Show resolved Hide resolved
src/token/AccountAmount.js Outdated Show resolved Hide resolved
@ivaylonikolov7 ivaylonikolov7 changed the title Feat: Token Airdrop Transaction feat: Token Airdrop Transaction Aug 30, 2024
@ivaylonikolov7 ivaylonikolov7 marked this pull request as ready for review August 30, 2024 12:56
@ivaylonikolov7 ivaylonikolov7 requested review from a team as code owners August 30, 2024 12:56
src/token/PendingAirdrop.js Outdated Show resolved Hide resolved
test/integration/AirdropTokenIntegrationTest.js Outdated Show resolved Hide resolved
test/integration/AirdropTokenIntegrationTest.js Outdated Show resolved Hide resolved
src/token/AccountAmount.js Outdated Show resolved Hide resolved
Copy link
Contributor

@0xivanov 0xivanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall.

test/integration/TokenAirdropIntegrationTest.js Outdated Show resolved Hide resolved
test/integration/TokenAirdropIntegrationTest.js Outdated Show resolved Hide resolved
test/integration/TokenAirdropIntegrationTest.js Outdated Show resolved Hide resolved
test/integration/TokenAirdropIntegrationTest.js Outdated Show resolved Hide resolved
Copy link
Contributor

@ivaylogarnev-limechain ivaylogarnev-limechain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

0xivanov
0xivanov previously approved these changes Sep 9, 2024
Copy link
Contributor

@0xivanov 0xivanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

src/token/AbstractTokenTransfer.js Outdated Show resolved Hide resolved
src/token/AbstractTokenTransfer.js Outdated Show resolved Hide resolved
src/token/AbstractTokenTransfer.js Outdated Show resolved Hide resolved
src/token/PendingAirdropId.js Show resolved Hide resolved
src/token/PendingAirdropRecord.js Show resolved Hide resolved
src/token/TokenAirdropTransaction.js Outdated Show resolved Hide resolved
test/unit/TokenAirdropTransaction.js Outdated Show resolved Hide resolved
agadzhalov
agadzhalov previously approved these changes Sep 10, 2024
Copy link
Contributor

@agadzhalov agadzhalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, ty @ivaylonikolov7 🚀

0xivanov
0xivanov previously approved these changes Sep 11, 2024
Copy link
Contributor

@0xivanov 0xivanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Ivaylo Nikolov <[email protected]>
Signed-off-by: Ivaylo Nikolov <[email protected]>
Signed-off-by: Ivaylo Nikolov <[email protected]>
Signed-off-by: Ivaylo Nikolov <[email protected]>
* feat: add airdrop claim and cancel transactions

Signed-off-by: Ivaylo Nikolov <[email protected]>

* chore: update protobufs

Signed-off-by: Ivaylo Nikolov <[email protected]>

* feat: update commit messages

Signed-off-by: Ivaylo Nikolov <[email protected]>

* test: add unit tests for cancel and claim

Signed-off-by: Ivaylo Nikolov <[email protected]>

* wip(test): add integration tests for cancel and claim transactions

Signed-off-by: Ivaylo Nikolov <[email protected]>

* fix: claim used the wrong channel function

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: rename transaction name

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: remove claim references in airdropcancel integration test

Signed-off-by: Ivaylo Nikolov <[email protected]>

* test(fix): fix not working test for airdrop cancel and claim

Signed-off-by: Ivaylo Nikolov <[email protected]>

* fix: airdropcancel transaction should work on sender not receiver

Signed-off-by: Ivaylo Nikolov <[email protected]>

* feat: add token airdrop example

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: rename transactions to have the same name as java

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: remove redundant imports and empty lines

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: rename transaction tests  to have the same name as java sdk

Signed-off-by: Ivaylo Nikolov <[email protected]>

* docs: add licenses

Signed-off-by: Ivaylo Nikolov <[email protected]>

* fix: remove dead code from token cancel

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: consistency in constructor

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: change airdrop_supply_per_person naming

Signed-off-by: Ivaylo Nikolov <[email protected]>

* test: fix setting sender id

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: specify what kind of tokens are airdropped

Signed-off-by: Ivaylo Nikolov <[email protected]>

---------

Signed-off-by: Ivaylo Nikolov <[email protected]>
Copy link

sonarcloud bot commented Sep 11, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
24.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Copy link
Contributor

@agadzhalov agadzhalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ivaylonikolov7 ivaylonikolov7 merged commit 5673280 into main Sep 12, 2024
10 of 11 checks passed
@ivaylonikolov7 ivaylonikolov7 deleted the feat/tokenairdroptransaction branch September 12, 2024 09:20
@ivaylonikolov7 ivaylonikolov7 mentioned this pull request Sep 12, 2024
@ivaylonikolov7 ivaylonikolov7 linked an issue Sep 13, 2024 that may be closed by this pull request
ivaylogarnev-limechain pushed a commit that referenced this pull request Sep 19, 2024
* feat: add Airdrop Transaction

Signed-off-by: Ivaylo Nikolov <[email protected]>

* test(wip): unit tests

Signed-off-by: Ivaylo Nikolov <[email protected]>

* fix: use interface for AccountAmount protobuf

Signed-off-by: Ivaylo Nikolov <[email protected]>

* fix: remove circular dependancy

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: RenameTokenTransfer list to TokenTransfer

Signed-off-by: Ivaylo Nikolov <[email protected]>

* feat: rename token transfer and add expected decimals

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: remove redundant code

Signed-off-by: Ivaylo Nikolov <[email protected]>

* test: finished unit tests

Signed-off-by: Ivaylo Nikolov <[email protected]>

* fix: correct return type for amount

Signed-off-by: Ivaylo Nikolov <[email protected]>

* fix: correct return for fromProtobuf

Signed-off-by: Ivaylo Nikolov <[email protected]>

* feat: add missing methods

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: use already implemented interfaces and classes

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: transfer transaction and airdrop transaction

Signed-off-by: Ivaylo Nikolov <[email protected]>

* feat: add logid and execute

Signed-off-by: Ivaylo Nikolov <[email protected]>

* feat: add integration tests

Signed-off-by: Ivaylo Nikolov <[email protected]>

* feat: add pending airdrop to rectord

Signed-off-by: Ivaylo Nikolov <[email protected]>

* test: add nft transfers to all test cases

Signed-off-by: Ivaylo Nikolov <[email protected]>

* chore: remove unused files for airdrop

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: remove circular dependancy and unused import

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: remove duplicated property

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: rename pendngairdroprecord

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: remove unused files

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: rename AirdropTokenTransaction

Signed-off-by: Ivaylo Nikolov <[email protected]>

* test: add additional tests

Signed-off-by: Ivaylo Nikolov <[email protected]>

* fix: rename file reference

Signed-off-by: Ivaylo Nikolov <[email protected]>

* test: check if newPendingAirdrops is empty for auto associated test

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: remove comment lines

Signed-off-by: Ivaylo Nikolov <[email protected]>

* test: remove get receipt line because we call get record

Signed-off-by: Ivaylo Nikolov <[email protected]>

* test: should be able to airdrop when receiver sig set to true

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: rename AbstractTokenTransfer

Signed-off-by: Ivaylo Nikolov <[email protected]>

* feat: Token Claim and Cancel Transaction (#2499)

* feat: add airdrop claim and cancel transactions

Signed-off-by: Ivaylo Nikolov <[email protected]>

* chore: update protobufs

Signed-off-by: Ivaylo Nikolov <[email protected]>

* feat: update commit messages

Signed-off-by: Ivaylo Nikolov <[email protected]>

* test: add unit tests for cancel and claim

Signed-off-by: Ivaylo Nikolov <[email protected]>

* wip(test): add integration tests for cancel and claim transactions

Signed-off-by: Ivaylo Nikolov <[email protected]>

* fix: claim used the wrong channel function

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: rename transaction name

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: remove claim references in airdropcancel integration test

Signed-off-by: Ivaylo Nikolov <[email protected]>

* test(fix): fix not working test for airdrop cancel and claim

Signed-off-by: Ivaylo Nikolov <[email protected]>

* fix: airdropcancel transaction should work on sender not receiver

Signed-off-by: Ivaylo Nikolov <[email protected]>

* feat: add token airdrop example

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: rename transactions to have the same name as java

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: remove redundant imports and empty lines

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: rename transaction tests  to have the same name as java sdk

Signed-off-by: Ivaylo Nikolov <[email protected]>

* docs: add licenses

Signed-off-by: Ivaylo Nikolov <[email protected]>

* fix: remove dead code from token cancel

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: consistency in constructor

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: change airdrop_supply_per_person naming

Signed-off-by: Ivaylo Nikolov <[email protected]>

* test: fix setting sender id

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: specify what kind of tokens are airdropped

Signed-off-by: Ivaylo Nikolov <[email protected]>

---------

Signed-off-by: Ivaylo Nikolov <[email protected]>

* fix(test): when empty id should be null

Signed-off-by: Ivaylo Nikolov <[email protected]>

* refactor: should return always in jsdoc

Signed-off-by: Ivaylo Nikolov <[email protected]>

---------

Signed-off-by: Ivaylo Nikolov <[email protected]>
Signed-off-by: ivaylogarnev-limechain <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants