Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Smart Contracts

This directory contains example smart contracts. The contracts are written in Rust using the ink! framework. ink! is an Embedded Domain Specific Language (EDSL) that uses attribute macros within standard Rust to define smart contracts.

Prerequisites

Install cargo-contract:

cargo install cargo-contract

Usage

Existing contracts

Change into the contracts directory:

cd hello_world

Build the contracts:

cargo contract build

Run the tests:

cargo test

New contracts

Create a new contract:

cargo contract new <contract-name>

Write the contract in the generated lib.rs file.

Build and run tests like above.

Deploy

Deploy the contract to the local testnet:

cargo contract upload

Interact

Interact with the contract on the local testnet:

cargo contract call

Useful resources