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

refactor: Migrate to NearToken #1104

Merged
merged 28 commits into from
Nov 18, 2023
Merged

Conversation

iho
Copy link
Contributor

@iho iho commented Oct 28, 2023

Closes #1103

@iho iho marked this pull request as ready for review October 29, 2023 07:56
Copy link
Collaborator

@frol frol left a comment

Choose a reason for hiding this comment

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

@iho I would suggest to actually use NearToken and NearGas as function arguments types instead of u64/u128, and re-export them from near_sdk (see what is the best place for the type to be imported from the user perspective)

examples/factory-contract/Cargo.toml Outdated Show resolved Hide resolved
examples/factory-contract/tests/workspaces.rs Outdated Show resolved Hide resolved
@frol
Copy link
Collaborator

frol commented Oct 30, 2023

@iho Let’s also replace the Balance type alias with NearToken

pub type Balance = u128;
, and remove ONE_YOCTO and ONE_NEAR consts:
/// Balance of one Yocto NEAR, which is the smallest denomination. This value is 10^-24 of one NEAR.

examples/fungible-token/tests/workspaces.rs Outdated Show resolved Hide resolved
examples/fungible-token/tests/workspaces.rs Outdated Show resolved Hide resolved
examples/fungible-token/tests/workspaces.rs Outdated Show resolved Hide resolved
examples/lockable-fungible-token/tests/workspaces.rs Outdated Show resolved Hide resolved
examples/lockable-fungible-token/tests/workspaces.rs Outdated Show resolved Hide resolved
near-contract-standards/src/fungible_token/core.rs Outdated Show resolved Hide resolved
near-contract-standards/src/fungible_token/core_impl.rs Outdated Show resolved Hide resolved
near-sdk/src/environment/env.rs Outdated Show resolved Hide resolved
iho and others added 2 commits November 3, 2023 09:01
This reverts commit 66c4dea.
Co-authored-by: Vlad Frolov <frolvlad@gmail.com>
@frol
Copy link
Collaborator

frol commented Nov 3, 2023

Please, apply the suggestions throughout the code, I only commented on a few places and didn’t go through every similar case in the code

examples/factory-contract/Cargo.toml Outdated Show resolved Hide resolved
examples/factory-contract/high-level/src/lib.rs Outdated Show resolved Hide resolved
examples/fungible-token/ft/src/lib.rs Outdated Show resolved Hide resolved
examples/lockable-fungible-token/src/lib.rs Outdated Show resolved Hide resolved
near-contract-standards/src/fungible_token/resolver.rs Outdated Show resolved Hide resolved
near-contract-standards/src/non_fungible_token/utils.rs Outdated Show resolved Hide resolved
near-contract-standards/src/non_fungible_token/utils.rs Outdated Show resolved Hide resolved
examples/lockable-fungible-token/tests/workspaces.rs Outdated Show resolved Hide resolved
examples/lockable-fungible-token/src/lib.rs Outdated Show resolved Hide resolved
examples/lockable-fungible-token/src/lib.rs Outdated Show resolved Hide resolved
examples/lockable-fungible-token/src/lib.rs Outdated Show resolved Hide resolved
examples/fungible-token/ft/src/lib.rs Outdated Show resolved Hide resolved
@frol frol mentioned this pull request Nov 15, 2023
9 tasks
@frol frol merged commit be16c35 into near:master Nov 18, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor NEAR tokens usages to use a strictly typed near-token crate
2 participants