Token Vault
This is where NFTs are housed and fractional ownership is tracked. The contract is an ERC20 token which tracks ownership.

Contract Storage:

1
/// -----------------------------------
2
/// -------- TOKEN INFORMATION --------
3
/// -----------------------------------
4
​
5
/// @notice the ERC721 token address of the vault's token
6
address public token;
7
​
8
/// @notice the ERC721 token ID of the vault's token
9
uint256 public id;
Copied!
1
/// -------------------------------------
2
/// -------- AUCTION INFORMATION --------
3
/// -------------------------------------
4
​
5
/// @notice the unix timestamp end time of the token auction
6
uint256 public auctionEnd;
7
​
8
/// @notice the length of auctions
9
uint256 public auctionLength;
10
​
11
/// @notice reservePrice * votingTokens
12
uint256 public reserveTotal;
13
​
14
/// @notice the current price of the token during an auction
15
uint256 public livePrice;
16
​
17
/// @notice the current user winning the token auction
18
address payable public winning;
19
​
20
enum State { inactive, live, ended, redeemed }
21
​
22
State public auctionState;
Copied!
1
/// -----------------------------------
2
/// -------- VAULT INFORMATION --------
3
/// -----------------------------------
4
​
5
/// @notice the governance contract which gets paid in ETH
6
address public settings;
7
​
8
/// @notice the address who initially deposited the NFT
9
address public curator;
10
​
11
/// @notice the AUM fee paid to the curator yearly. 3 decimals. ie. 100 = 10%
12
uint256 public fee;
13
​
14
/// @notice the last timestamp where fees were claimed
15
uint256 public lastClaimed;
16
​
17
/// @notice a boolean to indicate if the vault has closed
18
bool public vaultClosed;
19
​
20
/// @notice the number of ownership tokens voting on the reserve price at any given time
21
uint256 public votingTokens;
22
23
/// @notice a mapping of users to their desired token price
24
mapping(address => uint256) public userPrices;
Copied!

Governance Functions:

1
function kickCurator(address _curator)
Copied!
This function allows for governance to remove a curator who is acting maliciously in some way.

Curator Functions:

1
function updateCurator(address _curator)
Copied!
Allows the curator to update their address.
1
function updateBasePrice(uint256 _price)
Copied!
Allows the curator to update the base price of the NFT. This will influence the max and min reserve prices.
1
function updateAuctionLength(uint256 _length)
Copied!
Allows the curator to update the length of an auction for the NFT.
1
function updateFee(uint256 _fee)
Copied!
Allows the curator to update their fee.
1
function claimFees()
Copied!
Can be called by anyone but claims fees for the curator and governance.

Pricing Functions:

1
/// @notice a function for an end user to update their desired sale price
2
/// @param _new the desired price in ETH
3
function updateUserPrice(uint256 _new)
Copied!
Public function for a user to update their desired reserve price. Updated the full reserve price as well.
1
/// @notice an internal function used to update sender and receivers price on token transfer
2
/// @param _from the ERC20 token sender
3
/// @param _to the ERC20 token receiver
4
/// @param _amount the ERC20 token amount
5
function _beforeTokenTransfer(address _from, address _to, uint256 _amount) internal virtual override
Copied!
This function is called on all token transfers. Its core functionality is to update the reserve price on transfer based on the new holders desired reserve prices.

Auction Functions:

1
/// @notice kick off an auction. Must send reservePrice in ETH
2
function start() external payable
Copied!
Start an auction by sending ETH to the smart contract. This will set a livePrice variable and allow for bid() to be called.
1
/// @notice an external function to bid on purchasing the vaults NFT. The msg.value is the bid amount
2
function bid() external payable
Copied!
Bid on an already live auction. Must send more ETH than the previous bid by a percentage set by governance. If the auction is within 15 minutes of ending, extend the auction by 15 minutes.
1
/// @notice an external function to end an auction after the timer has run out
2
function end() external
Copied!
This can be called by anyone once an auction has ended to close the vault and send NFT to the winner.
1
/// @notice an external function to burn all ERC20 tokens to receive the ERC721 token
2
function redeem() external
Copied!
Burn the total supply of ownership tokens to receive the NFT.
1
/// @notice an external function to burn ERC20 tokens to receive ETH from ERC721 token purchase
2
function cash() external
Copied!
Burn your tokens to receive ETH based on your percentage of the total supply. Only to be called once an auction has ended.
1
/// @dev internal helper function to send ETH and WETH on failure
2
function _sendETHOrWETH(address who, uint256 amount) internal
Copied!
Helper function to try to send someone ETH and if that fails we force them to take WETH.
Last modified 3mo ago