📌Escrow

Overview

The Escrow contract is designed to securely manage the escrow process for various types of assets including ERC-20 tokens, Ether, and ERC-721 (NFT) tokens.

It acts as an intermediary to hold assets until predefined conditions are met, providing a trustless mechanism for transactions between parties.

Methods

acceptToken

Accepts ERC-20 tokens into escrow.

Parameters

Parameter

Type

Description

tokenAddress

address

Address of the ERC-20 token.

_amount

uint256

Amount of tokens to be escrowed.

_endTime

uint256

Timestamp when the escrow will be unlocked.

Returns

Return

Type

Description

balance

uint256

Remaining balance of the sender post-transaction.

acceptEth

Accepts Ether into escrow.

Parameters

Parameter

Type

Description

_endTime

uint256

Timestamp when the escrow will be unlocked.

Returns

Return

Type

Description

value

uint256

Amount of Ether sent to the contract.

tokenTransaction

Retrieves the current state of an ERC-20 token transaction in escrow.

Parameters

Parameter

Type

Description

tokenAddress

address

Address of the ERC-20 token.

Returns

Return

Type

Description

Tuple

(uint256, bool, bool, uint256)

Amount, lock status, spent status, and mature time.

ethTransacton

Retrieves the current state of an Ether transaction in escrow.

Returns

Return

Type

Description

Tuple

(uint256, bool, bool, uint256)

Amount, lock status, spent status, and mature time.

ethRelease

Admin function to unlock Ether in escrow.

Parameters

Return

Type

Description

success

bool

Returns true if successful.

ethWithdraw

Allows the seller to withdraw unlocked Ether.

Returns

Return

Type

Description

success

bool

Returns true if successful.

tokenRelease

Admin function to unlock ERC-20 tokens in escrow.

Parameters

Parameter

Type

Description

tokenAddress

address

Address of the ERC-20 token.

Returns

Return

Type

Description

success

bool

Returns true if successful.

tokenWithdraw

Allows the seller to withdraw unlocked ERC-20 tokens.

Parameters

Parameter

Type

Description

tokenAddress

address

Address of the ERC-20 token.

Returns

Return

Type

Description

success

bool

Returns true if successful.

acceptNFT

Accepts an ERC-721 token into escrow.

Parameters

Parameter

Type

Description

tokenContract

address

Address of the ERC-721 token contract.

tokenId

uint256

ID of the token.

_endTime

uint256

Timestamp when the escrow will be unlocked.

Returns

Return

Type

Description

tokenId

uint256

ID of the accepted token.

nftTransactions

Retrieves current state of transactions in escrow for a specific ERC-721 token contract.

Parameters

Parameter

Type

Description

tokenContract

address

Address of the ERC-721 token contract.

Returns

Return

Type

Description

transactions

NFTTransaction[]

An array of NFTTransaction structures.

nftRelease

Admin function to unlock an ERC-721 token in escrow.

Parameters

Parameter

Type

Description

tokenContract

address

Address of the ERC-721 token contract.

tokenIndex

uint256

Index of the token in the escrow.

Returns

Return

Type

Description

success

bool

Returns true if successful.

nftWithdraw

Allows the seller to withdraw an unlocked ERC-721 token.

Parameters

Parameter

Type

Description

tokenContract

address

Address of the ERC-721 token contract.

tokenIndex

uint256

Index of the token in the escrow.

Returns

Return

Type

Description

success

bool

Returns true if successful.

Last updated