Currently, users can specify a list of addresses that will be whitelisted to view the site, however, this is undesirable in cases where the list of addresses is massive or when the list of addresses updates frequently.
Solution
To fix this, we could:
add the contracts array rule field to simple rules OR create a new dynamic rule type.
add a new optional field, calldata, into the Contract type. This will be used to make the function call that should return an array of addresses OR a boolean.
This also means we would need to specify whether or not the user's address should be included in the calldata. For this I propose we add optional userArg field to the Contract object. This is a boolean value that when true means we will pass the user's address along with the calldata when making the function call.
If a boolean is returned by the function call, we will need another optional field inside contracts that lets the user mark what the expected value is.
userArg should default to false
expected should default to undefined/null
calldata should default to undefined/null
Example:
This dynamic rule example utilizes Chainalysis'SanctionsList contract to block all sanctioned addresses on Ethereum Mainnet.
Overview
Currently, users can specify a list of addresses that will be whitelisted to view the site, however, this is undesirable in cases where the list of addresses is massive or when the list of addresses updates frequently.
Solution
To fix this, we could:
contracts
array rule field tosimple
rules OR create a newdynamic
rule type.calldata
, into theContract
type. This will be used to make the function call that should return an array of addresses OR a boolean.This also means we would need to specify whether or not the user's address should be included in the calldata. For this I propose we add optional
userArg
field to theContract
object. This is a boolean value that whentrue
means we will pass the user's address along with the calldata when making the function call.If a boolean is returned by the function call, we will need another optional field inside
contracts
that lets the user mark what the expected value is.userArg
should default tofalse
expected
should default to undefined/nullcalldata
should default to undefined/nullExample:
This
dynamic
rule example utilizes Chainalysis'SanctionsList
contract to block all sanctioned addresses on Ethereum Mainnet.calldata
is for theisSanctioned
functionuserArg
is set to true becauseisSanctioned
takes an address as input and returns a boolean.expect
is set to false because this output means the user is not marked as sanctioned.