TransactionGuard

The TransactionGuard contract enforces delegation and locking rules on transactions within the Unlockd Wallet. It validates transactions based on predefined conditions and allowances, ensuring that only authorized actions are executed.

Key Functions:

function initialize(
    address _delegationOwner, 
    address _protocolOwner
) public

Initializes the TransactionGuard contract with the necessary parameters.

Parameters:

_delegationOwner (address): The address of the DelegationOwner contract.

_protocolOwner (address): The address of the ProtocolOwner contract.


function checkTransaction(
    address _to, 
    uint256 _value, 
    bytes calldata _data, 
    Enum.Operation operation, 
    uint256 _safeTxGas, 
    uint256 _baseGas, 
    uint256 _gasPrice, 
    address _gasToken, 
    address payable _refundReceiver, 
    bytes memory _signatures, 
    address _msgSender
) external view

Performs checks before executing a transaction, enforcing delegation and locking rules.

Parameters:

_to (address): The destination address of the transaction.

_value (uint256): The amount of ETH to be sent with the transaction.

_data (bytes): The data payload of the transaction.

operation (Enum.Operation): The operation type (Call or DelegateCall).

_safeTxGas (uint256): The gas limit for the transaction.

_baseGas (uint256): The base gas cost.

_gasPrice (uint256): The gas price used for the transaction.

_gasToken (address): The address of the token used for gas payment (0 for ETH).

_refundReceiver (address payable): The address that receives the gas payment refund.

_signatures (bytes): The packed signature data.

_msgSender (address): The address of the transaction sender.


function checkAfterExecution(
    bytes32 txHash, 
    bool success
) external view;

Performs checks after executing a transaction.

Parameters:

txHash (bytes32): The hash of the executed transaction.

success (bool): Indicates the success status of the transaction.


function isLocked(
    bytes32 _id
) external view returns (bool);

Checks if an asset is locked.

Parameters:

_id (bytes32): The ID of the asset.

Returns:

(bool): Indicates whether the asset is locked or not.


function getExpiry(
    bytes32 _id
) external view returns (uint256);

Returns the delegation expiry of an asset.

Parameters:

_id (bytes32): The ID of the asset.

Returns:

(uint256): The delegation expiry timestamp of the asset.


function setDelegationExpiries(
    address[] calldata _assets, 
    uint256[] calldata _ids, 
    uint256 _expiry
) external;

Sets the delegation expiry for a group of assets.

Parameters:

_assets (address[]): An array of asset addresses.

_ids (uint256[]): An array of asset IDs.

_expiry (uint256): The delegation expiry timestamp.


function setDelegationExpiry(
    address _asset, 
    uint256 _id, 
    uint256 _expiry
) external;

Sets the delegation expiry for a specific asset.

Parameters:

_asset (address): The address of the asset.

_id (uint256): The ID of the asset.

_expiry (uint256): The delegation expiry timestamp.


function lockAsset(bytes32 _id) external;

Sets an asset as locked.

Parameters:

_id (bytes32): The ID of the asset.


function unlockAsset(bytes32 _id) external;

Sets an asset as unlocked.

Parameters:

_id (bytes32): The ID of the asset.


function supportsInterface(
    bytes4 _interfaceId
) external view returns (bool);

Checks if the contract supports a specific interface.

Parameters:

_interfaceId (bytes4): The interface ID to check.

Returns:

(bool): Indicates whether the contract supports the specified interface or not.


Interactions:

  • Interacts with the DelegationOwner, GuardOwner, and ProtocolOwner contracts to enforce specific rules and permissions.

  • Validates transactions initiated through the GnosisSafe contract based on delegation and locking rules.

Last updated