Unverified Commit 5beaab44 authored by Alexander Theißen's avatar Alexander Theißen Committed by GitHub
Browse files

Add plain multisig wallet example (#327)



* Added a multisig example contract

* Added crate documentation

* Update examples/multisig_plain/lib.rs

shortcut for iter over references

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

* Update examples/multisig_plain/lib.rs

rename ensure_from_owner

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

* Update examples/multisig_plain/lib.rs

renaming

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

* Update examples/multisig_plain/lib.rs

renaming

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

* Update examples/multisig_plain/lib.rs

renaming

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

* renamings

* Better name for internal_confirm

* Renamed id -> trans_id

* Better name for ensure_requirement

* Renamed to confirm_by_caller

* Reformat conform_by_caller

* Remove unwraps in favor of expect

* More documentation

* Added license header

* Fix style issue in documentation

* Updated documentation

* Add warning about not using this in production

* Remove run_test for now as it's not working

* Fix metadata generation

* Use the EnvTypes type alias provided by the contract macro

* fix typo

* Emit Events

* Fix doc typos

* Do actual checking in contract_works test

* Added more tests (currently failing)

* Replace HashMap with BTreeMap

* Add docs regarding privileged wallet messages

* Added tests

* Update examples/multisig_plain/lib.rs

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

* Update examples/multisig_plain/lib.rs

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

* Remove superflous .cargo/config

* Add proper author information to manifest

* Update examples/multisig_plain/lib.rs

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

* Update examples/multisig_plain/lib.rs

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

* Apply suggestions from code review

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

* gas_limit is not measured in Balance

* Update examples/multisig_plain/lib.rs

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

* Switch owners, requirement argument position

* Remove mutate_map and use entry api instead

* Split execute into invoke and eval

This allows for evaluating the result of a call if needed.

* Remove superflous self argument of ensure_requirement_is_valid

* Switch parameterize_call arguments

* Return ConfirmationStatus after doing a confirmation

* Remove superflous insert into confirmation_count

* Rework public documentation

* Missing empty line in docs

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

* Unify exection Events

* Rework add_owner example to have an actual chance of compiling

* Remove redundant closure

Co-authored-by: default avatarHero Bird <robin.freyler@gmail.com>
parent 9e5a3ee0
Pipeline #82423 failed with stages
in 1 minute and 40 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 = "multisig_plain", default-features = false, features = ["ink-generate-abi"] }
ink_lang = { path = "../../../../lang", package = "ink_lang", default-features = false, features = ["ink-generate-abi"] }
serde = "1.0"
serde_json = "1.0"
fn main() -> Result<(), std::io::Error> {
let abi = <contract::MultisigPlain 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 = "multisig_plain"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
ink_abi = { path = "../../abi", default-features = false, features = ["derive"], optional = true }
ink_primitives = { path = "../../primitives", default-features = false }
ink_core = { path = "../../core", default-features = false }
ink_lang = { path = "../../lang", default-features = false }
ink_prelude = { path = "../../prelude", default-features = false }
scale = { package = "parity-scale-codec", version = "1.1", 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 = "multisig_plain"
path = "lib.rs"
crate-type = [
# Used for normal contract Wasm blobs.
"cdylib",
# Used for ABI generation.
"rlib",
]
[features]
default = ["test-env"]
std = [
"ink_abi/std",
"ink_core/std",
"ink_primitives/std",
"ink_prelude/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.
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