Skip to content

Commit

Permalink
Merge pull request #15 from Bond-Protocol/jem/module-management
Browse files Browse the repository at this point in the history
Module Management
  • Loading branch information
Oighty authored Jan 8, 2024
2 parents e3ecaaa + f49499f commit ddbdc63
Show file tree
Hide file tree
Showing 39 changed files with 3,773 additions and 2,003 deletions.
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

0 comments on commit ddbdc63

Please sign in to comment.