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

Baseline V2 DTL Callback #155

Closed
wants to merge 164 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
257e3c4
Add function documentation. Check bAsset and Baseline factory consist…
0xJem Apr 17, 2024
0a7d968
Shift BAsset validation
0xJem Apr 17, 2024
914f86f
Revert "chore: linting"
0xJem Apr 24, 2024
1a29d96
Merge branch 'develop' into baseline-v2-dtl
Oighty May 16, 2024
4b67a42
feat: baseline v2 callback as a policy to install
Oighty May 16, 2024
6eab990
Update docs to match implementation. Revert if auction format is FPS …
0xJem May 17, 2024
c324f92
TODOs, documentation
0xJem May 17, 2024
fdbe1d2
Implement check on vesting start. Add missing minting, checks.
0xJem May 17, 2024
7ec02dc
Handle zero curator fee
0xJem May 17, 2024
dd24383
Don't hardcode BPOOL decimals
0xJem May 17, 2024
9186ec1
Enable the policy owner to withdraw remaining reserves
0xJem May 17, 2024
5297e19
Update BPOOL interface based on rmliq branch
0xJem May 17, 2024
945da24
Merge branch 'fixed-batch' into baseline-v2-dtl
Oighty May 20, 2024
febecba
refactor: support FPB instead of FPS
Oighty May 20, 2024
31e27e7
fix: remove unnecessary casting
Oighty May 20, 2024
18c6129
wip: uniswap v3 tick math
Oighty May 20, 2024
6acb9bc
feat: add callback version with allocated amounts per buyer
Oighty May 20, 2024
545cb81
Update liquidity math from Baseline repo
0xJem May 17, 2024
0935b62
Improve docs, conditional logic in FPB
0xJem May 20, 2024
da9073d
FPB test stubs
0xJem May 20, 2024
a92f27d
Fixes stack too deep in FPB.bid()
0xJem May 20, 2024
bb86fbd
FPB: create auction tests
0xJem May 20, 2024
3c90c63
FPB: cancel auction tests
0xJem May 20, 2024
a47ae20
FPB: bid tests
0xJem May 20, 2024
4364588
FPB: correctly handle single bid going over capacity
0xJem May 20, 2024
1c9ee97
FPB: Bound price in the fuzz test
0xJem May 20, 2024
03db1ca
FPB: refundBid tests
0xJem May 20, 2024
1683d2d
FRB: tests for claimBids
0xJem May 20, 2024
44b6b64
FRB: claim multiple bids
0xJem May 20, 2024
bfe7abf
FPB: tests for settlement
0xJem May 20, 2024
84c64fa
FPB: decimal tests for bid creation
0xJem May 20, 2024
0c6a7e2
chore: linting
0xJem May 20, 2024
42e2cf4
Document allowlist contracts
0xJem May 20, 2024
0a42880
Correct calculation of tick and sqrtPriceX96 from clearing price
0xJem May 20, 2024
5633e0a
Adjust callback permissions
0xJem May 20, 2024
82e70ac
Update Baseline interfaces and interactions in the callbacks contract
0xJem May 20, 2024
b7e33a8
Refactor to define anchor and discovery ranges using a tick width as …
0xJem May 20, 2024
e40f1e2
Remove redundant constants
0xJem May 20, 2024
db6885d
Add Baseline contracts to solhint ignore list
0xJem May 20, 2024
fa8ec37
Merge branch 'fixed-batch' into baseline-v2-dtl
Oighty May 20, 2024
72b86f6
Initialise the pool using the anchor tick. Calculate tick ranges base…
0xJem May 21, 2024
a07c19e
Remove redundant TODO
0xJem May 21, 2024
f567c84
Emit event upon liquidity deployment
0xJem May 21, 2024
b5defaf
Sync function documentation with implementation
0xJem May 21, 2024
2f30ee0
Docs
0xJem May 21, 2024
55b62c7
Shift existing DTL tests into subdirectory
0xJem May 21, 2024
b36accb
Fix return types in IBPOOL interface
0xJem May 21, 2024
7911c32
chore: linting
0xJem May 21, 2024
41f0845
Test stubs for Baseline callback
0xJem May 21, 2024
b46cbae
Shift callbacks to parent contract
0xJem May 21, 2024
a9a2bb5
fix: remove EMP support from baseline callback
Oighty May 21, 2024
e9240af
refactor: simplify baseline initialization
Oighty May 21, 2024
1c9e634
chore: linter
Oighty May 21, 2024
a70e06b
chore: remove unused dependencies
Oighty May 21, 2024
12c184f
Remove redundant function
0xJem May 22, 2024
97374c9
Remove redundant test tasks
0xJem May 22, 2024
4a67463
Running tests
0xJem May 22, 2024
a266dad
Complete onCreate tests (which are failing)
0xJem May 22, 2024
0166153
Use existing libraries to determine the active tick
0xJem May 22, 2024
e27a513
Manually calculate the expected ticks, to be sure of accuracy
0xJem May 22, 2024
04bd7cf
Add test cases for token ordering and decimals
0xJem May 22, 2024
feeab6d
Split salt generation for the quote token used in the Baseline callba…
0xJem May 23, 2024
8b91151
Fix typo
0xJem May 23, 2024
703c779
Tests for Baseline allocated allowlist callback
0xJem May 23, 2024
f946619
Update docs
0xJem May 23, 2024
58a2dc1
Add missing reverts suffix to tests
0xJem May 23, 2024
4677563
Tests for onCancel callback, along with fixes
0xJem May 23, 2024
868e7bd
Tests for onSettle (some failing)
0xJem May 23, 2024
313362e
Fix failing tests for onSettle
0xJem May 23, 2024
be92097
Update salts for failing tests
0xJem May 23, 2024
b705e0d
Update tests for high and low fixed price
0xJem May 23, 2024
fb871aa
Tests for onCurate and withdrawReserves. Fixes issue with ownership o…
0xJem May 23, 2024
bb7a327
Remove permissions as constructor parameter from Baseline callbacks
0xJem May 24, 2024
078cb67
Add deployment and salts scripts for BaselineAllocatedAllowlist
0xJem May 24, 2024
738f6ed
Update script path
0xJem May 24, 2024
aff31e7
Add flag to deploy.sh to disable saving deployment output
0xJem May 24, 2024
ad59423
Shift deploy.sh to use named arguments instead of positions
0xJem May 24, 2024
66c59e4
Add named arguments to AuctionHouse salts script
0xJem May 24, 2024
b72a54a
Update error messages in deploy.sh
0xJem May 24, 2024
51d102d
Update error messages for AuctionHouse salts script
0xJem May 24, 2024
16be7f7
Named arguments for BaselineAllocatedAllowlist salts
0xJem May 24, 2024
d8df49f
Named parameters for Uniswap DTL salts
0xJem May 24, 2024
4ed53a6
Merge branch 'fixed-batch' into baseline-v2-dtl
0xJem May 27, 2024
d58c9a2
Merge branch 'fixed-batch' into baseline-v2-dtl
0xJem May 27, 2024
4d983b4
Add Baseline policy installation to deploy script
0xJem May 27, 2024
16e69b3
Update test salts
0xJem May 27, 2024
947c6b9
chore: linting
0xJem May 27, 2024
92d9432
Better documentation on merkle roots
0xJem May 27, 2024
5ddc1d1
Add script for creating a FixedPriceBatch auction with BaselineAlloca…
0xJem May 27, 2024
6f56707
Add missing policy permission
0xJem May 27, 2024
dbcd6de
Add log to deployment
0xJem May 27, 2024
14f1ab1
Shift test scripts into dedicated directory
0xJem May 27, 2024
cb52335
chore: linting
0xJem May 27, 2024
d1fe261
Update steps for Merkle proof generation
0xJem May 27, 2024
2f718b3
Update createAuction and placeBid scripts, add README
0xJem May 27, 2024
b6d53cb
Add script to settle auctions
0xJem May 27, 2024
2a0e831
chore: linting
0xJem May 27, 2024
c5a42fb
Add docs on settlement test script
0xJem May 27, 2024
c3ef474
Fix docs
0xJem May 27, 2024
c2f6e83
Add error to bash scripts if CHAIN is not defined
0xJem May 28, 2024
2e23076
Add test to reproduce issue with tick rounding
0xJem May 28, 2024
6ba5066
Amend the Baseline callback to initialise the pool with a rounded tick
0xJem May 28, 2024
dd5b7bf
Improve deployment, salt and test scripts to read from specified envi…
0xJem May 28, 2024
8eedf43
Add script for warping
0xJem May 28, 2024
4a85df1
Add check for floor and active ticks
0xJem May 28, 2024
99302e8
Adjusted approach to tick ranges
0xJem May 28, 2024
452f4b4
chore: linting
0xJem May 28, 2024
13139ff
Add ability to set the deployer address when generating salts
0xJem May 29, 2024
446726b
Fix salts for contracts that use msg.sender. Pull constants into abst…
0xJem May 29, 2024
77db7ed
Add logs to deployTokens script
0xJem May 29, 2024
c5dd712
Add ability in FPB test script to disable callbacks
0xJem May 30, 2024
1f6c824
Rename directory
0xJem May 30, 2024
592919e
Rename directory
0xJem May 30, 2024
0090a37
Rename directory
0xJem May 30, 2024
8ff52ac
Update test salts
0xJem May 30, 2024
a84f000
chore: linting
0xJem May 30, 2024
2dfd2f7
Ignore .env files
0xJem May 30, 2024
a183e45
Test scripts: print the real auction conclusion
0xJem May 30, 2024
474978c
chore: linting
0xJem May 30, 2024
265dc42
Add setMerkleRoot to the Baseline allocated allowlist
0xJem May 30, 2024
b1128e8
Update docs in BaseCallback and regenerate salts
0xJem May 30, 2024
78243f4
Shift Uniswap V2 DTL tests to use the salts and constants infra
0xJem May 30, 2024
779c0ea
Merge branch 'fixed-batch' into baseline-v2-dtl
0xJem May 30, 2024
eb61b14
Rename directory for Uniswap DTL scripts
0xJem May 30, 2024
93884c5
Move Baseline DTL scripts into directory
0xJem May 30, 2024
87dc47c
Remove structs from BALwithAllocatedAllowlist. Also shifts over to us…
0xJem May 31, 2024
a8951d0
Document approach to range layout. Test stubs.
0xJem Jun 15, 2024
f41952f
Update tests
0xJem Jun 15, 2024
75ee059
chore: linting
0xJem Jun 15, 2024
4eb230c
Implement range allocation
0xJem Jun 15, 2024
b32db96
Add configurable floor and anchor reserves
0xJem Jun 15, 2024
69e229a
Check discovery liquidity
0xJem Jun 15, 2024
23c0d72
Merge branch 'develop' into baseline-v2-dtl
0xJem Jun 15, 2024
d304f80
Merge branch 'develop' into baseline-v2-dtl
0xJem Jun 15, 2024
70ab623
Rename test scripts
0xJem Jun 15, 2024
14cae00
Remove merge duplication
0xJem Jun 15, 2024
3d67ed8
Add back removed salt key
0xJem Jun 15, 2024
b9f2093
Update salts
0xJem Jun 15, 2024
249be61
Update salts
0xJem Jun 15, 2024
c90f860
Merge branch 'develop' into baseline-v2-dtl
0xJem Jun 15, 2024
91ec912
Update BPOOL interface and mock with v2 release: https://github.com/0…
0xJem Jun 19, 2024
0d2804e
Update BaselineAxisLaunch to check the BPOOL's active tick against th…
0xJem Jun 19, 2024
10628d4
Shift BALwithAllowlist to use OpenZeppelin merkle proof library. Add …
0xJem Jun 21, 2024
b58e90f
Add salt generation for Baseline allowlist variants. Update test salts.
0xJem Jun 21, 2024
eef234a
Add length check on calldata
0xJem Jun 21, 2024
46fc158
Tests for Baseline capped allowlist
0xJem Jun 21, 2024
d570ca1
Add tests for Baseline Allowlist
0xJem Jun 21, 2024
01ad8e0
Add check for length of callback data
0xJem Jun 21, 2024
3e01b0c
Revert "Add check for length of callback data"
0xJem Jun 21, 2024
346c50a
Adjust liquidity in discovery
0xJem Jun 25, 2024
f8b489c
Merge branch 'develop' into baseline-v2-dtl
0xJem Jun 25, 2024
c88907e
Update salts
0xJem Jun 25, 2024
6aae98c
Update salts after clearing submodules
0xJem Jun 25, 2024
e0d9931
Add Baseline callback with TokenAllowlist + tests
0xJem Jun 27, 2024
db5b9c2
Merge branch 'develop' into baseline-v2-dtl
0xJem Jul 12, 2024
3e7d4e1
Adjust scripts to use new env.json format
0xJem Jul 12, 2024
a7f7c10
Standardise percent on 100e2
0xJem Jul 12, 2024
8aa26d8
chore: linting
0xJem Jul 12, 2024
dce6740
chore: linting
0xJem Jul 12, 2024
3925231
Merge branch 'develop' into baseline-v2-dtl
0xJem Jul 12, 2024
42ed18a
Update salts for non-Baseline tests
0xJem Jul 12, 2024
4acb057
Update salts for Baseline tests
0xJem Jul 12, 2024
44e5834
Add deployment scripts for other BaselineAxisLaunch variants
0xJem Jul 12, 2024
ffa34f8
Document how to use the Baseline callbacks
0xJem Jul 12, 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
297 changes: 0 additions & 297 deletions src/callbacks/liquidity/BaselinePreAsset.sol

