Walkthrough of using Trackers
policy.json
file for your project. Below is an example policy to illustrate the examples that will follow.
amount
does not exceed 1 billion tokens.
_update
function. This ensures the policy is
applied to both the transfer
and transferFrom
function calls.positiveEffect
that updates the tracker value whenever a transfer
call is successful.
TR
as in TR:TradingVolume
.When referencing in an update you must precede it with TRU
as in
TRU:TradingVolume
1_000_000_000
in trading volume is reached the token will no longer be transferrable. Fixing this will requires resetting the TradingVolume
tracker when the defined duration is reached. To do this we need another tracker to record the timestamp and mark the beginning of a rolling 24 hour period. Then we test for that condition in a new rule and reset the tracker values when the condition is true.
block.timestamp
directly within the rule condition. This is
not supported in the current version of the Rules Engine, but is anticipated. In the meantime,
you’d need to directly pass the timestamp value as an extra argument to the modifier added to the
_update
function.Find more info about how to do this in the contract integration guide.