AraBlocks / ara-contracts

Blockchain interactions in Ara modules.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pass price into Purchased event

MarkGeeRomano opened this issue · comments

If you pass price_ as a third parameter into the Purchased event, it will be much faster to calculate earnings. Currently to get earnings, I have to query all Purchased and PriceSet events from the contract. These are not trivial, and they each take a good amount of time. Then I have to loop through each Purchased event, look at the block number, and match it up with a PriceSet based on its block number, furthering time complexity.

By adding price to the emit, this process can be sped up alot, and will make for a faster app experience for users. It should only cost a few hundred more gas, which is really a very small fee I think.

Fixed #40