Skip to content

Commit

Permalink
fix: sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
Picodes committed Jun 6, 2024
1 parent bbd7e6a commit a84d8d6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"publish-image": "chmod +x ./scripts/publish.sh && ./scripts/publish.sh"
},
"dependencies": {
"@angleprotocol/sdk": "2.3.3",
"@angleprotocol/sdk": "2.9.1",
"@google-cloud/secret-manager": "^4.2.2",
"@octokit/rest": "19.0.13",
"@types/chai": "^4.3.6",
Expand Down
27 changes: 14 additions & 13 deletions src/bot/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,20 @@ export const checkDisputeWindow: Step = async (context, report) => {
const { startTime } = report;
const { disputer, disputeToken, endOfDisputePeriod } = report?.params;

if (!!disputer && disputer !== NULL_ADDRESS) return Result.Exit({ reason: 'Already disputed', report });
else if (disputeToken === NULL_ADDRESS) return Result.Exit({ reason: 'No dispute token set', report });
else if (endOfDisputePeriod <= startTime) {
// Check delay since last dispute period and eventually send an alert
if (endOfDisputePeriod + ALERTING_DELAY[context.chainId] * HOUR <= startTime) {
await context.logger.error(
context,
`Last update was ${((startTime - endOfDisputePeriod) / HOUR)?.toFixed(2)} hours ago`,
BotError.AlertDelay
);
}
return Result.Exit({ reason: 'Not in dispute period', report });
}
// if (!!disputer && disputer !== NULL_ADDRESS) return Result.Exit({ reason: 'Already disputed', report });
// else
// if (disputeToken === NULL_ADDRESS) return Result.Exit({ reason: 'No dispute token set', report });
// else if (endOfDisputePeriod <= startTime) {
// // Check delay since last dispute period and eventually send an alert
// if (endOfDisputePeriod + ALERTING_DELAY[context.chainId] * HOUR <= startTime) {
// await context.logger.error(
// context,
// `Last update was ${((startTime - endOfDisputePeriod) / HOUR)?.toFixed(2)} hours ago`,
// BotError.AlertDelay
// );
// }
// return Result.Exit({ reason: 'Not in dispute period', report });
// }
return Result.Success(report);
} catch (err) {
return Result.Error({ code: BotError.OnChainFetch, reason: `Unable to check dispute status: ${err}`, report });
Expand Down
9 changes: 4 additions & 5 deletions src/providers/on-chain/OnChainProvider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { AMM } from '@angleprotocol/sdk';
import { ExtensiveDistributionParametersStructOutput } from '@angleprotocol/sdk/dist/generated/DistributionCreator';
import { BigNumber, ContractReceipt, Overrides, Wallet } from 'ethers';

import { HolderClaims, HolderDetail } from '../../types/holders';
Expand Down Expand Up @@ -27,8 +26,8 @@ export default abstract class OnChainProvider extends ExponentialBackoffProvider

protected abstract onChainParams: () => Promise<OnChainParams>;
protected abstract timestampAt: (blockNumber: number) => Promise<number>;
protected abstract activeDistributions: () => Promise<ExtensiveDistributionParametersStructOutput[]>;
protected abstract activeDistributionsBetween: (start: number, end: number) => Promise<ExtensiveDistributionParametersStructOutput[]>;
protected abstract activeDistributions: () => Promise<any[]>;
protected abstract activeDistributionsBetween: (start: number, end: number) => Promise<any[]>;
protected abstract poolName: (pool: string, amm: AMM) => Promise<string>;
protected abstract claimed: (holderDetails: HolderDetail[]) => Promise<HolderClaims>;
protected abstract approve: (
Expand Down Expand Up @@ -70,11 +69,11 @@ export default abstract class OnChainProvider extends ExponentialBackoffProvider
return this.retryWithExponentialBackoff(this.approval, this.fetchParams, address, token);
}

async fetchActiveDistributions(): Promise<ExtensiveDistributionParametersStructOutput[]> {
async fetchActiveDistributions(): Promise<any[]> {
return this.retryWithExponentialBackoff(this.activeDistributions, this.fetchParams);
}

async fetchActiveDistributionsBetween(start: number, end: number): Promise<ExtensiveDistributionParametersStructOutput[]> {
async fetchActiveDistributionsBetween(start: number, end: number): Promise<any[]> {
return this.retryWithExponentialBackoff(this.activeDistributionsBetween, this.fetchParams, start, end);
}

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf"
integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==

"@angleprotocol/sdk@2.3.3":
version "2.3.3"
resolved "https://npm.pkg.github.com/download/@angleprotocol/sdk/2.3.3/d7704f15188fadd674d9b8d03753efb7b35a68aa#d7704f15188fadd674d9b8d03753efb7b35a68aa"
integrity sha512-6gqgad5OxCNl8gsTHUFtOXYM9yVD3zrFwUQGyZp4vQQKe7T0PXe6sAbRw69gCFiL0N0mf52oleZynf0YYRKQ/g==
"@angleprotocol/sdk@2.9.1":
version "2.9.1"
resolved "https://npm.pkg.github.com/download/@angleprotocol/sdk/2.9.1/ccb06980f8c62bc03c4010d985a95a2ae88f1308#ccb06980f8c62bc03c4010d985a95a2ae88f1308"
integrity sha512-lql4cr+0ai2LufIHdUgQlnzjNbRDsmE112GD6MsFsHY427GE9Qb0C72yp0tuoxEncqGgoTjux/iwjlRc87Hk4w==
dependencies:
"@apollo/client" "^3.7.17"
"@typechain/ethers-v5" "^10.0.0"
Expand Down

0 comments on commit a84d8d6

Please sign in to comment.