This file was deleted.

101 changes: 101 additions & 0 deletions src/callbacks/liquidity/BaselineV2/BALwithAllowlist.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import {MerkleProofLib} from "lib/solady/src/utils/MerkleProofLib.sol";

import {BaselineAxisLaunch} from "src/callbacks/liquidity/BaselineV2/BaselineAxisLaunch.sol";
import {Callbacks} from "src/lib/Callbacks.sol";

contract BALwithAllowlist is BaselineAxisLaunch {
// ========== STATE VARIABLES ========== //

bytes32 public merkleRoot;

// ========== CONSTRUCTOR ========== //

// PERMISSIONS
// onCreate: true
// onCancel: true
// onCurate: true
// onPurchase: true
// onBid: true
// onSettle: true
// receiveQuoteTokens: true
// sendBaseTokens: true
// Contract prefix should be: 11111111 = 0xFF

constructor(
address auctionHouse_,
Callbacks.Permissions memory permissions_,
address baselineKernel_,
address reserve_
) BaselineAxisLaunch(auctionHouse_, permissions_, baselineKernel_, reserve_) {}

// ========== CALLBACK FUNCTIONS ========== //

function __onCreate(
uint96,
address,
address,
address,
uint256,
bool,
bytes memory allowlistData_
) internal virtual override {
// Decode the merkle root from the callback data
(bytes32 merkleRoot_) = abi.decode(allowlistData_, (bytes32));

// Set the merkle root and buyer limit
merkleRoot = merkleRoot_;
}

function __onPurchase(
uint96 lotId_,
address buyer_,
uint256 amount_,
uint256 payout_,
bool prefunded_,
bytes calldata callbackData_
) internal override {
// Validate that the buyer is allowed to participate
_canParticipate(buyer_, callbackData_);

// Call any additional implementation-specific logic
___onPurchase(lotId_, buyer_, amount_, payout_, prefunded_, callbackData_);
}

function ___onPurchase(
uint96 lotId_,
address buyer_,
uint256 amount_,
uint256 payout_,
bool prefunded_,
bytes calldata callbackData_
) internal virtual {}

function _onBid(
uint96,
uint64,
address buyer_,
uint256,
bytes calldata callbackData_
) internal virtual override {
// Validate that the buyer is allowed to participate
_canParticipate(buyer_, callbackData_);
}

// ========== INTERNAL FUNCTIONS ========== //

function _canParticipate(address buyer_, bytes calldata callbackData_) internal view {
// Decode the merkle proof from the callback data
bytes32[] memory proof = abi.decode(callbackData_, (bytes32[]));

// Get the leaf for the buyer
bytes32 leaf = keccak256(abi.encodePacked(buyer_));

// Validate the merkle proof
if (!MerkleProofLib.verify(proof, merkleRoot, leaf)) {
revert Callback_NotAuthorized();
}
}
}
Loading
Loading