current position:Home>The execution process of smart contract is too long

The execution process of smart contract is too long

2022-02-03 23:11:48 Q & A of Denglian community

An interest bearing contract , Users log in every day eth Or token ,24 Click to call the method of calculating dividends in the contract , This method first calculates the amount of dividends everyone deserves , then for The cycle changes mapping Corresponding types address Medium balance value , If the user is particularly large , This method executes , It's impossible gas limit It's too big , If there is such a situation, how to deal with it better , Thank you very much ?




Take the answer 1:

A common question , The dividend calculation strategy needs to be modified ( Discuss with the product ), There are usually two ways :

  1. Calculation converted to a public variable , such as : Only calculate how much dividend should be paid per unit currency .

  2. Into their respective users trigger their own computing logic .

The above is the recommended way , Here is Not recommended way ( Use only if the above methods cannot be used ): By passing in parameters , Piecewise calculation .




copyright notice
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.
https://en.netfreeman.com/2022/02/202202032311458781.html

Random recommended