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

added get_token_id function in smart contract library #858

Merged

Conversation

tenmoves
Copy link
Contributor

@tenmoves tenmoves commented Jan 23, 2023

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes #640

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • unit tests
  • manual tests
    image
    image
    image

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@tenmoves tenmoves added feature New feature request smart contracts Involve smart contracts core team Assigned to the core team labels Jan 23, 2023
@tenmoves tenmoves self-assigned this Jan 23, 2023
@tenmoves tenmoves marked this pull request as ready for review January 24, 2023 10:25
@apoorv-2204 apoorv-2204 self-requested a review January 25, 2023 07:51
@tenmoves
Copy link
Contributor Author

fot the test I created a token, then a smart contract where we used the token id in the content, after transfer we can see that the content was updated with the token_id

lib/archethic/contracts/interpreter/library.ex Outdated Show resolved Hide resolved
lib/archethic/contracts/interpreter/library.ex Outdated Show resolved Hide resolved
lib/archethic/utils.ex Outdated Show resolved Hide resolved
@doc """
get token properties based on the genesis address and the transaction
"""
@spec get_token_properties(binary(), Transaction.t()) :: {:ok, map()} | {:error, atom()}
Copy link
Member

Choose a reason for hiding this comment

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

You may specify the possible atom return when an error occur, it will be easier to understand the possible result

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

name: Map.get(map, "name", ""),
supply: Map.get(map, "supply"),
symbol: Map.get(map, "symbol", ""),
type: type,
Copy link
Member

Choose a reason for hiding this comment

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

The type should be retrieve from the map, the expected type are fungible or non-fungible and not the transaction type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@Neylix Neylix merged commit 5710db0 into archethic-foundation:develop Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core team Assigned to the core team feature New feature request smart contracts Involve smart contracts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add token ID in smart contract library
3 participants