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.
EX:
clawbackExpr = AssetParam.clawback(Int(0))
clawbackAddr = clawbackExpr.value()
make sure the assetId is passed in the foreign assets.
Here is the doc link:
clawbackExpr
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:
https://pyteal.readthedocs.io/en/stable/api.html?highlight=AssetParam#pyteal.MaybeValue
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([
assetClawbackExpr,
assetClawbackExpr.value()
])
Assert(assetClawbackAddr == verifiedaddr)
Thank you so much for saving me hours of debugging!