Skip to content
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
782d0d3
made owner change track func generic
rahul7668gupta Feb 4, 2023
cb71ad4
some pr comments addressed from PR #34
rahul7668gupta Feb 5, 2023
5ea9486
moved is migrated outside module
rahul7668gupta Feb 5, 2023
581bfe0
created air extra for ttl
rahul7668gupta Feb 5, 2023
892ddbc
minor update
rahul7668gupta Feb 5, 2023
9849f83
update domain moduel
rahul7668gupta Feb 5, 2023
c25ac5f
updated unit tests
rahul7668gupta Feb 5, 2023
bfc4202
removed chainId from track funcs
rahul7668gupta Feb 5, 2023
d9fc108
updated module inputs
rahul7668gupta Feb 5, 2023
e5e98cf
addr to resolved address
rahul7668gupta Feb 5, 2023
dc66d3a
updated chain ids for common
rahul7668gupta Feb 5, 2023
d3953a5
updated module with latest changes
rahul7668gupta Feb 5, 2023
856ce80
minor update to eth registrar
rahul7668gupta Feb 5, 2023
d2fe208
removed resolver addresses from yaml file
rahul7668gupta Feb 5, 2023
19dd944
minor update
rahul7668gupta Feb 5, 2023
ade56f8
null cost in registration event
rahul7668gupta Feb 5, 2023
7016b6b
updated unit test
rahul7668gupta Feb 5, 2023
0c72079
updating owner in domain transfer txn
rahul7668gupta Feb 5, 2023
bec8999
updated tests
rahul7668gupta Feb 5, 2023
a6feb4b
moved label to labelHash
rahul7668gupta Feb 5, 2023
1978e6b
domain name module read me
rahul7668gupta Feb 5, 2023
4bd341c
updated docs for nft marketplace
rahul7668gupta Feb 5, 2023
6482870
minor update
rahul7668gupta Feb 5, 2023
abc5b9c
updated readmes
rahul7668gupta Feb 5, 2023
bce8ff8
minor domain module updates
rahul7668gupta Feb 5, 2023
f978a58
integrated module in ens subgraph
rahul7668gupta Feb 5, 2023
607d2e5
Merge pull request #39 from Airstack-xyz/ens-airstack-module-refactor
0xsarvesh Feb 6, 2023
28d6869
moved air account to common, updated modules
rahul7668gupta Feb 6, 2023
7cbd0fb
updated module with domain name changes
rahul7668gupta Feb 6, 2023
f1d5371
updated readme links to main repo
rahul7668gupta Feb 6, 2023
ffd6108
updated trackNameRenewedOrRegistrationByController func and docs
rahul7668gupta Feb 6, 2023
e30d912
Revert "updated trackNameRenewedOrRegistrationByController func and d…
rahul7668gupta Feb 6, 2023
7d32d42
updating domain expiry in renewal from controller event
rahul7668gupta Feb 6, 2023
bc709c0
saving air account after get/create
rahul7668gupta Feb 7, 2023
5c90906
updated module
rahul7668gupta Feb 7, 2023
4c61bd1
updated domain module, ens unit tests, deployed
rahul7668gupta Feb 7, 2023
2af335d
nft marketplace module update, air account
rahul7668gupta Feb 8, 2023
4665f3a
pointing urls to main branch
rahul7668gupta Feb 9, 2023
0b4e5da
module/common name, slug version update
rahul7668gupta Feb 9, 2023
77f5209
requested changes addresses, module integrated
rahul7668gupta Feb 9, 2023
c132f14
process -> get in network and chain id, deployed
rahul7668gupta Feb 9, 2023
af7f30b
updated readme comment from #42
rahul7668gupta Feb 9, 2023
cb6f1f8
saving all entities outside
rahul7668gupta Feb 10, 2023
722add5
removed newOwner account duplication
rahul7668gupta Feb 10, 2023
b74fbb2
refactor
rahul7668gupta Feb 10, 2023
998a1d0
saving domain before
rahul7668gupta Feb 10, 2023
5ef437f
removed domainId in airExtras
rahul7668gupta Feb 10, 2023
319c38a
moved air extras to common code
rahul7668gupta Feb 10, 2023
a927c6f
moved air extras and token into module common
rahul7668gupta Feb 10, 2023
ea2fc5b
addresses pr comments
rahul7668gupta Feb 13, 2023
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# Subgraphs
Airstack Subgraphs

