Skip to content

Commit

Permalink
Merge pull request #6 from acemasterjb/fix/revoked_passes
Browse files Browse the repository at this point in the history
🐛 Fix breaking issue with revoked passports
  • Loading branch information
johnmark13 authored Jan 25, 2024
2 parents 648231e + 6b61b1f commit d7d98b7
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions src/strategies/nation3-passport-coop-with-delegations/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { BigNumber, BigNumberish } from '@ethersproject/bignumber';
import { Multicaller } from '../../utils';
import { formatUnits } from '@ethersproject/units';
import { subgraphRequest } from '../../utils';

export const author = 'nation3';
export const version = '0.3.0';

type Query = {[key: string]: any}

Check failure on line 9 in src/strategies/nation3-passport-coop-with-delegations/index.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Replace `[key:·string]:·any}` with `·[key:·string]:·any·};`

const DECIMALS = 18;

const balanceAbi = [
Expand All @@ -29,28 +32,49 @@ export async function strategy(
): Promise<Record<string, number>> {
const blockTag = typeof snapshot === 'number' ? snapshot : 'latest';

const erc721SignerCaller = new Multicaller(network, provider, signerAbi, {
blockTag
});
const erc721OwnerCaller = new Multicaller(network, provider, ownerAbi, {
blockTag
});
const erc20BalanceCaller = new Multicaller(network, provider, balanceAbi, {
blockTag
});

const erc721LastTokenIdCaller = new Multicaller(
network,
provider,
lastTokenIdAbi,
{ blockTag }
);

const erc721SignerCaller = new Multicaller(network, provider, signerAbi, {
blockTag
});
const erc721OwnerCaller = new Multicaller(network, provider, ownerAbi, {
blockTag
});

const passportIssuanceSubgrgraph = "https://api.thegraph.com/subgraphs/name/nation3/passportissuance";

Check failure on line 53 in src/strategies/nation3-passport-coop-with-delegations/index.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Replace `·"https://api.thegraph.com/subgraphs/name/nation3/passportissuance"` with `⏎····'https://api.thegraph.com/subgraphs/name/nation3/passportissuance'`

const revokedQuery: Query = {
revokes: {
id: true,
_to: true,
_tokenId: true,

Check failure on line 59 in src/strategies/nation3-passport-coop-with-delegations/index.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Delete `,`
}
}

Check failure on line 61 in src/strategies/nation3-passport-coop-with-delegations/index.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Insert `;`

const revokedUsersResponse = await subgraphRequest(passportIssuanceSubgrgraph, revokedQuery);

Check failure on line 63 in src/strategies/nation3-passport-coop-with-delegations/index.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Replace `passportIssuanceSubgrgraph,·revokedQuery` with `⏎····passportIssuanceSubgrgraph,⏎····revokedQuery⏎··`

const revokedPassports: number[] = revokedUsersResponse.revokes.map(revokeObject => {

Check failure on line 65 in src/strategies/nation3-passport-coop-with-delegations/index.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Replace `(revokeObject` with `(⏎····(revokeObject)`
return BigNumber.from(revokeObject._tokenId).toNumber();

Check failure on line 66 in src/strategies/nation3-passport-coop-with-delegations/index.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Insert `··`
});

Check failure on line 67 in src/strategies/nation3-passport-coop-with-delegations/index.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Replace `});⏎` with `··}⏎··);`


erc721LastTokenIdCaller.call('lastTokenId', options.erc721, 'getNextId');

const lastIndex = await erc721LastTokenIdCaller.execute();
const lastTokenId = BigNumber.from(lastIndex.lastTokenId).toNumber();

for (let i = 1; i < lastTokenId; i++) {
if (revokedPassports.includes(i)) continue;

erc721SignerCaller.call(i, options.erc721, 'signerOf', [i]);
erc721OwnerCaller.call(i, options.erc721, 'ownerOf', [i]);
}
Expand Down

0 comments on commit d7d98b7

Please sign in to comment.