ITurtleShellFirewall
ITurtleShellFirewall Interface
The ITurtleShellFirewall
is an interface for a firewall contract that can be used to protect individual accounts on the Ethereum network. This document describes the methods provided by the interface and provides examples of how to integrate these into your contracts.
This interface was written in Solidity, a statically-typed programming language used for Ethereum smart contracts.
Contract Methods
setParameter(uint256 newParameter)
setParameter(uint256 newParameter)
This function allows a user to update their security parameter.
If the new parameter exceeds the preset threshold, the firewall will be activated automatically. However, if the firewall is already active, the parameter will be updated regardless.
On successful execution, it emits a ParameterChanged
event and a FirewallStatusUpdate
event. The function returns true
if the firewall was activated, or had already been active.
setUserConfig(uint8 thresholdPercentage, uint256 blockInterval, uint256 startParameter, uint256 cooldownPeriod)
setUserConfig(uint8 thresholdPercentage, uint256 blockInterval, uint256 startParameter, uint256 cooldownPeriod)
This function is for setting the configuration values for a firewall user. These values are:
thresholdPercentage
: The threshold percentage to set for the firewallblockInterval
: The block interval to set for the firewallstartParameter
: The start parameter for the firewallcooldownPeriod
: The cooldown period for the firewall
This function also emits a ParameterChanged
event.
setFirewallStatus(bool newStatus)
setFirewallStatus(bool newStatus)
This function can be used to manually change the firewall status for a user. It can be used to manually activate or deactivate the firewall for a user, and it should particularly be used to deactivate the firewall if it has been triggered.
On successful execution, it emits a FirewallStatusUpdate
event.
getFirewallStatusOf(address user)
getFirewallStatusOf(address user)
This function can be used to retrieve the firewall status for a user.
It returns a boolean value indicating whether the firewall is active for the given user.
getParameterOf(address user)
getParameterOf(address user)
This function can be used to retrieve the security parameter for a firewall user.
It returns the security parameter as a uint256 value.
getSecurityParameterConfigOf(address user)
getSecurityParameterConfigOf(address user)
This function can be used to retrieve the security parameters for a given address.
It returns the threshold and block interval set as security parameters for the address.
Remember, to use this interface you should have the contract address of the deployed ITurtleShellFirewall implementation. You should instantiate the ITurtleShellFirewall with this address:
Last updated