Skip to content

paritytech/contracts-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Utility repository for building and deploying smart contracts.

Quick start

Prerequisites

We will use deno, a modern alternative to Node that can work with TypeScript out of the box. You can install it by running:

curl -fsSL https://deno.land/install.sh | sh

Building contracts

We can now compile the contracts located in the contracts/ directory:

deno task build [--filter <contract-name>] [--clean]

This does the following:

  • Compile the bytecode for each contract into codgen/bytecode/*
  • Generate the abi for each contract into codgen/abi/*.ts and the index codegen/abis.ts

Deploying contracts

Before you can deploy contracts, let's copy the .env.example file to .env and fill in the required environment variables.

cp .env.example .env

Update tools/deploy.ts to include new contracts you want to deploy. Make sure to specify the constructor arguments and the value, if needed.

Deploying to Testnet

To deploy to Westend Testnet, you will need to specify the TESTNET_PRIVATE_KEY. Check the instructions here to connect with your wallet and request funds.

Deploying to a local chain

For local development, checkout the instructions here to setup and start a local chain.

Note: You can also test against geth, the deployment code, will detect the chain and deploy the right bytecode (evm or pvm).

Local deployments will use the account 0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac already configured in your .env file, This account is pre-funded at genesis, so you can use it to deploy contracts.

Now that you have the environment variables setup, ensure that your chain is running and deploy the contracts by running:

deno task deploy [--filter <contract-name>]

This command will update the codegen/addresses.ts file with the deployed contract addresses, so that you can easily reference them in your apps.

Run cli

There is an example cli in the cli directory that you can run to interact with the deployed contracts.

./cli/dao-hack.ts

Learn more

About

No description, website, or topics provided.

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •