Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions scripts/gas-refund-program/computeGasRefund_V3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@ async function startComputingGasRefundAllChains_V3() {

return Database.sequelize.transaction(async () => {
// TODO: disable this piece in previous cronjob after migrating to new one
logger.debug("trackRootUpdateV3");
await trackRootUpdate_V3();

// await StakesTracker_V3.getInstance().loadHistoricalStakes();
logger.debug("loadHistoricalStakes");
await StakesTracker_V3.getInstance().loadHistoricalStakes();

// await fetchRefundableTransactionsAllChains_V3();
logger.debug("fetchRefundableTransactionsAllChains_V3");
await fetchRefundableTransactionsAllChains_V3();

logger.debug("validateTransactions_V3");
// // if exceeds budget 500 USD per user - cap it
// await validateTransactions_V3();
await validateTransactions_V3();
});
}

Expand Down
34 changes: 19 additions & 15 deletions scripts/gas-refund-program/staking/2.0/BPTHelper_V3.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import * as ERC20ABI from '../../../../src/lib/abi/erc20.abi.json';
import * as BVaultABI from '../../../../src/lib/abi/balancer-vault.abi.json';
import * as MulticallV3ABI from '../../../../src/lib/abi/multicall-v3.abi.json';
import {
XYZ_ADDRESS,
MULTICALL_ADDRESS_V3,
MulticallEncodedData_V3,
BalancerVaultAddress_V3,
Balancer_80VLR_20WETH_address,
Balancer_80VLR_20WETH_poolId,
BalancerVaultAddress,
// BalancerVaultAddress_V3,
} from '../../../../src/lib/constants';
import { Provider } from '../../../../src/lib/provider';
import { BigNumber as EthersBN, Contract } from 'ethers';
Expand Down Expand Up @@ -88,7 +92,7 @@ export class BPTHelper_V3 {
provider,
);

this.bVaultIface = new Interface(balancerV3Abi);
this.bVaultIface = new Interface(BVaultABI);
this.erc20Iface = new Interface(ERC20ABI);
}

Expand All @@ -98,12 +102,12 @@ export class BPTHelper_V3 {
}
const bpt = grp2ConfigByChain_V3[this.chainId].bpt;
const contract = new Contract(
BalancerVaultAddress_V3,
balancerV3Abi,
BalancerVaultAddress,
BVaultABI,
Provider.getJsonRpcProvider(this.chainId),
);

const { tokens } = await contract.getPoolTokenInfo(bpt);
const { tokens } = await contract.getPoolTokens(Balancer_80VLR_20WETH_poolId[this.chainId]);

const xyzAddressLowercased = XYZ_ADDRESS[this.chainId].toLowerCase();

Expand All @@ -113,19 +117,19 @@ export class BPTHelper_V3 {
}

async fetchBPtState(blockNumber?: number): Promise<BPTState> {
const bpt = grp2ConfigByChain_V3[this.chainId].bpt;
// const bpt = grp2ConfigByChain_V3[this.chainId].bpt;
const multicallData = [
{
target: bpt,
target: Balancer_80VLR_20WETH_address[this.chainId], // bpt,
callData: this.erc20Iface.encodeFunctionData('totalSupply', []),
allowFailure: false,
// allowFailure: false,
},
{
target: BalancerVaultAddress_V3,
callData: this.bVaultIface.encodeFunctionData('getPoolTokenInfo', [
bpt,
target: BalancerVaultAddress,
callData: this.bVaultIface.encodeFunctionData('getPoolTokens', [
Balancer_80VLR_20WETH_poolId[this.chainId] // bpt,
]),
allowFailure: false,
// allowFailure: false,
},
];

Expand All @@ -140,13 +144,13 @@ export class BPTHelper_V3 {
.toString(),
);

const { tokens, balancesRaw: balances } =
const { tokens, balances } =
this.bVaultIface.decodeFunctionResult(
'getPoolTokenInfo',
'getPoolTokens',
rawResults[1].returnData,
) as unknown as {
tokens: [string, string];
balancesRaw: [EthersBN, EthersBN];
balances: [EthersBN, EthersBN];
};

const isXYZToken0 =
Expand Down
Loading