Closed artman325 closed 2 years ago
Please specify example calls where need to store such mapping?
i am confusing, what contract is mapping belong to?
note that Control contract is about invoke/endorse external methods, but not store smth data. method and params are present in hexademical types to be universal, and no way to get any params like ofTokenAndTag
, amount
think that it's functional af separate contract. main goal it's to restrict wasting eth by period week/daily etc
I realized we can make something great with ControlContract!
Basically it would be a mapping of mappings:
delegate[toAddress][ofAddress][ofTokenAndTag][bucketDuration] = maximumAmount
What it will be used for:
In metattransactions, it will allow people to delegate to some address to make transactions that deduct up to X amount per DAY or HOUR, of behalf of owner. And this would be checked by trustedforwarder, and update amountUsedInLatestBucket[byAddress][ofTokenAndTag][bucketDuration] = amountSoFar
So users can for example do microtransactions on MATIC silently without having to confirm via metamask.
But larger transactions the website would make them confirm.
The ControlContract would act as a trustedforwarder, get ofToken.balance(ofAddress) before and after the forwarded call, and rollback if it exceeded the amount spent in latest bucket. It can check for example DAY and HOUR rate limits