Transaction Hash:
Block:
15607334 at Sep-25-2022 02:15:23 AM +UTC
Transaction Fee:
0.000231417418649483 ETH
$0.56
Gas Used:
46,651 Gas / 4.960610033 Gwei
Emitted Events:
410 |
DelegateRegistry.SetDelegate( delegator=[Sender] 0x910da78afc36463fd15896bb441984552b236164, id=73646372762E6574680000000000000000000000000000000000000000000000, delegate=0x52ea58f4...A0EF887DC )
|
Account State Difference:
Address | Before | After | State Difference | ||
---|---|---|---|---|---|
0x469788fE...6Fc015446 | (Snapshot: Delegation) | ||||
0x910da78A...52B236164 |
0.008693051669128671 Eth
Nonce: 14
|
0.008461634250479188 Eth
Nonce: 15
| 0.000231417418649483 | ||
0xDAFEA492...692c98Bc5
Miner
| (Flashbots: Builder) | 0.283108372433463029 Eth | 0.283178348933463029 Eth | 0.0000699765 |
Execution Trace
DelegateRegistry.setDelegate( id=73646372762E6574680000000000000000000000000000000000000000000000, delegate=0x52ea58f4FC3CEd48fa18E909226c1f8A0EF887DC )
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); } }