balloonbox-inc / near-oracle-contracts Goto Github PK
View Code? Open in Web Editor NEWNearOracle Rust backend - Smart Contracts to store a credit score to blockchain and mint it as NFT
License: Apache License 2.0
NearOracle Rust backend - Smart Contracts to store a credit score to blockchain and mint it as NFT
License: Apache License 2.0
Integrate with the native NEAR wallet to allow for user authorization before proceeding to core calculation
Write full suite of unit tests to simulate the action of minting NFTs on NEAR. Simulate the transfer of NFTs and ensure that the host smart contract is paid a royalty too.
Deploy the NFT-minter smart contract to NEAR testnet. Test it's functionality.
Ever wondered how the wallet knows which NFTs you own? It's all thanks to log events. Let's implement some functions that emit an event whenever an NFT is transferred, minted, or burnt.
nft_mint
function is invokedinternal_transfer
is invokednft_resolve_transfer
is invokedWrite a new score on blockchain iff:
Implement logic to transfer an NFT from owner A to owner B
Perform unit testing of the codebase for the Rust smart contract. Test for these core functionalities:
./build.sh
Review the Rust code implementing the basic functionalities for the NEAR smart contract: i.e.,
testnet
and interact with itYou must implement a security layer to protect the smart contract from being called from outside of the dApp frontend. Solution: implement a whitelisting mechanism.
#[private]
function to add a user to a whitelist of account addressesstore_score()
and nft_mint()
Implemented on both smart contracts.
Grant approval permission to another contract to transfer NFTs
Ensure you are able to use patch fixes to correctly upgrade a smart contract by modifying both its state and it code.
./build.sh
Encrypt the score descriptive message as a vec < u8 > using the sha256 hash function from the sha2 cryptographic kit. Luckily, the Rust crate named near_sdk provides already the function sha256()
store_score
method in the smart contractEvery smart contract must be initialized to the blockchain by calling a one-time-only initialization function (which is defined inside the contract itself).
Iterate through all NFTs in a contract
collectible
tab in their NEAR walletValidate the logic of the smart contract to be correct. Furthermore, establish logic for limiting behaviour of the store_score
method in the smart contract. Specifically,
.as_byte()
method. The ultimate solution is to encrypt the score message, to then be able to decrypt it using a decryption key. Formerly you had hashed the message via a SHA256 hashing function, but hashing functions are one directional and are (almost) impossible to be reversed --at least they are not reversible in polynomial time--.Implement the following logic in the nft_mint()
function:
Assign automatized royalty payout
Every state handling function should require a gas fee to be called and executed. Impose a token fee by adding the #[payable]
macro on all state-handling implementations of the main Contract struct and print how much costly was the method execution by printing its gas cost.
#[payable]
macros where neededWhenever information is stored on the smart contract, memory is used up and someone needs to pay a gas fee for that memory usage. Ensure that the smart contract charges the cost of storage to the user (not the smart contract account!). --> This was eventually made possible through a whitelist.
Quality Assurance Testing of the NEARoracle dApp in view of the first release of the dApp for Milestone #1
Redesign and improve the contract implementing feedback received from the team after a contract design quality assurance check.
max_size
requirement for the contract, i.e., don't set an upper bound limit to the memory used by the contractquery_last_score()
function and use only the query_all_scores()
function insteaddoes_user_exist()
function to check whether we have a score record for a given user wallet addressEnsure that all the minting and transferring functions are payable methods. Namely,
#[payable]
macro;In all above cases, ensure that the account you are charging is the one interacting with the NearOracle dApp and NOT the account where the smart contract got deployed.
implement some functions to query the NFT ownership of wallet addresses: who owns what? / who are tokens owned by?
nft_total_supply
)nft_tokens
)nft_supply_for_owner
)nft_tokens_for_owner
)whose_token
)README.md
summarizing the core logic and functionalities of the smart contractWrite comprehensive Git docs documenting both gas-less and gas-fee methods featured in the smart contract. Write thorough docs for developers who might fork the project as well.
Currently the 2 smart contract for the NEARoracle dApp are stored in 2 distinct GitHub Repos. Merge such repos, standardize files in the root directory and store the codebase of each contract in subdirectory.
Ensure both smart contracts meets the NEAR nomicon.io standards.
contract-nft
: Ensure you've included the standard functions in your rust files:
contract-storescore
: Include the standard functions in the file:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.