Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Commit

Permalink
Feature/fixes validation nonces tests (#83)
Browse files Browse the repository at this point in the history
* implement testMultipleVaultsWithLiensOnTheSameCollateral

* changes to enable multiple loans at once properly

* golf down commitToLien further

* remove dead code

* rm dead code

* more golfing

* refacot our redundant expressions

* fix slot loads for delegate

* cleanup dead state, move storage structs to interface

* gpl pointer update

* restore missing validate in commit to lien, move nonce invalidation into vaults from router

* function to allow enabling allowlist

* test's to prove failure around signatures

* move incrementNonce, add tests

* remove the mapping since we only care about the vault itself

* pack structs

* add strategist shutdown to vault, disables the vault from deposits or commitToLien

* cancel auction flow fixes

* update lib gpl pointer

* loan generator updates, v3 wip

* change releaseTo to use safeTransferFrom, update harness to utilize ERC721Receiver

* refactor to use withdraw proxy object

* modifications for v3

* V3 Lending and Claim Fees flash action added

* migrate collateral token and lien token file methods to use enums

* adding yarn.lock

* router updates to support erc4626

* migrate helpers to use new router flow

* remove snapshot

* update pointer

* updates for postinstall, ffi target, tsconfig changes

* fix test install, update yarn lock

* dont execute postinstall with sh

* build to dist instead of individual

* ignore dist folder

* remove sherlock content block

* remove dummy scripts

* check the vault is valid before decreasing lien epoch count

* cleanup and sherlock fixes

* move imports to remapped style

* pointer update

* added missing guard to vault withdraw, removed vault withdraw from public vault inheritance graph
cleanup and fixes for the PR

one bug remaining with testMultipleVaultsWithLiensOnTheSameCollateral

* flow for withdraw accountants to not deploy t0, logging on the test

* gpl updated

* fix type

Co-authored-by: Joseph Delong <[email protected]>
Co-authored-by: Andrew Redden <=>
  • Loading branch information
androolloyd and dangerousfood authored Nov 15, 2022
1 parent b756427 commit 99d8b34
Show file tree
Hide file tree
Showing 52 changed files with 2,113 additions and 871 deletions.
25 changes: 0 additions & 25 deletions .gas-snapshot

This file was deleted.

7 changes: 2 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ jobs:
token: ${{ secrets.MY_REPO_PAT }}

- uses: actions/setup-node@v2
- run: yarn && npx tsc ./scripts/loanProofGenerator.ts
- run: yarn
- uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
- run: forge test --ffi --no-match-contract ForkedTest

- name: Run snapshot
run: NO_COLOR=1 forge snapshot --ffi >> $GITHUB_STEP_SUMMARY
- run: forge test --ffi --no-match-contract ForkedTest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ coverage.json
typechain
.DS_Store

dist
#Hardhat files
cache
artifacts
Expand Down
12 changes: 0 additions & 12 deletions .sherlock/contest.json

This file was deleted.

8 changes: 0 additions & 8 deletions dummy-scripts/retry.py

This file was deleted.

2 changes: 1 addition & 1 deletion lib/astaria-sdk
2 changes: 1 addition & 1 deletion lib/gpl
Submodule gpl updated from 6cdc23 to ce7d52
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
"private": true,
"main": "index.js",
"dependencies": {
"@openzeppelin/contracts": "^4.6.0",
"@rari-capital/solmate": "^6.2.0",
"global": "^4.4.0",
"hardhat": "^2.9.3",
"hardhat-preprocessor": "^0.1.4",
"hardhat-typechain": "^0.3.5",
"keccak256": "^1.0.6",
"merkletreejs": "^0.2.31",
"solidity-metrics": "^0.0.5",
"ts-generator": "^0.1.1"
"ts-generator": "^0.1.1",
"ts-node": "^10.9.1"
},
"engines": {
"node": "^16.0.0"
Expand All @@ -24,7 +23,7 @@
"lint": "eslint src/**/*.sol",
"lint:fix": "prettier --write src/**/*.sol",
"write-headers": "node scripts/writeHeaders.js",
"postinstall": "cd lib/astaria-sdk && yarn && yarn build"
"postinstall": "bash scripts/postinstall.sh"
},
"devDependencies": {
"@dethcrypto/eth-sdk": "^0.3.3",
Expand All @@ -34,12 +33,9 @@
"@nomiclabs/hardhat-waffle": "^2.0.0",
"@typechain/ethers-v5": "^7.0.1",
"@typechain/hardhat": "^2.3.0",
"@types/chai": "^4.2.21",
"@types/mocha": "^9.0.0",
"@types/node": "^12.0.0",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.1",
"chai": "^4.2.0",
"dotenv": "^10.0.0",
"eslint": "^7.29.0",
"eslint-config-prettier": "^8.3.0",
Expand Down
13 changes: 7 additions & 6 deletions scripts/loanProofGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,21 @@ if (detailsType === 0) {
mapping = [
"uint8",
"address",
"address[]",
"address",
"address",
"address",
"uint24",
"int24",
"int24",
"uint128",
"address",
"uint256",
"uint256",
"uint256",
"uint256",
"uint256",
"uint256",
];
}
// console.error(leaves);
// Create tree

const termData: string[] = defaultAbiCoder
Expand All @@ -57,12 +59,11 @@ const termData: string[] = defaultAbiCoder

// @ts-ignore
leaves.push(termData);
//
const csvOuput: string = leaves.reduce((acc, cur) => {
const output: string = leaves.reduce((acc, cur) => {
return acc + cur.join(",") + "\n";
}, "");

const merkleTree = new StrategyTree(csvOuput);
const merkleTree = new StrategyTree(output);

const rootHash: string = merkleTree.getHexRoot();
const proof = merkleTree.getHexProof(merkleTree.getLeaf(0));
Expand Down
11 changes: 11 additions & 0 deletions scripts/postinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
NPX="npx"

cd lib/astaria-sdk && yarn && yarn build && cd ../..

if [[ -z $CI ]] ; then
NPX=
fi
SCRIPT="${NPX-:""} tsc"

${SCRIPT}
19 changes: 19 additions & 0 deletions scripts/typechain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env zsh

# This script is used to generate typechain types for the contracts in the myArray+=(item)

# define array and add all contracts from out.sol that are in typechainabi

accepted_file_names=("AuctionHouse.sol" "CollateralToken.sol" "LienToken.sol" "MultiRolesAuthority.sol" "PublicVault.sol" "Vault.sol" "WithdrawProxy.sol" "AstariaRouter.sol" "VaultImplementation.sol")

forge build
# loop through the array and generate types for each contract
rm -rf typechainabi && mkdir -p typechainabi
for i in ./out/*;
do
file=$(basename "${i}")
if [[ ${accepted_file_names[(ie)$file]} -le ${#accepted_file_names} ]]; then
cp -r "$i"/*.json "typechainabi/"
fi
done
typechain --target=ethers-v5 typechainabi/**/**.json --out-dir=typechain --show-stack-traces
Loading

0 comments on commit 99d8b34

Please sign in to comment.