@finmath.net/sdc
v0.4.4
Published
Solidity Smart Derivative Contracts
Downloads
181
Maintainers
Readme
SDC Solidity implementation
Description
The reference SDC implementation can be unit tested with Hardhat to understand the trade process logic.
Compile and run tests with Hardhat
We provide the essential steps to compile the contracts and run the provided unit tests.
Provided Contracts and Tests
contracts/ISDC.sol
- Interface contractcontracts/SDCSingleTrade.sol
- SDC abstract contract for an OTC Derivative (single trade case only)contracts/SDCSingleTradePledgedBalance.sol
- SDC full implementation for an OTC Derivative (single trade case only)contracts/IERC20Settlement.sol
- Interface (extending the ERC-20) for settlement tokens used inSDCPledgedBalance
.contracts/ERC20Settlement.sol
- Mintable settlement token contract implementingIERC20Settlement
for unit teststest/SDCTests.js
- Unit tests for the life-cycle of the sdc implementation
Compile and run tests with Hardhat
Install dependencies:
npm i
Compile:
npx hardhat compile
Run all tests:
npx hardhat test
Configuration files
package.js
- Javascript package definition.hardhat.config.js
- Hardhat config.
Used javascript-based testing libraries for solidity
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.