Smart contracts for the Norges Bank CBDC sandbox
Disclaimer
This a sandbox project and not intended for production; use at your own risk.
Running locally
Installation
The repository may be cloned locally and installation triggered as follows.
git clone git@github.com:nahmii/nb-sandbox-contracts.git
cd nb-sandbox-contracts
npm install --ignore-scripts
NOTE: The reason for installing with the
--ignore-scripts
option is first and foremost to prevent the post-install script of package @consensys/universal-token from running. For the usage of @consensys/universal-token as dependency in this project the execution ofpostinstall
is obsolete.
Compilation
The smart contract code base may be compiled with
npm run compile
Testing
In order to take the smart contracts for a test drive you may invoke
npx hardhat test --parallel
Development
To run development environment with hardhat Cmd + Shift + P
and select Tasks: Run Task
and select dev
.
Build NPM package
To release NPM package, do
-
Cmd + Shift + P
, - select
Tasks: Run Task
and - select
release
.env
variables. This is because the release updates the addresses to the contracts and it is crucial that everyone has the same information. Please share the contents of the .env
file with other deployers through chat or any other preferred method of communication. This will help ensure that everyone is working with the most up-to-date information and that the deployment process runs smoothly.
Alternatively, you can use terminal:
NPM package is used to distribute the smart contract types and contract address instances to other projects e.g. dsp-wallet.
In order to build a NPM package for the smart contracts you may invoke
npx hardhat generate-npm-package
This is automatically invoked as part of the npm hardhat deploy-all --network […]
and npx hardhat release
(all networks) command.
Use in local development
Edit package.json dependency of your repot to point to this repo. Like this (one level up), if the two projects foleders reside side by side.
"@symfoni/cbdc-contracts": "file:../cbdc-sandbox-contracts-shared",