Skip to content

Commit

Permalink
set the gas multiplier on Sepolia to act more like Optimism rates
Browse files Browse the repository at this point in the history
  • Loading branch information
chuckbergeron committed Jun 15, 2023
1 parent 0e43dd1 commit cfaef67
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/library/src/claimerProfitablePrizeTxs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ interface ClaimPrizesParams {
}

/**
* Only claim if we're going to make at least $0.05 (This likely should be a config option)
* Only claim if we're going to make at least $0.01 (This likely should be a config option)
*/
const MIN_PROFIT_THRESHOLD_USD = 0.05;
const MIN_PROFIT_THRESHOLD_USD = 0.01;

/**
* Finds all winners for the current draw who have unclaimed prizes and decides if it's profitable
Expand Down
14 changes: 7 additions & 7 deletions packages/library/src/utils/getFeesUsd.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { ethers, BigNumber, Contract } from "ethers";
import { Provider } from "@ethersproject/providers";
import { ethers, BigNumber, Contract } from 'ethers';
import { Provider } from '@ethersproject/providers';

import { ContractsBlob } from "../types";
import { TESTNET_NETWORK_NATIVE_TOKEN_ADDRESS } from "../utils/network";
import { ContractsBlob } from '../types';
import { TESTNET_NETWORK_NATIVE_TOKEN_ADDRESS } from '../utils/network';

export const MARKET_RATE_CONTRACT_DECIMALS = 8;

const CHAIN_GAS_PRICE_MULTIPLIERS = {
1: 1,
11155111: 1,
11155111: 0.01, // if we want Sepolia to act more like Optimism/etc, set this to a fraction such as 0.1
80001: 24, // mumbai seems to return a much cheaper gas price then it bills you for
};

Expand All @@ -25,7 +25,7 @@ export const getFeesUsd = async (
chainId: number,
estimatedGasLimit: BigNumber,
gasTokenMarketRateUsd: number,
provider: Provider
provider: Provider,
): Promise<{ baseFeeUsd: number; maxFeeUsd: number; avgFeeUsd: number }> => {
const fees = { baseFeeUsd: null, maxFeeUsd: null, avgFeeUsd: null };

Expand Down Expand Up @@ -66,7 +66,7 @@ export const getGasTokenMarketRateUsd = async (contracts: ContractsBlob, marketR
// const wethRate = await marketRate.priceFeed(wethAddress, "USD");

const nativeTokenAddress = TESTNET_NETWORK_NATIVE_TOKEN_ADDRESS;
const gasTokenRate = await marketRate.priceFeed(nativeTokenAddress, "USD");
const gasTokenRate = await marketRate.priceFeed(nativeTokenAddress, 'USD');

return parseFloat(ethers.utils.formatUnits(gasTokenRate, MARKET_RATE_CONTRACT_DECIMALS));
};

0 comments on commit cfaef67

Please sign in to comment.