Hi guys!
I want to opt-in an escrow account for an asset, but I’m worried someone could drain the Algos out of the account by opting it in for an asset repeatedly after deployment. In order to prevent this, I require the fee of the opt-in txn to be 0. Then, I send it along with another txn which pays the fees of the other.
I have an issue setting the fee of the opt-in transaction. Here is my code:
params = cl.suggested_params()
params.flat_fee = True
params.fee = 0
print(params, params.fee)
atn = AssetTransferTxn(esc_addr, params, esc_addr, 0, asset_id)
print(atn)
The output shows “params” with the proper fee, but for some reason it doesn’t construct the txn correctly:
I think this could be a bug. Haven’t tried this fee structure with other txn types…
You monkey-patched that params object fee attribute with params.fee = 0
and the SDK has allowed that, but later the minimum fee condition took place.
The fee is taken from the sender, so when some address opt-in (with the amount of 0) for an asset then that account’s balance will decrease by 0.001 Algos. And the draining won’t take the place as you’re in charge for creating that transaction.
Take a look at this example and notice if not holding:
condition in the Python code.
I’ve used that code to opt-in to ASAs, @ipaleka. My issue is I want to set the fee to 0 and pay the minimum fee of 1000 with another transaction. This can be done according to the atomic transfer docs.
There is an example of 2 transactions with that structure using goal in the latest AVM update here
So, I believe this is an unintentional fee update.
I figured out the issue. When I first installed py-algorand-sdk, there was no support for pooled fees.
To fix this issue, I just ran
pip install py-algorand-sdk --upgrade
in my terminal.