๐Ÿ“–
Yupana Document Portal
  • Introduction
    • What is Yupana.Finance?
    • Participants
    • FAQ
  • Lending
    • Supplying assets
      • General
    • Borrowing assets
      • General
  • Liquidation
  • Liquidity Risk
    • Yupana Interest Rate
  • โš™๏ธDeveloper space
    • yToken contract methods
      • ๐Ÿ“„Storage overview
      • accrueInterest
      • priceCallback
      • updateInterest
      • ๐Ÿ”ตLending methods
        • borrow
        • enterMarket
        • exitMarket
        • liquidate
        • mint
        • redeem
        • repay
      • ๐Ÿ”ตFA2 Token entrypoints
        • balance_of
        • get_total_supply
        • transfer
        • update_operators
      • ๐Ÿ›‘Admin methods
        • ๐Ÿ“ฅSetup entrypionts
          • setTokenAction
          • setUseAction
        • ๐ŸคนManage entrypoints
          • addMarket
          • setAdmin
          • setBorrowPause
          • setGlobalFactors
          • setTokenFactors
          • updateMetadata
          • withdrawReserve
    • InterestRate contract
      • ๐Ÿ”ตOn-chain views
        • getBorrowRate
        • getSupplyRate
        • getUtilizationRate
      • ๐Ÿ›‘Admin methods
        • setCoefficients
        • updateAdmin
    • PriceFeed contract
      • getPrice
      • receivePrice
      • ๐Ÿ›‘Admin methods
        • setProxyAdmin
        • updateOracle
        • updatePair
        • updateYToken
  • Agreements
    • Terms of Service
    • Privacy Policy
    • Cookie Policy
Powered by GitBook
On this page
  • Types
  • Usage
  • Errors
  1. Developer space
  2. yToken contract methods
  3. FA2 Token entrypoints

transfer

params of transferParams -> (list(op), storage upd)

Previousget_total_supplyNextupdate_operators

Last updated 3 years ago

Implementation of FA2 interface method, more info about FA2 transfer you can read in the link below.

Types

yToken/fa2Types.ligo
type tokenId is nat

type transferDestination is [@layout:comb] record [
  to_                   : address;
  token_id              : tokenId;
  amount                : nat;
]

type transferParam is [@layout:comb] record [
  from_                 : address;
  txs                   : list(transferDestination);
]

type transferParams is list(transferParam)
Parameter
Type
Description

from_

address

account transfer tokens from

amount

nat

amount of tokens

to_

address

account transfer tokens to

token_id

nat

token identifier

Usage

const tokenId = 0; // or new BigNumber(0) or "0"
const alice = "tz1..."
const bob = "tz2..."
const yupana = await tezos.contract.at(yTokenAddress);
const operation = await yupana.methods.transfer([
        {
          from_: alice,
          txs: [
            { to_: bob, token_id: tokenId, amount: 0 },
            { to_: alice, token_id: tokenId, amount: 6_000 },
          ],
        },
      ]).send();
await operation.confirmation();
token_id = 0
alice = "tz1..."
bob = "tz2..."
yupana = ContractInterface.from_michelson(code) # or client.contract(contract_address)...
call = yupana.transfer([{ "from_" : alice,
        "txs" : [
            {
                "amount": 0,
                "to_": bob,
                "token_id": token_id
            },
            {
                "amount": 6_000,
                "to_": alice,
                "token_id": token_id
            }
        ]
    }])
opg = call.inject()

Errors

  • FA2_NOT_OPERATOR - sender is not operator of from_ account.

  • yToken/token-taken-as-collateral - when user entered market (enterMarket) for this token.

  • FA2_TOKEN_UNDEFINED - token identifier is not assigned to any known tokens.

  • FA2_INSUFFICIENT_BALANCE - when transfer amount greater than account from_ balance (also underflow/srcBalance make the same check but underflow is unreachable)

โš™๏ธ
๐Ÿ”ต
Logoproposals/tzip-12/tzip-12.md ยท master ยท Tezos / tzipGitLab
TZIP-12: FA2 - Multi-Asset Interface