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

[nation3-passport-coop-with-delegations] Update behaviour on revoked passports by querying subgraph #1396

Merged
merged 45 commits into from
Jan 25, 2024
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
2028a84
Make sure we have all the ERc20 balances that we need.
Jan 16, 2023
a46dea4
I think this is more simple....
Jan 16, 2023
d0b9d88
Still not beautiful, but in testing I believe that this is simplified…
Jan 17, 2023
f0eb905
Merge branch 'snapshot-labs:master' into master
johnmark13 Jan 17, 2023
1d12a25
Merge branch 'master' into master
ChaituVR Jan 18, 2023
61a8dc4
Merge pull request #1 from johnmark13/master
johnmark13 Jan 23, 2023
6ca541b
Update index.ts
johnmark13 Jan 26, 2023
fe2b3e5
Merge branch 'snapshot-labs:master' into master
johnmark13 Jul 17, 2023
3425086
How cooperative model might work
johnmark13 Jul 17, 2023
a5dfea8
Strip out the ERC20
johnmark13 Jul 21, 2023
261a320
Merge pull request #2 from nation3/new-n3-passport-voting-strategy
johnmark13 Jul 25, 2023
430af13
Merge branch 'snapshot-labs:master' into master
johnmark13 Jul 25, 2023
b07cb96
Update src/strategies/nation3-passport-coop-with-delegations/index.ts
johnmark13 Jul 26, 2023
c48d71d
Update src/strategies/nation3-passport-coop-with-delegations/index.ts
johnmark13 Jul 26, 2023
a5d139b
Update src/strategies/nation3-passport-coop-with-delegations/index.ts
johnmark13 Jul 26, 2023
e2b008f
Update index.ts
johnmark13 Jul 26, 2023
b431928
Fix from breaking PR suggestions
johnmark13 Jul 26, 2023
976bb03
Merge branch 'master' into master
johnmark13 Jul 26, 2023
e5b685c
Merge branch 'snapshot-labs:master' into master
johnmark13 Jul 26, 2023
9bb3d3c
Create CODEOWNERS
aahna-ashina Aug 6, 2023
60be5c9
Merge branch 'snapshot-labs:master' into master
aahna-ashina Aug 9, 2023
19a908e
Merge branch 'snapshot-labs:master' into master
aahna-ashina Sep 10, 2023
5875405
Merge branch 'snapshot-labs:master' into master
johnmark13 Sep 25, 2023
c6845e4
Largely untested, but passes unit tests
johnmark13 Sep 25, 2023
7203352
Checked with additional adresses and lower balances
johnmark13 Oct 3, 2023
590c7b9
Lint
johnmark13 Oct 3, 2023
d9b5eeb
Merge branch 'snapshot-labs:master' into master
aahna-ashina Nov 12, 2023
d25780e
Merge branch 'snapshot-labs:master' into master
aahna-ashina Nov 13, 2023
a226593
Merge branch 'snapshot-labs:master' into JMF-adding-venation-balance-…
johnmark13 Nov 13, 2023
163caaa
Fix lint issues
johnmark13 Nov 13, 2023
61fa0e6
Merge branch 'snapshot-labs:master' into master
aahna-ashina Nov 19, 2023
e0521f4
Merge branch 'master' into JMF-adding-venation-balance-check
johnmark13 Nov 20, 2023
98f89d7
Merge branch 'snapshot-labs:master' into master
johnmark13 Nov 20, 2023
d27215f
Merge branch 'master' into JMF-adding-venation-balance-check
johnmark13 Nov 20, 2023
db94b49
Did we ever have a passport 0?
johnmark13 Nov 20, 2023
2e3f996
Merge pull request #4 from nation3/JMF-adding-venation-balance-check
johnmark13 Nov 25, 2023
6ecbd3f
Merge branch 'snapshot-labs:master' into master
johnmark13 Nov 27, 2023
c01b95b
Update nation3-passport-coop-with-delegations to version to 0.3.0
johnmark13 Nov 28, 2023
56cac67
Remove CODEOWNERS
johnmark13 Nov 28, 2023
1329f49
Merge branch 'snapshot-labs:master' into master
aahna-ashina Dec 13, 2023
648231e
Merge branch 'snapshot-labs:master' into master
aahna-ashina Jan 4, 2024
88750e0
Automated lint (#1381)
github-actions[bot] Dec 31, 2023
6b61b1f
🐛 Fix breaking issue with revoked passports
acemasterjb Jan 4, 2024
d7d98b7
Merge pull request #6 from acemasterjb/fix/revoked_passes
johnmark13 Jan 25, 2024
e6ca43d
Merge branch 'snapshot-labs:master' into master
johnmark13 Jan 25, 2024
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
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}

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";

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

const revokedUsersResponse = await subgraphRequest(passportIssuanceSubgrgraph, revokedQuery);

const revokedPassports: number[] = revokedUsersResponse.revokes.map(revokeObject => {
return BigNumber.from(revokeObject._tokenId).toNumber();
});


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
Loading