## Verticals Supported in airstack-modules
1. NFT_MARKET_PLACE - [Check docs here](https://github.com/Airstack-xyz/Subgraphs/tree/main/airstack-modules/modules/airstack/nft-marketplace/Readme.md)

2. DOMAIN_NAME - [Check docs here](https://github.com/Airstack-xyz/Subgraphs/tree/main/airstack-modules/modules/airstack/domain-name/Readme.md)
201 changes: 4 additions & 197 deletions airstack-modules/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,211 +69,18 @@ for (let index = START_INDEX; index < args.length; index++) {
integrate(vertical, yaml, graphql, dataSources, templates)
.then(() => {
switch (vertical) {
case Vertical.Dex:
console.log(`
Integration done. Please call the following functions.
1. Add pool

function addDexPool(
poolAddress: string,
fee: BigInt,
inputTokens: Array<string>,
weights: Array<BigDecimal> | null = null,
outputToken: string | null = null
): void

2. Add pool

function swap(
poolAddress: string,
inputAmounts: Array<BigInt>,
outputAmounts: Array<BigInt>,
inputTokenIndex: i32,
outputTokenIndex: i32,
from: string,
to: string,
hash: string,
logIndex: BigInt,
timestamp: BigInt,
blockNumber: BigInt
): void

For documentation and examples please check: https://github.com/Airstack-xyz/Subgraphs
`);
break;

case Vertical.NftMarketplace:
console.log(`
Integration done. Please call the following functions.

1. Track NFT trade transaction
trackNFTSaleTransactions(
chainID: string,
txHash: string,
txIndex: BigInt,
NftSales: Sale[],
protocolType: string,
protocolActionType: string,
timestamp: BigInt,
blockHeight: BigInt,
blockHash: string
)

For documentation and examples please check: https://github.com/Airstack-xyz/Subgraphs
Integration for DOMAIN_NAME vertical done. For documentation and examples please check below link:
https://github.com/Airstack-xyz/Subgraphs/blob/ens-airstack-module-refactor/airstack-modules/modules/airstack/nft-marketplace/Readme.md
`);
break;

case Vertical.DomainName:
console.log(`
Integration done. Please call the following functions.

1. Track domain owner change transaction
trackDomainOwnerChangedTransaction(
blockHeight: BigInt,
blockHash: string,
blockTimestamp: BigInt,
logIndex: BigInt,
chainId: string,
newOwner: string,
transactionHash: string,
isMigrated: boolean,
node: Bytes,
label: Bytes,
tokenAddress: string,
fromOldRegistry: boolean,
)

2. Track domain transfer transaction
trackDomainTransferTransaction(
node: string,
chainId: string,
newOwnerAddress: string,
blockHeight: BigInt,
blockHash: string,
blockTimestamp: BigInt,
logIndex: BigInt,
transactionHash: string,
tokenAddress: string,
fromOldRegistry: boolean,
)

3. Track domain new resolver transaction
trackDomainNewResolverTransaction(
resolver: string,
node: string,
chainId: string,
blockHeight: BigInt,
blockHash: string,
blockTimestamp: BigInt,
transactionHash: string,
logIndex: BigInt,
tokenAddress: string,
fromOldRegistry: boolean,
)

4. Track domain new ttl transaction
trackDomainNewTTLTransaction(
node: string,
newTTL: BigInt,
chainId: string,
blockHeight: BigInt,
blockHash: string,
blockTimestamp: BigInt,
logIndex: BigInt,
transactionHash: string,
tokenAddress: string,
fromOldRegistry: boolean,
)

5. Track name registered transaction
trackNameRegisteredTransaction(
transactionHash: string,
blockHeight: BigInt,
blockHash: string,
blockTimestamp: BigInt,
logIndex: BigInt,
chainId: string,
registrantAddress: string,
expiryTimestamp: BigInt,
cost: BigInt,
paymentToken: string,
labelId: BigInt,
rootNode: ByteArray,
tokenAddress: string,
)

6. Track name renewed transaction
trackNameRenewedTransaction(
transactionHash: string,
blockHeight: BigInt,
blockHash: string,
blockTimestamp: BigInt,
chainId: string,
cost: BigInt | null,
paymentToken: string,
renewer: string,
labelId: BigInt,
rootNode: ByteArray,
expiryTimestamp: BigInt,
tokenAddress: string,
)

7. Track set name preimage transaction
trackSetNamePreImage(
name: string,
label: Bytes,
cost: BigInt,
paymentToken: string,
blockHeight: BigInt,
blockHash: string,
blockTimestamp: BigInt,
chainId: string,
rootNode: ByteArray,
tokenAddress: string,
transactionHash: string,
renewer: string | null,
expiryTimestamp: BigInt | null,
fromRegistrationEvent: boolean,
)

8. Track addr(resolvedAddress) changed transaction
trackAddrChangedTransaction(
chainId: string,
logIndex: BigInt,
resolverAddress: string,
addr: string,
node: string,
blockHeight: BigInt,
blockHash: string,
blockTimestamp: BigInt,
transactionHash: string,
tokenAddress: string,
)

9. Track resolver version changed transaction
trackResolverVersionChange(
chainId: string,
blockHeight: BigInt,
blockHash: string,
blockTimestamp: BigInt,
node: string,
resolverAddress: string,
tokenAddress: string,
)

10. Track set primary domain transaction
trackSetPrimaryDomainTransaction(
ensName: string,
chainId: string,
from: string,
blockHeight: BigInt,
blockHash: string,
blockTimestamp: BigInt,
transactionHash: string,
tokenAddress: string,
)

For documentation and examples please check: https://github.com/Airstack-xyz/Subgraphs
Integration for DOMAIN_NAME vertical done. For documentation and examples please check below link:
https://github.com/Airstack-xyz/Subgraphs/blob/ens-airstack-module-refactor/airstack-modules/modules/airstack/domain-name/Readme.md
`
);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type AirEntityCounter @entity {
type AirAccount @entity {
id: ID!
address: String!
createdAt: AirBlock!
}

type AirToken @entity {
Expand Down
57 changes: 53 additions & 4 deletions airstack-modules/modules/airstack/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
AirBlock,
AirEntityCounter,
AirMeta,
AirAccount,
} from "../../../generated/schema";

export const AIR_META_ID = "AIR_META";
Expand All @@ -17,9 +18,9 @@ export const BIG_INT_ZERO = BigInt.fromI32(0);

export const SUBGRAPH_SCHEMA_VERSION = "1.0.0";

export const SUBGRAPH_NAME = "AIRSTACK-SUBGRAPH";
export const SUBGRAPH_VERSION = "AIRSTACK-SUBGRAPH";
export const SUBGRAPH_SLUG = "AIRSTACK-SUBGRAPH";
export const SUBGRAPH_NAME = "ens";
export const SUBGRAPH_VERSION = "v1";
export const SUBGRAPH_SLUG = "ens-v1";

const AIR_NETWORK_MAP = new TypedMap<string, string>();
AIR_NETWORK_MAP.set("arbitrum-one", "ARBITRUM_ONE");
Expand All @@ -44,12 +45,42 @@ AIR_NETWORK_MAP.set("osmosis", "OSMOSIS");
AIR_NETWORK_MAP.set("matic", "MATIC");
AIR_NETWORK_MAP.set("xdai", "XDAI");

const AIR_CHAIN_ID_MAP = new TypedMap<string, string>();
AIR_CHAIN_ID_MAP.set("arbitrum-one", "42161");
AIR_CHAIN_ID_MAP.set("arweave-mainnet", "174");
AIR_CHAIN_ID_MAP.set("aurora", "1313161554");
AIR_CHAIN_ID_MAP.set("avalanche", "43114");
AIR_CHAIN_ID_MAP.set("boba", "288");
AIR_CHAIN_ID_MAP.set("bsc", "56");
AIR_CHAIN_ID_MAP.set("celo", "42220");
AIR_CHAIN_ID_MAP.set("COSMOS", "cosmos");
AIR_CHAIN_ID_MAP.set("CRONOS", "25");
AIR_CHAIN_ID_MAP.set("mainnet", "1");
AIR_CHAIN_ID_MAP.set("fantom", "250");
AIR_CHAIN_ID_MAP.set("fuse", "122");
AIR_CHAIN_ID_MAP.set("harmony", "1666600000");
AIR_CHAIN_ID_MAP.set("juno", "juno-1");
AIR_CHAIN_ID_MAP.set("moonbeam", "1284");
AIR_CHAIN_ID_MAP.set("moonriver", "1285");
AIR_CHAIN_ID_MAP.set("near-mainnet", "1313161554");
AIR_CHAIN_ID_MAP.set("optimism", "10");
AIR_CHAIN_ID_MAP.set("osmosis", "osmosis-1");
AIR_CHAIN_ID_MAP.set("matic", "137");
AIR_CHAIN_ID_MAP.set("xdai", "100");

export function processNetwork(network: string): string {
const value = AIR_NETWORK_MAP.get(network);
const result: string = value !== null ? value : "unknown";
return result;
}

export function processChainId(): string {
let network = dataSource.network();
const value = AIR_CHAIN_ID_MAP.get(network);
const result: string = value !== null ? value : "unknown";
return result;
}

//air entity funcitons

/**
Expand Down Expand Up @@ -124,4 +155,22 @@ export function getOrCreateAirBlock(
block.save()
}
return block as AirBlock;
}
}

/**
* @dev this function gets or creates a new air account entity
* @param chainId chain id
* @param address account address
* @param block air block object
* @returns AirAccount entity
*/
export function getOrCreateAirAccount(chainId: string, address: string, block: AirBlock): AirAccount {
let id = chainId.concat("-").concat(address);
let entity = AirAccount.load(id);
if (entity == null) {
entity = new AirAccount(id);
entity.address = address;
entity.createdAt = block.id;
}
return entity as AirAccount;
}
Loading