Afternoon all,
I have a method in a smart contract for some opt-ins like so:
def stakeAssetsOptin():
return Seq([
InnerTxnBuilder.Begin(),
InnerTxnBuilder.SetFields({
TxnField.type_enum: TxnType.AssetTransfer,
TxnField.xfer_asset: Int(833815143),
TxnField.asset_amount: Int(0),
TxnField.asset_receiver: Global.current_application_address(),
}),
InnerTxnBuilder.Submit(),
. . .
. . .
However, when I try to call this method with the code below, I receive:
algosdk.error.AlgodHTTPError: TransactionPool.Remember: transaction XLU23PGAKAKBP54MW4HBCOJ45ELYPNT2FRNOST65NPEZARY3KEQQ: logic eval error: unavailable Asset 833815143. Details: pc=616, opcodes=itxn_field TypeEnum; intc 5 // 833815143; itxn_field XferAsset
sender=sender_address,
sp=params,
index = app_id,
app_args = [0x3e6c9ef4.to_bytes(4, 'big')],
on_complete= OnComplete.NoOpOC
)
The docs say an unavailable asset means it doesn’t exist, but I’m on mainnet (where the smart contract is also launched and I am sending transactions from). To be clear, I am trying to opt my smart contract into some assets.
Any assistance would be appreciated, thank you!
Edit: Just FYI I also tried this for my method and also didn’t work:
InnerTxnBuilder.Begin(),
InnerTxnBuilder.SetFields({
TxnField.type_enum: TxnType.AssetTransfer,
TxnField.xfer_asset: Int(833815143),
TxnField.on_completion: OnComplete.OptIn
}),
. . .
. . .
UPDATE: Was able to get it to go through by including the foreign assets in the application call args and using my original method at the top of this post, thank you