smart-contracts
: getting started
Overview
The smart-contracts
NPM package contains the Solidity extensions for working with =nil;. The package includes four contracts:
- Faucet.sol is a service contract for distributing tokens
- Nil.sol is the extension library that allows for making async calls and performing other essential operations
- NilTokenBase.sol is the base contract for custom tokens on the cluster
- SmartAccount.sol is the default smart account that is deployed by the =nil; CLI and Nil.js
Installation and usage
To install the package:
- npm
- yarn
npm install @nilfoundation/smart-contracts
yarn add @nilfoundation/smart-contracts
To use the package, simply import the required contract in a project.
In a JS/TS project:
import SmartAccount_compiled from '@nilfoundation/smart-contracts/artifacts/SmartAccount.json';
const smartAccount_bytecode = `0x${SmartAccount_compiled.evm.bytecode.object}`
In a Solidity smart contract:
pragma solidity ^0.8.0;
import "@nilfoundation/smart-contracts/contracts/SmartAccount.sol";