-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] [Gas] create a multi-asset ERC-721 vault (#22)
This vault takes a similar form to our current ERC-721 vault; however, instead of requiring that a unique vault be deployed for each underlying ERC-721 token, this single vault can support multiple tokenIds each with a distinct entitlement and a beneficial owner. We believe this will result in substantial gas savings by removing the requirement that a new vault is deployed for each minted option. Additionally, more care is taken in this implementation to remove extraneous SSTOREs. One area where we could get further SSTORE improvements would be by thining the entitlement struct that we persist to not include the notion of the vault address, as the vault adderss is the same for each asset within the vault.
- Loading branch information
1 parent
b4424a2
commit 64edc62
Showing
14 changed files
with
1,560 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
pragma solidity ^0.8.10; | ||
|
||
import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol"; | ||
|
||
/// @title ERC-721 MultiVault Proxy Contract | ||
/// @author Jake Nyquist -- [email protected] | ||
/// @notice Each instance of this contract is a unique multi-vault which references the | ||
/// shared implementation pointed to by the Beacon | ||
contract HookERC721MultiVault is BeaconProxy { | ||
constructor( | ||
address beacon, | ||
address nftAddress, | ||
address hookProtocolAddress | ||
) | ||
BeaconProxy( | ||
beacon, | ||
abi.encodeWithSignature( | ||
"initialize(address,address)", | ||
nftAddress, | ||
hookProtocolAddress | ||
) | ||
) | ||
{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
pragma solidity ^0.8.10; | ||
|
||
import "./HookUpgradeableBeacon.sol"; | ||
|
||
/// @title HookERC721MultiVaultBeacon -- beacon holding pointer to current ERC721MultiVault implementation | ||
/// @author Jake Nyquist -- [email protected] | ||
/// @notice The beacon broadcasts the address which contains the existing implementation of the ERC721MultiVault | ||
/// @dev Permissions for who can upgrade are contained within the protocol contract. | ||
contract HookERC721MultiVaultBeacon is HookUpgradeableBeacon { | ||
constructor( | ||
address implementation, | ||
address hookProtocol, | ||
bytes32 upgraderRole | ||
) HookUpgradeableBeacon(implementation, hookProtocol, upgraderRole) {} | ||
} |
Oops, something went wrong.