mint
params of yAssetParams -> (list(op), storage upd)
Add token to protocol and mints related yToken token for caller.
The yToken contract expects that underlying token info of tokenId is updated by calling PriceFeed.getPrice and updateInterest in the same block before this contract method.
Types
type yAssetParams is [@layout:comb] record [
tokenId : nat; // yToken token Id
amount : nat; // amount of underlying token to send to Yupana
]tokenId
nat
yToken identifier
amount
nat
amount of underlying token to be sent to protocol
Usage
const tokenId = 0; // or new BigNumber(0) or "0"
const amount = 10_000_000; // or new BigNumber(10_000_000) or "10000000"
const yupana = await tezos.contract.at(yTokenAddress);
const proxy = await tezos.contract.at(proxyAddress);
const batchArray = [
{
kind: "transaction",
...yupana.methods.updateInterest(tokenId).toTransferParams(),
},
{
kind: "transaction",
...proxy.methods.getPrice([tokenId]).toTransferParams(),
},
{
kind: "transaction",
...yupana.methods.mint(tokenId, amount).toTransferParams(),
},
];
const batch = await tezos.wallet.batch(batchArray);
const operation = await batch.send();
await operation.confirmation();token_id = 0
amount = 10_000_000
yupana = ContractInterface.from_michelson(code) # or client.contract(contract_address)...
proxy = ContractInterface.from_michelson(prx_code) # or client.contract(prx_contract_address)...proxy = ContractInterface.from_michelson(code) # or client.contract(contract_address)...
call = pytezos.bulk(
yupana.updateInterest(token_id),
proxy.getPrice([token_id]),
yupana.mint(token_id, amount)
).autofill().sign()
opg = call.inject()Errors
token/cant-get-contract-token- FA12 token contract address does not containtransferentrypoint from FA12 interface.token/cant-get-contract-fa2-token- FA2 token contract address does not containtransferentrypoint from FA2 interface.underflow/liquidity - reserves- liquidity more than reserves.yToken/amount-is-zero- passed zeroamount.yToken/need-update- token price and interest not updated (see warning above)yToken/yToken-undefined- token identifier is not assigned to any known yTokens.
Last updated