Open
Description
Suppose we have accounts that are associated with some users.
!(bind! &acc1 (new-state (usdt 100)))
(= (asset s1) &acc1)
We can change the number of assets by changing the state.
!(change-state! &acc1 (usdt 200))
Is this representation the right one for the described model?
Suppose we have to implement a loop for buying assets by all the users. Buying process can only be made by some fixed portions. Thus we need reasonable amount of iterations to satisy some critical value thresh
that is simply a sum of all assets.
!(bind! &acc2 (new-state (usdt 300)))
(= (asset s2) &acc2)
!(bind! &quant (new-state (usdt 1)))
(= (buy $agent $quant)
(let ($usdt $num) (asset $agent) $num
(change-state! (asset $agent) (usdt 200)) ...)
)
(= (buy_loop $threshold $agent_list)
(if (<= (get_all_assets $agent_list) $threshold)
(for_every_agent_in_agent_list (buy $agent))
)
)
How to do that iterations in the most effective way?
Activity