This little project aims to implement SDC settlement logic in a very lean way focussing solely on a integrative solidity based implementation as much as possible. In the first version the project contains four contracts.
Sample Unit Testing in solidity will be provided soon. Simple Tests as minting EUR Tokens and Inception of an SDC as well as inception of single SDC Trades to come.
Two implementations are available:
- A more native ERC20 implementation containing three contracts: SDC, Ledger, Valuation Oracle
- A ERC1155 implementation where entire functionality is contained in one contract
A good getting started can be found here We provide the essential steps in the following, assuming NodeJS 14.x LTS ist installed.
- Check out project
- Go to folder and initalise a new npm project:
npm init -y
. A basicpackage.json
file should occur - Install Hardhat as local solidity dev environment:
npx hardhat
- Select: Create an empty hardhat.config.js and change solidity compiler version to 0.8.4
- Install Hardhat as a development dependency:
npm install --save-dev hardhat
- Install further testing dependencies:
npm install --save-dev @nomiclabs/hardhat-waffle @nomiclabs/hardhat-ethers ethereum-waffle chai ethers solidity-coverage
- add plugins to hardhat.config.ts:
require("@nomiclabs/hardhat-waffle");
require('solidity-coverage');
- Adding commands to
package.json
:
"scripts": {
"build": "hardhat compile",
"test:light": "hardhat test",
"test": "hardhat coverage"
},
- run
npm run build
- run
npm run test
ethereum-waffle
: Waffle is a Solidity testing library. It allows you to write tests for your contracts with JavaScript.chai
: Chai is an assertion library and provides functions like expect.ethers
: This is a popular Ethereum client library. It allows you to interface with blockchains that implement the Ethereum API.solidity-coverage
: This library gives you coverage reports on unit tests with the help of Istanbul.