Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module Management #15

Merged
merged 35 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
47eaa08
WIP tree tests for versioned modules
0xJem Dec 26, 2023
c085d8e
More tree tests. Messing with types.
0xJem Dec 26, 2023
33044bf
Fix syntax
0xJem Jan 2, 2024
177d268
Codebase compiles
0xJem Jan 2, 2024
af7d8f2
Fix Foundry configuration
0xJem Jan 2, 2024
2d91998
Complete keycode validation
0xJem Jan 2, 2024
4b701ee
Tests for getting module with and without the version number
0xJem Jan 2, 2024
e084195
Rename directory
0xJem Jan 3, 2024
47d0304
Versioned module implementation for installation. Documentation.
0xJem Jan 3, 2024
d7ef6da
Change contract name
0xJem Jan 3, 2024
e0c1fea
Implementation and tests for upgradeModule
0xJem Jan 3, 2024
495f1f6
Consolidate into unwrapKeycode function
0xJem Jan 3, 2024
017c2a9
refactor: simplify module management and change nomenclature
Oighty Jan 3, 2024
f0bde00
fix: minor clean-up and remove unused errors
Oighty Jan 3, 2024
c433e77
Post-refactor cleanup
0xJem Jan 4, 2024
4f157e1
Merge pull request #16 from Bond-Protocol/oighty/module-updates
0xJem Jan 4, 2024
22b83fd
Add setup/config for linting
0xJem Jan 4, 2024
cdeb384
chore: linting
0xJem Jan 4, 2024
439f369
Add solhint:check script
0xJem Jan 4, 2024
16eb1c0
Update CI configuration
0xJem Jan 4, 2024
ccb7f9e
Fix linting
0xJem Jan 4, 2024
add0e1f
Add tests for sunsetModule
0xJem Jan 4, 2024
e07804a
Documentation
0xJem Jan 4, 2024
dbfb0bd
Tests for execOnModule
0xJem Jan 4, 2024
220fc80
Add event for module sunset
0xJem Jan 4, 2024
4a96819
Add blacklist of module functions
0xJem Jan 4, 2024
beae6fe
Remove getModules() and add modulesCount
0xJem Jan 4, 2024
48d0506
Add TYPE() to Module contract. Natspec comments.
0xJem Jan 4, 2024
26413e5
Shift to using forge fmt for formatting
0xJem Jan 5, 2024
80e41ba
chore: linting
0xJem Jan 5, 2024
e622a8a
Remove .prettierignore
0xJem Jan 5, 2024
f853b19
Shift to module-level modifier to gate internal functions
0xJem Jan 5, 2024
cba5b29
Add enum for Module type
0xJem Jan 5, 2024
f702ef6
Integrate feedback on execOnModule
0xJem Jan 8, 2024
f49499f
Additional test case
0xJem Jan 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: test

on: workflow_dispatch
on:
push:
branches:
- master
pull_request:

env:
FOUNDRY_PROFILE: ci
Expand All @@ -17,10 +21,25 @@ jobs:
with:
submodules: recursive

- uses: actions/setup-node@v2

- uses: pnpm/action-setup@v2
with:
version: 8

- name: Install Node dependencies
run: pnpm install

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
version: nightly-ca67d15f4abd46394b324c50e21e66f306a1162d

- name: Install Foundry dependencies
run: forge install

- name: Run lint check
run: pnpm run lint:check

- name: Run Forge build
run: |
Expand All @@ -30,5 +49,5 @@ jobs:

- name: Run Forge tests
run: |
forge test -vvv
pnpm run test
id: test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ docs/

# Dotenv file
.env

