Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update compound time and add min compound size #41

Merged
merged 2 commits into from
Nov 11, 2023
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
4 changes: 4 additions & 0 deletions packages/bot/src/p2p/compound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import { GLOBAL_OVERRIDES, StakingType } from "../constant"

export const splitOrders = (orders: SimpleMatchOrder[], limit: number): SimpleMatchOrder[][] => {
let orderAmount = orders.length
if (orderAmount < 3) {
logger.info(`valid p2p order count: ${orderAmount}, less than 3`)
return []
}
let batchOrders: SimpleMatchOrder[][] = []
while (orderAmount > 0) {
batchOrders.push(orders.slice(0, limit))
Expand Down
4 changes: 2 additions & 2 deletions packages/bot/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ export namespace Runtime {
try {
let hasStarted = false
const curHour = new Date().getUTCHours() + 8
// only run at UTC+8 8:00
if (curHour === 8) {
// only run at UTC+8 14:00
if (curHour === 14) {
if (!hasStarted) {
logger.info("start to run...")
await checkBalanceSufficient(
Expand Down
16 changes: 16 additions & 0 deletions packages/bot/src/supplyAndStake/compound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ const claimApeAndCompoundWithSimulation = async (
await provider.getProvider().getGasPrice(),
runtime.isMainnet
)
// maxPriorityFeePerGas: ethers.utils.parseUnits("2", "gwei"),
// nonce:
}
const tx = info.isBakc
? await pool.claimPairedApeAndCompound(nftAsset, users, nftPairs, options)
Expand Down Expand Up @@ -186,6 +188,20 @@ export function splitCompoundInfos(compoundInfo: ValidCompoundInfo, limit: numbe
logger.info(`No ${collection} to claim and compound`)
continue
}
if (
collectionInfo.isBakc
? collectionInfo.nftPairs.flat().length < 3
: collectionInfo.tokenIds.flat().length < 3
) {
logger.info(
`No ${collection} to claim and compound, token count: ${
collectionInfo.isBakc
? collectionInfo.nftPairs.flat().length
: collectionInfo.tokenIds.flat().length
} less than 3`
)
continue
}

let users = cloneDeep(collectionInfo.users)
let batches = []
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/tx/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const getOptMaxFeePerGas = async (
): Promise<BigNumber> => {
curGasPrice
if (!isMainnet) return ethers.utils.parseUnits("1000", "gwei")
const maxGasPrice = ethers.utils.parseUnits("20", "gwei")
const maxGasPrice = ethers.utils.parseUnits("24", "gwei")
return maxGasPrice
// const midGasPrice = ethers.utils.parseUnits("25", "gwei")
// if (curGasPrice.gte(maxGasPrice)) return maxGasPrice
Expand Down
Loading