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

constructor

initialize

Initialize function that replaces the constructor

_authorizeUpgrade

Internal function to authorize upgrades, verifies if the new implementation address matches the one provided by the upgrade gatekeeper.

Parameters

Name
Type
Description

newImplementation

address

The address of the new implementation.

onlyEscrow

setOffchainPayout

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

Name
Type
Description

_offchainPayout

bool

Whether to turn on or off offchain payouts.

permitSetOffchainPayout

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

Name
Type
Description

_offchainPayout

bool

Whether to turn on or off offchain payouts.

_signature

struct Signature

disableOffchainPayout

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

Name
Type
Description

_address

address

The address to disable offchain payouts for

depositERC20ForSale

Deposits the given amount of ERC20 token to the vault contract.

Parameters

Name
Type
Description

_saleId

uint256

The sale id to deposit funds for

depositColleNFT

Deposits the given ERC721 token to the vault contract.

Parameters

Name
Type
Description

_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

Withdraws ERC721 token and ERC20 tokens to a single receiver who will handle making parties whole

Parameters

Name
Type
Description

_sale

struct IEscrow.Sale

The sale that had a issue arise

_receiver

address

The address of the user who will make parties whole

withdrawToDepositors

Withdraws ERC721 token and ERC20 tokens to the original depositors of these tokens

Parameters

Name
Type
Description

_sale

struct IEscrow.Sale

The slme that is being cancelled

payout

Withdraws ERC721 token and ERC20 tokens on sale success to all parties.

Parameters

Name
Type
Description

_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

Withdraws ERC721 token and ERC20 tokens to erc20 and erc721 receivers

Parameters

Name
Type
Description

_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

Withdraws ERC20 tokens to a receiver

Parameters

Name
Type
Description

_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

_from, _tokenId and _data parameters are exist per standard but are unused

Function that is called when an ERC721 token is received.

Parameters

Name
Type
Description

_operator

address

The address of the operator, which must be the Vault itself

address

uint256

bytes

supportsInterface

Checks if the contract implements an interface.

Parameters

Name
Type
Description

_interfaceId

bytes4

The ID of the interface.

Return Values

Name
Type
Description

[0]

bool

True if the contract implements the interface, false otherwise.

_getPermitSetOffchainPayoutHash

Computes the EIP-712 hash that should be signed by the buyer to buy a token.

Parameters

Name
Type
Description

_offchainPayout

bool

Whether to turn on or off offchain payouts.

_signature

struct Signature

The address of the buyer and the deadline

Return Values

Name
Type
Description

[0]

bytes32

Returns the EIP-712 hash.

Last updated