/evm_stablecoin_ds

An upgradeable CDP-based stablecoin using Diamond Standard for EVM Blockchains

Primary LanguageSolidityMIT LicenseMIT

Mojo

Polygon's Native stablecoin

An upgradable, ownable, pausable polygon stablecoin/borrowing smart contract which can be used as a protocol layer.

About

  • It's a Polygon's native stablecoin protocol smart contract.
  • For more, refer Wiki.
  • To launch the protocol, follow Getting Started manual.

Usage

Installation

Install node packages

$ yarn install

Build

Build the smart contracts

$ yarn compile

Contract size

yarn contract-size

Test

Run unit tests

$ yarn test

TypeChain

Compile the smart contracts and generate TypeChain artifacts:

$ yarn typechain

Lint Solidity

Lint the Solidity code:

$ yarn lint:sol

Lint TypeScript

Lint the TypeScript code:

$ yarn lint:ts

Coverage

Generate the code coverage report:

$ yarn coverage

Report Gas

See the gas usage per unit test and average gas per method call:

$ REPORT_GAS=true yarn test

Clean

Delete the smart contract artifacts, the coverage reports and the Hardhat cache:

$ yarn clean

Deploy

Environment variables: Create a .env file with its values in .env.example

Sequence:

  1. Deploy the MojoCustomBase contract.
  2. Deploy the "MojoDiamond.sol" contract with facets & libraries & address of MojoCustomBase contract.
    • "DefaultPool.sol"
    • "ActivePool.sol"
    • "Whitelist.sol"
    • "BorrowerOperations.sol"
  3. Set addresses using setAddresses() function (inside Diamond Proxy SC)
    • only Owner
  1. Add assets as whitelisted for respective pools (active, default, collSurplus) from Whitelist::addCollateral function. Whenever an asset is added, the asset is updated in the pools as well.

localhost

// on terminal-1
$ npx hardhat node

// on terminal-2
$ yarn hardhat run deployment/deploy.main.ts --network rinkeby

ETH Testnet - Rinkeby

  • Deploy the contracts
$ yarn hardhat run deployment/deploy.main.ts --network rinkeby

ETH Mainnet

  • Deploy the contracts
$ yarn hardhat run deployment/deploy.main.ts --network ethmainnet