Unverified Commit 4712ff2f authored by Ricardo Rius's avatar Ricardo Rius Committed by GitHub
Browse files

Add Erc721 Example (#337)



* Add Erc721 example with ink2.0 syntax

* Remove all println lines

* Remove use dynamic storage

update operator_approvals to <(AccountId, AccountId), bool>

* Remove all none_account related code

* Update author to Parity

* Add ink_prelude declared

* Update owned_tokens_count to AccountId -> u32

* Update tokenId from Hash to TokenId(u32)

* rebase example

* Initial migration to latest ink

* Fix approval

* Move approval

* Remove config file

* Add some tests

* Add more tests

* Patch approve

* Some fixes

* Add docs

* Update examples/erc721/Cargo.toml

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update docs

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Update examples/erc721/src/lib.rs

Co-Authored-By: default avatarHero Bird <robin.freyler@gmail.com>

* Fix ids

* Update docs

* Update examples/erc721/src/lib.rs

* Update examples/erc721/src/lib.rs

* fix fmt

* fix fmt 2

* fix fmt 3

Co-authored-by: default avatarXatMassacrE <xxat.massacre@gmail.com>
Co-authored-by: default avatarHero Bird <robin.freyler@gmail.com>
parent 24109d05
Pipeline #82805 passed with stages
in 10 minutes and 55 seconds
# Ignore build artifacts from the local tests sub-crate.
/target/
# Ignore backup files creates by cargo fmt.
**/*.rs.bk
# Remove Cargo.lock when creating an executable, leave it for libraries
# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
Cargo.lock
\ No newline at end of file
[package]
name = "abi-gen"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
publish = false
[[bin]]
name = "abi-gen"
path = "main.rs"
[dependencies]
contract = { path = "../..", package = "erc721", default-features = false, features = ["ink-generate-abi"] }
ink_lang = { path = "../../../../lang", default-features = false, features = ["ink-generate-abi"] }
serde = "1.0"
serde_json = "1.0"
fn main() -> Result<(), std::io::Error> {
let abi = <contract::Erc721 as ink_lang::GenerateAbi>::generate_abi();
let contents = serde_json::to_string_pretty(&abi)?;
std::fs::create_dir("target").ok();
std::fs::write("target/metadata.json", contents)?;
Ok(())
}
[package]
name = "erc721"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
ink_primitives = { path = "../../primitives", default-features = false }
ink_abi = { path = "../../abi", default-features = false, features = ["derive"], optional = true }
ink_core = { path = "../../core", default-features = false }
ink_lang = { path = "../../lang", default-features = false }
scale = { package = "parity-scale-codec", version = "1.2", default-features = false, features = ["derive"] }
type-metadata = { git = "https://github.com/type-metadata/type-metadata.git", default-features = false, features = ["derive"], optional = true }
[lib]
name = "erc721"
crate-type = [
# Used for normal contract Wasm blobs.
"cdylib",
# Used for ABI generation.
"rlib",
]
[features]
default = ["test-env"]
std = [
"ink_primitives/std",
"ink_abi/std",
"ink_core/std",
"scale/std",
"type-metadata/std",
]
test-env = [
"std",
"ink_lang/test-env",
]
ink-generate-abi = [
"std",
"ink_abi",
"type-metadata",
"ink_core/ink-generate-abi",
"ink_lang/ink-generate-abi",
]
ink-as-dependency = []
[profile.release]
panic = "abort"
lto = true
opt-level = "z"
overflow-checks = true
[workspace]
members = [
".ink/abi_gen"
]
exclude = [
".ink"
]
This diff is collapsed.
File mode changed from 100755 to 100644
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment