Skip to content

Commit

Permalink
Renaming + Certora adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
sunbreak1211 committed Aug 27, 2024
1 parent 56e2dd6 commit f9da49f
Show file tree
Hide file tree
Showing 23 changed files with 612 additions and 601 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/certora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
strategy:
fail-fast: false
matrix:
nst:
- nst
- nst-join
- dai-nst
usds:
- usds
- usds-join
- dai-usds

steps:
- name: Checkout
Expand All @@ -38,7 +38,7 @@ jobs:
- name: Install Certora
run: pip3 install certora-cli-beta

# - name: Verify ${{ matrix.nst }}
# run: make certora-${{ matrix.nst }}
# env:
# CERTORAKEY: ${{ secrets.CERTORAKEY }}
- name: Verify ${{ matrix.usds }}
run: make certora-${{ matrix.usds }}
env:
CERTORAKEY: ${{ secrets.CERTORAKEY }}
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PATH := ~/.solc-select/artifacts/solc-0.8.21:~/.solc-select/artifacts:$(PATH)
certora-nst :; PATH=${PATH} certoraRun certora/Nst.conf$(if $(rule), --rule $(rule),)
certora-nst-join :; PATH=${PATH} certoraRun certora/NstJoin.conf$(if $(rule), --rule $(rule),)
certora-dai-nst :; PATH=${PATH} certoraRun certora/DaiNst.conf$(if $(rule), --rule $(rule),)
certora-usds :; PATH=${PATH} certoraRun certora/Usds.conf$(if $(rule), --rule $(rule),)
certora-usds-join :; PATH=${PATH} certoraRun certora/UsdsJoin.conf$(if $(rule), --rule $(rule),)
certora-dai-usds :; PATH=${PATH} certoraRun certora/DaiUsds.conf$(if $(rule), --rule $(rule),)
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# NST Token and contracts associated
# USDS Token and contracts associated

This repository includes 3 smart contracts:

- NST token
- NstJoin
- DaiNst Converter
- USDS token
- UsdsJoin
- DaiUsds Converter

### NST token
### USDS token

This is a standard erc20 implementation with regular `permit` functionality + EIP-1271 smart contract signature validation.

The token uses the ERC-1822 UUPS pattern for upgradeability and the ERC-1967 proxy storage slots standard.
It is important that the `NstDeploy` library sequence be used for deploying the token.
It is important that the `UsdsDeploy` library sequence be used for deploying the token.

#### OZ upgradeability validations

The OZ validations can be run alongside the existing tests:
`VALIDATE=true forge test --ffi --build-info --extra-output storageLayout`

### NstJoin
### UsdsJoin

This is the contract in charge of `mint`ing the erc20 IOUs in exchange of native `vat.dai` balance. It also manages the reverse operation, `burn`ing tokens and releasing `vat.dai`.
A noticeable code difference against `DaiJoin` is this contract doesn't have any permissions system at all.
However, in practice, `NstJoin` acts the exact same way as the production `DaiJoin` implementation. This is because there isn't any `wards(address)` set there.
However, in practice, `UsdsJoin` acts the exact same way as the production `DaiJoin` implementation. This is because there isn't any `wards(address)` set there.

### DaiNst
### DaiUsds

It is a permissionless converter between `Dai` and `Nst` (both ways). Using the `public` functions of `NstJoin` and `DaiJoin` moves from one token to the other. The exchange rate is 1:1.
It is a permissionless converter between `Dai` and `Usds` (both ways). Using the `public` functions of `UsdsJoin` and `DaiJoin` moves from one token to the other. The exchange rate is 1:1.
It is just a "convenience" contract, users could still get the same outcome executing the separate methods in the `join`s or use any other converter implementation.
6 changes: 3 additions & 3 deletions certora/DaiJoinMock.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pragma solidity ^0.8.21;

import "../src/NstJoin.sol";
import "../src/UsdsJoin.sol";

contract DaiJoinMock is NstJoin {
constructor(address vat_, address dai_) NstJoin(vat_, dai_) {}
contract DaiJoinMock is UsdsJoin {
constructor(address vat_, address dai_) UsdsJoin(vat_, dai_) {}
}
4 changes: 2 additions & 2 deletions certora/DaiMock.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pragma solidity ^0.8.21;

import "../src/Nst.sol";
import "../src/Usds.sol";

contract DaiMock is Nst {
contract DaiMock is Usds {

}
224 changes: 0 additions & 224 deletions certora/DaiNst.spec

This file was deleted.

28 changes: 14 additions & 14 deletions certora/DaiNst.conf → certora/DaiUsds.conf
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
{
"files": [
"src/DaiNst.sol",
"src/NstJoin.sol",
"src/Nst.sol",
"src/DaiUsds.sol",
"src/UsdsJoin.sol",
"src/Usds.sol",
"certora/DaiJoinMock.sol",
"certora/DaiMock.sol",
"certora/VatMock.sol",
],
"link": [
"DaiNst:nstJoin=NstJoin",
"DaiNst:nst=Nst",
"DaiNst:daiJoin=DaiJoinMock",
"DaiNst:dai=DaiMock",
"NstJoin:nst=Nst",
"NstJoin:vat=VatMock",
"DaiJoinMock:nst=DaiMock",
"DaiUsds:usdsJoin=UsdsJoin",
"DaiUsds:usds=Usds",
"DaiUsds:daiJoin=DaiJoinMock",
"DaiUsds:dai=DaiMock",
"UsdsJoin:usds=Usds",
"UsdsJoin:vat=VatMock",
"DaiJoinMock:usds=DaiMock",
"DaiJoinMock:vat=VatMock"
],
"rule_sanity": "basic",
"solc": "solc-0.8.21",
"solc_optimize_map": {
"DaiNst": "200",
"NstJoin": "200",
"Nst": "200",
"DaiUsds": "200",
"UsdsJoin": "200",
"Usds": "200",
"DaiJoinMock": "0",
"DaiMock": "0",
"VatMock": "0"
},
"verify": "DaiNst:certora/DaiNst.spec",
"verify": "DaiUsds:certora/DaiUsds.spec",
"prover_args": [
"-mediumTimeout 180"
],
Expand Down
Loading

0 comments on commit f9da49f

Please sign in to comment.