setTokenFactors

params of setTokenParams -> storage with [ tokens[tokenId] ] upd

Updates token-related factors of the protocol by tokenId of yToken.

Types

type setTokenParams     is [@layout:comb] record [
  tokenId               : nat;
  collateralFactorF     : nat;
  reserveFactorF        : nat;
  interestRateModel     : address;
  maxBorrowRate         : nat;
  threshold             : nat;
  liquidReserveRateF    : nat;
]

Parameter
Type
Description

tokenId

nat

token identifier

collateralFactorF

nat

collateral factor

as float number multiplied by precision= 1000000000000000000n; (1e+18)

reserveFactorF

nat

reserve factor

as float number multiplied by precision= 1000000000000000000n; (1e+18)

interestRateModel

address

priceFeed proxy contract instance

maxBorrowRate

nat

threshold

nat

liquidReserveRateF

nat

Usage

const tokenId = 0; // or new BigNumber(0) or "0"
const yupana = await tezos.contract.at(yTokenAddress);
const batchArray = [
      {
        kind: "transaction",
        ...yupana.methods.updateInterest(tokenId).toTransferParams(),
      },
      {
        kind: "transaction",
        ...proxy.methods.getPrice([tokenId]).toTransferParams(),
      },
      {
        kind: "transaction",
        ...yupana.methods.setTokenFactors(
          tokenId,
          650000000000000000,
          200000000000000000,
          "KT1...",
          5000000000000,
          550000000000000000
        ).toTransferParams(),
      },
    ];
const batch = await tezos.wallet.batch(batchArray);
const operation = await batch.send();
await operation.confirmation();

Errors

  • yToken/not-admin - sender is not contract admin.

  • yToken/need-update - token price and interest not updated (see warning above)

Last updated