-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from casper-ecosystem/contract-ownership
Implement contract ownership and metadata validation
- Loading branch information
Showing
29 changed files
with
3,041 additions
and
648 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Session code for the Balance entry point | ||
|
||
Utility session code meant for interacting with the `balance_of` entry point on the main enhanced NFT contract. | ||
The `balance_of` session code calls the relevant entry point and saves the amount of tokens owned by either an `Account` | ||
or `Contract` and saves the value in the `NamedKeys` of `Account` executing the session code. | ||
|
||
|
||
## Compiling session code | ||
|
||
The session code can be compiled to Wasm by running the `make build-contract` command provided in the Makefile at the top level. | ||
The Wasm will be found in the `client/balance_of_session/target/wasm32-unknown-unknown/release` as `balance_of.wasm`. | ||
|
||
## Usage | ||
|
||
The `balance_of` session code takes in the following required runtime arguments. | ||
|
||
* `nft_contract_hash`: The hash of a given Enhanced NFT contract passed in as a `Key`. | ||
* `token_owner`: The `Key` of either the `Account` or `Contract` whose balance is being queried. | ||
* `key_name`: The name for the entry within the `NamedKeys` under which the token amount will be stored, passed in as a `String`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Session code for get_approved | ||
|
||
Utility session code for interacting with the `get_approved` entry point present on the enhanced NFT contract. It returns | ||
a `Key` if a given NFT is approved to be spent by another `Account` or `Contract` apart from the owner of the | ||
NFT itself. It returns `Some(Key)` if there is an approved spender, `None` if there is no spender. | ||
|
||
## Compiling session code | ||
|
||
The session code can be compiled to Wasm by running the `make build-contract` command provided in the Makefile at the top level. | ||
The Wasm will be found in the `client/get_approved_session/target/wasm32-unknown-unknown/release` as `get_approved.wasm`. | ||
|
||
## Usage | ||
|
||
The `get_approved` session code takes in the following required runtime arguments. | ||
|
||
* `nft_contract_hash`: The hash of a given Enhanced NFT contract passed in as a `Key`. | ||
* `token_id`: The `id` of the NFT, passed in as a `u64`. | ||
* `key_name`: The name for the entry within the `NamedKeys` under which `Option<Key>` value is stored, passed in as a `String`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Session code for minting | ||
|
||
Utility session code for interacting with the `mint` entry point present on the enhanced NFT contract. The session code retrieves | ||
the read only reference and inserts the reference under the executing `Account`s `NamedKeys`. | ||
|
||
## Compiling session code | ||
|
||
The session code can be compiled to Wasm by running the `make build-contract` command provided in the Makefile at the top level. | ||
The Wasm will be found in the `client/mint_session/target/wasm32-unknown-unknown/release` as `mint_call.wasm`. | ||
|
||
## Usage | ||
|
||
The `mint_call` session code takes in the following required runtime arguments. | ||
|
||
* `nft_contract_hash`: The hash of a given Enhanced NFT contract passed in as a `Key`. | ||
* `token_owner`: The `Key` of the owner for the NFT to be minted. Note, this argument is ignored in the `Ownership::Minter` mode. | ||
* `token_metadata`: The metadata describing the NFT to be minted, passed in as a `String`. | ||
* `token_uri`: The URI for the off-chain resource represented by the NFT to be minted, passed in as a `String` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "minting_contract" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
casper-contract = "1.4.3" | ||
casper-types = "1.4.5" | ||
|
||
[[bin]] | ||
name = "minting_contract" | ||
path = "src/main.rs" | ||
bench = false | ||
doctest = false | ||
test = false | ||
|
||
[profile.release] | ||
codegen-units = 1 | ||
lto = true |
Oops, something went wrong.