ITeamSmartWallet

A smart contract for managing access-controlled and upgradable smart wallets for teams. Includes capabilities for trading NFTs, managing financials, and upgrading the smart wallet.

The contract uses OpenZeppelin's AccessControlUpgradeable for access control functionality, and UUPSUpgradeable for the upgradeability. It implements the IERC721ReceiverUpgradeable and IERC1155ReceiverUpgradeable interfaces to enable receiving NFTs, and uses the SignatureValidator contract to enable off-chain approval of transactions.

AllowUpgrade

event AllowUpgrade(bool isAllowed)

Emitted when a admin consents to a contract upgade.

UpdateMarketHub

event UpdateMarketHub(address marketHub)

Emitted when the registered MarketHub is updated.

setMarketHub

function setMarketHub(address _marketHub) external

Sets the address of the MarketHub contract.

Parameters

Name
Type
Description

_marketHub

address

The new MarketHub contract address.

executeRawTransaction

This function is used to execute raw transactions.

Can only be called by the DEFAULT_ADMIN_ROLE. Calls an arbitrary function in a smart contract.

Parameters

Name
Type
Description

_target

address

The target smart contract address.

_value

uint256

The amount of native token to be sent.

_data

bytes

The raw data representing a function and its parameters in the smart contract.

Return Values

Name
Type
Description

success

bool

Boolean indicator for the status of transaction execution.

returnData

bytes

Data returned from function call.

transferERC721

This function is used to transfer ERC721 NFTs from this contract to another address.

Can only be called by the FINANCIAL_ROLE.

Parameters

Name
Type
Description

_collection

address

The address of the NFT collection.

_recipient

address

The address to receive the NFT.

_tokenId

uint256

The ID of the NFT to transfer.

list

This function is used to list a token for trading.

Can only be called by the TRADING_ROLE.

Parameters

Name
Type
Description

_collection

address

The address of the token's collection.

_tokenId

uint256

The ID of the token to list.

_erc20

address

The address of the ERC20 token to be used for payment.

_price

uint256

The listing price of the token.

delist

This function is used to delist a token from trading.

Can only be called by the TRADING_ROLE.

Parameters

Name
Type
Description

_collection

address

The address of the token's collection.

_tokenId

uint256

The ID of the token to delist.

_erc20

address

The address of the ERC20 token previously used for payment.

buy

This function is used to buy a listed token.

Can only be called by the TRADING_ROLE.

Parameters

Name
Type
Description

_collection

address

The address of the collection contract to which the token belongs.

_tokenId

uint256

The ID of the token to be bought.

_erc20

address

The address of the ERC20 token to be used as the payment currency.

offer

This function is used to make an offer for a token.

Can only be called by the TRADING_ROLE.

Parameters

Name
Type
Description

_collection

address

The address of the token's collection.

_tokenId

uint256

The ID of the token to offer.

_erc20

address

The address of the ERC20 token to be used for payment.

_price

uint256

The offered price for the token.

revokeOffer

This function is used to revoke an offer for a token.

Can only be called by the TRADING_ROLE.

Parameters

Name
Type
Description

_collection

address

The address of the token's collection.

_tokenId

uint256

The ID of the token for which the offer is revoked.

_erc20

address

The address of the ERC20 token previously used for the offer.

acceptOffer

This function is used to accept an offer for a token.

Can only be called by the TRADING_ROLE.

Parameters

Name
Type
Description

_buyer

address

The address of the buyer whose offer is being accepted.

_erc20

address

The address of the ERC20 token used in the offer.

_collection

address

The address of the token's collection.

_tokenId

uint256

The ID of the token for which the offer is accepted.

updateSale

This function is used to update the state of a sale.

Can only be called by the TRADING_ROLE.

Parameters

Name
Type
Description

_saleId

uint256

The ID of the sale to update.

_newState

enum IEscrow.State

The new state of the sale.

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.

transferNative

This function allows the caller to perform a native transfer.

The caller must be a user with the FINANCIAL_ROLE.

Parameters

Name
Type
Description

_recipient

address payable

The address of the recipient.

_amount

uint256

The amount to transfer.

approveERC20

This function allows a user to approve a ERC20 transfer.

The function must be called by a user with the FINANCIAL_ROLE.

Parameters

Name
Type
Description

_token

contract IERC20

The ERC20 token to approve.

_spender

address

The address of the spender.

_amount

uint256

The amount to approve.

transferERC20

This function allows the caller permit to perform a ERC20 transfer.

The function must be called by a user with the FINANCIAL_ROLE.

Parameters

Name
Type
Description

_token

address

The ERC20 token to transfer.

_recipient

address

The address of the recipient.

_amount

uint256

The amount to transfer.

approveERC721

This function allows the caller to approve a ERC721 transfer.

The function must be called by a user with the FINANCIAL_ROLE.

Parameters

Name
Type
Description

_token

address

The ERC721 token to approve.

_to

address

The address to approve.

_tokenId

uint256

The ID of the token to approve.

setApprovalForAllERC721

This function allows a caller to approve or revoke approval of an operator to transfer any NFT by the owner.

The function must be called by a user with the FINANCIAL_ROLE.

Parameters

Name
Type
Description

_erc721

address

The ERC721 contract to approve.

_operator

address

The address to approve.

_approved

bool

The approval status.

setApprovalForAllERC1155

This function allows a caller to set approval for all ERC1155 tokens.

The function must be called by a user with the FINANCIAL_ROLE.

Parameters

Name
Type
Description

_erc1155

address

The ERC1155 token contract.

_operator

address

The operator to be approved or disapproved.

_approved

bool

Approval status to set for the operator.

transferFromERC1155

This function allows a caller to perform a ERC1155 transfer.

The function must be called by a user with the FINANCIAL_ROLE.

Parameters

Name
Type
Description

_erc1155

address

The ERC1155 token contract.

_from

address

The address to transfer from.

_to

address

The address to transfer to.

_id

uint256

The ID of the token to transfer.

_amount

uint256

The amount of the token to transfer.

Last updated