# Transfer and call, a new entrypoint for FA2

**URL:** https://forum.tezosagora.org/t/transfer-and-call-a-new-entrypoint-for-fa2/3144
**Category:** TZIP
**Created:** [May 20, 2021, 1:22pm UTC](https://forum.tezosagora.org/t/transfer-and-call-a-new-entrypoint-for-fa2/3144 "2021-05-20T13:22:59Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Jordan](https://forum.tezosagora.org/letter_avatar_proxy/v4/letter/j/eb9ed0/32.png) [@Jordan](https://forum.tezosagora.org/u/Jordan)
#### Post date: [May 20, 2021, 1:22pm UTC](https://forum.tezosagora.org/t/transfer-and-call-a-new-entrypoint-for-fa2/3144/1 "2021-05-20T13:22:59Z")

</div>

# Transfer and call

## Key points

- SmartPy team proposed as new TZIP inspired by [ERC677](https://github.com/ethereum/EIPs/issues/677) with a `transfer_and_call` entry-point.
- You can read the whole [here](https://gitlab.com/tzip/tzip/-/blob/b40b4ef8d966a610a6cd8515dcf6ade9739121b9/proposals/tzip-23/tzip-23.md).
- Here is the [merge request](https://gitlab.com/tzip/tzip/-/merge_requests/163).
- Here is a example of a scenario using it: [SmartPy](https://smartpy.io/ide?cid=QmeVo8dGqCgvTmt5NewZxCsZ5SS5PNSMLpCgLBBqMaHDAg&k=181eb256d440a3b9c9a7).
- We are waiting for your comments and suggestions.

## A new entry-point for FA2

TZIP-23 extends FA2 token specifications by introducing a multi-action  
transfer entry point. The entry point adds a proxy mechanism to the standard  
transfer behavior, allowing the source to send a request or notify the recipient  
after a successful transfer.

This TZIP adds a new entry-point to FA2 token contracts,  
`transfer_and_call` which can be called to transfer tokens to a contract and  
send a follow up call. Once the tokens are transferred, the token contract calls  
the receiving contract’s entry-point given in argument with the specified data.

The `transfer_and_call` is inspired by [ERC677](https://github.com/ethereum/EIPs/issues/677)).

## Motivation

Currently, the FA2 transfer standard doesn’t offer any mechanism to allow the  
sender to notify the recipient of a transaction. This mechanism is necessary to  
improve the interoperability between contracts. As a result, it will turn the  
communication more decentralized by removing off-chain dependencies.

## Interface Specification

Token contract implementing this TZIP standard MUST implement the given entrypoint: [`transfer_and_call`](#transfer_and_call)

### `transfer_and_call`

```michelson
(list %transfer_and_call
  (pair
    (address %from_)
    (list %txs
      (pair
        (address %to_)
        (address %callback)
        (bytes %data)
        (nat %token_id)
        (nat %amount)
      )
    )
  )
)

```

The entrypoint SHALL perform and only perform the following 3 actions:

1. Regular transfer
2. Callback verification
3. Callback

The entrypoint SHOULD NOT perform any extra logic and SHOULD NOT call any other  
contract or rely on any other instruction that can fail because of a third party.

### Regular transfer

The transfer part of the `transfer_and_call` MUST work **exactly** like a call to  
the `transfer` entrypoint would have do (see FA2#transfer).

### Callback verification

The contract MUST verify the validity each `%callback`.

The `%callback` address is in the form: `prefix` `hash` `suffix` where `suffix`  
is in the form `%entrypoint`  
The `%to_` address is in the form: `prefix` `hash` (even if nothing prevents  
user sending an entrypoint).

The transaction MUST FAILWITH `"FA2_CALLBACK_AND_RECEIVER_DIFFERS"` if  
`%callback` and `%to_` differ by more than the `suffix`.

### Callback

The contract MUST return a list of transfer operation for each `%callback` in  
the **same order** that the transfer are performed without deduplicating or  
aggregating them with the following type argument:

```auto
(pair
  (address %sender)
  (bytes %data)
  (nat %token_id)
  (nat %amount)
  )
)

```

* * *

Thank you for reading.  
We are waiting for your comments and suggestions!

---

<div class="post-metadata">

### Author: ![mpsp](https://forum.tezosagora.org/letter_avatar_proxy/v4/letter/m/3da27b/32.png) [@mpsp](https://forum.tezosagora.org/u/mpsp)
#### Post date: [May 20, 2021, 5:52pm UTC](https://forum.tezosagora.org/t/transfer-and-call-a-new-entrypoint-for-fa2/3144/2 "2021-05-20T17:52:59Z")

</div>

> [@Jordan](#):
>
> tierce entity

Might want to adjust the wording here.

---

<div class="post-metadata">

### Author: ![Jordan](https://forum.tezosagora.org/letter_avatar_proxy/v4/letter/j/eb9ed0/32.png) [@Jordan](https://forum.tezosagora.org/u/Jordan)
#### Post date: [May 20, 2021, 6:01pm UTC](https://forum.tezosagora.org/t/transfer-and-call-a-new-entrypoint-for-fa2/3144/3 "2021-05-20T18:01:45Z")

</div>

Thank you.  
Changed to `third party`

---

<div class="post-metadata">

### Author: ![arrijabba](https://forum.tezosagora.org/letter_avatar_proxy/v4/letter/a/b9bd4f/32.png) [@arrijabba](https://forum.tezosagora.org/u/arrijabba)
#### Post date: [May 25, 2021, 5:06pm UTC](https://forum.tezosagora.org/t/transfer-and-call-a-new-entrypoint-for-fa2/3144/4 "2021-05-25T17:06:43Z")

</div>

i get it but is there any way to keep this entrypoint optional? message passing in Tezos is still pretty unsafe even with DFS. So like I’m sure there would be folks who want to use this, so i support the TZIP generally. but if I want to make a complex contract and embed an FA2 token inside, I don’t want to be forced into implementing this endpoint to get my little “FA2” badge.

---

<div class="post-metadata">

### Author: ![Jordan](https://forum.tezosagora.org/letter_avatar_proxy/v4/letter/j/eb9ed0/32.png) [@Jordan](https://forum.tezosagora.org/u/Jordan)
#### Post date: [October 21, 2021, 12:15pm UTC](https://forum.tezosagora.org/t/transfer-and-call-a-new-entrypoint-for-fa2/3144/5 "2021-10-21T12:15:53Z")

</div>

I updated the proposal.

Now we can specify a callback address that is totally different from the receiving address. The receiving address is now passed in the callback args.

It removed the need of `same_underlying_address` verification which was not well standardize in Michelson.

**Callback is now**

```auto
(pair
  (nat %amount)
  (bytes %data)
  (address %receiver)
  (address %sender)
  (nat %token_id)
)

```
