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

added 6551 base related code #97

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion erc-6551-accounts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"codegen": "graph codegen",
"build": "graph build",
"deploy": "graph deploy --node https://api.studio.thegraph.com/deploy erc-6551-accounts-mainnet",
"deploy": "graph deploy --product hosted-service sharathkrml/erc6551-base",
"create-local": "graph create --node https://api.studio.thegraph.com/deploy erc-6551-accounts-mainnet",
"remove-local": "graph remove --node https://api.studio.thegraph.com/deploy erc-6551-accounts-mainnet",
"deploy-local": "graph deploy --node https://api.studio.thegraph.com/deploy --ipfs https://api.thegraph.com/ipfs erc-6551-accounts-mainnet",
Expand Down
40 changes: 3 additions & 37 deletions erc-6551-accounts/src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export const BIG_INT_ZERO = BigInt.fromI32(0);

export const SUBGRAPH_SCHEMA_VERSION = "1.0.0";

export const SUBGRAPH_NAME = "Mainnet ERC-6551";
export const SUBGRAPH_NAME = "Base ERC-6551";
export const SUBGRAPH_VERSION = "v1";
export const SUBGRAPH_SLUG = "mainnet-erc-6551";
export const SUBGRAPH_SLUG = "base-erc-6551";

const AIR_CHAIN_ID_MAP = new TypedMap<string, string>();
AIR_CHAIN_ID_MAP.set("arbitrum-one", "42161");
Expand All @@ -44,6 +44,7 @@ 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("gnosis", "100")
AIR_CHAIN_ID_MAP.set("base", "8453")

export function getChainId(): string {
const network = dataSource.network();
Expand Down Expand Up @@ -133,38 +134,3 @@ export function getOrCreateAirBlock(
}
return block as AirBlock;
}

/**
* @dev this function does not save the returned entity
* @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 {
const 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;
}

/**
* @dev this function does not save the returned entity
* @dev this function gets or creates a new air token entity
* @param chainID chain id
* @param address token address
* @returns AirToken entity
*/
export function getOrCreateAirToken(chainID: string, address: string): AirToken {
let entity = AirToken.load(chainID + "-" + address);
if (entity == null) {
entity = new AirToken(chainID + "-" + address);
entity.address = address;
}
return entity as AirToken;
}
4 changes: 2 additions & 2 deletions erc-6551-accounts/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ schema:
dataSources:
- kind: ethereum
name: ERC6551Registry
network: mainnet
network: base
source:
address: "0x02101dfB77FDE026414827Fdc604ddAF224F0921"
abi: ERC6551Registry
startBlock: 17212995
startBlock: 2333712
mapping:
kind: ethereum/events
apiVersion: 0.0.7
Expand Down