-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 614499e
Showing
51 changed files
with
18,022 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.data/ | ||
dist/ | ||
build/ | ||
|
||
## env | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
node_modules | ||
bin | ||
pkg | ||
target | ||
coverage | ||
dist | ||
build | ||
packages/contracts-{build,sdk} | ||
packages/oraidex-common-ui | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"root": true, | ||
"env": { | ||
"node": true, | ||
"commonjs": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:security/recommended", | ||
"plugin:import/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest" | ||
}, | ||
"settings": { | ||
"import/resolver": { | ||
"node": true, | ||
"typescript": true | ||
} | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
"rules": { | ||
"no-console": "off", | ||
"quotes": ["error", "double"], | ||
"semi": ["error", "always"] | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": { | ||
"@typescript-eslint/no-explicit-any": "warn", | ||
"@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }], | ||
"security/detect-object-injection": "off", | ||
"@typescript-eslint/ban-ts-comment": "off" | ||
} | ||
}, | ||
{ | ||
"files": ["*.js"], | ||
"rules": { | ||
"@typescript-eslint/no-var-requires": "warn" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Ignore environment variables file | ||
.env | ||
|
||
.npmrc | ||
build | ||
|
||
dist | ||
.DS_Store | ||
cache/ | ||
|
||
coverage | ||
|
||
.nx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"singleQuote": false, | ||
"trailingComma": "none", | ||
"jsxSingleQuote": false, | ||
"printWidth": 120 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnSave": true, | ||
"editor.formatOnPaste": false, | ||
"prettier.useEditorConfig": false, | ||
"prettier.useTabs": false, | ||
"prettier.trailingComma": "none", | ||
"prettier.tabWidth": 2, | ||
"prettier.printWidth": 120, | ||
"prettier.semi": true, | ||
"prettier.singleQuote": true, | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"[typescript]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": "explicit" | ||
}, | ||
"cSpell.words": [ | ||
"chaintypes", | ||
"Datasource", | ||
"subql" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM node:20.12.0 AS builder | ||
|
||
ARG CONTRACT_ADDRESS | ||
ARG RPC_URL | ||
ENV AMM_V3_CONTRACT_ADDRESS=$CONTRACT_ADDRESS | ||
ENV RPC_URL=$RPC_URL | ||
WORKDIR /app | ||
COPY ./package.json ./yarn.lock ./lerna.json ./ | ||
COPY packages/libs/package.json /app/packages/libs/package.json | ||
COPY packages/amm-v3/package.json /app/packages/amm-v3/package.json | ||
COPY packages/tx-history/package.json /app/packages/tx-history/package.json | ||
RUN yarn | ||
COPY packages/libs/ /app/packages/libs/ | ||
COPY packages/amm-v3/ /app/packages/amm-v3/ | ||
COPY packages/tx-history/ /app/packages/tx-history/ | ||
COPY ./tsconfig.json /app/tsconfig.json | ||
|
||
RUN yarn prebuild && yarn build | ||
|
||
FROM subquerynetwork/subql-node-cosmos:v4.0.1 AS base-node | ||
|
||
FROM base-node AS ammv3-indexer | ||
|
||
COPY --from=builder /app/packages/amm-v3 /app | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Oraichain Indexer | ||
|
||
## How to build | ||
|
||
```bash | ||
docker build . \ | ||
--build-arg CONTRACT_ADDRESS=$AMM_V3_CONTRACT_ADDRESS \ | ||
--build-arg RPC_URL=$RPC_URL \ | ||
--target ammv3-indexer \ | ||
-t oraichain/defi_ammv3-indexer | ||
``` | ||
|
||
## How to run | ||
|
||
```bash | ||
cd packages/${project} && docker-compose up --remove-orphans | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// jest.config.js | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
testPathIgnorePatterns: ["/node_modules/", "/dist/", "/build/"], | ||
transform: { | ||
"^.+\\.tsx?$": "ts-jest" | ||
}, | ||
transformIgnorePatterns: ["/node_modules/(?!oraidex-contracts-sdk|react-day-picker)"], | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"$schema": "node_modules/lerna/schemas/lerna-schema.json", | ||
"npmClient": "yarn", | ||
"version": "1.0.7", | ||
"command": { | ||
"publish": { | ||
"registry": "https://registry.npmjs.org/" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"tasksRunnerOptions": { | ||
"default": { | ||
"options": {} | ||
} | ||
}, | ||
"targetDefaults": { | ||
"build": { | ||
"dependsOn": ["^build"], | ||
"cache": true | ||
}, | ||
"cli": { | ||
"packageManager": "yarn" | ||
}, | ||
"test": { | ||
"cache": true | ||
} | ||
}, | ||
"namedInputs": { | ||
"default": ["{projectRoot}/**/*", "sharedGlobals"], | ||
"sharedGlobals": [], | ||
"production": ["default"] | ||
}, | ||
"cacheDirectory": "node_modules/.cache" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "@oraichain/indexer", | ||
"private": true, | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"repository": "github:oraichain/oraichain-indexer", | ||
"scripts": { | ||
"postinstall": "patch-package", | ||
"test": "NODE_OPTIONS=--experimental-vm-modules jest", | ||
"prepare": "husky", | ||
"prebuild": "lerna run codegen --concurrency 1", | ||
"build": "lerna run build --concurrency 1" | ||
}, | ||
"dependencies": { | ||
"@types/node": "^17.0.21", | ||
"typescript": "^5.2.2" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^29.5.12", | ||
"@typescript-eslint/eslint-plugin": "^7.3.1", | ||
"@typescript-eslint/parser": "^7.3.1", | ||
"eslint": "^8.57.0", | ||
"eslint-import-resolver-typescript": "^3.6.1", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-security": "^2.1.1", | ||
"husky": "^9.1.4", | ||
"jest": "^29.7.0", | ||
"lerna": "^8.1.7", | ||
"nx": "19.5.6", | ||
"patch-package": "^8.0.0", | ||
"ts-jest": "^29.2.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
# These are some examples of commonly ignored file patterns. | ||
# You should customize this list as applicable to your project. | ||
# Learn more about .gitignore: | ||
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore | ||
|
||
# Node artifact files | ||
node_modules/ | ||
dist/ | ||
|
||
# lock files | ||
yarn.lock | ||
package-lock.json | ||
|
||
# Compiled Java class files | ||
*.class | ||
|
||
# Compiled Python bytecode | ||
*.py[cod] | ||
|
||
# Log files | ||
*.log | ||
|
||
# Package files | ||
*.jar | ||
|
||
# Generated files | ||
target/ | ||
dist/ | ||
src/types | ||
project.yaml | ||
|
||
# JetBrains IDE | ||
.idea/ | ||
|
||
# Unit test reports | ||
TEST*.xml | ||
|
||
# Generated by MacOS | ||
.DS_Store | ||
|
||
# Generated by Windows | ||
Thumbs.db | ||
|
||
# Applications | ||
*.app | ||
*.exe | ||
*.war | ||
|
||
# Large media files | ||
*.mp4 | ||
*.tiff | ||
*.avi | ||
*.flv | ||
*.mov | ||
*.wmv | ||
|
||
.data | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "@oraichain/libs-indexer", | ||
"version": "0.0.1", | ||
"description": "This project can be use as a starting point for developing your Oraichain based SubQuery project", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"build": "tsc -p tsconfig.build.json" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@subql/cli": "latest", | ||
"@subql/node-cosmos": "latest", | ||
"@subql/testing": "latest", | ||
"@types/ejs": "^3.1.5", | ||
"@types/node-fetch": "^2.6.11", | ||
"typescript": "^5.2.2" | ||
}, | ||
"dependencies": { | ||
"@cosmjs/stargate": "^0.32.3", | ||
"@subql/types-cosmos": "latest", | ||
"@types/node": "^20.14.12", | ||
"node-fetch": "^2.7.0", | ||
"pino": "^7.8.0", | ||
"ts-proto": "^1.112.1", | ||
"tslib": "=2.3.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { CosmosEvent } from "@subql/types-cosmos"; | ||
import { AMM_V3_ACTIONS } from "../utils/constant"; | ||
import { ContractAddressAttribute, parseEventToAmmV3Action } from "./common"; | ||
|
||
export type ClaimFeeEvent = ContractAddressAttribute & { | ||
action: AMM_V3_ACTIONS.CLAIM_FEE; | ||
owner: string; | ||
pool_key: string; | ||
position_token_id: string; | ||
amount_x: string; | ||
amount_y: string; | ||
incentives_token_address: string; | ||
incentives_amount: string; | ||
}; | ||
|
||
export function createClaimFeeId(txHash: string, positionId: string): string { | ||
return `${txHash}-claimFee-${positionId}`; | ||
} | ||
|
||
export function extractClaimFeeEvent(event: CosmosEvent, ammV3: string) { | ||
return parseEventToAmmV3Action<ClaimFeeEvent>(event, AMM_V3_ACTIONS.CLAIM_FEE, ammV3); | ||
} | ||
|
||
export function parseIncentivesAttr(incentives: string) { | ||
return incentives.split(","); | ||
} | ||
|
||
export function parseIncentiveReward(incentive: string) { | ||
return incentive.split(","); | ||
} | ||
|
||
export function createClaimFeeIncentiveTokenId(claimFeeId: string, incentiveToken: string) { | ||
return `${claimFeeId}-${incentiveToken}`; | ||
} |
Oops, something went wrong.