🛠️TransferNFT

Helper action to transfer a NFT token to the specified address

Description

Action transfers a ERC721 compliant NFT in the context of a DSProxy from -> to an account. Calling the standard IERC721(_nftAddr).transferFrom(_from, _to, _nftId);

The action is a utils action and does not emit custom events to save on gas cost.

SDK Action


// nft approval needed if from != proxy
const transferNFTAction = new dfs.actions.basic.TransferNFTAction(
    nftAddr,
    from,
    to,
    tokenId,
);

Contract

This is a standard dfs action.

Proxy must have approve if _from != proxy

to address can't be address(0), action will revert

Input:

/// @param nftAddr Address of the ERC721 contract
/// @param from Where from we are pulling the nft (defaults to proxy)
/// @param to Address where we are transferring the nft
/// @param nftId TokenId we are transferring
struct Params {
    address nftAddr;
    address from;
    address to;
    uint256 nftId;
}

Return value:

return bytes32(inputData.nftId);

Last updated