A simple mock contract, tests and tasks to check conditional publishing conditions.
## To run tests
npx hardhat test
npx hardhat node
npx hardhat ignition deploy ./ignition/modules/MoCMock.ts --network ganache
## To execute a task
npx hardhat <TASK_NAME> <CONTRACT_ADDRESS> <...ARGS> --network <NETWORK>
The following tasks are available:
reset
: Reset all mock state vars to cond pub === FALSE
readAll
: Query all state vars + current blockreadQAClock
: Query qACLockedInPending varreadEma
: Query shouldCalculateEma()readBts
: Query bts varreadNextTC
: Query nextTCInterestPayment var
### Set publishing condition to true
setAll-t
: Set all mock state vars to cond pub === TRUEsetQAClock-t
: Set qACLockedInPending to 1 (Condition: qACLockedInPending > 0)setEma-t
: Set emaBool var totrue
(Condition: shouldCalculateEma() == true)setBts-t
: Set bts var to 0 (Condition: bts == 0)setNextTC-t
: Set nextTCInterestPayment tocurrentBlock - 1
(Condition: currentBlock > nextTCInterestPayment)
Notice that all tasks with
-t
appended produce the publishing condition to be evaluated to true.
setQAClock
: Set qACLockedInPending var to an arbitrary valuesetEma
: Set emaBool var - 0 (false) : 1 (true)setBts
: Set bts var to an arbitrary valuesetNextTC
: Set nextTCInterestPayment var to an arbitrary value