Fetch onchain data with function calls
Monitoring Address Token Balance
use Call, PercentageDiff from hexagate;
source pool: address = 0x3041CbD36888bECc7bbCBc0045E3B1f144466f5f;
source usdc: address = 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48;
source usdt: address = 0xdac17f958d2ee523a2206206994597c13d831ec7;
source usdcBalance: integer = Call {
contract: usdc,
signature: "function balanceOf(address) returns (uint256)",
params: tuple(pool)
};
source usdtBalance: integer = Call {
contract: usdt,
signature: "function balanceOf(address) returns (uint256)",
params: tuple(pool)
};
source percentageDiff: integer = PercentageDiff {
before: usdcBalance,
after: usdtBalance
};
source threshold: integer = 2; // Up to 2% difference is allowed
rule {
description: "Uniswap USDC/USDT pool balance differ by more than ${percentageDiff}%",
condition: percentageDiff <= threshold
};Last updated