This repository contains crates of chain-extension that you can use in your contracts.
In crates
folder you will find the chain-extension struct that implements callable functions.
In examples
folder you will find full implementation of the chain-extension struct and its integration tests in tests
folder
This crate exposes AssetsExtension
struct that implement all functions of pallet-assets chain-extension.
Usage
- add
assets_extension
in yourCargo.toml
and to thestd
features
assets_extension = { git = "https://github.com/swanky-dapps/chain-extension-contracts", default-features = false }
[features]
default = ["std"]
std = [
"ink_metadata/std",
"ink/std",
"scale/std",
"scale-info/std",
"assets_extension/std",
]
- Add use statement in your contract module
use assets_extension::*;
- Use struct functions directly in your contract
AssetsExtension::create(Origin::Address, asset_id, contract, min_balance)
Note: For now only call as contract Origin::Address
is supported
This crate exposes DappsStaking
struct that implement all functions of dapps-staking chain extension.
Usage
- add
dapps_staking_extension
in yourCargo.toml
and to thestd
features
dapps_staking_extension = { git = "https://github.com/swanky-dapps/chain-extension-contracts", default-features = false }
[features]
default = ["std"]
std = [
"ink_metadata/std",
"ink/std",
"scale/std",
"scale-info/std",
"dapps_staking_extension/std"
]
- Add use statement in your contract module
pub mod staking_example {
use dapps_staking_extension::*;
...
- Use struct functions directly in your contract
DappsStaking::read_unbonding_period()
Apache 2.0
Use these instructions to set up your ink!/Rust environment
Run this command in the contract folder:
cargo contract build
First start your local node.
Deploy using contracts UI. Instructions on Astar docs
First start your local node.
This repo needs a node version of at least polkadot v0.9.37
Recommended swanky-node 1.4.0
yarn
yarn compile
yarn test