Skip to content

Commit

Permalink
Post QS2 audit updates (#69)
Browse files Browse the repository at this point in the history
* Token symbol uniqueness (#57)

* feat: ensure token symbol is unique

* fix: some typos and comments

* fix: entity token uniqueness mapping and add test

* fix: include external tokens in uniqueness check

* test: LibERC token symbol

* feat: update entity token info

* doc: update generated markdown

* test: entity token info update

* Revert "doc: update generated markdown"

This reverts commit 96ed7ee.

# Conflicts:
#	docs/facets/IEntityFacet.md

* fix: linter issues

* test: failed ERC20 calls

* refactor: fix solidity parser in prettier

* ci: fix branch scopes

* feat: add support for sepolia

* feat: run anvil in docker

* chore: remove a CI step not needed anymore

* ci: reformat test workflow summary

* ci: reformat test workflow summary

* fix: sepolia upgrade hash make target

* Update local node scripts (#64)

* chore: ignore slither vscode files

* feat: scripted scheduling

* fix: update anvil bootstrap script

* refactor: deployment on anvil, makefile

* fix: makefile defaults and addresses

* fix: anvil bootstrap

* fix: anvil upgrade targets

* chore: add sepolia broadcasts

* chore: update sepolia broadcasts

---------

Co-authored-by: Kevin Park <kevin@fruitful.gg>

* chore: add make commands to initialize and upgrade a new diamond on anvil

* refactor: align boostrap with new deployment scripts

* fix: prep upgrade script method ref

* feat: script anvil upgrade flow

* chore: update gitignore for mnemonic files

* ci: fix upgrade hash report

* chore: remove stale goerli broadcasts

* fix: upgrade stack too deep error

* refactor: add some makefile targets for sepolia

* fix: write the array of selectors to the same memory location to avoid stack too deep

* chore: add deploy-contract-sepolia command, commit broadcast files

* chore: minor makefile arg fix

* chore: sepolia upgrade broadcasts

* refactor(prep-upgrade): pull out generate function

* chore: update prettier config

* ci: don't generate upgrade hashes

* chore: bump to v3.5.0

* feat: .env format proposal

* feat: .env format proposal

* chore: add sepolia broadcasts, acl facet updated

* fix: add back simple policy info struct (#68)

struct without the arrays is needed for web3j compatibility

* Hotfix execute limit offer (#67)

* fix(erc20-wrapper): allowance function modifiers

* doc: update interface reference

* fix: remove duplicate target

* feat: add forking makefile targets

* fix: deploy-mainnet-fork permissions

* chore: upgrade sepolia diamond to v3.5.1

* ci: fix coverage env vars

* fix: mainnet fork target for owner balance

* Emit dividend withdrawn event (#59)

* Deployer adapter script (#70)

* feat: initial deployer script adapter

* feat: script upgrade procedure

* feat(deployer): add fork support

* refactor: improve logging

* fix: mainnet fork support

* feat: add dry run option

* refactor: improve flow and arguments for mainnet operation

* refactor: better logging and argument handling

* Enhance Fee and Commission Payment Routing for Marketplace and Policies (#66)

* chore(deployer): fix mainnet fork upgrade flow

* Refactor fees (#72)

* refactor(fees): update fee schedule struct and mapping (WiP)

* fix: compilation errors after refactoring

* fix: trading fee payment

* fix: remove non-default fee schedule

* refactor: make getSigner pure

* refactor: pass fee config externally as arrays instead of struct

* chore: cleanup left over comments

* doc: add replaceMakerBP natspec

* fix: unique id for default fee schedule regardless of type

* refactor: generic fee paid event

* test: dynamic array size for comparing fee schedules

* chore: fix formatting

---------

Co-authored-by: Aleksandar Marinković <aleksandar@Aleksandars-MacBook-Pro.local>

* chore: deployer script output formatting

* chore: upgrade sepolia to v3.6.0

* chore(verification-util): pull out network into vars

* rerfactor: generic fee schedule getter

* chore: bump package version to v3.6.1

* doc: fix natspec

* chore: broadcasts for v3.6.1

* chore: remove hotfix test

this test is no longer relevant

* fix: add view modifier to isObjectTokenizable

* test(fees): trading fees coverage

* test(fees): fix variable name typo

* feat(fees): add zero premium fee support for platform

* fix premium fee tests to consider stakeholder fees

* chore: clean up pre policy setup in tests; clean up unused foundry props

* chore: fix linter

* chore: add platform flag for running docker on ARM CPUs

* Calculate the trading fee on matching offer(s) schedule (#74)

Co-authored-by: Kevin Park <kevin@fruitful.gg>

* Fork Sanity Tests for Contract Upgrades (#76)

* fix: calculate fee allocations breakdown

* fix: setup default fee schedules inthe init diamond

* fix: reintroduce order matching rounding parameter

* fix: dividend withdraw fuzz test

* chore: 4x the number of max rejects for fuzzing

* Update access control part 1 (#77)

* Withdraw restriction (#78)

* fix: add contract verification to deployer script

* chore: ignore macos files

* chore: upgrade sepolia to v3.6.2

* chore: update email in package.json

* Roles part 1  refinement (#79)

* chore: upgrade sepolia to v3.6.3 smart contracts

* refactor: deployer only to verify when not forking

* fix: deployer account resolution

* doc: deployer script explainer

* Prevent role demotion (IM-24357) (#80)

* test: hRoles - pretty print roles

* feat: update SmartDeploy to pass in init diamond address

* feat: command anvil-upgrade-init-addr

* fix: prepare for upgrade, add custom init and getters

* chore: update forge-std

* deployment: add helper commands for anvil deployment; add script to deploy state updating contract

* chore: gitignore generated file

* chore: add custom solhit config in script folder

* test: add cHr helper method to pretty print commission receivers

* chore: remove redundant getter

* chore: fix typos

* chore: remove redundant scripts for deploying contracts

* deployment: update prep-upgrade.js to take in an init contract address

---------

Co-authored-by: Kevin Park <kevin@fruitful.gg>
Co-authored-by: Theodore Georgas <contact@theodoregeorgas.com>
Co-authored-by: Aleksandar Marinković <aleksandar@Aleksandars-MacBook-Pro.local>
  • Loading branch information
4 people committed Oct 2, 2023
1 parent 65c2be9 commit 2d5c25b
Show file tree
Hide file tree
Showing 199 changed files with 16,001 additions and 32,031 deletions.
9 changes: 6 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ export LOCAL_RPC_URL=
export ETH_MAINNET_RPC_URL=
export ETH_GOERLI_RPC_URL=
export ETH_SEPOLIA_RPC_URL=
export ETH_MAINNET_API_KEY=
export ETH_GOERLI_API_KEY=
export ETHERSCAN_API_KEY=
export NAYMS_SALT=
export OWNER_ACCOUNT_KEY=
export OWNER_ACCOUNT_KEY=
export SYSTEM_ADMIN_1=
export BOOL_FORK_TEST=
export FORK_BLOCK_1=
export FORK_BLOCK_11155111=
export FORK_BLOCK_31337=
14 changes: 14 additions & 0 deletions .env.proposal
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export LOCAL_ID=123
export LOCAL_RPC_URL=
export LOCAL_OWNER_ACCOUNT_KEY=

export MAINNET_ID=1
export MAINNET_RPC_URL=
export MAINNET_OWNER_ACCOUNT_KEY=

export SEPOLIA_ID=11155111
export SEPOLIA_RPC_URL=
export SEPOLIA_OWNER_ACCOUNT_KEY=

export ETHERSCAN_API_KEY=
export NAYMS_SALT=
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- dev
pull_request:

jobs:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ jobs:
registry-url: "https://registry.npmjs.org"
always-auth: true

- name: Update path
run: echo "/root/.cargo/bin:/root/.foundry/bin" >> $GITHUB_PATH

- name: Install solc
run: svm install 0.7.6 && svm install 0.8.17 && svm use 0.8.17

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/solstat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ jobs:
with:
submodules: recursive

- name: Update path
run: echo "/root/.cargo/bin:/root/.foundry/bin" >> $GITHUB_PATH

- name: Make solstat report
run: solstat --path ./src/diamonds/nayms/

Expand Down
35 changes: 23 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- dev
pull_request:

jobs:
Expand All @@ -23,9 +24,6 @@ jobs:
with:
submodules: recursive

- name: Update path
run: echo "/root/.cargo/bin:/root/.foundry/bin" >> $GITHUB_PATH

- name: Install solc
run: svm install 0.7.6 && svm install 0.8.17 && svm use 0.8.17

Expand All @@ -47,10 +45,13 @@ jobs:
- name: Tests - local
env:
ETH_MAINNET_RPC_URL: ${{ secrets.ETH_MAINNET_RPC_URL }}
ETH_SEPOLIA_RPC_URL: ${{ secrets.ETH_SEPOLIA_RPC_URL }}
ETH_GOERLI_RPC_URL: ${{ secrets.ETH_GOERLI_RPC_URL }}
run: make test

- name: Coverage report
env:
ETH_MAINNET_RPC_URL: ${{ secrets.ETH_MAINNET_RPC_URL }}
run: make coverage

- name: Coveralls
Expand All @@ -73,12 +74,22 @@ jobs:
with:
sarif_file: ${{ steps.slither.outputs.sarif }}

- name: Generate upgrade hashes
env:
ETH_MAINNET_RPC_URL: ${{ secrets.ETH_MAINNET_RPC_URL }}
ETH_GOERLI_RPC_URL: ${{ secrets.ETH_GOERLI_RPC_URL }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
run: |
echo "### Upgrade hash" >> $GITHUB_STEP_SUMMARY
echo " - mainnet \`$(make upgrade-hash-mainnet)\`" >> $GITHUB_STEP_SUMMARY
echo " - goerli \`$(make upgrade-hash-goerli)\`" >> $GITHUB_STEP_SUMMARY
# - name: Generate upgrade hashes
# env:
# ETH_MAINNET_RPC_URL: ${{ secrets.ETH_MAINNET_RPC_URL }}
# ETH_GOERLI_RPC_URL: ${{ secrets.ETH_GOERLI_RPC_URL }}
# ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
# run: |
# make upgrade-hash-mainnet
# make upgrade-hash-goerli
# make upgrade-hash-sepolia

# echo "### Upgrade hash" >> $GITHUB_STEP_SUMMARY
# echo " - mainnet \`$(jq --raw-output '.returns.upgradeHash.value' broadcast/SmartDeploy.s.sol/1/dry-run/hash-latest.json || echo "Not Available")\`" >> $GITHUB_STEP_SUMMARY
# echo "> $(jq --raw-output '.returns.cut.value' broadcast/SmartDeploy.s.sol/1/dry-run/hash-latest.json || echo "Not Available")" >> $GITHUB_STEP_SUMMARY

# echo " - goerli \`$(jq --raw-output '.returns.upgradeHash.value' broadcast/SmartDeploy.s.sol/5/dry-run/hash-latest.json || echo "Not Available")\`" >> $GITHUB_STEP_SUMMARY
# echo "> $(jq --raw-output '.returns.cut.value' broadcast/SmartDeploy.s.sol/5/dry-run/hash-latest.json || echo "Not Available")" >> $GITHUB_STEP_SUMMARY

# echo " - sepolia \`$(jq --raw-output '.returns.upgradeHash.value' broadcast/SmartDeploy.s.sol/11155111/dry-run/hash-latest.json || echo "Not Available")\`" >> $GITHUB_STEP_SUMMARY
# echo "> $(jq --raw-output '.returns.cut.value' broadcast/SmartDeploy.s.sol/11155111/dry-run/hash-latest.json || echo "Not Available") >> $GITHUB_STEP_SUMMARY
3 changes: 0 additions & 3 deletions .github/workflows/upgrade-goerli-diamond.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ jobs:
submodules: true
token: ${{ secrets.GITHUB_TOKEN }}

- name: Update path
run: echo "/root/.cargo/bin:/root/.foundry/bin" >> $GITHUB_PATH

- name: Install solc
run: svm install 0.8.17 && svm use 0.8.17

Expand Down
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ results.sarif
anvil*.json

# SECURITY
nayms_mnemonic.txt
*mnemonic*.txt

# yarn v1, node
node_modules
Expand All @@ -31,6 +31,7 @@ facetsdeployed.txt
.vscode/dryrun.log
.vscode/targets.log
.vscode/launch.json
.vscode/slither-results.json

.history

Expand All @@ -48,3 +49,12 @@ broadcast/**/31337/*
NaymsDiamond.json

broadcast/**/dry-run

# coverage report
cov-html

# macOS
.DS_Store

# Generated files
script/deployment/S03UpgradeDiamond.s.sol
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{
"files": "*.sol",
"options": {
"parser": "solidity-parse",
"printWidth": 180,
"tabWidth": 4,
"useTabs": false,
Expand All @@ -16,6 +17,17 @@
"options": {
"parser": "json"
}
},
{
"files": "*.js",
"options": {
"parser": "flow",
"printWidth": 180,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": true
}
}
]
}
3 changes: 2 additions & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"avoid-low-level-calls": "off",
"const-name-snakecase": "off",
"reason-string": "off",
"var-name-mixedcase": "off"
"var-name-mixedcase": "off",
"func-name-mixedcase": "off"
}
}
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
".gas-snapshot": "julia"
},
"solidity.packageDefaultDependenciesContractsDirectory": "src",
"solidity.packageDefaultDependenciesDirectory": "lib"
"solidity.packageDefaultDependenciesDirectory": "lib",
"slither.solcPath": "",
"slither.hiddenDetectors": []
}

0 comments on commit 2d5c25b

Please sign in to comment.