Firewall.sol
Last updated
Last updated
The contract is the main contract of the system. It stores and manages all the to which subscribe to, and executes them as needed.
approvedPolicies
mapping
(address => bool)
subscribedPolicies
mapping
(address =>
mapping
(bytes4 => address[])
)
subscribedGlobalPolicies
mapping
(address => address[])
Only allows the modified function to run if it was called by the (see ) .
function preExecution(address sender, bytes calldata data, uint value)
sender
address
the sender of the transaction
data
bytes calldata
the transaction data
value
uint
the value that was sent with the transaction
function postExecution(address sender, bytes calldata data, uint value)
sender
address
the sender of the transaction
data
bytes calldata
the transaction data
value
uint
the value that was sent with the transaction
function setPolicyStatus(address policy, bool status)
policy
address
status
bool
function addPolicy(address consumer, bytes4 methodSig, address policy)
consumer
address
methodSig
bytes4
policy
address
function removePolicy(address consumer, bytes4 methodSig, uint policyIndex)
consumer
address
methodSig
bytes4
policyIndex
uint
function addPolicies(address consumer, bytes4[] calldata methodSigs, address[] calldata policies)
consumer
address
methodSigs
bytes4[] calldata
policies
address[] calldata
function removePolicies(address consumer, bytes4[] calldata methodSigs, address[] calldata policies)
consumer
address
methodSig
bytes4 calldata
policyIndex
uint calldata
function addGlobalPolicy(address consumer, address policy)
consumer
address
policy
address
function removeGlobalPolicy(address consumer, uint policyIndex)
consumer
address
policyIndex
uint
function addGlobalPoliciesForConsumers(address[] consumers, address policy)
consumers
address[]
policy
address
function removeGlobalPoliciesForConsumers(address[] consumers, address policy)
consumers
address[]
policy
address
function getActivePolicies(address consumer, bytes4 methodSig) public returns (address[] memory)
consumer
address
methodSig
bytes4
the method signature we’re getting the active policies for
function getActiveGloablPolicies(address consumer) public returns (address[] memory)
consumer
address
the that can be used by that use this
a mapping between the of a and the configured for these methods
a mapping between a and the that are configured on it
Runs the hook on all the that msg.sender
has subscribed to for the method described by the first 4 bytes of data
.
Runs the hook on all the that msg.sender
has subscribed to for the method described by the first 4 bytes of data
.
Callable only by the , used to approve or revoke approval of a . Revoking approval doesn’t remove existing consumer subscriptions.
the address of the to set the status
for
the new status of the policy, true
meaning approved and false
meaning unapproved
see for more details
Callable only by the of the , this method adds the to the list of subscribed policies for the given method signature.
the for which to add the for
the method-sig for which to apply this for
the to add
Callable only by the of the consumer, this method removes the found at the policyIndex
from the list of subscribed policies for the given method signature.
the for which to remove the from
the method-sig for which to apply this for
the index of the to remove
Callable only by the of the , this method adds multiple policies to the list of subscribed policies for the given method signatures. Each will be subscribed to the corresponding Method-Sig from the methodSigs
array.
the for which to add the
the method-sig for which to apply this for
the to add
Callable only by the of the , this method removes multiple policies from the list of subscribed policies for the given method signatures. Each will be removed from the corresponding Method-Sig from the methodSigs
array.
the for which to remove the from
the method-sig for which to apply this for
the index of the to remove
Callable only by the of the , this method adds a to the list of subscribed for the .
the for which to add the policy for
the to add
Callable only by the of the , this method removes a from the list of subscribed for the .
the for which to remove the from
the index of the to remove
Callable only by the of all the , this method adds a to the list of subscribed for the all the .
an array of to add the to
the address of the to add
Callable only by the of all the , this method removes a from a list of .
an array of to remove the from
the address of the to remove
Returns an array of all the policies a has subscribed to a method.
the for which to get the active policies
Returns an array of all the a is subscribed to.
the for which to get the active policies
On our GitHub repository: