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

Add HTS Precompile tests for token check methods #468

Merged

Conversation

natanasow
Copy link
Collaborator

@natanasow natanasow commented Aug 24, 2022

Signed-off-by: nikolay n.atanasow94@gmail.com

Description:

Add support for the token verifications:

isToken(address _token) returns (uint64 statusCode, bool isToken)
getTokenType(address _token) returns (uint64 statusCode, int32 tokenType)

Related issue(s):

Fixes #411

Notes for reviewer:

Checklist

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

Signed-off-by: nikolay <n.atanasow94@gmail.com>
@natanasow natanasow self-assigned this Aug 24, 2022
@natanasow natanasow requested review from georgi-l95, Nana-EC, Ivo-Yankov and dimitrovmaksim and removed request for georgi-l95 August 24, 2022 11:46
@Nana-EC Nana-EC added enhancement New feature or request limechain P2 labels Aug 24, 2022
@Nana-EC Nana-EC added this to the 0.7.0 milestone Aug 24, 2022
Copy link
Collaborator

@Nana-EC Nana-EC 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.
Some clarifying suggestions.

Once addressed please move PR to draft.
Let's wait on services tag before checking this PR in.

const tokenType = txReceipt.events.filter(e => e.event === 'TokenType')[0].args.tokenType;
expect(tokenType).to.equal(0);
});
it('should returns 1 for getTokenType with passed HTS nft token', async function() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
it('should returns 1 for getTokenType with passed HTS nft token', async function() {
it('should return 1 for getTokenType with passed HTS nft token', async function() {

const tokenType = txReceipt.events.filter(e => e.event === 'TokenType')[0].args.tokenType;
expect(tokenType).to.equal(1);
});
it('should throws an exception for getTokenType with passed contract address', async function() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
it('should throws an exception for getTokenType with passed contract address', async function() {
it('should throw an exception for getTokenType with passed contract address', async function() {

const isTokenFlag = txReceipt.events.filter(e => e.event === 'IsToken')[0].args.isToken;
expect(isTokenFlag).to.equal(true);
});
it('should returns 0 for getTokenType with passed HTS token', async function() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
it('should returns 0 for getTokenType with passed HTS token', async function() {
it('should returns 0 for getTokenType with passed FUNGIBLE_COMMON token', async function() {

const tokenType = txReceipt.events.filter(e => e.event === 'TokenType')[0].args.tokenType;
expect(tokenType).to.equal(0);
});
it('should returns 1 for getTokenType with passed HTS nft token', async function() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
it('should returns 1 for getTokenType with passed HTS nft token', async function() {
it('should returns 1 for getTokenType with passed HTS NON_FUNGIBLE_UNIQUE token', async function() {

@Nana-EC Nana-EC modified the milestones: 0.7.0, 0.8.0 Aug 24, 2022
@natanasow natanasow marked this pull request as draft August 25, 2022 07:23
Signed-off-by: nikolay <n.atanasow94@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Aug 25, 2022

Codecov Report

Base: 76.38% // Head: 76.38% // No change to project coverage 👍

Coverage data is based on head (b0aaaf0) compared to base (c3d3fb8).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #468   +/-   ##
=======================================
  Coverage   76.38%   76.38%           
=======================================
  Files          12       12           
  Lines         923      923           
  Branches      144      144           
=======================================
  Hits          705      705           
  Misses        165      165           
  Partials       53       53           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Nana-EC and others added 5 commits September 6, 2022 21:12
Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
…n-check-methods

# Conflicts:
#	packages/server/tests/acceptance/htsPrecompile.spec.ts
#	packages/server/tests/contracts/BaseHTS.json
#	packages/server/tests/contracts/BaseHTS.sol
#	packages/server/tests/contracts/HederaTokenService.sol
#	packages/server/tests/contracts/IHederaTokenService.sol
Signed-off-by: nikolay <n.atanasow94@gmail.com>
Signed-off-by: nikolay <n.atanasow94@gmail.com>
Signed-off-by: nikolay <n.atanasow94@gmail.com>
@natanasow natanasow marked this pull request as ready for review September 14, 2022 10:50
Nana-EC
Nana-EC previously approved these changes Sep 14, 2022
Copy link
Collaborator

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

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

LG, please update PR description to match your changes

…n-check-methods

# Conflicts:
#	packages/server/tests/contracts/BaseHTS.json
Signed-off-by: nikolay <n.atanasow94@gmail.com>
@natanasow natanasow closed this Sep 15, 2022
@natanasow natanasow reopened this Sep 15, 2022
@sonarcloud
Copy link

sonarcloud bot commented Sep 15, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@natanasow natanasow merged commit 400a1e7 into main Sep 15, 2022
@natanasow natanasow deleted the 411-add-htsprecompile-tests-support-for-token-check-methods branch September 15, 2022 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request limechain P2
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add htsPrecompile acceptance tests support for token check methods
4 participants