Skip to content

How to get the selector in a analysis module #1858

Open
@huzhanchi

Description

@huzhanchi

Description

In the Defi protocol, it is very common to use "uniswapV3SwapCallback" like interface function to receive the callbak from LP, However some implementation of uniswapV3SwapCallback has no premission controll. Just as the uniswap official give the caution:
image
You can also check the background in my article here:
refer:https://medium.com/@zhanchihu/watch-your-back-while-you-want-to-do-aribitrage-with-uniswap-flashloan-f456e4f3e99d

Tests

todo

Implementation details

I want to implement a module to hook the CALL instruction, and give the constraint like

  1. the selector of message transaction call is "uniswapV3SwapCallback"
  2. ERC20 token could transfer to other address without any premission controlls

Now, my problem is how can I get the selector in the current CALL instruction. I have checked the "state.environment.calldata", and will to extract the selector, but in debug mode it look like this
image

Is there any convient way for me to get selector?

Metadata

Metadata

Assignees

No one assigned

    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