README
ARCx Contracts
A synthetic asset protocol where you can use one or many collateral types to output a single synthetic token. For more information read here: https://docs.google.com/document/d/1bZsaxeCzUSdfrZdnRJj5NXeQ9lJqTbwxw1SXGM_BZvI/edit#.
Architecture
The two core debt systems are known as Mozart and Spritz. Mozart is our latest debt system and introduces an interest rate & savings functionality (MozartSavings). A synthetic asset is defined by the Synthetic Token that it outputs. A Synthetic can have multiple addresses which are minters. A minter can be a Core system, Savings system or EOA. In Mozart's case, MozartCoreV1.sol is the core system which represents all the state and data for a collateral type. Multiple core systems can be added to a Synthetic token which in effect creates a synth with multiple collaterals backing it.
We like to view the Core system as a single file which contains all the functionality needed to mint. This implementation is optimised around two key principles, simplicity and efficiency. Apart from an oracle source and collateral token, each core system has no outside dependencies.
Warning
This is experimental, beta software and is provided on an "as is" and "as available" basis. We do not give any warranties and will not be liable for any loss, direct or indirect through continued use of this code.
Developers
Our contracts were written in Solidity and our tests in TypeScript.
If you want to contribute, familiarity with Hardhat, Ethers, Waffle and TypeChain is needed.
Pre Requisites
Before running any command, make sure to install dependencies:
$ yarn install
Build
Compile the smart contracts with Buidler and generate TypeChain artifacts:
$ yarn build
Lint Solidity
Lint the Solidity code:
$ yarn lint:sol
Test Unit
Run the unit tests:
$ yarn test
Coverage
Generate the code coverage report:
$ yarn coverage
Clean
Delete the smart contract artifacts, the coverage reports and the Buidler cache:
$ yarn clean
Discussion
For any concerns or feedback, open an issue or visit us on Discord to discuss.
Mainnet contract deployment checklist
- Run
yarn clean && yarn build - Ensure all tests pass
- Ensure there are no outstanding PRs in regards to the contract that is to be deployed
- The contract is successfully deployed on Rinkeby
- Is verified on Etherscan on Rinkeby
- Go to https://ethgasstation.info/ and set the fast gas price you see there in
hardhat.config.tsunder themainnetkey - Send it
Verifying contracts with solc and Sourcify
Sourcify is a nice tool to verify your contracts on different chains. To use it, you must deploy your contract on the chain you want, generate its metadata file then upload that file on the Sourcify website.
To generate the metadata file, you must first install solc. The easiest way to do so is with
docker (see here).
After you installed docker, simply run this command:
docker run \
-v `pwd`:/contracts \
--platform linux/amd64 \
ethereum/solc:0.8.4 \
@openzeppelin=/contracts/node_modules/@openzeppelin \
--metadata --metadata-literal \
/contracts/<path to your .sol file> \
-o /contracts/output \
--allow-paths /contracts/contracts, \
--optimize
For example, to compile SapphirePassportScores.sol, you can run:
docker run \
-v `pwd`:/contracts \
--platform linux/amd64 \
ethereum/solc:0.8.4 \
@openzeppelin=/contracts/node_modules/@openzeppelin \
--metadata --metadata-literal \
/contracts/contracts/sapphire/SapphirePassportScores.sol \
-o /contracts/output \
--allow-paths /contracts/contracts, \
--optimize
Once the <contract name>_meta.json file was created (under output/), simply upload it on
sourcify.dev and you're done!