There's a function in solidity Im looking at which takes the custom datatype

DecreaseLiquidityParams as input. 
    function decreaseLiquidity(DecreaseLiquidityParams calldata params)
        returns (uint256 amount0, uint256 amount1);

DecreaseLiquidityParams id defined in another file as:

struct DecreaseLiquidityParams {
    uint256 tokenId;
    uint128 liquidity;
    uint256 amount0Min;
    uint256 amount1Min;
    uint256 deadline;

So If I'm calling this function through web3 on python, do I pass the parameters in individually or as a dictionary? like this:


1 Answer 1


You would just use a JSON format for that param. In web3js, the method would accept a JSON object as follows:

contract.decreaseLiquidity({ tokenId: 12345, liquidity: 100, amount0Min: 100, amount1Min: 100, deadline: 100}).send()

In web3py, the method would accept the param as a dictionary as follows:

contract.decreaseLiquidity({ "tokenId": 12345, "liquidity": 100, "amount0Min": 100, "amount1Min": 100, "deadline": 100}).transact()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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