node_modules/
17 changes: 17 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "solhint:recommended",
"rules": {
"compiler-version": ["error",">=0.7.0"],
"avoid-low-level-calls": "off",
"const-name-snakecase": "off",
"var-name-mixedcase": "off",
"func-name-mixedcase": "off",
"not-rely-on-time": "off",
"func-visibility": [ "warn", { "ignoreConstructors":true }],
"no-inline-assembly": "off",
"reason-string": "off",
"no-empty-blocks": "off",
"no-console": "off",
"no-global-import": "off"
}
}
3 changes: 3 additions & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
src/test/**/*.sol
src/scripts/**/*.sol
lib/**
27 changes: 14 additions & 13 deletions design/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ classDiagram
AuctionModule ..> Auctioneer

DerivativeModule ..> Derivatizer

CondenserModule ..> AuctionHouse
Auctioneer --|> AuctionHouse
Derivatizer --|> AuctionHouse
Expand Down Expand Up @@ -198,20 +198,20 @@ classDiagram

AuctionModule --|> GDA
AuctionModule --|> TVGDA

DerivativeModule --|> CliffVesting
DerivativeModule --|> StakedCliffVesting
DerivativeModule --|> RageVesting
DerivativeModule --|> FixedStrikeOption
DerivativeModule --|> SuccessToken


```

### TODOs
- [ ] Add section for Auction and Derivative module implementations after we prioritize which ones to build first
- [ ] Create a function or add return values so that a solver / user can determine the derivative token that a market will return (useful for then creating off-chain orders for that token). This also brings up a point about how certain auction view functions that rely solely on an amount need to be refactored for a multi-variate auction world, e.g. `payoutFor(uint256)` -> `payoutFor(uint256, bytes)`

- [ ] Add section for Auction and Derivative module implementations after we prioritize which ones to build first
- [ ] Create a function or add return values so that a solver / user can determine the derivative token that a market will return (useful for then creating off-chain orders for that token). This also brings up a point about how certain auction view functions that rely solely on an amount need to be refactored for a multi-variate auction world, e.g. `payoutFor(uint256)` -> `payoutFor(uint256, bytes)`

## Processes

Expand All @@ -234,7 +234,7 @@ sequenceDiagram
AtomicAuctionModule->>AtomicAuctionModule: _auction(uint256 id, Lot lot, bytes implParams)
Note right of AtomicAuctionModule: module-specific actions

AtomicAuctionModule-->>AuctionHouse:
AtomicAuctionModule-->>AuctionHouse:
deactivate AtomicAuctionModule

Note over AuctionHouse: store routing information
Expand All @@ -252,7 +252,7 @@ sequenceDiagram
autoNumber
participant Buyer
participant AuctionHouse

activate AuctionHouse
Buyer->>AuctionHouse: purchase(address recipient, address referrer, uint256 auctionId, uint256 amount, uint256 minAmountOut, bytes approval)
AuctionHouse->>AuctionHouse: _getModuleForId(uint256 auctionId)
Expand Down Expand Up @@ -382,7 +382,7 @@ sequenceDiagram

activate AuctionHouse
AuctionOwner->>AuctionHouse: close(uint256 id)

AuctionHouse->>AuctionHouse: _getModuleForId(id)

AuctionHouse->>AuctionHouse: lotRouting(id)
Expand All @@ -394,7 +394,7 @@ sequenceDiagram
AuctionHouse-->>AuctionOwner: returns
else
AuctionHouse->>AuctionOwner: revert
end
end
deactivate AuctionHouse
```

Expand Down Expand Up @@ -456,8 +456,8 @@ sequenceDiagram

deactivate AuctionHouse
```
Need to think about the implications of transferring to/from the AuctionOwner once here, because _handleTransfers is not currently designed for this.

Need to think about the implications of transferring to/from the AuctionOwner once here, because \_handleTransfers is not currently designed for this.

### User Redeems Derivative Token - V1 (through AuctionHouse, requires refactoring AuctionModule)

Expand All @@ -482,7 +482,7 @@ sequenceDiagram
DerivativeModule->>DerivativeToken: burn(user, amount)
destroy DerivativeToken
User-->>DerivativeToken: derivative tokens burned
else
else
DerivativeModule->>DerivativeModule: burn(tokenId, user, amount)
User-->>DerivativeModule: derivative tokens burned
end
Expand All @@ -508,7 +508,7 @@ sequenceDiagram
DerivativeModule->>DerivativeToken: burn(user, amount)
destroy DerivativeToken
User-->>DerivativeToken: derivative tokens burned
else
else
DerivativeModule->>DerivativeModule: burn(tokenId, user, amount)
User-->>DerivativeModule: derivative tokens burned
end
Expand Down Expand Up @@ -554,5 +554,6 @@ sequenceDiagram
```

### Create Auction by transforming one Derivative to another

TODO determine if it makes sense to build this as a specific workflow within the system.
It's a bit of an edge case and will add several variables to the auction creation process that are optional.
It's a bit of an edge case and will add several variables to the auction creation process that are optional.
Loading
Loading