Design

Basket.sol

The ERC-20 contract that facilitates the transaction of Basket tokens and TangibleNFTs. These can be created by anyone who holds a TangibleNFT. A new basket can be deployed via the Basket Manager.

BasketManager.sol

This is also known as the “basket factory”. This contract tracks all existing baskets and allows anyone who is holding a TangibleNFT (of a supported tnftType) to deploy a new unique basket via `deployBasket`.

BasketsVrfConsumer.sol

To facilitate the random redeemables in each basket, we’ve decided to build a single BasketsVrfConsumer contract that handles all entropy requests from all baskets. This contract will keep track of all outstanding vrf requests made and route the proper vrf coordinator callback to the designated basket.

Beacon Proxy Pattern

The Basket architecture utilizes the OZ Beacon Proxy pattern. This allows us to have multiple deployed proxies that all share a single implementation. There only exists 1 Basket.sol on-chain to act as our implementation contract. The BasketManager would deploy a new BeaconProxy contract when a new basket is created.

The BeaconProxy contracts would read from the UpgradeableBeacon when performing any executables. The UpgradeableBeacon would hold the implementation address of the only Basket base contract. In the event the Basket logic needs to be updated, all we’d need to do is update the implementation address on the UpgradeableBeacon.

Last updated