execTransactionsFromModule
for batch transactions
Dependency
In this example, we are using TypeScript as the programming language. Please install the following dependencies first:
@ethereumjs/tx
@ethereumjs/common
Let's simulate the "Remove Liquidity" function on Uniswap on the Goerli network, removing liquidity for UNI-WETH pair.
We will use the decreaseLiquidity and collect method of the NonfungiblePositionManager contract. Please first set the Role and Member. (for the detailed configurations for methods and parameters, you may refer to the Best Practice of Uniswap)
Example
We use Infura as the provider. You may choose the provider you like:
import Web3 from 'web3'
const moduleAddress = 'YOUR_COMPASS_SAFE_MODULE_ADDRESS'
const safeAddress = 'YOUR_GNOSIS_SAFE_ADDRESS'
const INFURA_KEY = 'YOUR_INFURA_PROJECT_ID'
const provider = new Web3.providers.HttpProvider(`https://goerli.infura.io/v3/${INFURA_KEY}`)
const senderAddress = 'YOUR_MEMBER_ADDRESS'
const privateKey = Buffer.from('YOUR_MEMBER_PRIVATE_KEY', 'hex')Execute the execTransactionsFromModule method of the Compass Safe Module:
Please note: to obtain the parameter roleName, we can directly retrieve it from the role list in Compass Safe, or compile it based on the Role Name.
Use execTransactionsFromModule to call decreaseLiquidity and collect method
You can view the transaction on https://goerli.etherscan.io/ using the transactionHash.
Last updated