VaultUpgradeable
The Vault contract that manages the ERC20 and ERC721 assets. The Vault contract is upgradeable and makes use of the OpenZeppelin's UUPSUpgradeable contracts. The contract implements the IVault interface and inherits from the MarketHubRegistrarUpgradeable and IERC721ReceiverUpgradeable contracts.
erc20Balances
mapping(address => uint256) erc20Balances
Checks the balance of ERC20 token in the vault.
Parameters
Return Values
erc721Balances
mapping(address => mapping(uint256 => bool)) erc721Balances
Checks if an ERC721 token is in the vault.
Parameters
Return Values
offchainPayouts
mapping(address => bool) offchainPayouts
constructor
constructor() public
initialize
function initialize() public
Initialize function that replaces the constructor
_authorizeUpgrade
function _authorizeUpgrade(address newImplementation) internal
Internal function to authorize upgrades, verifies if the new implementation address matches the one provided by the upgrade gatekeeper.
Parameters
newImplementation
address
The address of the new implementation.
onlyEscrow
modifier onlyEscrow()
setOffchainPayout
function setOffchainPayout(bool _offchainPayout) public virtual
Turns on or off the offchain payout behaviour
When on, payouts will be redirected to Colle, and emit a event stating Colle owes the user the amount
Parameters
_offchainPayout
bool
Whether to turn on or off offchain payouts.
permitSetOffchainPayout
function permitSetOffchainPayout(bool _offchainPayout, struct Signature _signature) public virtual
Turns on or off the offchain payout behaviour, via a EIP-712 signature
When on, payouts will be redirected to Colle, and emit a event stating Colle owes the user the amount
Parameters
_offchainPayout
bool
Whether to turn on or off offchain payouts.
_signature
struct Signature
disableOffchainPayout
function disableOffchainPayout(address _address) public virtual
Turns off the offchain payout behaviour for a given address
When on, payouts will be redirected to Colle, and emit a event stating Colle owes the user the amount
Parameters
_address
address
The address to disable offchain payouts for
depositERC20ForSale
function depositERC20ForSale(uint256 _saleId) public virtual
Deposits the given amount of ERC20 token to the vault contract.
Parameters
_saleId
uint256
The sale id to deposit funds for
depositColleNFT
function depositColleNFT(address _erc721, uint256 _tokenId, address _sender) public virtual
Deposits the given ERC721 token to the vault contract.
Parameters
_erc721
address
The address of the ERC721 token.
_tokenId
uint256
The ID of the ERC721 token to deposit.
_sender
address
The address of the sender.
withdrawForResolution
function withdrawForResolution(struct IEscrow.Sale _sale, address _receiver) public virtual
Withdraws ERC721 token and ERC20 tokens to a single receiver who will handle making parties whole
Parameters
_sale
struct IEscrow.Sale
The sale that had a issue arise
_receiver
address
The address of the user who will make parties whole
withdrawToDepositors
function withdrawToDepositors(struct IEscrow.Sale _sale) public virtual
Withdraws ERC721 token and ERC20 tokens to the original depositors of these tokens
Parameters
_sale
struct IEscrow.Sale
The slme that is being cancelled
payout
function payout(struct IEscrow.Sale _sale, uint256 _colleComissionPoolAmount, uint256 _initialOwnerRoyaltyPayout, uint256 _recentOwnerRoyaltyPayout, uint256 _amountToSeller, address _initialOwner, address[4] _recentOwners) public virtual
Withdraws ERC721 token and ERC20 tokens on sale success to all parties.
Parameters
_sale
struct IEscrow.Sale
The sale that is completed
_colleComissionPoolAmount
uint256
The amount of the sale to payout in comissions
_initialOwnerRoyaltyPayout
uint256
The amount of the sale to payout to the original owner as a royalty
_recentOwnerRoyaltyPayout
uint256
The amount of the sale each recent owner gets as a royalty
_amountToSeller
uint256
The amount that the seller is to received from the sale
_initialOwner
address
The address to receive the initial owner royalty
_recentOwners
address[4]
The recent owners to receive the recent owner royalty
_withdrawFromSale
function _withdrawFromSale(struct IEscrow.Sale _sale, address _erc20Receiver, address _erc721Receiver) internal virtual
Withdraws ERC721 token and ERC20 tokens to erc20 and erc721 receivers
Parameters
_sale
struct IEscrow.Sale
The sale that had a issue arise
_erc20Receiver
address
The address receiving the erc20 tokens in full including taxes
_erc721Receiver
address
The address receiving the erc721 token
_withdrawERC20
function _withdrawERC20(uint256 _saleId, address _erc20, address _to, uint256 _amount) internal virtual
Withdraws ERC20 tokens to a receiver
Parameters
_saleId
uint256
The sale this payout or royalty is from
_erc20
address
The address of the ERC20 token
_to
address
The address to receive the ERC20 tokens
_amount
uint256
The amount of ERC20 tokens to withdraw
onERC721Received
function onERC721Received(address _operator, address, uint256, bytes) public view returns (bytes4)
_from, _tokenId and _data parameters are exist per standard but are unused
Function that is called when an ERC721 token is received.
Parameters
_operator
address
The address of the operator, which must be the Vault itself
address
uint256
bytes
supportsInterface
function supportsInterface(bytes4 _interfaceId) public view virtual returns (bool)
Checks if the contract implements an interface.
Parameters
_interfaceId
bytes4
The ID of the interface.
Return Values
[0]
bool
True if the contract implements the interface, false otherwise.
_getPermitSetOffchainPayoutHash
function _getPermitSetOffchainPayoutHash(bool _offchainPayout, struct Signature _signature) internal view virtual returns (bytes32)
Computes the EIP-712 hash that should be signed by the buyer to buy a token.
Parameters
_offchainPayout
bool
Whether to turn on or off offchain payouts.
_signature
struct Signature
The address of the buyer and the deadline
Return Values
[0]
bytes32
Returns the EIP-712 hash.
Last updated