Giter Site home page Giter Site logo

use-ink / ink-examples Goto Github PK

View Code? Open in Web Editor NEW
90.0 8.0 45.0 10.89 MB

A set of examples for ink! smart contract language. Happy hacking!

Home Page: https://use.ink

License: The Unlicense

Rust 61.52% Shell 0.04% HTML 0.47% JavaScript 0.62% TypeScript 36.73% CSS 0.63%
blockchain examples kusama polkadot rust smart-contracts substrate wasm

ink-examples's People

Contributors

0xf333 avatar agryaznov avatar ascjones avatar cmichi avatar dependabot[bot] avatar doubleotheven avatar fishmonger45 avatar peetzweg avatar pgherveou avatar sergejparity avatar skymanone avatar smiasojed avatar tenuki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ink-examples's Issues

Error: while deploy erc20 contract

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

e2e tests are failing

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

change_forward_address method Disappeared

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

Error in delegator example

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

ERROR: Error invoking `cargo metadata` for Cargo.toml Caused by: `cargo metadata` exited with an error: error: failed to get `dia-oracle-getter` as a dependency of package `stable_coin_contract v4.0.0-beta.1 (/home/blockchain/myproject/coin)` Caused by: failed to load source for dependency `dia-oracle-getter` Caused by: Unable to update /home/blockchain/myproject/oracle-contracts/oracle-getter Caused by: failed to read `/home/blockchain/myproject/oracle-contracts/oracle-getter/Cargo.toml` Caused by: No such file or directory (os error 2)

I am facing this issue please anyone here who guide me how I solve this.

build ink-example /trait-dyn-cross-contract-calls fail

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

`ink-examples/set_code_hash` e2e failing

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 version: cargo-contract-contract 2.2.1-unknown-aarch64-apple-darwin
  • ink! version: 4.2.0
    -rustc tried with:
    • stable 1.69.0
    • nightly nightly-2023-03-14

CI: Display test coverage of each example

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.