AssetParam not working pyteal

I need to run Assert(AssetParam.clawback(assetid) == verifiedaddr),, but it’s not working. Why is this?

You need to pass assetId in foreign assets and then pass the index of it to AssetParam.

clawbackExpr = AssetParam.clawback(Int(0))
clawbackAddr = clawbackExpr.value()

make sure the assetId is passed in the foreign assets.

Here is the doc link:

Thanks for your advice, but that’s what I have done so far - could you please explain what the value does and how to use it in an Assert?

AssetParam.clawback() will not return the clawback address, instead it returns the MayBeValue expression.
you need to call .value() on the MayBeValue expression to get the exact value.

Here is the documentation for it:

When I do Assert(AssetParam.clawback(assetid).value() == verifiedaddr), it throws the error pyteal.TealCompileError: Scratch slot load occurs before store. Thank you for your help so far.

assetClawbackExpr = AssetParam.clawback(Int(0))
    assetClawbackAddr = Seq([
Assert(assetClawbackAddr == verifiedaddr)
1 Like

Thank you so much for saving me hours of debugging!

1 Like