Skip to content

Commit

Permalink
refactor: Remove unused mappings/abi
Browse files Browse the repository at this point in the history
  • Loading branch information
chef-huan committed Apr 23, 2024
1 parent 3b742ea commit 40289a4
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 2,479 deletions.
522 changes: 0 additions & 522 deletions subgraphs/exchange-stableswap/arb/abis/StableSwap3PairV2.json

This file was deleted.

522 changes: 0 additions & 522 deletions subgraphs/exchange-stableswap/arb/abis/StableSwapPairV2.json

This file was deleted.

19 changes: 10 additions & 9 deletions subgraphs/exchange-stableswap/arb/mappings/factory.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* eslint-disable prefer-const */
import { DataSourceContext, log } from "@graphprotocol/graph-ts";
import { StableSwapPair as StableSwapPairContract } from "../generated/templates/StableSwapPair/StableSwapPair";
import { StableSwap3PairV2 as StableSwap3PairV2Contract } from "../generated/templates/StableSwap3PairV2/StableSwap3PairV2";
import { BIG_DECIMAL_ZERO, BIG_INT_ONE, BIG_INT_ZERO, ADDRESS_ZERO } from "./utils";
import { getOrCreateFactory, getOrCreateToken } from "./utils/data";
import { NewStableSwapPair } from "../generated/StableSwapFactory/StableSwapFactory";
import { ERC20, StableSwapPair } from "../generated/templates";
import { AbstractStableSwap } from "../generated/StableSwapFactory/AbstractStableSwap";
import { ERC20, StableSwapNG, StableSwapPair } from "../generated/templates";
import { Pair } from "../generated/schema";

export function handlePairCreated(event: NewStableSwapPair): void {
Expand Down Expand Up @@ -55,13 +54,15 @@ export function handlePairCreated(event: NewStableSwapPair): void {
factory.totalPairs = factory.totalPairs.plus(BIG_INT_ONE);
factory.save();

StableSwapPair.create(event.params.swapContract);
let ssToken = AbstractStableSwap.bind(event.params.swapContract).token();
let isNGPool = ssToken.equals(event.params.swapContract);
if (isNGPool) {
StableSwapNG.create(event.params.swapContract);
} else {
StableSwapPair.create(event.params.swapContract);
}

let context = new DataSourceContext();
context.setString("pairAddress", event.params.swapContract.toHex());
if (event.params.tokenC.toHex() != ADDRESS_ZERO) {
ERC20.createWithContext(StableSwap3PairV2Contract.bind(event.params.swapContract).token(), context);
} else {
ERC20.createWithContext(StableSwapPairContract.bind(event.params.swapContract).token(), context);
}
ERC20.createWithContext(ssToken, context);
}
90 changes: 0 additions & 90 deletions subgraphs/exchange-stableswap/arb/mappings/stableSwapPairV3.ts

This file was deleted.

3 changes: 0 additions & 3 deletions subgraphs/exchange-stableswap/arb/mappings/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/* eslint-disable prefer-const */
import { Address, BigDecimal, BigInt } from "@graphprotocol/graph-ts";
// import { ERC20 } from "../../../exchange/generated/Factory/ERC20";
// import { ERC20NameBytes } from "../../../exchange/generated/Factory/ERC20NameBytes";
// import { ERC20SymbolBytes } from "../../../exchange/generated/Factory/ERC20SymbolBytes";
import { PriceLens0 } from "../../generated/StableSwapFactory/PriceLens0";
import { StableSwapFactory } from "../../generated/StableSwapFactory/StableSwapFactory";
import { ERC20 } from "../../generated/StableSwapFactory/ERC20";
Expand Down
8 changes: 2 additions & 6 deletions subgraphs/exchange-stableswap/arb/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ dataSources:
handler: handlePairCreated
templates:
- kind: ethereum/contract
name: StableSwapPair #Factory
name: StableSwapPair
network: arbitrum-one
source:
abi: StableSwapPair
mapping:
kind: ethereum/events
apiVersion: 0.0.4
language: wasm/assemblyscript
file: ./mappings/stableSwapPairV2.ts
file: ./mappings/stableSwapPair.ts
entities:
- Pair
- Mint
Expand All @@ -63,14 +63,10 @@ templates:
file: ./abis/StableSwapFactory.json
- name: StableSwapPair
file: ./abis/StableSwapPair.json
- name: Factory
file: ./abis/Factory.json
- name: Pair
file: ./abis/Pair.json
- name: PairV3
file: ./abis/PairV3.json
- name: ERC20
file: ./abis/ERC20.json
- name: PriceLens0
file: ./abis/PriceLens0.json
eventHandlers:
Expand Down
Loading

0 comments on commit 40289a4

Please sign in to comment.