> For the complete documentation index, see [llms.txt](https://yuga.gitbook.io/zkyuga-whitepaper/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yuga.gitbook.io/zkyuga-whitepaper/developer-guide/stablecoin/transfer.md).

# transfer

The `transfer` function is a fundamental feature of the StableCoin Contracts, enabling token holders to send a specified amount of tokens to another Ethereum address. This operation is integral to the basic functionality of ERC20 tokens, facilitating the movement of tokens between addresses for transactions, payments, or other purposes.

## Method Signature

```typescript
async transfer(userAddress: string, amount: string, signer: any): Promise<string>
```

## Parameters

* `userAddress: string`: The Ethereum address to which the tokens will be transferred. This can be a standard Ethereum address or an ENS name.
* `amount: string`: The quantity of tokens to be transferred, represented as a string.
* `signer: any`: An object representing the signer of the transaction, typically obtained from a wallet interface like MetaMask or ethers.js.

## Function Logic

1. **Resolve ENS Name**: Converts the `userAddress` from an ENS name to the corresponding Ethereum address if necessary.
2. **Get Contract Instance**: Creates a contract instance using the `signer` for interacting with the blockchain.
3. **Execute Transfer**: Performs the `transfer` method on the contract with the resolved `userAddress` and specified `amount`.
4. **Return Result**: The result of the transfer operation, usually a transaction hash, is returned as a string.

## Example Usage

```typescript
const recipientAddress = "recipient.eth";
const amount = "200";
const signer = ethersProvider.getSigner();

stableCoinContract.transfer(recipientAddress, amount, signer)
    .then(result => 
        // add your logic here 
    )
    .catch(error => 
        // add your logic here
    );
```

## Notes

* The `transfer` function is essential for the liquidity and usability of ERC20 tokens.
* Proper address resolution and accurate amount specification are crucial for successful token transfers.
