Skip to main content
improve format; add context of makerdao's cdp
Source Link
DiveInto
  • 490
  • 5
  • 16

I'm looking into the event logs of makerdao's CDP operation, and I'm confused why there are several event logs for 1 cdp operation, like this tx: https://etherscan.io/tx/0x0fb6a8d8f10410c544b27b848319e67a422be883e4252fea639c89a444209685#eventlog, it contains 1 cdp operation: draw dai.

there is only 1 Draw event of 95 Dai: transfer 95 dai

while in event logs, there are several event logs(totally 6) with the Topic0:

(0x440f19ba00000000000000000000000000000000000000000000000000000000):

event logs

why is this?

Note: signature of draw event is:

  function draw(bytes32 cup, uint wad) public note {

here the log is made by the modifier note, which is:

event LogNote(
    bytes4   indexed  sig,
    address  indexed  guy,
    bytes32  indexed  foo,
    bytes32  indexed  bar,
    uint              wad,
    bytes             fax
) anonymous;

modifier note {
    bytes32 foo;
    bytes32 bar;

    assembly {
        foo := calldataload(4)
        bar := calldataload(36)
    }

    LogNote(msg.sig, msg.sender, foo, bar, msg.value, msg.data);

    _;
}

event LogNote is anonymous, so topic0 is msg.sig instead of the signature of the event. and msg.sig for func dai is: draw(bytes32,uint256), the keccak is: 0x440f19ba0

this tx: https://etherscan.io/tx/0x0fb6a8d8f10410c544b27b848319e67a422be883e4252fea639c89a444209685#eventlog

there is only 1 Draw event of 95 Dai: transfer 95 dai

while in event logs, there are several event logs(totally 6) with the Topic0:

0x440f19ba00000000000000000000000000000000000000000000000000000000

event logs

why is this?

Note: signature of draw event is:

  function draw(bytes32 cup, uint wad) public note {

here the log is made by the modifier note, which is:

event LogNote(
    bytes4   indexed  sig,
    address  indexed  guy,
    bytes32  indexed  foo,
    bytes32  indexed  bar,
    uint              wad,
    bytes             fax
) anonymous;

modifier note {
    bytes32 foo;
    bytes32 bar;

    assembly {
        foo := calldataload(4)
        bar := calldataload(36)
    }

    LogNote(msg.sig, msg.sender, foo, bar, msg.value, msg.data);

    _;
}

event LogNote is anonymous, so topic0 is msg.sig instead of the signature of the event. and msg.sig for func dai is: draw(bytes32,uint256), the keccak is: 0x440f19ba0

I'm looking into the event logs of makerdao's CDP operation, and I'm confused why there are several event logs for 1 cdp operation, like this tx: https://etherscan.io/tx/0x0fb6a8d8f10410c544b27b848319e67a422be883e4252fea639c89a444209685#eventlog, it contains 1 cdp operation: draw dai.

there is only 1 Draw event of 95 Dai: transfer 95 dai

while in event logs, there are several event logs(totally 6) with the Topic0 (0x440f19ba00000000000000000000000000000000000000000000000000000000):

event logs

why is this?

Note: signature of draw event is:

  function draw(bytes32 cup, uint wad) public note {

here the log is made by the modifier note, which is:

event LogNote(
    bytes4   indexed  sig,
    address  indexed  guy,
    bytes32  indexed  foo,
    bytes32  indexed  bar,
    uint              wad,
    bytes             fax
) anonymous;

modifier note {
    bytes32 foo;
    bytes32 bar;

    assembly {
        foo := calldataload(4)
        bar := calldataload(36)
    }

    LogNote(msg.sig, msg.sender, foo, bar, msg.value, msg.data);

    _;
}

event LogNote is anonymous, so topic0 is msg.sig instead of the signature of the event. and msg.sig for func dai is: draw(bytes32,uint256), the keccak is: 0x440f19ba0

Source Link
DiveInto
  • 490
  • 5
  • 16

why several Draw event logs when there is actually one?

this tx: https://etherscan.io/tx/0x0fb6a8d8f10410c544b27b848319e67a422be883e4252fea639c89a444209685#eventlog

there is only 1 Draw event of 95 Dai: transfer 95 dai

while in event logs, there are several event logs(totally 6) with the Topic0:

0x440f19ba00000000000000000000000000000000000000000000000000000000

event logs

why is this?

Note: signature of draw event is:

  function draw(bytes32 cup, uint wad) public note {

here the log is made by the modifier note, which is:

event LogNote(
    bytes4   indexed  sig,
    address  indexed  guy,
    bytes32  indexed  foo,
    bytes32  indexed  bar,
    uint              wad,
    bytes             fax
) anonymous;

modifier note {
    bytes32 foo;
    bytes32 bar;

    assembly {
        foo := calldataload(4)
        bar := calldataload(36)
    }

    LogNote(msg.sig, msg.sender, foo, bar, msg.value, msg.data);

    _;
}

event LogNote is anonymous, so topic0 is msg.sig instead of the signature of the event. and msg.sig for func dai is: draw(bytes32,uint256), the keccak is: 0x440f19ba0