Assets and pending rewards

Hi,

For non payment transactions like asset transfers, are pending rewards added to the receiver balance?

I mean, seems only the sender of a non-payment tx collects pending rewards but want to know if other accounts affected by the tx (like the receiver of assets) do also collect rewards.

Regards,
Mauro.

I am pretty sure it is any transaction where your address involved. From: https://www.algorand.com/resources/blog/rewards-technical-overview

Unclaimed pending rewards are claimed by an address when that address is contained within a transaction’s To, From, or Close parameters. That means it is impossible to transact without claiming any unclaimed pending rewards first. If there are unclaimed pending rewards to claim, they will be noted in the transaction and available when you query that transaction.

Hi @JasonW, the source code code is confusing me.

On payment TXs, you can see what you say is true and node’s api also shows that information (stored internally in the ApplyData field of the transaction information)

But on non-payment TXs I have a confusion when, for e.g., asset balances are modified, if rewards are collected.

I need to look more into this. Take a look at eval.go specifically move and get and put functions. If the get is called and then a put I believe it is updated. It is definitely in payment.go.

Yes, yesterday I saw put adds an account into an array and later those accounts seems to collect the pending rewards but, first, I’m not sure if I’m following the correct flow and, second, I cannot also figure out if that information is really stored.

Meantime I’m also trying to collect some rewards in order to do a live test on testnet or mainnet.

Max just pointed out to me that the gets second parameters are false meaning the account balance do not get updated with rewards so the put wont reflect those. If you do an asset transfer do you get rewards in the sender?

I have to check, but I’m not worried about the sender because the fromrewards field is always present if a TX implies collecting them.

My doubt is related to asset xfer (and might be freeze too) receiver and close accounts, if they also collect rewards in tihs scenario or not.

Looking at the code, I dont believe they do

1 Like

I think the same. But I’m not sure.

Can you test it with an asset transfer or find an existing one on mainnet and use something like:
let tx = (await algodclient.accountInformation(account));
var textedJson = JSON.stringify(tx, undefined, 4);
console.log(textedJson);

This should give you output like: (note this field amountwithoutpendingrewards)
“round”: 6130326,
“address”: “TZ27KYCVDKJA7NIHGPNMS545CFCT2Y44U2GU5E6TRM7ZWVLRJKDLURA34A”,
“amount”: 100000000,
“pendingrewards”: 0,
“amountwithoutpendingrewards”: 100000000,
“rewards”: 0,
“status”: “Offline”

I registered to receive an asset. I’m waiting some rounds to earn rewards. I’ll tell you the results.

Ok, @JasonW confirmed receiving assets DOES NOT involves collecting pending rewards.

Did a query to the node about my account before and after receiving the asset and the only affected data, as expected, was the asset amount but pendingrewards remains the same.

Thanks for the assistance!!

Thanks for posting back.