Skip to content

(chore): update events in L1 & L2 contracts #378

@viraj124

Description

@viraj124

We can make some updates to events in the L1 contracts, mainly to save gas on L1, the potential changes would be as follows:

  • event FuelChainStateUpdated(address indexed sender, address indexed oldValue, address indexed newValue); can be updated to event FuelChainStateUpdated(address sender, address indexed oldValue, address indexed newValue); as only addresses with DEFAULT_ADMIN_ROLE can update the chain state contract, and addresses with that role are limited.

  • event Deposit(bytes32 indexed sender, address indexed tokenAddress, uint256 amount); can be changed to event Deposit(bytes32 sender, address indexed tokenAddress, uint256 amount); to remove the number of indexed arguments and save gas.

  • event Withdrawal(bytes32 indexed recipient, address indexed tokenAddress, uint256 amount); can be changed to event Withdrawal(bytes32 recipient, address indexed tokenAddress, uint256 amount); to remove the number of indexed arguments and save gas.

There is another update we can make to the L2 bridge contract events, which would be as follows:

  • pub struct DepositEvent {pub amount: u64, pub from: b256, pub to: Identity} can be updated to pub struct DepositEvent {pub amount: u64, pub from: b256, pub to: Identity, pub token_id: b256} to add the deposited token id.

  • pub struct WithdrawalEvent {pub amount: u64, pub from: b256, pub to: Identity} can be updated to pub struct WithdrawalEvent {pub amount: u64, pub from: b256, pub to: Identity, pub token_id: b256} to add the withdrawn token id.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions