Argument.df_reaching_functions_arguments()

Returns the list of pairs, where the first element is the function and the second element is the argument to which data flow reaches from the argument (it may reach through a chain of calls).

df_reaching_functions_arguments() โ†’ List[Tuple[Callable, int]]

from glider import *


def query():
    func = Contracts().with_name('LendingPool').non_interface_contracts().functions().with_arg_count(5).exec(1)

    arg = func.arguments().list()[0]
    
    results = [func]
    for (f, arg_index) in arg.df_reaching_functions_arguments():
        results.append(f)
        print(f.source_code() + '\n\n'+str(arg_index))
    return func

For the argument uint256 lpTokenAmount in the function nftRemove at address 0xf792e438b3bd8501274d98a58d19f2777cacd9f6

function nftRemove(
        uint256 lpTokenAmount,
        uint256 minBaseTokenOutputAmount,
        uint256 deadline,
        uint256[] calldata tokenIds,
        bool withFee
    ) public returns (uint256 baseTokenOutputAmount, uint256 fractionalTokenOutputAmount) {
        // remove liquidity and send fractional tokens and base tokens to sender
        (baseTokenOutputAmount, fractionalTokenOutputAmount) =
            remove(lpTokenAmount, minBaseTokenOutputAmount, tokenIds.length * ONE, deadline);
 
        // unwrap the fractional tokens into NFTs and send to sender
        unwrap(tokenIds, withFee);
    }

The function will return tuples like this:

[(removeQuote, 0), (remove, 0),...]

As can be seen, the argument flows into function calls like:

Returns: List[Tuple[Callable, int]]

Last updated