Transaction Hash:
Block:
16632846 at Feb-15-2023 08:06:47 AM +UTC
Transaction Fee:
0.001301600208460132 ETH
$5.03
Gas Used:
46,543 Gas / 27.965541724 Gwei
Emitted Events:
279 |
DelegateRegistry.SetDelegate( delegator=[Sender] 0x23a21a4a392f3099ecc317b6a641906c0b80a256, id=0000000000000000000000000000000000000000000000000000000000000000, delegate=0xd714Dd60...bBDD3F3C8 )
|
Account State Difference:
Address | Before | After | State Difference | ||
---|---|---|---|---|---|
0x23a21A4A...c0B80a256 |
0.030068896032282794 Eth
Nonce: 26
|
0.028767295823822662 Eth
Nonce: 27
| 0.001301600208460132 | ||
0x469788fE...6Fc015446 | (Snapshot: Delegation) | ||||
0x690B9A9E...Db4FaC990
Miner
| (builder0x69) | 2.153955991526543526 Eth | 2.154002534526543526 Eth | 0.000046543 |
Execution Trace
DelegateRegistry.setDelegate( id=0000000000000000000000000000000000000000000000000000000000000000, delegate=0xd714Dd60e22BbB1cbAFD0e40dE5Cfa7bBDD3F3C8 )
setDelegate[DelegateRegistry (ln:18)]
ClearDelegate[DelegateRegistry (ln:28)]
SetDelegate[DelegateRegistry (ln:30)]
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.8.0; contract DelegateRegistry { // The first key is the delegator and the second key a id. // The value is the address of the delegate mapping (address => mapping (bytes32 => address)) public delegation; // Using these events it is possible to process the events to build up reverse lookups. // The indeces allow it to be very partial about how to build this lookup (e.g. only for a specific delegate). event SetDelegate(address indexed delegator, bytes32 indexed id, address indexed delegate); event ClearDelegate(address indexed delegator, bytes32 indexed id, address indexed delegate); /// @dev Sets a delegate for the msg.sender and a specific id. /// The combination of msg.sender and the id can be seen as a unique key. /// @param id Id for which the delegate should be set /// @param delegate Address of the delegate function setDelegate(bytes32 id, address delegate) public { require (delegate != msg.sender, "Can't delegate to self"); require (delegate != address(0), "Can't delegate to 0x0"); address currentDelegate = delegation[msg.sender][id]; require (delegate != currentDelegate, "Already delegated to this address"); // Update delegation mapping delegation[msg.sender][id] = delegate; if (currentDelegate != address(0)) { emit ClearDelegate(msg.sender, id, currentDelegate); } emit SetDelegate(msg.sender, id, delegate); } /// @dev Clears a delegate for the msg.sender and a specific id. /// The combination of msg.sender and the id can be seen as a unique key. /// @param id Id for which the delegate should be set function clearDelegate(bytes32 id) public { address currentDelegate = delegation[msg.sender][id]; require (currentDelegate != address(0), "No delegate set"); // update delegation mapping delegation[msg.sender][id] = address(0); emit ClearDelegate(msg.sender, id, currentDelegate); } }