Skip to content

Commit

Permalink
better abstraction for invariants
Browse files Browse the repository at this point in the history
  • Loading branch information
coolhill committed Feb 25, 2022
1 parent b63c5bc commit 08dd9f2
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 269 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ deployments/hardhat
deployments/docker
subgraph/generated
subgraph/tests/.bin/*
crytic-export/
corpus/
10 changes: 10 additions & 0 deletions contracts/echidna/Addresses.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.8.10;

import "../Vault.sol";
import "../test/TestERC20.sol";

contract Addresses {
Vault vault = Vault(0x6A4A62E5A7eD13c361b176A5F62C2eE620Ac0DF8);
TestERC20 underlying = TestERC20(0x1dC4c1cEFEF38a777b15aA20260a54E584b16C48);
}
19 changes: 19 additions & 0 deletions contracts/echidna/Echidna_Deposit_Withdraw.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.8.10;
import "./Helper.sol";

contract Echidna_Deposit_Withdraw is Helper {

// zero address should always revert
function withdraw_zero_address_recipient(uint256[] memory _ids) public {
withdraw_should_revert(address(0), _ids);
}

function withdraw_should_revert(address recipient, uint256[] memory _ids) internal {
try vault.withdraw(recipient, _ids) {
assert(false);
} catch {
assert(true);
}
}
}
5 changes: 5 additions & 0 deletions contracts/echidna/Echidna_Deposit_Withdraw.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
initialize: contracts/echidna/init.json
coverage: true
testMode: assertion
corpusDir: 'corpus'
codeSize: 0xfffffffffff
8 changes: 8 additions & 0 deletions contracts/echidna/Helper.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.8.10;
import "./Addresses.sol";

contract Helper is Addresses {


}
25 changes: 25 additions & 0 deletions contracts/echidna/init.json

Large diffs are not rendered by default.

13 changes: 0 additions & 13 deletions contracts/test/EchidnaVault.sol

This file was deleted.

4 changes: 0 additions & 4 deletions contracts/test/EchidnaVault.yml

This file was deleted.

24 changes: 0 additions & 24 deletions contracts/test/seed/EchidnaVault.json

This file was deleted.

228 changes: 0 additions & 228 deletions test/EchidnaVault.spec.ts

This file was deleted.

0 comments on commit 08dd9f2

Please sign in to comment.