Axis-Fi / axis-core

Axis Protocol
https://axis.finance
Other
6 stars 1 forks source link

Callbacks: Implement capacity-capped allowlist callback #58

Closed Oighty closed 5 months ago

Oighty commented 6 months ago

Objective

Implement a callback contract that tracks capacity allocated to bidders for atomic auctions

Rationale

This type of callback would enable the use case discussed in the Fixed Price Auction Module issue.

Design

An onCreate call should register the auction on the callback and provide its capacity and a capacity-per-bidder (in the callbackData).

It should also implement an allowlist check, which can be generalized and then implemented in inheriting contracts (and conforming to the existing IAllowlist style interface). We any existing TokenAllowlist implementation from the Bond Protocol option contracts that can be used. The other main version would be a Merkle Proof allowlist. Any initialization data would need to be provided in the onCreate function as well.

An onPurchase call should check the bidder is on the allowlist (revert if not). It should also check the capacity purchased + previous capacity purchased against the cap per user (revert if over). The capacity purchased should be updated for the user.