1

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

1 Answer 1

2

Thanks to the help of @dc and @equivrel from makerdao's chat channel link1 link2

There are a quite a number of sai functions that produce multiple log entries - it's due to the use of DSNote which produces a log events each time an internal note function is called

@dc

So the 6 event logs comes from:

  • 3 direct calls of chi()
  • 1 direct call of rhi()
  • 1 un-direct call of chi() (safe() -> tab() -> chi())
  • 1 call of draw()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.