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(contract-standards): Adding near-contract-standards library and more tools #275

Merged
merged 34 commits into from
Mar 4, 2021

Conversation

ilblackdragon
Copy link
Member

@ilblackdragon ilblackdragon commented Jan 24, 2021

near-contract-standards is a library with implementations of contract standards.

Additional tools include testing and implementation tools that reduce contract code and tests size by 2x.
Also added env::storage_byte_code() which right now returns a constant but in the future will be switched to return current storage cost from environment.

Fixes #254

near-std/Cargo.toml Outdated Show resolved Hide resolved
examples/fungible-token/src/lib.rs Outdated Show resolved Hide resolved
@ilblackdragon ilblackdragon changed the title Adding near-std library feat(near-std): Adding near-std library Jan 25, 2021
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.

@ilblackdragon near-lib is even more confusing (we had already had nearlib which was the JS API client library, and we finally renamed it to near-api-js to avoid ambiguity).

Some utils can go into sdk crate proper, but it then will end with overloading SDK with tons of utils.

SDK should be a one-stop-shop of all the compatible utils by design:

A software development kit (SDK) is a collection of software development tools in one installable package.

Wikipedia

I believe that SDK can have a different release schedule, but given the nature of SDK it should provide or re-export (potentially behind a feature flag) the NEP standards and various helpers.

I propose near-contract-standards or it would be even better to split them apart into dedicated crates (e.g. near-contract-nft-standard), so it is easy to track the evolution of certain standards (if that is necessary).

@ilblackdragon ilblackdragon changed the title feat(near-std): Adding near-std library feat(near-lib): Adding near-lib library Feb 2, 2021
Cargo.toml Outdated Show resolved Hide resolved
@ilblackdragon ilblackdragon changed the title feat(near-lib): Adding near-lib library feat(contract-standards): Adding near-contract-standards library and more tools Feb 21, 2021
Willem Wyndham and others added 3 commits February 22, 2021 13:05
fix: allow trait methods in generated impl
feat(contract-standards) Switch contract standards to use NEP-141 for FungibleToken
chadoh and others added 2 commits March 2, 2021 18:02
* refactor: add more simulation tests to ft example

Co-authored-by: Willem Wyndham <willem@cs.umd.edu>

* update directory structure for sim tests

* clean up fungible-token/Cargo.toml

* examples/ft: whitelist members again

* Mike/141 movement with sim (#304)

* implement account registration and don't use storage for fungible token

* update sim tests

* ft_resolve_transfer should just return U128, ar_is_registered view only

* final change with use bytes for deposit

* Cargo.toml changes

* Reworking DeFi test example

* Working again, except no force closing of the account

* Add extra callbacks

Co-authored-by: Evgeny Kuzyakov <ek@nearprotocol.com>

Co-authored-by: Willem Wyndham <willem@cs.umd.edu>
Co-authored-by: Mike Purvis <mikedotexe@gmail.com>
Co-authored-by: Evgeny Kuzyakov <ek@nearprotocol.com>
@ilblackdragon
Copy link
Member Author

Hm.... How does one put the hash of the contract (code) into the contract itself?

@willemneal
Copy link
Contributor

@ilblackdragon I think you need it to be part of the initialization.

@mikedotexe
Copy link
Contributor

Hm.... How does one put the hash of the contract (code) into the contract itself?

The reference_hash is the hash of the external JSON file that contains additional, free-form details.
https://nomicon-pr-158.onrender.com/Standards/Tokens/FungibleTokenMetadata.html#reference-level-explanation

@evgenykuzyakov
Copy link
Contributor

Let's merge it and iterate

@evgenykuzyakov evgenykuzyakov merged commit 0b3419c into master Mar 4, 2021
@evgenykuzyakov evgenykuzyakov deleted the add-near-std branch March 4, 2021 01:55
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.

Standards library
7 participants