Skip to content

Latest commit

 

History

History
85 lines (59 loc) · 3.06 KB

README.md

File metadata and controls

85 lines (59 loc) · 3.06 KB

Pop DRink!

R0GUE Logo

Twitter URL Twitter URL Telegram

Forked version of inkdevhub/drink for E2E testing of smart contract using the Pop API on Pop Network.

Overview

About the repository folder structure:

  • pop-drink: Library for testing contracts deployed on Pop Network using drink.
  • drink: drink is a toolbox for ink! developers to test contracts in a sandbox environment.
  • ink-sandbox: Creates a sandbox environment for a given runtime, without having to run a node.
  • examples: A collection of example contracts tested with drink.
  • drink-cli: Simple command line tool to help you play with your local contracts in a convenient way.

Getting Started

Add pop-drink crate to your contract Cargo.toml:

drink = { version = "1.0.0",  package = "pop-drink" }

Set up your pop-drink test environment and write your first test.

use drink::{
    devnet::{AccountId, Balance, Runtime},
    TestExternalities,
    deploy, call,
};


// Builds your contract(s).
#[drink::contract_bundle_provider]
enum BundleProvider {}

/// Sandbox environment for Pop Devnet Runtime.
pub struct Pop {
    ext: TestExternalities,
}

// Initialising genesis state.
impl Default for Pop {
    fn default() -> Self {
        let balances: Vec<(AccountId, Balance)> = vec![(ALICE, 100u128)];
        let ext = BlockBuilder::<Runtime>::new_ext(balances);
        Self { ext }
    }
}

// Implement core functionalities for the `Pop` sandbox.
drink::impl_sandbox!(Pop, Runtime, ALICE);

// Write your first pop-drink test!
#[drink::test(sandbox = Pop)]
fn test(mut session: Session) { ... }

Important: run your tests with --release

cargo test --release

Learn more

Dive into the "quick start with drink!" to learn more about drink. Also check out the other examples provided by drink.

If you are interested in learning more about testing contracts using the Pop API, check out the example contracts tested with pop-drink!

Support

Be part of our passionate community of Web3 builders. Join our Telegram!

Feel free to contribute to drink or pop-drink to help improve testing ink! smart contracts!

For any questions related to ink! you can also go to Polkadot Stack Exchange or ask the ink! community.