-
Notifications
You must be signed in to change notification settings - Fork 7
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
example: fungible token #14
Conversation
c2cddc2
to
143e32f
Compare
add tools to path in .bashrc setup_test_env in every test
@race-of-sloths include |
@petersalomonsen Thank you for your contribution! Your pull request is now a part of the Race of Sloths! Current status: waiting for finalizationThe pull request is merged, you have 24 hours to finalize your scoring. The scoring ends Thu Oct 10 19:22:25 2024
Your contribution is much appreciated with a final score of 13! What is the Race of SlothsRace of Sloths is a friendly competition where you can participate in challenges and compete with other open-source contributors within your normal workflow For contributors:
For maintainers:
Feel free to check our website for additional details! Bot commands
|
Application for joining @race-of-sloths can be found here: NEAR-DevHub/race-of-sloths#187 |
@race-of-sloths include |
@race-of-sloths score 13 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome magic!
@petersalomonsen Thank you for your contribution! Your pull request is now a part of the Race of Sloths! Current status: executed
Your contribution is much appreciated with a final score of 13! We would appreciate your feedback or contribution idea that you can submit here What is the Race of SlothsRace of Sloths is a friendly competition where you can participate in challenges and compete with other open-source contributors within your normal workflow For contributors:
For maintainers:
Feel free to check our website for additional details! Bot commands
|
There are 3 highlights in this Pull Request:
A full example of building QuickJS for integrating with Rust in WebAssembly, and then also NEAR smart contracts
Now that this project downloads QuickJS, contains all the build scripts which is part of the Rust build pipeline, and compiles for WebAssembly targets including a NEAR protocol smart contract, it serves as a comprehensive and complete example of bundling QuickJS with Rust and WebAssembly. The combination of JS, Rust and NEAR protocol smart contracts, opens up for having a lightweight JavaScript customization layer on top of robust Rust implementation of standard contracts such as NFT and FT.
A customizable Fungible Token contract
The added JavaScript engine makes it possible to add custom transfer functions. Below is an example from the tests, that transfers a fixed amount of
2000
tokens toalice
. When calling this function, atransfer_id
is returned, whichalice
then can use to return excessive funds. In this examplealice
can call therefund
function with thetransfer_id
as argument, and then the account that did the transfer toalice
will get1000
tokens in refund.My intended use case of this is to be able to reserve the max needed tokens for an AI request, and then return back to the caller the unspent tokens.