Greetings.
I have a contract that stores erc-721 lp-token. it checks the tick values and, if it leaves the range, withdraws liquidity and creates a new position with new parameters.
when I call this function from Remix everything works correctly. when I try to call it through Relayer, I get fail transactions. But it gets correct needed conditions.
I have already tried to give approvals to the Relayer and increase the throttle, but have not achieved success. please tell me what could be the problem?
Here is my action code
const { Defender } = require('@openzeppelin/defender-sdk');
const { ethers } = require('ethers');
exports.handler = async function(credencials) {
const client = new Defender(credencials);
const provider = await client.relaySigner.getProvider();
const signer = await client.relaySigner.getSigner(provider, { speed: 'fast'});
const ADDRESS = '0xMyContractAddress';
const ABI = [here is my ABI];
const contract = new ethers.Contract(ADDRESS, ABI, signer);
const currentTick = await contract.getCurrentTick();
const tickLower = await contract.getTickLower();
const tickUpper = await contract.getTickUpper();
const range = tickUpper - tickLower;
const trigger = range / 10 ;
const zoneUpper = tickUpper - trigger;
const zoneLower = tickLower + trigger;
const gasLimit = 180000;
if (currentTick > zoneUpper) {
const txRes = await contract.request({ gasLimit });
console.log('Near Upper Tick - Rebalanced');
return txRes.hash;
} else if (currentTick < zoneLower){
const txRes = await contract.request({ gasLimit });
console.log('Near Lower Tick - Rebalanced');
return txRes.hash;
} else {
console.log('We are in Range');
}
P.s. Relayer says that Action succeeded and shows txRes.hash, but actual tx is mined but failed with "execution reverted" error. Every time
Enviropment:
Smart Contract (deployed with Remix) - Base Chain - Relayer