use-ink / ink-examples Goto Github PK
View Code? Open in Web Editor NEWA set of examples for ink! smart contract language. Happy hacking!
Home Page: https://use.ink
License: The Unlicense
A set of examples for ink! smart contract language. Happy hacking!
Home Page: https://use.ink
License: The Unlicense
Currently our CI config is:
platform:
- ubuntu_20_64_core
- macos-latest
Please add windows_server_64_core
and see if it works.
Hello,
I follow this instruction to deploy an upgradable contract link. When I have to deploy the contract only gives me 2 methods flip and get. When I want to change the forward contract to invoke the change_forward_address method, the method Disappeared. Please help
The code is already available here: https://github.com/xermicus/call_solidity.
Needs to be ported to ink! 4.0 and a README needs to be added.
cd trait-dyn-cross-contract-calls/contracts/incrementer
cargo contract build
the error is :
Compiling trait-incrementer v4.0.0 (/private/var/folders/q3/qpr18mtx5pzdfzdp282189gw0000gn/T/cargo-contract_LdIgay/contracts/incrementer) error: the#[global_allocator]` in ink_allocator conflicts with global allocator in: ink_allocator
error[E0152]: duplicate lang item in crate ink_env (which ink depends on): panic_impl.
|
= note: the lang item is first defined in crate ink_env (which ink depends on)
= note: first definition in ink_env loaded from /Volumes/E/project/github.com/paritytech/ink-examples/trait-dyn-cross-contract-calls/target/ink/trait_incrementer/wasm32-unknown-unknown/release/deps/libink_env-732c71f7eb8a9501.rlib, /Volumes/E/project/github.com/paritytech/ink-examples/trait-dyn-cross-contract-calls/target/ink/trait_incrementer/wasm32-unknown-unknown/release/deps/libink_env-732c71f7eb8a9501.rmeta
= note: second definition in ink_env loaded from /Volumes/E/project/github.com/paritytech/ink-examples/trait-dyn-cross-contract-calls/target/ink/trait_incrementer/wasm32-unknown-unknown/release/deps/libink_env-d25c2c37eb82aaca.rlib, /Volumes/E/project/github.com/paritytech/ink-examples/trait-dyn-cross-contract-calls/target/ink/trait_incrementer/wasm32-unknown-unknown/release/deps/libink_env-d25c2c37eb82aaca.rmeta
`
the Cargo.toml is as follow; I modity the ink = { path = "/Volumes/E/project/github.com/paritytech/ink/crates/ink", default-features = false };
`
[package]
name = "trait-incrementer"
version = "4.0.0"
authors = ["Parity Technologies [email protected]"]
edition = "2021"
publish = false
[dependencies]
ink = { path = "/Volumes/E/project/github.com/paritytech/ink/crates/ink", default-features = false }
#ink = { path = "../../../../crates/ink", default-features = false }
`
So how can i build this contract。 @cmichi thanks
I have implemented the Multisig wallet and have successfully created an e2e test to check the functionality.
My e2e flow:
invoke_transaction does not error but requirement does not update either.
eval_transaction errors with:
Calling `eval_transaction` failed: CallExtrinsic(Module(ModuleError(<Contracts::ContractReverted>)))
This problem only occurs when calling functions on Multisig. Calling functions on external contracts works.
I got this error while I am deploying erc20 smart contract in swanky dev container. The compilation is successfully done but got this error in deploying
⠋ DeployingError: createType(Balance):: String should not contain decimal points or scientific notation
at createTypeUnsafe (/opt/swanky/node_modules/@polkadot/types-create/cjs/create/type.js:54:22)
at TypeRegistry.createType (/opt/swanky/node_modules/@polkadot/types/cjs/create/registry.js:270:52)
at /opt/swanky/node_modules/@polkadot/api-contract/cjs/Abi/index.js:145:204
at Array.map (<anonymous>)
at Abi.<anonymous> (/opt/swanky/node_modules/@polkadot/api-contract/cjs/Abi/index.js:145:143)
at Object.toU8a (/opt/swanky/node_modules/@polkadot/api-contract/cjs/Abi/index.js:118:95)
at CodePromise.<anonymous> (/opt/swanky/node_modules/@polkadot/api-contract/cjs/base/Code.js:31:169)
at /opt/swanky/node_modules/@polkadot/api-contract/cjs/base/Code.js:45:185
at Object.new (/opt/swanky/node_modules/@polkadot/api-contract/cjs/base/util.js:14:51)
at DeployApi.deploy (/opt/swanky/node_modules/@astar-network/swanky-core/dist/lib/deploy-api.js:19:44)
✖ Error Deploying
The e2e test for the set_code_hash example is failing.
When I run the e2e tests with cargo test --features e2e-tests
I get the following error:
thread 'incrementer::e2e_tests::set_code_works' panicked at 'error on call `sign_and_submit_then_watch_default`: Encode(Error { context: Context { path: LinkedList(Some(Inner { item: Location { inner: Field("determinism") }, prev: LinkedList(None) })) }, kind: CannotFindVariant { name: "Deterministic", expected: 80 } })', /Users/peterwhite/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ink_e2e-4.2.0/src/xts.rs:318:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test incrementer::e2e_tests::set_code_works ... FAILED
It is panicking at the following lines of code:
// When
let new_code_hash = client
.upload("updated_incrementer", &ink_e2e::alice(), None)
.await
.expect("uploading `updated_incrementer` failed")
.code_hash;
cargo-contract-contract 2.2.1-unknown-aarch64-apple-darwin
4.2.0
rustc
tried with:
1.69.0
nightly-2023-03-14
Hello,
I have used the flipper example
But the contracts-ui gives this error with no more explanations.
Probably the contracts rococo was not updated to the ink! 5.0.0, right ?
We need some job to demonstrate effect on contract sizes, like it's done in this job in ink-waterfall, which provides its results in a table like this.
in flipper directory when running:
cargo test --features e2e-tests
getting this error:
--> lib.rs:62:9
|
62 | #[ink_e2e::test]
| ^^^^^^^^^^^^^^^^
|
= help: message: contract build for /home/nikhil/astar/ink-examples/flipper/Cargo.toml failed: Loading of original wasm failed
error: custom attribute panicked
--> lib.rs:94:9
|
94 | #[ink_e2e::test]
| ^^^^^^^^^^^^^^^^
|
= help: message: Once instance has previously been poisoned
warning: unused import: `super::*`
--> lib.rs:57:13
|
57 | use super::*;
| ^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused import: `ink_e2e::build_message`
--> lib.rs:58:13
|
58 | use ink_e2e::build_message;
| ^^^^^^^^^^^^^^^^^^^^^^
warning: `flipper` (lib test) generated 2 warnings
error: could not compile `flipper` (lib test) due to 2 previous errors; 2 warnings emitted
Steps
Hola 👋
Maybe someone help out : )
How do I call migrate
on the set-code-hash-migration
example in upgradable smart contracts?
I thought I can figure it out based on the e2e test example.
But I couldn't
What command I have to hammer in my terminal to make the example work?
Thats my current status
e2e_test_frank.sh Is the bash version of the end to test.
Best regards,
Frank 🌤️
A question that developers writing ink! contracts regularly ask is: How can I see the test coverage?
We should add a CI stage that outputs the test coverage of each example.
Tracking issue to reflect this goal on the Parity Roadmap.
I am facing this issue please anyone here who guide me how I solve this.
When running the e2e-test and trying out the contract I get the following error:
E2e-test:
thread 'delegator::e2e_tests::e2e_delegator' panicked at 'error on ws request
upload_code
: Rpc(ClientError(Call(Custom(ErrorObject { code: ServerError(-32000), message: "Client error: Execution failed: Runtime panicked: Bad input data provided to upload_code: Input buffer has still data left after decoding!", data: None }))))', /Users/parity/.cargo/registry/src/github.com-1ecc6299db9ec823/ink_e2e-4.0.1/src/xts.rs:333:17
Running the contract:
tokio-runtime-worker jsonrpsee_server::transport::ws: WS transport error: i/o error: Socket is not connected (os error 57); terminate connection: 8
UI : https://contracts-ui.substrate.io/instantiate
Error :
StorageDepositLimitExhausted
More storage was created than allowed by the storage deposit limit.
Example contract - https://github.com/paritytech/ink-examples/tree/main/dns
There's a broken link on the use.ink website.
At https://use.ink/examples/smart-contracts if we click on view example
for Cross-contract calls we end up with 404
Due to use-ink/cargo-contract#1190 we now need to update examples to use checked arithmetic operations
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.