-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d454365
commit f376059
Showing
8 changed files
with
110 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "lib/forge-std"] | ||
path = lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[profile.default] | ||
src = 'contracts' | ||
out = 'out' | ||
libs = ['node_modules', 'lib'] | ||
test = 'test' | ||
cache_path = 'cache_forge' | ||
solc = '0.8.18' | ||
|
||
[fuzz] | ||
runs = 1_000 | ||
depth = 100 | ||
|
||
# Extreme Fuzzing CI Profile | ||
[profile.ci] | ||
runs = 100_000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@ensdomains/=node_modules/@ensdomains/ | ||
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/ | ||
@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/ | ||
ds-test/=lib/forge-std/lib/ds-test/src/ | ||
eth-gas-reporter/=node_modules/eth-gas-reporter/ | ||
forge-std/=lib/forge-std/src/ | ||
hardhat/=node_modules/hardhat/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.18; | ||
|
||
import {Test} from "forge-std/Test.sol"; | ||
import {console} from "forge-std/console.sol"; | ||
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
|
||
import "../contracts/USDM.sol"; | ||
|
||
contract UUPSProxy is ERC1967Proxy { | ||
constructor(address _implementation, bytes memory _data) | ||
ERC1967Proxy(_implementation, _data) | ||
{} | ||
} | ||
|
||
contract Handler { | ||
USDM public usdm; | ||
|
||
constructor(USDM _usdm) { | ||
usdm = _usdm; | ||
} | ||
} | ||
|
||
contract USDMInvariants is Test { | ||
USDM implementation; | ||
UUPSProxy proxy; | ||
USDM usdm; | ||
Handler handler; | ||
|
||
function setUp() public { | ||
// deploy implementation contract | ||
implementation = new USDM(); | ||
|
||
// deploy proxy contract and point it to implementation | ||
proxy = new UUPSProxy(address(implementation), ""); | ||
|
||
// wrap in ABI to support easier calls | ||
usdm = USDM(address(proxy)); | ||
|
||
usdm.initialize("Mountain Protocol USD", "USDM", 0); | ||
|
||
handler = new Handler(usdm); | ||
|
||
// targetContract(address(handler)); | ||
// targetContract(address(implementation)); | ||
} | ||
|
||
function invariant_totalSupply() public { | ||
assertEq(usdm.balanceOf(address(this)), usdm.totalSupply()); | ||
} | ||
|
||
function invariant_totalShares() public { | ||
assertEq(usdm.sharesOf(address(this)), usdm.totalShares()); | ||
} | ||
|
||
function invariant_totalShares_totalSupply() public { | ||
assertEq(usdm.totalSupply(), usdm.totalShares()); | ||
} | ||
} |