├── .eslintignore ├── .prettierrc ├── .env.dist ├── readme.md ├── src ├── sdk │ ├── binance.ts │ ├── matic.ts │ ├── avalanche.ts │ ├── metadata.ts │ ├── util.ts │ ├── symbol.ts │ ├── constants.ts │ ├── price.ts │ ├── Interfaces.ts │ ├── basic-sdk.ts │ ├── tezos.ts │ └── EVMC.ts ├── tester │ ├── util.ts │ └── test.ts └── adapters │ ├── element │ ├── abi.json │ └── index.js │ ├── bhero-market │ ├── index.ts │ └── abi.json │ ├── bhouse-market │ ├── index.ts │ └── abi.json │ ├── x │ ├── index.ts │ └── abi.json │ ├── thetan-arena │ ├── index.ts │ └── abi.json │ ├── rarible-tezos │ └── index.ts │ ├── ens │ ├── index.ts │ └── abi.json │ ├── radiocaca │ └── index.ts │ ├── bazaar │ ├── index.ts │ └── abi.json │ ├── cryptopunks2 │ ├── index.ts │ └── abi.json │ ├── galler-bsc │ └── index.ts │ ├── galler │ ├── index.ts │ └── abi.json │ ├── golom │ └── index.ts │ └── nftkey-avalanche │ ├── index.ts │ └── abi.json ├── tsconfig.json ├── .eslintrc.js ├── package.json └── .gitignore /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | package.json 3 | package-lock.json -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120, 3 | "tabWidth": 4, 4 | "useTabs": false, 5 | "trailingComma": "all", 6 | "endOfLine": "lf", 7 | "overrides": [] 8 | } 9 | 10 | -------------------------------------------------------------------------------- /.env.dist: -------------------------------------------------------------------------------- 1 | DAPPRADAR_API_URL=http://nft-sales-service.dappradar.com/open-source 2 | DAPPRADAR_API_KEY=your-sample-key-from-dappradar 3 | WS_PROXY_URL=ws://nft-sales-websocket.dappradar.com 4 | HTTP_PROXY_URL=http://nft-sales-websocket.dappradar.com -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # DappRadar NFT Sales Adapters 2 | 3 | This repository hosts the adapters for integrating NFT collections or marketplaces on 4 | [dappradar.com/nft](https://dappradar.com/nft) and other products. 5 | 6 | Repository is maintained through community support, to add your collection or marketplace please read 7 | [documentation](https://dappradar.github.io/nft-sales-adapters). 8 | -------------------------------------------------------------------------------- /src/sdk/binance.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | 3 | dotenv.config(); 4 | 5 | import { AVAILABLE_PROTOCOLS } from "./constants"; 6 | import EVMC from "./EVMC"; 7 | 8 | class BSC extends EVMC { 9 | constructor(props: any) { 10 | super(props); 11 | this.range = 500; 12 | this.chunkSize = 2; 13 | this.protocol = AVAILABLE_PROTOCOLS.BSC; 14 | } 15 | } 16 | 17 | export default BSC; 18 | -------------------------------------------------------------------------------- /src/sdk/matic.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | 3 | dotenv.config(); 4 | 5 | import { AVAILABLE_PROTOCOLS } from "./constants"; 6 | import EVMC from "./EVMC"; 7 | 8 | class Matic extends EVMC { 9 | constructor(props: any) { 10 | super(props); 11 | 12 | this.range = 500; 13 | this.chunkSize = 2; 14 | this.protocol = AVAILABLE_PROTOCOLS.POLYGON; 15 | } 16 | } 17 | 18 | export default Matic; 19 | -------------------------------------------------------------------------------- /src/sdk/avalanche.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | 3 | dotenv.config(); 4 | 5 | import { AVAILABLE_PROTOCOLS } from "./constants"; 6 | import EVMC from "./EVMC"; 7 | 8 | class Avalanche extends EVMC { 9 | constructor(props: any) { 10 | super(props); 11 | this.range = 500; 12 | this.chunkSize = 2; 13 | this.protocol = AVAILABLE_PROTOCOLS.AVALANCHE; 14 | } 15 | } 16 | 17 | export default Avalanche; 18 | -------------------------------------------------------------------------------- /src/tester/util.ts: -------------------------------------------------------------------------------- 1 | const ENTITY_KEYS = [ 2 | "providerName", 3 | "providerContract", 4 | "nftContract", 5 | "nftId", 6 | "token", 7 | "tokenSymbol", 8 | "amount", 9 | "price", 10 | "priceUsd", 11 | "seller", 12 | "buyer", 13 | "soldAt", 14 | "blockNumber", 15 | "transactionHash", 16 | "protocol", 17 | ]; 18 | 19 | const PROVIDER_KEYS = ["run", "addToDatabase"]; 20 | 21 | export { ENTITY_KEYS, PROVIDER_KEYS }; 22 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "experimentalDecorators": true, 4 | "emitDecoratorMetadata": true, 5 | "strictPropertyInitialization": false, 6 | "target": "es2019", 7 | "module": "commonjs", 8 | "moduleResolution": "node", 9 | "rootDir": "src", 10 | "outDir": "dist", 11 | "strict": true, 12 | "esModuleInterop": true, 13 | "skipLibCheck": true, 14 | "useUnknownInCatchVariables": false 15 | }, 16 | "include": [ 17 | "**/*" 18 | ] 19 | } -------------------------------------------------------------------------------- /src/sdk/metadata.ts: -------------------------------------------------------------------------------- 1 | class Metadata { 2 | block = async (provider: any): Promise => { 3 | if (!provider.block) { 4 | throw new Error("Testing block not supplied"); 5 | } 6 | return provider.block; 7 | }; 8 | 9 | // Ensure metadata methods exists. 10 | ensure = async (_provider: any) => {}; 11 | 12 | get = async (_provider: any) => {}; 13 | 14 | update = async (_provider: any, _block: number | string) => {}; 15 | 16 | create = async (_provider: any, _block: number | string) => {}; 17 | } 18 | 19 | export default new Metadata(); 20 | -------------------------------------------------------------------------------- /src/sdk/util.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | dotenv.config(); 3 | 4 | const asyncTimeout = async (seconds = 10): Promise => { 5 | return new Promise(r => setTimeout(r, 1000 * seconds)); 6 | }; 7 | 8 | const dynamicImport = async (pathToFile: string): Promise => { 9 | return new Promise((resolve, reject) => { 10 | import(pathToFile) 11 | .then(file => { 12 | resolve(file.default); 13 | }) 14 | .catch(error => { 15 | reject(error); 16 | }); 17 | }); 18 | }; 19 | 20 | export { asyncTimeout, dynamicImport }; 21 | -------------------------------------------------------------------------------- /src/sdk/symbol.ts: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | import { API_KEY, API_URL } from "./constants"; 3 | 4 | import { ISymbolAPIResponse } from "./Interfaces"; 5 | 6 | const USER_AGENT = 7 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36"; 8 | 9 | class Symbol { 10 | get = async (token: string, protocol: string): Promise => { 11 | const url = `${API_URL}/token-metadata`; 12 | const config = { 13 | params: { 14 | key: API_KEY, 15 | token_address: token, 16 | protocol, 17 | }, 18 | headers: { 19 | "User-Agent": USER_AGENT, 20 | }, 21 | }; 22 | const resp = await axios.get(url, config); 23 | 24 | return resp.data; 25 | }; 26 | } 27 | 28 | export default new Symbol(); 29 | -------------------------------------------------------------------------------- /src/sdk/constants.ts: -------------------------------------------------------------------------------- 1 | enum AVAILABLE_PROTOCOLS { 2 | ETH = "ethereum", 3 | BSC = "bsc", 4 | POLYGON = "polygon", 5 | AVALANCHE = "avalanche", 6 | TEZOS = "tezos", 7 | } 8 | 9 | const API_KEY = process.env.DAPPRADAR_API_KEY || ""; 10 | const API_URL = process.env.DAPPRADAR_API_URL || ""; 11 | const WS_PROXY_URL = process.env.WS_PROXY_URL || ""; 12 | const HTTP_PROXY_URL = process.env.HTTP_PROXY_URL || ""; 13 | 14 | if (!API_KEY.length) throw new Error(`Missing "API_KEY" environment variable`); 15 | if (!API_URL.length) throw new Error(`Missing "API_URL" environment variable`); 16 | if (!WS_PROXY_URL.length) throw new Error(`Missing "WS_PROXY_URL" environment variable`); 17 | if (!HTTP_PROXY_URL.length) throw new Error(`Missing "HTTP_PROXY_URL" environment variable`); 18 | 19 | const DEFAULT_MAX_RETRIES = 10; 20 | 21 | export { AVAILABLE_PROTOCOLS, API_KEY, API_URL, WS_PROXY_URL, HTTP_PROXY_URL, DEFAULT_MAX_RETRIES }; 22 | -------------------------------------------------------------------------------- /src/sdk/price.ts: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | import { API_KEY, API_URL } from "./constants"; 3 | 4 | import { IPriceAPIResponse } from "./Interfaces"; 5 | 6 | const USER_AGENT = 7 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36"; 8 | 9 | class Price { 10 | get = async (token: string, protocol: string, timestamp: number): Promise => { 11 | const url = `${API_URL}/token-price`; 12 | const config = { 13 | params: { 14 | key: API_KEY, 15 | token_address: token, 16 | protocol, 17 | timestamp, 18 | }, 19 | headers: { 20 | "User-Agent": USER_AGENT, 21 | }, 22 | }; 23 | const resp = await axios.get(url, config); 24 | 25 | return resp.data; 26 | }; 27 | } 28 | 29 | export default new Price(); 30 | -------------------------------------------------------------------------------- /src/sdk/Interfaces.ts: -------------------------------------------------------------------------------- 1 | export interface ISaleEntity { 2 | providerName: string; 3 | providerContract: string; 4 | protocol: string; 5 | nftContract: string; 6 | nftId: string; 7 | token: string; 8 | tokenSymbol: string; 9 | amount: number; 10 | price: number | null; 11 | priceUsd: number | null; 12 | seller: string; 13 | buyer: string; 14 | soldAt: string; 15 | blockNumber: number; 16 | transactionHash: string; 17 | } 18 | 19 | export interface IDappRadarAPIHeaders { 20 | key: string; 21 | protocol: string; 22 | "content-type"?: string; 23 | } 24 | 25 | export interface ISymbolAPIResponse { 26 | id: number; 27 | address: string; 28 | symbol: string; 29 | protocol: string; 30 | decimals: number; 31 | created_at: string; 32 | currency: string; 33 | } 34 | 35 | export interface IPriceAPIResponse { 36 | protocol: string; 37 | token: string; 38 | date: string; 39 | price: number; 40 | decimals: number | null; 41 | currency: string; 42 | } 43 | 44 | export interface IObjectStringAny { 45 | [key: string]: any; 46 | } 47 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parser: "@typescript-eslint/parser", 3 | env: { 4 | es6: true, 5 | browser: true, 6 | node: true, 7 | jest: true, 8 | }, 9 | extends: [ 10 | "prettier", 11 | "plugin:@typescript-eslint/eslint-recommended", 12 | "plugin:@typescript-eslint/recommended" 13 | ], 14 | plugins: ["@typescript-eslint", "prettier"], 15 | rules: { 16 | "no-unused-vars": [ 17 | "warn", 18 | {argsIgnorePattern: "^_", varsIgnorePattern: "^_"}, 19 | ], 20 | "no-prototype-builtins": "off", 21 | "no-useless-escape": "warn", 22 | "prettier/prettier": "error", 23 | "no-console": "off", 24 | "no-var": "warn", 25 | "prefer-const": "warn", 26 | "no-constant-condition": "off", 27 | "no-inner-declarations": "off", 28 | "no-dupe-class-members": "off", 29 | "require-atomic-updates": "off", // until https://github.com/eslint/eslint/issues/11899 30 | "no-throw-literal": "error", 31 | "no-mixed-spaces-and-tabs": ["warn", "smart-tabs"], 32 | 33 | //"prettier/prettier": "warn", 34 | "no-restricted-imports": ["error"], 35 | }, 36 | }; 37 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dappradar-nft-sales-adapters", 3 | "version": "0.1.0", 4 | "description": "Service from tracking NFT sales.", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/dappradar/nft-sales-adapters.git" 8 | }, 9 | "keywords": [ 10 | "nft" 11 | ], 12 | "author": "DappRadar", 13 | "license": "gpl-3.0 license", 14 | "homepage": "https://github.com/dappradar/nft-sales-adapters#readme", 15 | "private": true, 16 | "dependencies": { 17 | "@types/lodash": "^4.14.182", 18 | "axios": "^0.21.1", 19 | "bignumber.js": "^9.0.1", 20 | "dotenv": "^8.2.0", 21 | "http-proxy": "^1.18.1", 22 | "lodash": "^4.17.21", 23 | "moment": "^2.29.1", 24 | "ts-node": "^10.8.1", 25 | "web3": "^1.3.4", 26 | "web3-eth-abi": "^1.3.4", 27 | "web3-utils": "^1.3.4", 28 | "ws": "^8.2.2" 29 | }, 30 | "devDependencies": { 31 | "@typescript-eslint/eslint-plugin": "^5.29.0", 32 | "@typescript-eslint/parser": "^5.29.0", 33 | "babel-eslint": "^10.1.0", 34 | "copyfiles": "^2.4.1", 35 | "eslint": "^8.18.0", 36 | "eslint-config-prettier": "^6.15.0", 37 | "eslint-nibble": "^5.1.0", 38 | "eslint-plugin-prettier": "^3.4.0", 39 | "husky": "^7.0.1", 40 | "lint-staged": "^10.2.11", 41 | "prettier": "^1.19.1", 42 | "prettylint": "^1.0.0" 43 | }, 44 | "scripts": { 45 | "lint": "eslint . --ext .ts --fix", 46 | "prepare": "husky install", 47 | "build": "rm -rf ./dist && tsc && copyfiles -u 1 ./src/**/*.json ./dist" 48 | }, 49 | "lint-staged": { 50 | "*.{js,json}": "eslint --fix" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/tester/test.ts: -------------------------------------------------------------------------------- 1 | // In order to have your pull request approven this test case must not fail 2 | // Sample usage: node tester/test.js ../adapters/ens/index.js 3 | import * as dotenv from "dotenv"; 4 | 5 | dotenv.config(); 6 | 7 | import path from "path"; 8 | 9 | import { ENTITY_KEYS, PROVIDER_KEYS } from "./util"; 10 | import { AVAILABLE_PROTOCOLS } from "../sdk/constants"; 11 | 12 | import { ISaleEntity } from "../sdk/Interfaces"; 13 | import { dynamicImport } from "../sdk/util"; 14 | 15 | if (process.argv.length < 3) { 16 | console.error(`Missing correct pathname to test`); 17 | process.exit(1); 18 | } 19 | 20 | const pathToAdapter = path.resolve(__dirname, process.argv[2]); 21 | const tester = async (): Promise => { 22 | try { 23 | const AdapterClass = await dynamicImport(pathToAdapter); 24 | const adapter = new AdapterClass(); 25 | for (const key of PROVIDER_KEYS) { 26 | if (!Object.keys(adapter).includes(key)) { 27 | throw new Error("Modules are expected to have value run"); 28 | } 29 | } 30 | 31 | const entities: ISaleEntity[] = []; 32 | 33 | adapter.addToDatabase = async (entity: ISaleEntity) => { 34 | entities.push(entity); 35 | if (entities.length > 4) { 36 | await adapter.stop(); 37 | } 38 | }; 39 | 40 | await adapter.run(); 41 | 42 | if (entities.length == 0) { 43 | throw new Error('No entities were returned'); 44 | } 45 | 46 | for (const entity of entities) { 47 | for (const entityKey of ENTITY_KEYS) { 48 | if (!entity.hasOwnProperty(entityKey)) { 49 | throw new Error(`Missing ${entityKey} property in entity`); 50 | } 51 | } 52 | 53 | if (!Object.values(AVAILABLE_PROTOCOLS).find(p => p === entity.protocol)) { 54 | throw new Error(`Unsupported protocol "${entity.protocol}"`); 55 | } 56 | } 57 | 58 | console.log(entities); 59 | } catch (err) { 60 | console.error(err); 61 | process.exit(); 62 | } 63 | }; 64 | 65 | const main = async () => { 66 | await tester() 67 | .then(() => { 68 | console.log("Tests were passed"); 69 | process.exit(); 70 | }) 71 | .catch(err => console.log("Got an error in tester", err)); 72 | }; 73 | main(); 74 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | src/sdk/logger/logs 9 | 10 | # Diagnostic reports (https://nodejs.org/api/report.html) 11 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 12 | 13 | # Runtime data 14 | pids 15 | *.pid 16 | *.seed 17 | *.pid.lock 18 | 19 | # Directory for instrumented libs generated by jscoverage/JSCover 20 | lib-cov 21 | 22 | # Coverage directory used by tools like istanbul 23 | coverage 24 | *.lcov 25 | 26 | # nyc test coverage 27 | .nyc_output 28 | 29 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 30 | .grunt 31 | 32 | # Bower dependency directory (https://bower.io/) 33 | bower_components 34 | 35 | # node-waf configuration 36 | .lock-wscript 37 | 38 | # Compiled binary addons (https://nodejs.org/api/addons.html) 39 | build/Release 40 | 41 | # Dependency directories 42 | node_modules/ 43 | jspm_packages/ 44 | 45 | # Snowpack dependency directory (https://snowpack.dev/) 46 | web_modules/ 47 | 48 | # TypeScript cache 49 | *.tsbuildinfo 50 | 51 | # Optional npm cache directory 52 | .npm 53 | 54 | # Optional eslint cache 55 | .eslintcache 56 | 57 | # Microbundle cache 58 | .rpt2_cache/ 59 | .rts2_cache_cjs/ 60 | .rts2_cache_es/ 61 | .rts2_cache_umd/ 62 | 63 | # Optional REPL history 64 | .node_repl_history 65 | 66 | # Output of 'npm pack' 67 | *.tgz 68 | 69 | # Yarn Integrity file 70 | .yarn-integrity 71 | 72 | # dotenv environment variables file 73 | .env 74 | .env.test 75 | 76 | # parcel-bundler cache (https://parceljs.org/) 77 | .cache 78 | .parcel-cache 79 | 80 | # Next.js build output 81 | .next 82 | out 83 | 84 | # Nuxt.js build / generate output 85 | .nuxt 86 | dist 87 | 88 | # Gatsby files 89 | .cache/ 90 | # Comment in the public line in if your project uses Gatsby and not Next.js 91 | # https://nextjs.org/blog/next-9-1#public-directory-support 92 | # public 93 | 94 | # vuepress build output 95 | .vuepress/dist 96 | 97 | # Serverless directories 98 | .serverless/ 99 | 100 | # FuseBox cache 101 | .fusebox/ 102 | 103 | # DynamoDB Local files 104 | .dynamodb/ 105 | 106 | # TernJS port file 107 | .tern-port 108 | 109 | # Stores VSCode versions used for testing VSCode extensions 110 | .vscode-test 111 | 112 | # yarn v2 113 | .yarn/cache 114 | .yarn/unplugged 115 | .yarn/build-state.yml 116 | .yarn/install-state.gz 117 | .pnp.* 118 | 119 | # Editor 120 | .idea 121 | -------------------------------------------------------------------------------- /src/sdk/basic-sdk.ts: -------------------------------------------------------------------------------- 1 | import _ from "lodash"; 2 | import { asyncTimeout } from "./util"; 3 | import { DEFAULT_MAX_RETRIES } from "./constants"; 4 | 5 | export interface IBasicSDKRetryConfig { 6 | maxRetries?: number; 7 | customParams?: object; 8 | callback: () => any; 9 | successCallback?: (response: any) => void; 10 | errorCallback?: (response: any) => void; 11 | retryAfter?: number; 12 | action?: string; 13 | } 14 | 15 | export interface IBasicSDKCaller { 16 | fileName?: string; 17 | method?: string; 18 | } 19 | 20 | export interface IBasicSDKError { 21 | fileName?: string; 22 | method?: string; 23 | providerName: string; 24 | state: string; 25 | retries: number; 26 | duration?: number; 27 | 28 | [key: string]: any; 29 | } 30 | 31 | abstract class BasicSDK { 32 | provider: any; 33 | stack?: any; 34 | running: boolean; 35 | 36 | protected constructor(provider: any) { 37 | this.provider = provider; 38 | this.running = true; 39 | } 40 | 41 | getCaller = (): IBasicSDKCaller => { 42 | const oldStackTrace = Error.prepareStackTrace; 43 | 44 | try { 45 | Error.prepareStackTrace = (err, structuredStackTrace) => structuredStackTrace; 46 | Error.captureStackTrace(this); 47 | const stack = this.stack[2]; 48 | 49 | return { 50 | fileName: stack.getFileName(), 51 | method: stack.getFunctionName(), 52 | }; 53 | } finally { 54 | Error.prepareStackTrace = oldStackTrace; 55 | } 56 | 57 | return {}; 58 | }; 59 | 60 | retry = async (config: IBasicSDKRetryConfig): Promise => { 61 | const caller: IBasicSDKCaller = await this.getCaller(); 62 | 63 | let startDate: number = Date.now(); 64 | let retries = 0; 65 | let error: IBasicSDKError | undefined; 66 | while (retries < (config.maxRetries || DEFAULT_MAX_RETRIES)) { 67 | startDate = Date.now(); 68 | const logData = { 69 | ...caller, 70 | providerName: this.provider.name, 71 | contract: this.provider.contract, 72 | ...config.customParams, 73 | action: config.action, 74 | retries, 75 | }; 76 | const commonLogData = _.omitBy(logData, _.isNil); 77 | 78 | try { 79 | console.info({ 80 | ...commonLogData, 81 | state: "start", 82 | }); 83 | 84 | const response: any = await config.callback(); 85 | 86 | console.info({ 87 | ...commonLogData, 88 | state: "end", 89 | duration: Date.now() - startDate, 90 | }); 91 | 92 | if (config.successCallback) { 93 | await config.successCallback(response); 94 | } 95 | 96 | return response; 97 | } catch (err) { 98 | // @ts-ignore 99 | error = { 100 | ...commonLogData, 101 | ...caller, 102 | error: err?.message, 103 | state: "error", 104 | duration: Date.now() - startDate, 105 | }; 106 | 107 | console.info(error); 108 | await asyncTimeout(config.retryAfter); 109 | retries++; 110 | } 111 | } 112 | 113 | console.error(error); 114 | await asyncTimeout(3); 115 | process.exit(); 116 | }; 117 | } 118 | 119 | export default BasicSDK; 120 | -------------------------------------------------------------------------------- /src/adapters/element/abi.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { "indexed": false, "internalType": "address", "name": "maker", "type": "address" }, 6 | { "indexed": false, "internalType": "address", "name": "taker", "type": "address" }, 7 | { "indexed": false, "internalType": "contract IERC20", "name": "erc20Token", "type": "address" }, 8 | { "indexed": false, "internalType": "uint256", "name": "erc20TokenAmount", "type": "uint256" }, 9 | { "indexed": false, "internalType": "address", "name": "erc721Token", "type": "address" }, 10 | { "indexed": false, "internalType": "uint256", "name": "erc721TokenId", "type": "uint256" }, 11 | { "indexed": false, "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } 12 | ], 13 | "name": "ERC721SellOrderFilled", 14 | "type": "event" 15 | }, 16 | { 17 | "anonymous": false, 18 | "inputs": [ 19 | { "indexed": false, "internalType": "address", "name": "maker", "type": "address" }, 20 | { "indexed": false, "internalType": "address", "name": "taker", "type": "address" }, 21 | { "indexed": false, "internalType": "contract IERC20", "name": "erc20Token", "type": "address" }, 22 | { "indexed": false, "internalType": "uint256", "name": "erc20TokenAmount", "type": "uint256" }, 23 | { "indexed": false, "internalType": "address", "name": "erc721Token", "type": "address" }, 24 | { "indexed": false, "internalType": "uint256", "name": "erc721TokenId", "type": "uint256" }, 25 | { "indexed": false, "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } 26 | ], 27 | "name": "ERC721BuyOrderFilled", 28 | "type": "event" 29 | }, 30 | { 31 | "anonymous": false, 32 | "inputs": [ 33 | { "indexed": false, "internalType": "address", "name": "maker", "type": "address" }, 34 | { "indexed": false, "internalType": "address", "name": "taker", "type": "address" }, 35 | { "indexed": false, "internalType": "contract IERC20", "name": "erc20Token", "type": "address" }, 36 | { "indexed": false, "internalType": "uint256", "name": "erc20FillAmount", "type": "uint256" }, 37 | { "indexed": false, "internalType": "address", "name": "erc1155Token", "type": "address" }, 38 | { "indexed": false, "internalType": "uint256", "name": "erc1155TokenId", "type": "uint256" }, 39 | { "indexed": false, "internalType": "uint128", "name": "erc1155FillAmount", "type": "uint128" }, 40 | { "indexed": false, "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } 41 | ], 42 | "name": "ERC1155SellOrderFilled", 43 | "type": "event" 44 | }, 45 | { 46 | "anonymous": false, 47 | "inputs": [ 48 | { "indexed": false, "internalType": "address", "name": "maker", "type": "address" }, 49 | { "indexed": false, "internalType": "address", "name": "taker", "type": "address" }, 50 | { "indexed": false, "internalType": "contract IERC20", "name": "erc20Token", "type": "address" }, 51 | { "indexed": false, "internalType": "uint256", "name": "erc20FillAmount", "type": "uint256" }, 52 | { "indexed": false, "internalType": "address", "name": "erc1155Token", "type": "address" }, 53 | { "indexed": false, "internalType": "uint256", "name": "erc1155TokenId", "type": "uint256" }, 54 | { "indexed": false, "internalType": "uint128", "name": "erc1155FillAmount", "type": "uint128" }, 55 | { "indexed": false, "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } 56 | ], 57 | "name": "ERC1155BuyOrderFilled", 58 | "type": "event" 59 | } 60 | ] 61 | -------------------------------------------------------------------------------- /src/adapters/bhero-market/index.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | 3 | dotenv.config(); 4 | 5 | import moment from "moment"; 6 | import BigNumber from "bignumber.js"; 7 | import BSC from "../../sdk/binance"; 8 | import path from "path"; 9 | import symbolSdk from "../../sdk/symbol"; 10 | import priceSdk from "../../sdk/price"; 11 | 12 | import { ISaleEntity, ISymbolAPIResponse } from "../../sdk/Interfaces"; 13 | import { EventData } from "web3-eth-contract"; 14 | 15 | class BHeroMarket { 16 | name: string; 17 | symbol: ISymbolAPIResponse | undefined; 18 | token: string | undefined; 19 | protocol: string; 20 | block: number; 21 | contract: string; 22 | events: string[]; 23 | pathToAbi: string | undefined; 24 | range: number; 25 | chunkSize: number; 26 | sdk: any; 27 | 28 | constructor() { 29 | this.name = "bhero-market"; 30 | this.symbol = undefined; 31 | this.token = undefined; 32 | this.protocol = "bsc"; 33 | this.block = 15498601; 34 | this.contract = "0x376a10e7f125a4e0a567cc08043c695cd8edd704"; 35 | this.events = ["Sold"]; 36 | this.pathToAbi = path.join(__dirname, "./abi.json"); 37 | this.range = 500; 38 | this.chunkSize = 6; 39 | this.sdk = undefined; 40 | } 41 | 42 | run = async () => { 43 | this.sdk = await this.loadSdk(); 44 | 45 | const token = await this.sdk.callContractMethod("bcoinContract"); 46 | if (!token) throw new Error("Failed to fetch token address"); 47 | this.token = token.toLowerCase(); 48 | 49 | const symbol = await symbolSdk.get(this.token || "", this.protocol); 50 | if (!symbol) throw new Error(`Missing symbol metadata for provider ${this.name}`); 51 | 52 | this.symbol = symbol; 53 | 54 | await this.sdk.run(); 55 | }; 56 | 57 | loadSdk = () => { 58 | return new BSC(this); 59 | }; 60 | 61 | stop = async () => { 62 | this.sdk.stop(); 63 | }; 64 | 65 | getBuyer = (event: EventData): string | null => { 66 | return event.returnValues.buyer; 67 | }; 68 | 69 | getSeller = (event: EventData): string | null => { 70 | return event.returnValues.seller; 71 | }; 72 | 73 | process = async (event: EventData): Promise => { 74 | const block = await this.sdk.getBlock(event.blockNumber); 75 | const timestamp = moment.unix(block.timestamp).utc(); 76 | const po = await priceSdk.get(this.token || "", this.protocol, block.timestamp); 77 | const nativePrice = new BigNumber(event.returnValues.price).dividedBy(10 ** (this.symbol?.decimals || 0)); 78 | const buyer = this.getBuyer(event); 79 | if (!buyer) { 80 | return; 81 | } 82 | const tokenId = event.returnValues.tokenId; 83 | const seller = this.getSeller(event) || ""; 84 | const nftContract = await this.sdk.callContractMethod("nftContract"); 85 | 86 | const entity: ISaleEntity = { 87 | providerName: this.name, 88 | providerContract: this.contract, 89 | protocol: this.protocol, 90 | nftContract: nftContract.toLowerCase(), 91 | nftId: tokenId, 92 | token: this.token || "", 93 | tokenSymbol: this.symbol?.symbol || "", 94 | amount: 1, 95 | price: nativePrice.toNumber(), 96 | priceUsd: nativePrice.multipliedBy(po.price).toNumber(), 97 | seller: seller.toLowerCase(), 98 | buyer: buyer.toLowerCase(), 99 | soldAt: timestamp.format("YYYY-MM-DD HH:mm:ss"), 100 | blockNumber: event.blockNumber, 101 | transactionHash: event.transactionHash, 102 | }; 103 | return this.addToDatabase(entity); 104 | }; 105 | 106 | addToDatabase = async (entity: ISaleEntity): Promise => { 107 | return entity; 108 | }; 109 | } 110 | 111 | export default BHeroMarket; 112 | -------------------------------------------------------------------------------- /src/adapters/bhouse-market/index.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | 3 | dotenv.config(); 4 | 5 | import moment from "moment"; 6 | import BigNumber from "bignumber.js"; 7 | import BSC from "../../sdk/binance"; 8 | import path from "path"; 9 | import symbolSdk from "../../sdk/symbol"; 10 | import priceSdk from "../../sdk/price"; 11 | 12 | import { ISaleEntity, ISymbolAPIResponse } from "../../sdk/Interfaces"; 13 | import { EventData } from "web3-eth-contract"; 14 | 15 | class BHouseMarket { 16 | name: string; 17 | symbol: ISymbolAPIResponse | undefined; 18 | token: string | undefined; 19 | protocol: string; 20 | block: number; 21 | contract: string; 22 | events: string[]; 23 | pathToAbi: string | undefined; 24 | range: number; 25 | chunkSize: number; 26 | sdk: any; 27 | 28 | constructor() { 29 | this.name = "bhouse-market"; 30 | this.symbol = undefined; 31 | this.token = undefined; 32 | this.protocol = "bsc"; 33 | this.block = 14498666; 34 | this.contract = "0x049896f350c802cd5c91134e5f35ec55fa8f0108"; 35 | this.events = ["Sold"]; 36 | this.pathToAbi = path.join(__dirname, "./abi.json"); 37 | this.range = 500; 38 | this.chunkSize = 6; 39 | this.sdk = undefined; 40 | } 41 | 42 | run = async () => { 43 | this.sdk = await this.loadSdk(); 44 | 45 | const token = await this.sdk.callContractMethod("bcoinContract"); 46 | if (!token) throw new Error("Failed to fetch token address"); 47 | this.token = token.toLowerCase(); 48 | 49 | const symbol = await symbolSdk.get(this.token || "", this.protocol); 50 | if (!symbol) throw new Error(`Missing symbol metadata for provider ${this.name}`); 51 | 52 | this.symbol = symbol; 53 | 54 | await this.sdk.run(); 55 | }; 56 | 57 | loadSdk = () => { 58 | return new BSC(this); 59 | }; 60 | 61 | stop = async () => { 62 | this.sdk.stop(); 63 | }; 64 | 65 | getBuyer = (event: EventData): string | null => { 66 | return event.returnValues.buyer; 67 | }; 68 | 69 | getSeller = (event: EventData): string | null => { 70 | return event.returnValues.seller; 71 | }; 72 | 73 | process = async (event: EventData): Promise => { 74 | const block = await this.sdk.getBlock(event.blockNumber); 75 | const timestamp = moment.unix(block.timestamp).utc(); 76 | const po = await priceSdk.get(this.token || "", this.protocol, block.timestamp); 77 | const nativePrice = new BigNumber(event.returnValues.price).dividedBy(10 ** (this.symbol?.decimals || 0)); 78 | const buyer = this.getBuyer(event); 79 | if (!buyer) { 80 | return; 81 | } 82 | const tokenId = event.returnValues.tokenId; 83 | const seller = this.getSeller(event) || ""; 84 | const nftContract = await this.sdk.callContractMethod("nftContract"); 85 | 86 | const entity: ISaleEntity = { 87 | providerName: this.name, 88 | providerContract: this.contract, 89 | protocol: this.protocol, 90 | nftContract: nftContract.toLowerCase(), 91 | nftId: tokenId, 92 | token: this.token || "", 93 | tokenSymbol: this.symbol?.symbol || "", 94 | amount: 1, 95 | price: nativePrice.toNumber(), 96 | priceUsd: nativePrice.multipliedBy(po.price).toNumber(), 97 | seller: seller.toLowerCase(), 98 | buyer: buyer.toLowerCase(), 99 | soldAt: timestamp.format("YYYY-MM-DD HH:mm:ss"), 100 | blockNumber: event.blockNumber, 101 | transactionHash: event.transactionHash, 102 | }; 103 | return this.addToDatabase(entity); 104 | }; 105 | 106 | addToDatabase = async (entity: ISaleEntity): Promise => { 107 | return entity; 108 | }; 109 | } 110 | 111 | export default BHouseMarket; 112 | -------------------------------------------------------------------------------- /src/adapters/x/index.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | dotenv.config(); 3 | 4 | import moment from "moment"; 5 | import BigNumber from "bignumber.js"; 6 | import Ethereum from "../../sdk/EVMC"; 7 | import path from "path"; 8 | import symbolSdk from "../../sdk/symbol"; 9 | import priceSdk from "../../sdk/price"; 10 | 11 | import { ISaleEntity, ISymbolAPIResponse } from "../../sdk/Interfaces"; 12 | 13 | class X { 14 | name: string; 15 | symbols: Map; 16 | token: string; 17 | protocol: string; 18 | block: number; 19 | contract: string; 20 | events: string[]; 21 | pathToAbi: string | undefined; 22 | range: number; 23 | chunkSize: number; 24 | sdk: any; 25 | 26 | constructor() { 27 | this.name = "x"; 28 | this.symbols = new Map(); 29 | this.protocol = "ethereum"; 30 | this.block = 15127333; 31 | this.contract = "0xb4a2e49818dd8a5cdd818f22ab99263b62ddeb6c"; 32 | this.events = [ 33 | "0xd5a12c8e1b2b15aa8d8e98c670c585319359222157e5a1c959a59de835027b4f", // TakerBid 34 | "0xe1a9e4a1dd601b64511a244940f55fd6e2d1ba8846974ed476a0b6e478327bf8", // TakerAsk 35 | "0x782a08f6e55ce0dc0c0acae21b90c56f026e34f2693c89e7669eafc7a0546e82", // legacy TakerBid 36 | ]; 37 | this.pathToAbi = path.join(__dirname, "./abi.json"); 38 | this.range = 500; 39 | this.chunkSize = 6; 40 | this.sdk = new Ethereum(this); 41 | } 42 | 43 | run = async (): Promise => { 44 | await this.ensureSymbol("0x0000000000000000000000000000000000000000"); 45 | this.sdk = this.loadSdk(); 46 | await this.sdk.run(); 47 | }; 48 | 49 | loadSdk = () => { 50 | return new Ethereum(this); 51 | }; 52 | 53 | stop = async (): Promise => { 54 | this.sdk.stop(); 55 | }; 56 | 57 | ensureSymbol = async (address: string) => { 58 | const symbol = await symbolSdk.get(address, this.protocol); 59 | if (!symbol) throw new Error(`Missing symbol metadata for provider ${this.name}`); 60 | this.symbols.set(address, symbol); 61 | }; 62 | 63 | process = async (event: any): Promise => { 64 | const block = await this.sdk.getBlock(event.blockNumber); 65 | const timestamp = moment.unix(block.timestamp).utc(); 66 | 67 | let buyer = event.returnValues.taker; 68 | let seller = event.returnValues.maker; 69 | if (event.event === "TakerAsk") { 70 | buyer = event.returnValues.maker; 71 | seller = event.returnValues.taker; 72 | } 73 | 74 | const { collection, tokenId, amount, currency, price } = event.returnValues.fulfillment; 75 | await this.ensureSymbol(currency); 76 | const symbol = this.symbols.get(currency)!; 77 | const priceInfo = await priceSdk.get(currency, this.protocol, block.timestamp); 78 | const displayPrice = new BigNumber(price).dividedBy(10 ** (symbol.decimals || 0)); 79 | const priceInUsd = displayPrice.multipliedBy(priceInfo.price); 80 | 81 | const entity: ISaleEntity = { 82 | providerName: this.name, 83 | providerContract: this.contract, 84 | protocol: this.protocol, 85 | nftContract: collection.toLowerCase(), 86 | nftId: tokenId, 87 | token: currency.toLowerCase(), 88 | tokenSymbol: symbol.symbol, 89 | amount: amount, 90 | price: displayPrice.toNumber(), 91 | priceUsd: priceInUsd.toNumber(), 92 | seller: seller.toLowerCase(), 93 | buyer: buyer.toLowerCase(), 94 | soldAt: timestamp.format("YYYY-MM-DD HH:mm:ss"), 95 | blockNumber: event.blockNumber, 96 | transactionHash: event.transactionHash, 97 | }; 98 | 99 | return this.addToDatabase(entity); 100 | }; 101 | 102 | addToDatabase = async (entity: ISaleEntity): Promise => { 103 | return entity; 104 | }; 105 | } 106 | 107 | export default X; 108 | -------------------------------------------------------------------------------- /src/adapters/thetan-arena/index.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | dotenv.config(); 3 | 4 | import path from "path"; 5 | import moment from "moment"; 6 | import BSC from "../../sdk/binance"; 7 | import BigNumber from "bignumber.js"; 8 | import priceSdk from "../../sdk/price"; 9 | import symbolSdk from "../../sdk/symbol"; 10 | import { EventData } from "web3-eth-contract"; 11 | import { BlockTransactionString } from "web3-eth"; 12 | import { ISaleEntity, ISymbolAPIResponse } from "../../sdk/Interfaces"; 13 | 14 | class ThetanArena { 15 | name: string; 16 | symbol: ISymbolAPIResponse | undefined; 17 | token: string; 18 | protocol: string; 19 | block: number; 20 | contract: string; 21 | events: string[]; 22 | pathToAbi: string | undefined; 23 | range: number; 24 | chunkSize: number; 25 | sdk: any; 26 | 27 | constructor() { 28 | this.name = "thetan-arena"; 29 | this.symbol = undefined; 30 | this.token = "0x0000000000000000000000000000000000000000"; 31 | this.protocol = "bsc"; 32 | this.block = 14551809; 33 | this.contract = "0x7bf5d1dec7e36d5b4e9097b48a1b9771e6c96aa4"; 34 | this.events = ["MatchTransaction"]; 35 | this.pathToAbi = path.join(__dirname, "./abi.json"); 36 | this.range = 500; 37 | this.chunkSize = 6; 38 | this.sdk = undefined; 39 | } 40 | 41 | loadSdk = () => { 42 | return new BSC(this); 43 | }; 44 | 45 | run = async () => { 46 | this.sdk = await this.loadSdk(); 47 | await this.sdk.run(); 48 | }; 49 | 50 | stop = async (): Promise => { 51 | this.sdk.stop(); 52 | }; 53 | 54 | _getPrice = async ( 55 | event: EventData, 56 | block: BlockTransactionString, 57 | symbol: ISymbolAPIResponse, 58 | paymentToken: string, 59 | ): Promise<{ price: number | null; priceUsd: number | null }> => { 60 | const po = await priceSdk.get(paymentToken, this.protocol, +block.timestamp); 61 | 62 | if (!symbol?.decimals) { 63 | return { 64 | price: null, 65 | priceUsd: null, 66 | }; 67 | } 68 | 69 | const amount = event.returnValues.price; 70 | const nativePrice = new BigNumber(amount).dividedBy(10 ** (symbol?.decimals || 0)); 71 | 72 | return { 73 | price: nativePrice.toNumber(), 74 | priceUsd: nativePrice.multipliedBy(po.price).toNumber(), 75 | }; 76 | }; 77 | 78 | process = async (event: EventData): Promise => { 79 | const block = await this.sdk.getBlock(event.blockNumber); 80 | const timestamp = moment.unix(block.timestamp).utc(); 81 | 82 | const buyer = event.returnValues.buyer.toLowerCase(); 83 | const seller = event.returnValues.seller.toLowerCase(); 84 | const tokenId = event.returnValues.tokenId; 85 | const nftContract = event.returnValues.contractAddress.toLowerCase(); 86 | const paymentToken = event.returnValues.paymentToken.toLowerCase(); 87 | const symbol = await symbolSdk.get(paymentToken, this.protocol); 88 | 89 | const { price, priceUsd } = await this._getPrice(event, block, symbol, paymentToken); 90 | 91 | const entity = { 92 | providerName: this.name, 93 | providerContract: this.contract, 94 | protocol: this.protocol, 95 | nftContract: nftContract, 96 | nftId: tokenId, 97 | token: paymentToken, 98 | tokenSymbol: symbol?.symbol || "", 99 | amount: 1, 100 | price, 101 | priceUsd: priceUsd, 102 | seller, 103 | buyer, 104 | soldAt: timestamp.format("YYYY-MM-DD HH:mm:ss"), 105 | blockNumber: event.blockNumber, 106 | transactionHash: event.transactionHash, 107 | }; 108 | 109 | await this.addToDatabase(entity); 110 | }; 111 | 112 | addToDatabase = async (entity: ISaleEntity): Promise => { 113 | return entity; 114 | }; 115 | } 116 | 117 | export default ThetanArena; 118 | -------------------------------------------------------------------------------- /src/adapters/rarible-tezos/index.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | dotenv.config(); 3 | 4 | import moment from "moment"; 5 | import BigNumber from "bignumber.js"; 6 | import Tezos from "../../sdk/tezos"; 7 | import symbolSdk from "../../sdk/symbol"; 8 | import priceSdk from "../../sdk/price"; 9 | 10 | import { ISaleEntity, ISymbolAPIResponse, IObjectStringAny } from "../../sdk/Interfaces"; 11 | 12 | const PROTOCOL = "tezos"; 13 | const TOKEN = "xtz"; 14 | 15 | class RaribleTezos { 16 | name: string; 17 | token: string; 18 | protocol: string; 19 | block: number; 20 | contract: string; 21 | event: string; 22 | symbol: ISymbolAPIResponse | undefined; 23 | sdk: any; 24 | 25 | constructor() { 26 | this.name = "rarible-tezos"; 27 | this.token = TOKEN; 28 | this.protocol = PROTOCOL; 29 | this.block = 0; 30 | this.contract = "KT18pVpRXKPY2c4U2yFEGSH3ZnhB2kL8kwXS"; 31 | this.event = "transfer"; 32 | this.sdk = undefined; 33 | } 34 | 35 | run = async (): Promise => { 36 | const symbol = await symbolSdk.get(this.token, this.protocol); 37 | if (!symbol) throw new Error(`Missing symbol metadata for provider ${this.name}`); 38 | this.symbol = symbol; 39 | 40 | this.sdk = await this.loadSdk(); 41 | 42 | await this.sdk.run(); 43 | }; 44 | 45 | stop = async (): Promise => { 46 | this.sdk.stop(); 47 | }; 48 | 49 | loadSdk = (): any => { 50 | return new Tezos(this); 51 | }; 52 | 53 | process = async (call: any) => { 54 | if ("applied" !== call.status) { 55 | return; 56 | } 57 | 58 | const operation = await this.sdk.getOperation(call.hash); 59 | const transfers = operation.filter((o: IObjectStringAny) => o?.parameter?.entrypoint === "do_transfers"); 60 | if (transfers.length === 0) { 61 | return; 62 | // no transfers were made 63 | } 64 | const sorted = operation 65 | .filter((o: IObjectStringAny): boolean => !!o.target) 66 | .sort((a: IObjectStringAny, b: IObjectStringAny): number => +b?.amount - +a?.amount); 67 | const biggest = sorted[0]; 68 | if (+biggest?.amount === 0) { 69 | // no money was transferred 70 | return; 71 | } 72 | if (!biggest?.target) { 73 | return; 74 | } 75 | const timestamp = moment(call.timestamp, "YYYY-MM-DDTHH:mm:ssZ").utc(); 76 | const po = await priceSdk.get(this.token, this.protocol, timestamp.unix()); 77 | const nativePrice = new BigNumber(biggest.amount).dividedBy(10 ** (this.symbol?.decimals || 0)); 78 | 79 | const transferOp = operation.find((o: IObjectStringAny): boolean => { 80 | return o?.parameter?.entrypoint === "transfer" && o?.target?.address === this.contract; 81 | }); 82 | if (!transferOp) { 83 | return; 84 | } 85 | const seller = transferOp.parameter.value[0].address; 86 | const buyer = transferOp.initiator.address; 87 | const nft_collection_address = transferOp.target.address; 88 | const nft_id = transferOp.parameter.value[0].list[0].token_id; 89 | 90 | const entity = { 91 | providerName: this.name, 92 | providerContract: this.contract, 93 | nftContract: nft_collection_address, 94 | nftId: nft_id, 95 | token: TOKEN, 96 | tokenSymbol: this.symbol?.symbol || "", 97 | amount: 1, 98 | price: nativePrice.toNumber(), 99 | priceUsd: nativePrice.multipliedBy(po.price).toNumber(), 100 | seller, 101 | buyer, 102 | soldAt: timestamp.format("YYYY-MM-DD HH:mm:ss"), 103 | blockNumber: call.level, 104 | transactionHash: call.hash, 105 | protocol: PROTOCOL, 106 | }; 107 | 108 | await this.addToDatabase(entity); 109 | }; 110 | addToDatabase = async (entity: ISaleEntity): Promise => { 111 | return entity; 112 | }; 113 | } 114 | 115 | export default RaribleTezos; 116 | -------------------------------------------------------------------------------- /src/adapters/ens/index.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | dotenv.config(); 3 | 4 | import moment from "moment"; 5 | import BigNumber from "bignumber.js"; 6 | import Ethereum from "../../sdk/EVMC"; 7 | import path from "path"; 8 | import symbolSdk from "../../sdk/symbol"; 9 | import priceSdk from "../../sdk/price"; 10 | 11 | import { ISaleEntity, ISymbolAPIResponse } from "../../sdk/Interfaces"; 12 | import { EventData } from "web3-eth-contract"; 13 | import { TransactionReceipt } from "web3-core"; 14 | 15 | class ENS { 16 | // stands for Ethereum name service 17 | 18 | name: string; 19 | symbol: ISymbolAPIResponse | undefined; 20 | token: string; 21 | protocol: string; 22 | block: number; 23 | contract: string; 24 | events: string[]; 25 | pathToAbi: string | undefined; 26 | range: number; 27 | chunkSize: number; 28 | sdk: any; 29 | 30 | constructor() { 31 | this.name = "ens"; 32 | this.symbol = undefined; 33 | this.token = "0x0000000000000000000000000000000000000000"; 34 | this.protocol = "ethereum"; 35 | this.block = 12855192; 36 | this.contract = "0x283af0b28c62c092c9727f1ee09c02ca627eb7f5"; 37 | this.events = ["NameRegistered", "NameRenewed"]; 38 | this.pathToAbi = path.join(__dirname, "./abi.json"); 39 | this.range = 500; 40 | this.chunkSize = 6; 41 | this.sdk = new Ethereum(this); 42 | } 43 | 44 | run = async (): Promise => { 45 | const symbol = await symbolSdk.get(this.token, this.protocol); 46 | if (!symbol) throw new Error(`Missing symbol metadata for provider ${this.name}`); 47 | this.symbol = symbol; 48 | 49 | this.sdk = await this.loadSdk(); 50 | 51 | await this.sdk.run(); 52 | }; 53 | 54 | loadSdk = () => { 55 | return new Ethereum(this); 56 | }; 57 | 58 | stop = async (): Promise => { 59 | this.sdk.stop(); 60 | }; 61 | 62 | getBuyer = async (event: EventData): Promise => { 63 | const buyer: string = event.returnValues.owner; 64 | 65 | if (event.event === "NameRenewed") { 66 | const txReceipt: TransactionReceipt | null = await this.sdk.getTransactionReceipt(event.transactionHash); 67 | if (txReceipt === null) { 68 | return null; 69 | } 70 | return txReceipt.from.toLowerCase(); 71 | } 72 | 73 | return buyer.toLowerCase(); 74 | }; 75 | 76 | process = async (event: any): Promise => { 77 | const block = await this.sdk.getBlock(event.blockNumber); 78 | const timestamp = moment.unix(block.timestamp).utc(); 79 | const po = await priceSdk.get(this.token, this.protocol, block.timestamp); 80 | const nativePrice = new BigNumber(event.returnValues.cost).dividedBy(10 ** (this.symbol?.decimals || 0)); 81 | const buyer = await this.getBuyer(event); 82 | if (!buyer) { 83 | return; 84 | } 85 | 86 | const labelHash = event.returnValues.label; 87 | const tokenId = new BigNumber(labelHash, 16).toFixed(); 88 | const entity: ISaleEntity = { 89 | providerName: this.name, // the name of the folder 90 | providerContract: this.contract, // the providers contract from which you get data 91 | protocol: this.protocol, 92 | nftContract: this.contract, 93 | nftId: tokenId, 94 | token: this.token, 95 | tokenSymbol: this.symbol?.symbol || "", 96 | amount: 1, 97 | price: nativePrice.toNumber(), 98 | priceUsd: nativePrice.multipliedBy(po.price).toNumber(), 99 | seller: this.contract, // its bought from ens and transfered to the owner 100 | buyer, 101 | soldAt: timestamp.format("YYYY-MM-DD HH:mm:ss"), 102 | blockNumber: event.blockNumber, 103 | transactionHash: event.transactionHash, 104 | }; 105 | 106 | return this.addToDatabase(entity); 107 | }; 108 | 109 | addToDatabase = async (entity: ISaleEntity): Promise => { 110 | return entity; 111 | }; 112 | } 113 | 114 | export default ENS; 115 | -------------------------------------------------------------------------------- /src/adapters/radiocaca/index.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | dotenv.config(); 3 | 4 | import path from "path"; 5 | import moment from "moment"; 6 | import BSC from "../../sdk/binance"; 7 | import BigNumber from "bignumber.js"; 8 | import priceSdk from "../../sdk/price"; 9 | import symbolSdk from "../../sdk/symbol"; 10 | import { EventData } from "web3-eth-contract"; 11 | import { BlockTransactionString } from "web3-eth"; 12 | import { ISaleEntity, ISymbolAPIResponse } from "../../sdk/Interfaces"; 13 | 14 | class RadioCaca { 15 | name: string; 16 | symbol: ISymbolAPIResponse | undefined; 17 | token: string; 18 | protocol: string; 19 | block: number; 20 | contract: string; 21 | events: string[]; 22 | pathToAbi: string | undefined; 23 | range: number; 24 | chunkSize: number; 25 | sdk: any; 26 | 27 | constructor() { 28 | this.name = "radiocaca"; 29 | this.symbol = undefined; 30 | this.token = "0x0000000000000000000000000000000000000000"; 31 | this.protocol = "bsc"; 32 | this.block = 13219620; 33 | this.contract = "0xe97fdca0a3fc76b3046ae496c1502c9d8dfef6fc"; 34 | this.events = ["AuctionExecuted"]; 35 | this.pathToAbi = path.join(__dirname, "./abi.json"); 36 | this.range = 500; 37 | this.chunkSize = 6; 38 | this.sdk = undefined; 39 | } 40 | 41 | loadSdk = () => { 42 | return new BSC(this); 43 | }; 44 | 45 | run = async () => { 46 | this.sdk = await this.loadSdk(); 47 | await this.sdk.run(); 48 | }; 49 | 50 | stop = async (): Promise => { 51 | this.sdk.stop(); 52 | }; 53 | 54 | _getPrice = async ( 55 | event: EventData, 56 | block: BlockTransactionString, 57 | symbol: ISymbolAPIResponse, 58 | paymentToken: string, 59 | ): Promise<{ price: number | null; priceUsd: number | null }> => { 60 | const po = await priceSdk.get(paymentToken, this.protocol, +block.timestamp); 61 | 62 | if (!symbol?.decimals) { 63 | return { 64 | price: null, 65 | priceUsd: null, 66 | }; 67 | } 68 | 69 | const amount = event.returnValues.bid; 70 | const nativePrice = new BigNumber(amount).dividedBy(10 ** (symbol?.decimals || 0)); 71 | 72 | return { 73 | price: nativePrice.toNumber(), 74 | priceUsd: nativePrice.multipliedBy(po.price).toNumber(), 75 | }; 76 | }; 77 | 78 | process = async (event: EventData): Promise => { 79 | const block = await this.sdk.getBlock(event.blockNumber); 80 | const timestamp = moment.unix(block.timestamp).utc(); 81 | 82 | const auctionInfo = await this.sdk.callContractMethod("auctions", [event.returnValues.auctionId]); 83 | const status = auctionInfo[12]; 84 | 85 | if (status === 0) return; 86 | 87 | const seller = auctionInfo[0]; 88 | const count = auctionInfo[3]; 89 | const paymentToken = auctionInfo[4].toLowerCase(); 90 | const symbol = await symbolSdk.get(paymentToken, this.protocol); 91 | 92 | const buyer = event.returnValues.bidder; 93 | const tokenId = event.returnValues.tokenId; 94 | const nftContract = event.returnValues.nftAddress; 95 | 96 | const { price, priceUsd } = await this._getPrice(event, block, symbol, paymentToken); 97 | 98 | const entity = { 99 | providerName: this.name, 100 | providerContract: this.contract, 101 | protocol: this.protocol, 102 | nftContract: nftContract.toLowerCase(), 103 | nftId: tokenId, 104 | token: paymentToken.toLowerCase(), 105 | tokenSymbol: symbol?.symbol || "", 106 | amount: count, 107 | price, 108 | priceUsd: priceUsd, 109 | seller: seller.toLowerCase(), 110 | buyer: buyer.toLowerCase(), 111 | soldAt: timestamp.format("YYYY-MM-DD HH:mm:ss"), 112 | blockNumber: event.blockNumber, 113 | transactionHash: event.transactionHash, 114 | }; 115 | 116 | await this.addToDatabase(entity); 117 | }; 118 | 119 | addToDatabase = async (entity: ISaleEntity): Promise => { 120 | return entity; 121 | }; 122 | } 123 | 124 | export default RadioCaca; 125 | -------------------------------------------------------------------------------- /src/adapters/bazaar/index.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | 3 | dotenv.config(); 4 | 5 | import path from "path"; 6 | import moment from "moment"; 7 | import BSC from "../../sdk/binance"; 8 | import BigNumber from "bignumber.js"; 9 | import symbolSdk from "../../sdk/symbol"; 10 | import priceSdk from "../../sdk/price"; 11 | 12 | import { ISaleEntity, ISymbolAPIResponse } from "../../sdk/Interfaces"; 13 | import { BlockTransactionString } from "web3-eth"; 14 | import { EventData } from "web3-eth-contract"; 15 | 16 | interface IPricesResponse { 17 | price: number | null; 18 | priceUsd: number | null; 19 | } 20 | 21 | class Bazaar { 22 | name: string; 23 | symbol: ISymbolAPIResponse | undefined; 24 | token: string; 25 | protocol: string; 26 | block: number; 27 | contract: string; 28 | events: string[]; 29 | pathToAbi: string; 30 | range: number; 31 | chunkSize: number; 32 | sdk: any; 33 | 34 | constructor() { 35 | this.name = "bazaar"; 36 | this.token = "0x154a9f9cbd3449ad22fdae23044319d6ef2a1fab"; 37 | this.protocol = "binance-smart-chain"; 38 | this.block = 8114624; 39 | this.contract = "0x90099da42806b21128a094c713347c7885af79e2"; 40 | this.events = ["PurchasedListing"]; 41 | this.pathToAbi = path.join(__dirname, "./abi.json"); 42 | this.range = 500; 43 | this.chunkSize = 6; 44 | this.sdk = undefined; 45 | } 46 | 47 | run = async (): Promise => { 48 | const symbol = await symbolSdk.get(this.token, this.protocol); 49 | if (!symbol) throw new Error(`Missing symbol metadata for provider ${this.name}`); 50 | this.symbol = symbol; 51 | 52 | this.sdk = await this.loadSdk(); 53 | 54 | await this.sdk.run(); 55 | }; 56 | 57 | loadSdk = (): any => { 58 | return new BSC(this); 59 | }; 60 | 61 | stop = async (): Promise => { 62 | this.sdk.stop(); 63 | }; 64 | 65 | getBuyer = async (event: EventData): Promise => { 66 | const buyer = event.returnValues.owner; 67 | 68 | if (event.event === "PurchasedListing") { 69 | const txReceipt = await this.sdk.getTransactionReceipt(event.transactionHash); 70 | if (txReceipt === null) { 71 | return null; 72 | } 73 | return txReceipt.from; 74 | } 75 | 76 | return buyer; 77 | }; 78 | 79 | _getPrice = async (event: EventData, block: BlockTransactionString): Promise => { 80 | if (!this.symbol?.decimals) { 81 | return { price: null, priceUsd: null }; 82 | } 83 | 84 | const po = await priceSdk.get(this.token, this.protocol, +block.timestamp); 85 | const nativePrice = new BigNumber(event.returnValues.price).dividedBy(10 ** (this.symbol?.decimals || 0)); 86 | 87 | return { 88 | price: nativePrice.toNumber(), 89 | priceUsd: nativePrice.multipliedBy(po.price).toNumber(), 90 | }; 91 | }; 92 | 93 | process = async (event: EventData): Promise => { 94 | const block = await this.sdk.getBlock(event.blockNumber); 95 | const timestamp = moment.unix(block.timestamp).utc(); 96 | const buyer = await this.getBuyer(event); 97 | if (!buyer) { 98 | return; 99 | } 100 | 101 | const { price, priceUsd } = await this._getPrice(event, block); 102 | 103 | const tokenId = event.returnValues.nftID; 104 | const entity = { 105 | providerName: this.name, 106 | providerContract: this.contract, 107 | protocol: this.protocol, 108 | nftContract: this.contract, 109 | nftId: tokenId, 110 | token: this.token, 111 | tokenSymbol: this.symbol?.symbol || "", 112 | amount: 1, 113 | price, 114 | priceUsd: priceUsd, 115 | seller: this.contract, 116 | buyer: buyer.toLowerCase(), 117 | soldAt: timestamp.format("YYYY-MM-DD HH:mm:ss"), 118 | blockNumber: event.blockNumber, 119 | transactionHash: event.transactionHash, 120 | }; 121 | 122 | await this.addToDatabase(entity); 123 | }; 124 | 125 | addToDatabase = async (entity: ISaleEntity): Promise => { 126 | return entity; 127 | }; 128 | } 129 | 130 | export default Bazaar; 131 | -------------------------------------------------------------------------------- /src/adapters/cryptopunks2/index.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | 3 | dotenv.config(); 4 | 5 | import moment from "moment"; 6 | import BigNumber from "bignumber.js"; 7 | import Matic from "../../sdk/matic"; 8 | import path from "path"; 9 | import symbolSdk from "../../sdk/symbol"; 10 | import priceSdk from "../../sdk/price"; 11 | 12 | import { ISaleEntity, ISymbolAPIResponse } from "../../sdk/Interfaces"; 13 | import { EventData } from "web3-eth-contract"; 14 | 15 | class CRYPTOPUNKS2 { 16 | name: string; 17 | symbol: ISymbolAPIResponse | undefined; 18 | token: string; 19 | protocol: string; 20 | block: number; 21 | contract: string; 22 | events: string[]; 23 | pathToAbi: string; 24 | range: number; 25 | chunkSize: number; 26 | sdk: any; 27 | 28 | constructor() { 29 | this.name = "cryptopunks2"; 30 | this.token = "matic"; 31 | this.protocol = "polygon"; 32 | this.block = 20346370; 33 | this.contract = "0xc02d332abc7f9e755e2b1eb56f6ae21a7da4b7ad"; 34 | this.events = ["Transfer"]; 35 | this.pathToAbi = path.join(__dirname, "./abi.json"); 36 | this.range = 500; 37 | this.chunkSize = 6; 38 | } 39 | 40 | run = async (): Promise => { 41 | const symbol = await symbolSdk.get(this.token, this.protocol); 42 | if (!symbol) throw new Error(`Missing symbol metadata for provider ${this.name}`); 43 | this.symbol = symbol; 44 | 45 | this.sdk = await this.loadSdk(); 46 | 47 | await this.sdk.run(); 48 | }; 49 | 50 | loadSdk = (): any => { 51 | return new Matic(this); 52 | }; 53 | 54 | stop = async (): Promise => { 55 | this.sdk.stop(); 56 | }; 57 | 58 | getBuyer = async (event: EventData): Promise => { 59 | const buyer = event.returnValues.owner; 60 | if (event.event === "Mint") { 61 | const txReceipt = await this.sdk.getTransactionReceipt(event.transactionHash); 62 | if (txReceipt === null) { 63 | return null; 64 | } 65 | return txReceipt.from; 66 | } 67 | 68 | return buyer; 69 | }; 70 | 71 | process = async (event: EventData): Promise => { 72 | const block = await this.sdk.getBlock(event.blockNumber); 73 | const timestamp = moment.unix(block.timestamp).utc(); 74 | const baseTx = await this.sdk.getTransaction(event.transactionHash); 75 | if (baseTx.value == 0) { 76 | return; // ignore marketing (zero value) mints 77 | } 78 | 79 | const txReceipt = await this.sdk.getTransactionReceipt(event.transactionHash); 80 | 81 | let numberOfTokens = 0; 82 | 83 | for (let i = 0; i < txReceipt.logs.length; i++) { 84 | if (txReceipt.logs[i].topics[0] == "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef") { 85 | numberOfTokens++; 86 | } 87 | } 88 | 89 | const po = await priceSdk.get(this.token, this.protocol, block.timestamp); 90 | let nativePrice = new BigNumber(0); 91 | if (baseTx.value > 0) 92 | nativePrice = new BigNumber(baseTx.value) 93 | .dividedBy(10 ** (this.symbol?.decimals || 0)) 94 | .dividedBy(numberOfTokens); 95 | 96 | const buyer = baseTx.from; 97 | 98 | if (!buyer) { 99 | return; 100 | } 101 | 102 | const tokenId = event.returnValues.tokenId; 103 | const entity = { 104 | providerName: this.name, // the name of the folder 105 | providerContract: this.contract, // the providers contract from which you get data 106 | protocol: this.protocol, 107 | nftContract: this.contract, 108 | nftId: tokenId, 109 | token: this.token, 110 | tokenSymbol: this.symbol?.symbol || "", 111 | amount: 1, 112 | price: nativePrice.toNumber(), 113 | priceUsd: nativePrice.multipliedBy(po.price).toNumber(), 114 | seller: this.contract, 115 | buyer, 116 | soldAt: timestamp.format("YYYY-MM-DD HH:mm:ss"), 117 | blockNumber: event.blockNumber, 118 | transactionHash: event.transactionHash, 119 | }; 120 | 121 | await this.addToDatabase(entity); 122 | }; 123 | 124 | addToDatabase = async (entity: ISaleEntity): Promise => { 125 | return entity; 126 | }; 127 | } 128 | 129 | export default CRYPTOPUNKS2; 130 | -------------------------------------------------------------------------------- /src/adapters/x/abi.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { "indexed": true, "internalType": "address", "name": "taker", "type": "address" }, 6 | { "indexed": true, "internalType": "address", "name": "maker", "type": "address" }, 7 | { "indexed": true, "internalType": "address", "name": "strategy", "type": "address" }, 8 | { "indexed": false, "internalType": "bytes32", "name": "orderHash", "type": "bytes32" }, 9 | { "indexed": false, "internalType": "uint256", "name": "itemIdx", "type": "uint256" }, 10 | { "indexed": false, "internalType": "bytes32", "name": "orderItemHash", "type": "bytes32" }, 11 | { 12 | "components": [ 13 | { "internalType": "address", "name": "collection", "type": "address" }, 14 | { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, 15 | { "internalType": "uint256", "name": "amount", "type": "uint256" }, 16 | { "internalType": "address", "name": "currency", "type": "address" }, 17 | { "internalType": "uint256", "name": "price", "type": "uint256" } 18 | ], 19 | "indexed": false, 20 | "internalType": "struct OrderTypes.Fulfillment", 21 | "name": "fulfillment", 22 | "type": "tuple" 23 | }, 24 | { "indexed": false, "internalType": "bytes32", "name": "marketplace", "type": "bytes32" } 25 | ], 26 | "name": "TakerAsk", 27 | "type": "event" 28 | }, 29 | { 30 | "anonymous": false, 31 | "inputs": [ 32 | { "indexed": true, "internalType": "address", "name": "taker", "type": "address" }, 33 | { "indexed": true, "internalType": "address", "name": "maker", "type": "address" }, 34 | { "indexed": true, "internalType": "address", "name": "strategy", "type": "address" }, 35 | { "indexed": false, "internalType": "bytes32", "name": "orderHash", "type": "bytes32" }, 36 | { "indexed": false, "internalType": "uint256", "name": "itemIdx", "type": "uint256" }, 37 | { "indexed": false, "internalType": "bytes32", "name": "orderItemHash", "type": "bytes32" }, 38 | { 39 | "components": [ 40 | { "internalType": "address", "name": "collection", "type": "address" }, 41 | { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, 42 | { "internalType": "uint256", "name": "amount", "type": "uint256" }, 43 | { "internalType": "address", "name": "currency", "type": "address" }, 44 | { "internalType": "uint256", "name": "price", "type": "uint256" } 45 | ], 46 | "indexed": false, 47 | "internalType": "struct OrderTypes.Fulfillment", 48 | "name": "fulfillment", 49 | "type": "tuple" 50 | }, 51 | { "indexed": false, "internalType": "bytes32", "name": "marketplace", "type": "bytes32" } 52 | ], 53 | "name": "TakerBid", 54 | "type": "event" 55 | }, 56 | { 57 | "anonymous": false, 58 | "inputs": [ 59 | { "indexed": true, "internalType": "address", "name": "taker", "type": "address" }, 60 | { "indexed": true, "internalType": "address", "name": "maker", "type": "address" }, 61 | { "indexed": true, "internalType": "address", "name": "strategy", "type": "address" }, 62 | { "indexed": false, "internalType": "bytes32", "name": "orderHash", "type": "bytes32" }, 63 | { "indexed": false, "internalType": "uint256", "name": "itemIdx", "type": "uint256" }, 64 | { "indexed": false, "internalType": "bytes32", "name": "orderItemHash", "type": "bytes32" }, 65 | { 66 | "components": [ 67 | { "internalType": "address", "name": "collection", "type": "address" }, 68 | { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, 69 | { "internalType": "uint256", "name": "amount", "type": "uint256" }, 70 | { "internalType": "address", "name": "currency", "type": "address" }, 71 | { "internalType": "uint256", "name": "price", "type": "uint256" } 72 | ], 73 | "indexed": false, 74 | "internalType": "struct OrderTypes.Fulfillment", 75 | "name": "fulfillment", 76 | "type": "tuple" 77 | } 78 | ], 79 | "name": "TakerBid", 80 | "type": "event" 81 | } 82 | ] 83 | -------------------------------------------------------------------------------- /src/adapters/galler-bsc/index.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | dotenv.config(); 3 | 4 | import moment from "moment"; 5 | import BigNumber from "bignumber.js"; 6 | import BSC from "../../sdk/binance"; 7 | import { AVAILABLE_PROTOCOLS } from "../../sdk/constants"; 8 | import path from "path"; 9 | import symbolSdk from "../../sdk/symbol"; 10 | import priceSdk from "../../sdk/price"; 11 | 12 | import { ISaleEntity, ISymbolAPIResponse, IObjectStringAny } from "../../sdk/Interfaces"; 13 | import { EventData } from "web3-eth-contract"; 14 | 15 | class GallerBSC { 16 | name: string; 17 | token: string; 18 | protocol: string; 19 | block: number; 20 | contract: string; 21 | events: string[]; 22 | symbol: ISymbolAPIResponse | undefined; 23 | pathToAbi: string | undefined; 24 | sdk: any; 25 | 26 | constructor() { 27 | this.name = "galler-bsc"; 28 | this.token = "bnb"; 29 | this.protocol = AVAILABLE_PROTOCOLS.BSC; 30 | this.block = 14444440; 31 | this.pathToAbi = path.join(__dirname, "../galler/abi.json"); 32 | this.contract = "0xb50a86874394f75d9388dd5bc47705145110d9a5"; 33 | this.events = ["OrdersMatched"]; 34 | this.sdk = new BSC(this); 35 | } 36 | 37 | run = async (): Promise => { 38 | const symbol = await symbolSdk.get(this.token, this.protocol); 39 | if (!symbol) throw new Error(`Missing symbol metadata for provider ${this.name}`); 40 | this.symbol = symbol; 41 | 42 | this.sdk = await this.loadSdk(); 43 | 44 | await this.sdk.run(); 45 | }; 46 | 47 | stop = async (): Promise => { 48 | this.sdk.stop(); 49 | }; 50 | 51 | loadSdk = (): any => { 52 | return new BSC(this); 53 | }; 54 | 55 | getNftContractAndId = async (event: EventData): Promise<[string | null, string | null]> => { 56 | const txReceipt = await this.sdk.getTransactionReceipt(event.transactionHash); 57 | 58 | const buyer = event.returnValues.secondMaker.toLowerCase(); 59 | const seller = event.returnValues.firstMaker.toLowerCase(); 60 | 61 | if (txReceipt === null) { 62 | return [null, null]; 63 | } 64 | const logs = txReceipt.logs; 65 | for (let i = 0; i < logs.length; i++) { 66 | const topics = logs[i].topics; 67 | if ( 68 | topics[0] === "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" && 69 | this.sdk.hexToAddress(topics[1]) === seller.toLowerCase() && 70 | this.sdk.hexToAddress(topics[2]) === buyer.toLowerCase() 71 | ) { 72 | const nftContract = logs[i].address.toLowerCase(); 73 | const tokenIdHex = topics[3]; 74 | const tokenId = parseInt(tokenIdHex, 16); 75 | return [nftContract, tokenId.toString()]; 76 | } 77 | } 78 | 79 | return [null, null]; 80 | }; 81 | 82 | process = async (event: any): Promise => { 83 | const block = await this.sdk.getBlock(event.blockNumber); 84 | const timestamp = moment.unix(block.timestamp).utc(); 85 | const po = await priceSdk.get(this.token, this.protocol, block.timestamp); 86 | const nativePrice = new BigNumber(event.returnValues.newSecondFill).dividedBy( 87 | 10 ** (this.symbol?.decimals || 0), 88 | ); 89 | const amount = event.returnValues.newFirstFill; 90 | const buyer = event.returnValues.secondMaker.toLowerCase(); 91 | const seller = event.returnValues.firstMaker.toLowerCase(); 92 | 93 | const [nftCollectionAddress, nftId] = await this.getNftContractAndId(event); 94 | 95 | const entity: ISaleEntity = { 96 | providerName: this.name, 97 | providerContract: this.contract, 98 | nftContract: nftCollectionAddress || "", 99 | nftId: nftId || "", 100 | token: this.token, 101 | tokenSymbol: this.symbol?.symbol || "", 102 | amount, 103 | price: nativePrice.toNumber(), 104 | priceUsd: nativePrice.multipliedBy(po.price).toNumber(), 105 | seller, 106 | buyer, 107 | soldAt: timestamp.format("YYYY-MM-DD HH:mm:ss"), 108 | blockNumber: event.blockNumber, 109 | transactionHash: event.transactionHash, 110 | protocol: AVAILABLE_PROTOCOLS.BSC, 111 | }; 112 | 113 | return this.addToDatabase(entity); 114 | }; 115 | addToDatabase = async (entity: ISaleEntity): Promise => { 116 | return entity; 117 | }; 118 | } 119 | 120 | export default GallerBSC; 121 | -------------------------------------------------------------------------------- /src/adapters/galler/index.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | dotenv.config(); 3 | 4 | import moment from "moment"; 5 | import BigNumber from "bignumber.js"; 6 | import Ethereum from "../../sdk/EVMC"; 7 | import { AVAILABLE_PROTOCOLS } from "../../sdk/constants"; 8 | import path from "path"; 9 | import symbolSdk from "../../sdk/symbol"; 10 | import priceSdk from "../../sdk/price"; 11 | 12 | import { ISaleEntity, ISymbolAPIResponse, IObjectStringAny } from "../../sdk/Interfaces"; 13 | import { EventData } from "web3-eth-contract"; 14 | import EVMC from "../../sdk/EVMC"; 15 | 16 | class Galler { 17 | name: string; 18 | token: string; 19 | protocol: string; 20 | block: number; 21 | contract: string; 22 | events: string[]; 23 | symbol: ISymbolAPIResponse | undefined; 24 | pathToAbi: string | undefined; 25 | sdk: any; 26 | 27 | constructor() { 28 | this.name = "galler"; 29 | this.token = "eth"; 30 | this.protocol = AVAILABLE_PROTOCOLS.ETH; 31 | this.block = 14079071; 32 | this.pathToAbi = path.join(__dirname, "./abi.json"); 33 | this.contract = "0xe9fcdb934cfa605e149482d21b330b022ca12e48"; 34 | this.events = ["OrdersMatched"]; 35 | this.sdk = new Ethereum(this); 36 | } 37 | 38 | run = async (): Promise => { 39 | const symbol = await symbolSdk.get(this.token, this.protocol); 40 | if (!symbol) throw new Error(`Missing symbol metadata for provider ${this.name}`); 41 | this.symbol = symbol; 42 | 43 | this.sdk = await this.loadSdk(); 44 | 45 | await this.sdk.run(); 46 | }; 47 | 48 | stop = async (): Promise => { 49 | this.sdk.stop(); 50 | }; 51 | 52 | loadSdk = (): any => { 53 | return new Ethereum(this); 54 | }; 55 | 56 | getNftContractAndId = async (event: EventData): Promise<[string | null, string | null]> => { 57 | const txReceipt = await this.sdk.getTransactionReceipt(event.transactionHash); 58 | 59 | const buyer = event.returnValues.secondMaker.toLowerCase(); 60 | const seller = event.returnValues.firstMaker.toLowerCase(); 61 | 62 | if (txReceipt === null) { 63 | return [null, null]; 64 | } 65 | const logs = txReceipt.logs; 66 | for (let i = 0; i < logs.length; i++) { 67 | const topics = logs[i].topics; 68 | if ( 69 | topics[0] === "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" && 70 | this.sdk.hexToAddress(topics[1]) === seller.toLowerCase() && 71 | this.sdk.hexToAddress(topics[2]) === buyer.toLowerCase() 72 | ) { 73 | const nftContract = logs[i].address.toLowerCase(); 74 | const tokenIdHex = topics[3]; 75 | const tokenId = parseInt(tokenIdHex, 16); 76 | return [nftContract, tokenId.toString()]; 77 | } 78 | } 79 | 80 | return [null, null]; 81 | }; 82 | 83 | process = async (event: any): Promise => { 84 | const block = await this.sdk.getBlock(event.blockNumber); 85 | const timestamp = moment.unix(block.timestamp).utc(); 86 | const po = await priceSdk.get(this.token, this.protocol, block.timestamp); 87 | const nativePrice = new BigNumber(event.returnValues.newSecondFill).dividedBy( 88 | 10 ** (this.symbol?.decimals || 0), 89 | ); 90 | const amount = event.returnValues.newFirstFill; 91 | const buyer = event.returnValues.secondMaker.toLowerCase(); 92 | const seller = event.returnValues.firstMaker.toLowerCase(); 93 | 94 | const [nftCollectionAddress, nftId] = await this.getNftContractAndId(event); 95 | 96 | const entity: ISaleEntity = { 97 | providerName: this.name, 98 | providerContract: this.contract, 99 | nftContract: nftCollectionAddress || "", 100 | nftId: nftId || "", 101 | token: this.token, 102 | tokenSymbol: this.symbol?.symbol || "", 103 | amount, 104 | price: nativePrice.toNumber(), 105 | priceUsd: nativePrice.multipliedBy(po.price).toNumber(), 106 | seller, 107 | buyer, 108 | soldAt: timestamp.format("YYYY-MM-DD HH:mm:ss"), 109 | blockNumber: event.blockNumber, 110 | transactionHash: event.transactionHash, 111 | protocol: AVAILABLE_PROTOCOLS.ETH, 112 | }; 113 | 114 | return this.addToDatabase(entity); 115 | }; 116 | addToDatabase = async (entity: ISaleEntity): Promise => { 117 | return entity; 118 | }; 119 | } 120 | 121 | export default Galler; 122 | -------------------------------------------------------------------------------- /src/sdk/tezos.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | dotenv.config(); 3 | 4 | import axios from "axios"; 5 | import { asyncTimeout } from "./util"; 6 | import { HTTP_PROXY_URL, API_KEY, AVAILABLE_PROTOCOLS } from "./constants"; 7 | import _ from "lodash"; 8 | import BasicSDK from "./basic-sdk"; 9 | 10 | import { IDappRadarAPIHeaders } from "./Interfaces"; 11 | 12 | interface IAlias { 13 | alias?: string; 14 | address: string; 15 | } 16 | 17 | interface ITransactionParameter { 18 | entrypoint: string; 19 | value: { 20 | [key: string]: any; 21 | }; 22 | } 23 | 24 | interface IBigMapKeyShort { 25 | hash: string; 26 | key: { 27 | [key: string | number]: any; 28 | }; 29 | value: { 30 | [key: string | number]: any; 31 | }; 32 | } 33 | 34 | interface IBigMapDiff { 35 | bigmap: string; 36 | path: string; 37 | action: string; 38 | content?: IBigMapKeyShort; 39 | } 40 | 41 | interface IOperation { 42 | type?: string; 43 | id: number; 44 | level: number; 45 | timestamp: string; 46 | block: string; 47 | hash: string; 48 | counter: number; 49 | initiator: IAlias; 50 | sender: IAlias; 51 | nonce?: number; 52 | gasLimit: number; 53 | gasUsed: number; 54 | storageLimit: number; 55 | storageUsed: number; 56 | bakerFee: number; 57 | storageFee: number; 58 | allocationFee: number; 59 | target: IAlias; 60 | amount: number; 61 | parameter: ITransactionParameter; 62 | storage?: { 63 | [key: string]: any; 64 | }; 65 | diffs?: IBigMapDiff[]; 66 | status: string; 67 | errors: { [key: string]: any }[]; 68 | hasInternals: boolean; 69 | tokenTransfersCount?: number; 70 | } 71 | 72 | const headers: IDappRadarAPIHeaders = { 73 | key: API_KEY, 74 | protocol: AVAILABLE_PROTOCOLS.TEZOS, 75 | "content-type": "application/json", 76 | }; 77 | 78 | class Tezos extends BasicSDK { 79 | provider: any; 80 | range: number; 81 | chunkSize: number; 82 | 83 | constructor(provider: any) { 84 | super(provider); 85 | 86 | this.range = 500; // Maximum amount that API can handle is 500 87 | this.chunkSize = 10; 88 | } 89 | 90 | run = async (): Promise => { 91 | await this.calls(); 92 | }; 93 | 94 | stop = (): void => { 95 | this.running = false; 96 | }; 97 | 98 | calls = async (): Promise => { 99 | while (this.running) { 100 | const calls = await this.getCalls(0); 101 | const chunks = _.chunk(calls, this.chunkSize); 102 | for (const chunk in chunks) { 103 | if (!this.running) { 104 | return; 105 | } 106 | const promises = []; 107 | for (const call of chunks[chunk]) { 108 | promises.push(this.provider.process(call, 0)); 109 | } 110 | 111 | await Promise.all(promises); 112 | } 113 | 114 | if (calls.length < this.range) { 115 | await asyncTimeout(60); 116 | } 117 | } 118 | }; 119 | 120 | getCalls = async (offset: number): Promise => { 121 | const callback = async (): Promise => { 122 | const url = `${HTTP_PROXY_URL}/operations/transactions`; 123 | 124 | const config = { 125 | params: { 126 | target: this.provider.contract, 127 | entrypoint: this.provider.event, 128 | limit: this.range, 129 | offset, 130 | }, 131 | headers, 132 | }; 133 | 134 | const response = await axios.get(url, config); 135 | 136 | return response.data; 137 | }; 138 | 139 | return this.retry({ 140 | callback, 141 | customParams: { 142 | contract: this.provider.contract, 143 | event: this.provider.event, 144 | range: this.range, 145 | offset, 146 | }, 147 | }); 148 | }; 149 | 150 | getOperation = async (hash: string): Promise => { 151 | const callback = async (): Promise => { 152 | const url = `${HTTP_PROXY_URL}/operations/${hash}`; 153 | const config = { headers }; 154 | 155 | const response = await axios.get(url, config); 156 | 157 | return response.data; 158 | }; 159 | 160 | return this.retry({ 161 | callback, 162 | customParams: { 163 | transactionHash: hash, 164 | }, 165 | }); 166 | }; 167 | } 168 | 169 | export default Tezos; 170 | -------------------------------------------------------------------------------- /src/adapters/golom/index.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | dotenv.config(); 3 | 4 | import moment from "moment"; 5 | import BigNumber from "bignumber.js"; 6 | import Ethereum from "../../sdk/EVMC"; 7 | import path from "path"; 8 | import symbolSdk from "../../sdk/symbol"; 9 | import priceSdk from "../../sdk/price"; 10 | 11 | import { ISaleEntity, ISymbolAPIResponse } from "../../sdk/Interfaces"; 12 | import { EventData } from "web3-eth-contract"; 13 | 14 | class GOLOM { 15 | name: string; 16 | symbol: ISymbolAPIResponse | undefined; 17 | token: string; 18 | protocol: string; 19 | block: number; 20 | contract: string; 21 | events: string[]; 22 | pathToAbi: string | undefined; 23 | range: number; 24 | chunkSize: number; 25 | sdk: any; 26 | 27 | constructor() { 28 | this.name = "golom"; 29 | this.symbol = undefined; 30 | this.token = "eth"; 31 | this.protocol = "ethereum"; 32 | this.block = 14880514; 33 | this.contract = "0xd29e1fcb07e55eaceb122c63f8e50441c6acedc9"; 34 | this.events = ["OrderFilled"]; 35 | this.pathToAbi = path.join(__dirname, "./abi.json"); 36 | this.range = 500; 37 | this.chunkSize = 6; 38 | this.sdk = new Ethereum(this); 39 | } 40 | 41 | run = async (): Promise => { 42 | const symbol = await symbolSdk.get(this.token, this.protocol); 43 | if (!symbol) throw new Error(`Missing symbol metadata for provider ${this.name}`); 44 | this.symbol = symbol; 45 | 46 | this.sdk = await this.loadSdk(); 47 | 48 | await this.sdk.run(); 49 | }; 50 | 51 | loadSdk = () => { 52 | return new Ethereum(this); 53 | }; 54 | 55 | stop = async (): Promise => { 56 | this.sdk.stop(); 57 | }; 58 | 59 | getNftId = async (event: EventData): Promise => { 60 | const txReceipt = await this.sdk.getTransactionReceipt(event.transactionHash); 61 | if (txReceipt === null) { 62 | return null; 63 | } 64 | const logs = txReceipt.logs; 65 | for (let i = 0; i < logs.length; i++) { 66 | const topics = logs[i].topics; 67 | if ( 68 | topics[0] === "0x5ff9e72404463058acdc1a7367b634d29a9c3c5aa4d41dddf6321b586afb5aed" && 69 | topics.length == 4 70 | ) { 71 | const transfer_topic = logs[i - 1].topics; 72 | const nftContract = logs[i - 1].address.toLowerCase(); 73 | const tokenidhex = transfer_topic[3]; 74 | const tokenId = parseInt(tokenidhex, 16); 75 | return tokenId.toString() + "_" + nftContract; 76 | } 77 | } 78 | 79 | return null; 80 | }; 81 | 82 | process = async (event: any): Promise => { 83 | const block = await this.sdk.getBlock(event.blockNumber); 84 | const timestamp = moment.unix(block.timestamp).utc(); 85 | const po = await priceSdk.get(this.token, this.protocol, block.timestamp); 86 | const nativePrice = new BigNumber(event.returnValues.price).dividedBy(10 ** (this.symbol?.decimals || 0)); 87 | const buyer = event.returnValues.taker.toLowerCase(); 88 | const seller = event.returnValues.maker.toLowerCase(); 89 | const orderType = event.returnValues.orderType; 90 | 91 | const token_symbol = orderType == 0 ? "eth" : "weth"; 92 | const tokenId_nftContract = await this.getNftId(event); 93 | 94 | if (!tokenId_nftContract) { 95 | return; 96 | } 97 | const split_data = tokenId_nftContract.split("_"); 98 | const tokenId = split_data[0]; 99 | const nftContract = split_data[1]; 100 | const entity: ISaleEntity = { 101 | providerName: this.name, // the name of the folder 102 | providerContract: this.contract, // the providers contract from which you get data 103 | protocol: this.protocol, 104 | nftContract: nftContract, 105 | nftId: tokenId, 106 | token: this.token, 107 | tokenSymbol: token_symbol, 108 | amount: 1, 109 | price: nativePrice.toNumber(), 110 | priceUsd: nativePrice.multipliedBy(po.price).toNumber(), 111 | seller: seller, // its bought from ens and transfered to the owner 112 | buyer, 113 | soldAt: timestamp.format("YYYY-MM-DD HH:mm:ss"), 114 | blockNumber: event.blockNumber, 115 | transactionHash: event.transactionHash, 116 | }; 117 | 118 | return this.addToDatabase(entity); 119 | }; 120 | 121 | addToDatabase = async (entity: ISaleEntity): Promise => { 122 | return entity; 123 | }; 124 | } 125 | 126 | export default GOLOM; 127 | -------------------------------------------------------------------------------- /src/adapters/nftkey-avalanche/index.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | 3 | dotenv.config(); 4 | 5 | import moment from "moment"; 6 | import Avalanche from "../../sdk/avalanche"; 7 | import path from "path"; 8 | import BigNumber from "bignumber.js"; 9 | import symbolSdk from "../../sdk/symbol"; 10 | import priceSdk from "../../sdk/price"; 11 | import { ISaleEntity, ISymbolAPIResponse } from "../../sdk/Interfaces"; 12 | import { BlockTransactionString } from "web3-eth"; 13 | import { EventData } from "web3-eth-contract"; 14 | 15 | class NFTKey { 16 | name: string; 17 | symbol: ISymbolAPIResponse | undefined; 18 | token: string; 19 | protocol: string; 20 | block: number; 21 | contract: string; 22 | events: string[]; 23 | pathToAbi: string | undefined; 24 | range: number; 25 | chunkSize: number; 26 | sdk: any; 27 | 28 | constructor() { 29 | this.name = "nftkey-avalanche"; 30 | this.symbol = undefined; 31 | this.token = "avax"; 32 | this.protocol = "avalanche"; 33 | this.block = 6421617; 34 | this.contract = "0x1a7d6ed890b6c284271ad27e7abe8fb5211d0739"; 35 | this.events = ["TokenBought", "TokenBidAccepted"]; 36 | this.pathToAbi = path.join(__dirname, "./abi.json"); 37 | this.range = 500; 38 | this.chunkSize = 6; 39 | this.sdk = undefined; 40 | } 41 | 42 | run = async (): Promise => { 43 | this.sdk = await this.loadSdk(); 44 | 45 | await this.sdk.run(); 46 | }; 47 | 48 | loadSdk = (): any => { 49 | return new Avalanche(this); 50 | }; 51 | 52 | stop = async (): Promise => { 53 | this.sdk.stop(); 54 | }; 55 | 56 | _getBuyer = (event: EventData): string => { 57 | if (event.event === "TokenBidAccepted") { 58 | return event.returnValues.bid.bidder; 59 | } 60 | return event.returnValues.buyer; 61 | }; 62 | 63 | _getPaymentToken = async (event: EventData): Promise => { 64 | if (event.event === "TokenBidAccepted") { 65 | const paymentTokenCall = await this.sdk.callContractMethod("paymentToken"); 66 | return paymentTokenCall.toLowerCase(); 67 | } 68 | 69 | return "avax"; 70 | }; 71 | 72 | _getPrice = async ( 73 | event: EventData, 74 | block: BlockTransactionString, 75 | symbol: ISymbolAPIResponse, 76 | paymentToken: string, 77 | ): Promise<{ price: number | null; priceUsd: number | null }> => { 78 | if (!symbol?.decimals) { 79 | return { 80 | price: null, 81 | priceUsd: null, 82 | }; 83 | } 84 | 85 | const po = await priceSdk.get(paymentToken, this.protocol, +block.timestamp); 86 | 87 | let value: number; 88 | if (event.event === "TokenBidAccepted") { 89 | value = event.returnValues.bid.value; 90 | } else { 91 | value = event.returnValues.listing.value; 92 | } 93 | const nativePrice = new BigNumber(value).dividedBy(10 ** (symbol?.decimals || 0)); 94 | 95 | return { 96 | price: nativePrice.toNumber(), 97 | priceUsd: nativePrice.multipliedBy(po.price).toNumber(), 98 | }; 99 | }; 100 | 101 | _getSeller = (event: EventData): string => { 102 | if (event.event === "TokenBidAccepted") { 103 | return event.returnValues.seller; 104 | } 105 | return event.returnValues.listing.seller; 106 | }; 107 | 108 | process = async (event: EventData): Promise => { 109 | const block = await this.sdk.getBlock(event.blockNumber); 110 | const timestamp = moment.unix(block.timestamp).utc(); 111 | const buyer = this._getBuyer(event); 112 | if (!buyer) { 113 | return; 114 | } 115 | const paymentToken = await this._getPaymentToken(event); 116 | const symbol = await symbolSdk.get(paymentToken, this.protocol); 117 | const { price, priceUsd } = await this._getPrice(event, block, symbol, paymentToken); 118 | const tokenId = event.returnValues.tokenId; 119 | const seller = this._getSeller(event); 120 | const nftContract = event.returnValues.erc721Address.toLowerCase(); 121 | 122 | const entity = { 123 | providerName: this.name, 124 | providerContract: this.contract, 125 | protocol: this.protocol, 126 | nftContract: nftContract, 127 | nftId: tokenId, 128 | token: this.token, 129 | tokenSymbol: symbol?.symbol || "", 130 | amount: 1, 131 | price, 132 | priceUsd: priceUsd, 133 | seller: seller.toLowerCase(), 134 | buyer: buyer.toLowerCase(), 135 | soldAt: timestamp.format("YYYY-MM-DD HH:mm:ss"), 136 | blockNumber: event.blockNumber, 137 | transactionHash: event.transactionHash, 138 | }; 139 | 140 | await this.addToDatabase(entity); 141 | }; 142 | 143 | addToDatabase = async (entity: ISaleEntity): Promise => { 144 | return entity; 145 | }; 146 | } 147 | 148 | export default NFTKey; 149 | -------------------------------------------------------------------------------- /src/adapters/element/index.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config(); 2 | 3 | const moment = require("moment"); 4 | const BigNumber = require("bignumber.js"); 5 | const Ethereum = require("../../sdk/EVMC"); 6 | const axios = require("axios"); 7 | const URL = "http://nft-sales-service.dappradar.com/open-source"; 8 | const KEY = process.env.DAPPRADAR_API_KEY; 9 | const path = require("path"); 10 | 11 | class ELEMENT { 12 | // stands for Ethereum name service 13 | constructor() { 14 | this.name = "element"; 15 | this.symbol = "ETH"; 16 | this.token = "eth"; 17 | this.protocol = "ethereum"; 18 | this.block = 15080677; 19 | this.contract = "0x20f780a973856b93f63670377900c1d2a50a77c4"; 20 | this.events = [ 21 | "ERC721SellOrderFilled", 22 | "ERC721BuyOrderFilled", 23 | "ERC1155SellOrderFilled", 24 | "ERC1155BuyOrderFilled", 25 | ]; 26 | this.pathToAbi = path.join(__dirname, "./abi.json"); 27 | this.range = 500; 28 | this.chunkSize = 6; 29 | this.sdk = new Ethereum(this); 30 | } 31 | 32 | run = async () => { 33 | const s = await this.getSymbol(); 34 | this.sdk = this.loadSdk(); 35 | this.symbol = s; 36 | await this.sdk.run(); 37 | }; 38 | 39 | loadSdk = () => { 40 | return new Ethereum(this); 41 | }; 42 | getSymbol = async () => { 43 | const resp = await axios.get( 44 | `${URL}/token-metadata?key=${KEY}&token_address=${this.token}&protocol=${this.protocol}`, 45 | { 46 | headers: { 47 | "User-Agent": 48 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4619.141 Safari/537.36", 49 | }, 50 | }, 51 | ); 52 | const symbol = resp.data; 53 | return symbol; 54 | }; 55 | getPrice = async timestamp => { 56 | const resp = await axios.get( 57 | `${URL}/token-price?key=${KEY}&token_address=${this.token}&protocol=${this.protocol}×tamp=${timestamp}`, 58 | { 59 | headers: { 60 | "User-Agent": 61 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4619.141 Safari/537.36", 62 | }, 63 | }, 64 | ); 65 | return resp.data; 66 | }; 67 | stop = async () => { 68 | this.sdk.stop(); 69 | }; 70 | 71 | // getBuyer = async event => { 72 | // const buyer = event.returnValues.owner; 73 | // if (event.event === "NameRenewed") { 74 | // const txReceipt = await this.sdk.getTransactionReceipt(event.transactionHash); 75 | // if (txReceipt === null) { 76 | // return null; 77 | // } 78 | // return txReceipt.from; 79 | // } 80 | // return buyer; 81 | // }; 82 | 83 | process = async event => { 84 | const isER721 = event.event === "ERC721SellOrderFilled" || event.event === "ERC721BuyOrderFilled"; 85 | const isSellOrder = ["ERC721SellOrderFilled", "ERC1155SellOrderFilled"].includes(event.event); 86 | const block = await this.sdk.getBlock(event.blockNumber); 87 | const timestamp = moment.unix(block.timestamp).utc(); 88 | const po = await this.getPrice(block.timestamp); 89 | const amount = isER721 ? 1 : event.returnValues["erc1155FillAmount"]; 90 | const price = isER721 ? event.returnValues["erc20TokenAmount"] : event.returnValues["erc20FillAmount"]; 91 | const nativePrice = new BigNumber(price).dividedBy(10 ** this.symbol.decimals); 92 | const maker = event.returnValues["maker"]; 93 | const taker = event.returnValues["taker"]; 94 | const buyer = isSellOrder ? taker : maker; 95 | const seller = isSellOrder ? maker : taker; 96 | const nft_contract = event.returnValues["erc721Token"] || event.returnValues["erc1155Token"]; 97 | const tokenId = event.returnValues["erc721TokenId"] || event.returnValues["erc1155TokenId"]; 98 | const erc20token = event.returnValues["erc20Token"]; 99 | const token = 100 | erc20token.toLowerCase() === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" 101 | ? "0x0000000000000000000000000000000000000000" 102 | : erc20token; 103 | const entity = { 104 | provider_name: this.name, // the name of the folder 105 | provider_contract: this.contract.toLowerCase(), // the providers contract from which you get data 106 | protocol: this.protocol, 107 | nft_contract: nft_contract.toLowerCase(), 108 | nft_id: tokenId, 109 | token: token.toLowerCase(), 110 | token_symbol: this.symbol.symbol, 111 | amount, 112 | price: nativePrice.toNumber(), 113 | price_usd: nativePrice.multipliedBy(po.price).toNumber(), 114 | seller: seller.toLowerCase(), 115 | buyer: buyer.toLowerCase(), 116 | sold_at: timestamp.format("YYYY-MM-DD HH:mm:ss"), 117 | block_number: event.blockNumber, 118 | transaction_hash: event.transactionHash, 119 | }; 120 | await this.addToDatabase(entity); 121 | }; 122 | 123 | addToDatabase = async entity => { 124 | console.log(`creating sale for ${entity.nft_contract} with id ${entity.nft_id}`); 125 | return entity; 126 | }; 127 | } 128 | 129 | module.exports = ELEMENT; 130 | -------------------------------------------------------------------------------- /src/adapters/bhero-market/abi.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": false, 7 | "internalType": "uint256", 8 | "name": "tokenId", 9 | "type": "uint256" 10 | } 11 | ], 12 | "name": "CancelOrder", 13 | "type": "event" 14 | }, 15 | { 16 | "anonymous": false, 17 | "inputs": [ 18 | { 19 | "indexed": false, 20 | "internalType": "uint256", 21 | "name": "tokenId", 22 | "type": "uint256" 23 | }, 24 | { 25 | "indexed": false, 26 | "internalType": "uint256", 27 | "name": "price", 28 | "type": "uint256" 29 | }, 30 | { 31 | "indexed": false, 32 | "internalType": "uint256", 33 | "name": "tokenDetail", 34 | "type": "uint256" 35 | }, 36 | { 37 | "indexed": false, 38 | "internalType": "address", 39 | "name": "seller", 40 | "type": "address" 41 | } 42 | ], 43 | "name": "CreateOrder", 44 | "type": "event" 45 | }, 46 | { 47 | "anonymous": false, 48 | "inputs": [ 49 | { 50 | "indexed": false, 51 | "internalType": "address", 52 | "name": "account", 53 | "type": "address" 54 | } 55 | ], 56 | "name": "Paused", 57 | "type": "event" 58 | }, 59 | { 60 | "anonymous": false, 61 | "inputs": [ 62 | { 63 | "indexed": false, 64 | "internalType": "uint256", 65 | "name": "tokenId", 66 | "type": "uint256" 67 | }, 68 | { 69 | "indexed": false, 70 | "internalType": "uint256", 71 | "name": "price", 72 | "type": "uint256" 73 | }, 74 | { 75 | "indexed": false, 76 | "internalType": "uint256", 77 | "name": "tokenDetail", 78 | "type": "uint256" 79 | }, 80 | { 81 | "indexed": false, 82 | "internalType": "address", 83 | "name": "seller", 84 | "type": "address" 85 | }, 86 | { 87 | "indexed": false, 88 | "internalType": "address", 89 | "name": "buyer", 90 | "type": "address" 91 | } 92 | ], 93 | "name": "Sold", 94 | "type": "event" 95 | }, 96 | { 97 | "anonymous": false, 98 | "inputs": [ 99 | { 100 | "indexed": false, 101 | "internalType": "address", 102 | "name": "account", 103 | "type": "address" 104 | } 105 | ], 106 | "name": "Unpaused", 107 | "type": "event" 108 | }, 109 | { 110 | "inputs": [], 111 | "name": "bcoinContract", 112 | "outputs": [ 113 | { 114 | "internalType": "contract IBEP20", 115 | "name": "", 116 | "type": "address" 117 | } 118 | ], 119 | "stateMutability": "view", 120 | "type": "function" 121 | }, 122 | { 123 | "inputs": [], 124 | "name": "cooldownBeforeCancel", 125 | "outputs": [ 126 | { 127 | "internalType": "uint256", 128 | "name": "", 129 | "type": "uint256" 130 | } 131 | ], 132 | "stateMutability": "view", 133 | "type": "function" 134 | }, 135 | { 136 | "inputs": [], 137 | "name": "cooldownByBlockNumber", 138 | "outputs": [ 139 | { 140 | "internalType": "uint256", 141 | "name": "", 142 | "type": "uint256" 143 | } 144 | ], 145 | "stateMutability": "view", 146 | "type": "function" 147 | }, 148 | { 149 | "inputs": [], 150 | "name": "nftContract", 151 | "outputs": [ 152 | { 153 | "internalType": "contract IERC721", 154 | "name": "", 155 | "type": "address" 156 | } 157 | ], 158 | "stateMutability": "view", 159 | "type": "function" 160 | }, 161 | { 162 | "inputs": [], 163 | "name": "owner", 164 | "outputs": [ 165 | { 166 | "internalType": "address", 167 | "name": "", 168 | "type": "address" 169 | } 170 | ], 171 | "stateMutability": "view", 172 | "type": "function" 173 | }, 174 | { 175 | "inputs": [], 176 | "name": "paused", 177 | "outputs": [ 178 | { 179 | "internalType": "bool", 180 | "name": "", 181 | "type": "bool" 182 | } 183 | ], 184 | "stateMutability": "view", 185 | "type": "function" 186 | }, 187 | { 188 | "inputs": [], 189 | "name": "taxRate", 190 | "outputs": [ 191 | { 192 | "internalType": "uint256", 193 | "name": "", 194 | "type": "uint256" 195 | } 196 | ], 197 | "stateMutability": "view", 198 | "type": "function" 199 | }, 200 | { 201 | "inputs": [ 202 | { 203 | "internalType": "address", 204 | "name": "newOwner", 205 | "type": "address" 206 | } 207 | ], 208 | "name": "transferOwnership", 209 | "outputs": [], 210 | "stateMutability": "nonpayable", 211 | "type": "function" 212 | }, 213 | { 214 | "inputs": [ 215 | { 216 | "internalType": "address", 217 | "name": "bcoinCA_", 218 | "type": "address" 219 | }, 220 | { 221 | "internalType": "address", 222 | "name": "nftCA_", 223 | "type": "address" 224 | } 225 | ], 226 | "name": "initialize", 227 | "outputs": [], 228 | "stateMutability": "nonpayable", 229 | "type": "function" 230 | }, 231 | { 232 | "inputs": [], 233 | "name": "withdrawBalance", 234 | "outputs": [], 235 | "stateMutability": "nonpayable", 236 | "type": "function" 237 | }, 238 | { 239 | "inputs": [ 240 | { 241 | "internalType": "uint256", 242 | "name": "taxRate_", 243 | "type": "uint256" 244 | }, 245 | { 246 | "internalType": "uint256", 247 | "name": "cooldownBeforeCancel_", 248 | "type": "uint256" 249 | } 250 | ], 251 | "name": "changeSettings", 252 | "outputs": [], 253 | "stateMutability": "nonpayable", 254 | "type": "function" 255 | }, 256 | { 257 | "inputs": [], 258 | "name": "getBalance", 259 | "outputs": [ 260 | { 261 | "internalType": "uint256", 262 | "name": "", 263 | "type": "uint256" 264 | } 265 | ], 266 | "stateMutability": "view", 267 | "type": "function" 268 | }, 269 | { 270 | "inputs": [ 271 | { 272 | "internalType": "uint256", 273 | "name": "_tokenId", 274 | "type": "uint256" 275 | }, 276 | { 277 | "internalType": "uint256", 278 | "name": "_price", 279 | "type": "uint256" 280 | } 281 | ], 282 | "name": "createOrder", 283 | "outputs": [], 284 | "stateMutability": "nonpayable", 285 | "type": "function" 286 | }, 287 | { 288 | "inputs": [ 289 | { 290 | "internalType": "uint256", 291 | "name": "_tokenId", 292 | "type": "uint256" 293 | }, 294 | { 295 | "internalType": "uint256", 296 | "name": "_price", 297 | "type": "uint256" 298 | } 299 | ], 300 | "name": "buy", 301 | "outputs": [], 302 | "stateMutability": "nonpayable", 303 | "type": "function" 304 | }, 305 | { 306 | "inputs": [ 307 | { 308 | "internalType": "uint256", 309 | "name": "_tokenId", 310 | "type": "uint256" 311 | } 312 | ], 313 | "name": "cancelOrder", 314 | "outputs": [], 315 | "stateMutability": "nonpayable", 316 | "type": "function" 317 | }, 318 | { 319 | "inputs": [ 320 | { 321 | "internalType": "uint256", 322 | "name": "_tokenId", 323 | "type": "uint256" 324 | } 325 | ], 326 | "name": "cancelOrderWhenPaused", 327 | "outputs": [], 328 | "stateMutability": "nonpayable", 329 | "type": "function" 330 | }, 331 | { 332 | "inputs": [ 333 | { 334 | "internalType": "uint256", 335 | "name": "_tokenId", 336 | "type": "uint256" 337 | } 338 | ], 339 | "name": "getOrder", 340 | "outputs": [ 341 | { 342 | "internalType": "uint256", 343 | "name": "tokenDetail", 344 | "type": "uint256" 345 | }, 346 | { 347 | "internalType": "address", 348 | "name": "seller", 349 | "type": "address" 350 | }, 351 | { 352 | "internalType": "uint256", 353 | "name": "price", 354 | "type": "uint256" 355 | }, 356 | { 357 | "internalType": "uint256", 358 | "name": "startedAt", 359 | "type": "uint256" 360 | } 361 | ], 362 | "stateMutability": "view", 363 | "type": "function" 364 | }, 365 | { 366 | "inputs": [], 367 | "name": "myVersion", 368 | "outputs": [ 369 | { 370 | "internalType": "uint64", 371 | "name": "ver_", 372 | "type": "uint64" 373 | } 374 | ], 375 | "stateMutability": "pure", 376 | "type": "function" 377 | }, 378 | { 379 | "inputs": [], 380 | "name": "pause", 381 | "outputs": [], 382 | "stateMutability": "nonpayable", 383 | "type": "function" 384 | }, 385 | { 386 | "inputs": [], 387 | "name": "unpause", 388 | "outputs": [], 389 | "stateMutability": "nonpayable", 390 | "type": "function" 391 | }, 392 | { 393 | "inputs": [ 394 | { 395 | "internalType": "uint256", 396 | "name": "_tokenDetails", 397 | "type": "uint256" 398 | }, 399 | { 400 | "internalType": "uint256", 401 | "name": "_price", 402 | "type": "uint256" 403 | } 404 | ], 405 | "name": "isSellable", 406 | "outputs": [ 407 | { 408 | "internalType": "bool", 409 | "name": "", 410 | "type": "bool" 411 | } 412 | ], 413 | "stateMutability": "view", 414 | "type": "function" 415 | }, 416 | { 417 | "inputs": [ 418 | { 419 | "internalType": "uint256", 420 | "name": "_rarity", 421 | "type": "uint256" 422 | }, 423 | { 424 | "internalType": "bool", 425 | "name": "_isSellable", 426 | "type": "bool" 427 | }, 428 | { 429 | "internalType": "uint256", 430 | "name": "_minPrice", 431 | "type": "uint256" 432 | } 433 | ], 434 | "name": "setSellableRule", 435 | "outputs": [], 436 | "stateMutability": "nonpayable", 437 | "type": "function" 438 | }, 439 | { 440 | "inputs": [ 441 | { 442 | "internalType": "address[]", 443 | "name": "_addresses", 444 | "type": "address[]" 445 | } 446 | ], 447 | "name": "addToBacklist", 448 | "outputs": [], 449 | "stateMutability": "nonpayable", 450 | "type": "function" 451 | }, 452 | { 453 | "inputs": [ 454 | { 455 | "internalType": "address[]", 456 | "name": "_addresses", 457 | "type": "address[]" 458 | } 459 | ], 460 | "name": "removeFromBacklist", 461 | "outputs": [], 462 | "stateMutability": "nonpayable", 463 | "type": "function" 464 | }, 465 | { 466 | "inputs": [ 467 | { 468 | "internalType": "address", 469 | "name": "_address", 470 | "type": "address" 471 | } 472 | ], 473 | "name": "isBlacklist", 474 | "outputs": [ 475 | { 476 | "internalType": "bool", 477 | "name": "", 478 | "type": "bool" 479 | } 480 | ], 481 | "stateMutability": "view", 482 | "type": "function" 483 | }, 484 | { 485 | "inputs": [ 486 | { 487 | "internalType": "uint256", 488 | "name": "_new", 489 | "type": "uint256" 490 | } 491 | ], 492 | "name": "setCooldownByBlockNumber", 493 | "outputs": [], 494 | "stateMutability": "nonpayable", 495 | "type": "function" 496 | } 497 | ] -------------------------------------------------------------------------------- /src/adapters/bhouse-market/abi.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": false, 7 | "internalType": "uint256", 8 | "name": "tokenId", 9 | "type": "uint256" 10 | } 11 | ], 12 | "name": "CancelOrder", 13 | "type": "event" 14 | }, 15 | { 16 | "anonymous": false, 17 | "inputs": [ 18 | { 19 | "indexed": false, 20 | "internalType": "uint256", 21 | "name": "tokenId", 22 | "type": "uint256" 23 | }, 24 | { 25 | "indexed": false, 26 | "internalType": "uint256", 27 | "name": "price", 28 | "type": "uint256" 29 | }, 30 | { 31 | "indexed": false, 32 | "internalType": "uint256", 33 | "name": "tokenDetail", 34 | "type": "uint256" 35 | }, 36 | { 37 | "indexed": false, 38 | "internalType": "address", 39 | "name": "seller", 40 | "type": "address" 41 | } 42 | ], 43 | "name": "CreateOrder", 44 | "type": "event" 45 | }, 46 | { 47 | "anonymous": false, 48 | "inputs": [ 49 | { 50 | "indexed": false, 51 | "internalType": "address", 52 | "name": "account", 53 | "type": "address" 54 | } 55 | ], 56 | "name": "Paused", 57 | "type": "event" 58 | }, 59 | { 60 | "anonymous": false, 61 | "inputs": [ 62 | { 63 | "indexed": false, 64 | "internalType": "uint256", 65 | "name": "tokenId", 66 | "type": "uint256" 67 | }, 68 | { 69 | "indexed": false, 70 | "internalType": "uint256", 71 | "name": "price", 72 | "type": "uint256" 73 | }, 74 | { 75 | "indexed": false, 76 | "internalType": "uint256", 77 | "name": "tokenDetail", 78 | "type": "uint256" 79 | }, 80 | { 81 | "indexed": false, 82 | "internalType": "address", 83 | "name": "seller", 84 | "type": "address" 85 | }, 86 | { 87 | "indexed": false, 88 | "internalType": "address", 89 | "name": "buyer", 90 | "type": "address" 91 | } 92 | ], 93 | "name": "Sold", 94 | "type": "event" 95 | }, 96 | { 97 | "anonymous": false, 98 | "inputs": [ 99 | { 100 | "indexed": false, 101 | "internalType": "address", 102 | "name": "account", 103 | "type": "address" 104 | } 105 | ], 106 | "name": "Unpaused", 107 | "type": "event" 108 | }, 109 | { 110 | "inputs": [], 111 | "name": "bcoinContract", 112 | "outputs": [ 113 | { 114 | "internalType": "contract IBEP20", 115 | "name": "", 116 | "type": "address" 117 | } 118 | ], 119 | "stateMutability": "view", 120 | "type": "function" 121 | }, 122 | { 123 | "inputs": [], 124 | "name": "cooldownBeforeCancel", 125 | "outputs": [ 126 | { 127 | "internalType": "uint256", 128 | "name": "", 129 | "type": "uint256" 130 | } 131 | ], 132 | "stateMutability": "view", 133 | "type": "function" 134 | }, 135 | { 136 | "inputs": [], 137 | "name": "cooldownByBlockNumber", 138 | "outputs": [ 139 | { 140 | "internalType": "uint256", 141 | "name": "", 142 | "type": "uint256" 143 | } 144 | ], 145 | "stateMutability": "view", 146 | "type": "function" 147 | }, 148 | { 149 | "inputs": [], 150 | "name": "nftContract", 151 | "outputs": [ 152 | { 153 | "internalType": "contract IERC721", 154 | "name": "", 155 | "type": "address" 156 | } 157 | ], 158 | "stateMutability": "view", 159 | "type": "function" 160 | }, 161 | { 162 | "inputs": [], 163 | "name": "owner", 164 | "outputs": [ 165 | { 166 | "internalType": "address", 167 | "name": "", 168 | "type": "address" 169 | } 170 | ], 171 | "stateMutability": "view", 172 | "type": "function" 173 | }, 174 | { 175 | "inputs": [], 176 | "name": "paused", 177 | "outputs": [ 178 | { 179 | "internalType": "bool", 180 | "name": "", 181 | "type": "bool" 182 | } 183 | ], 184 | "stateMutability": "view", 185 | "type": "function" 186 | }, 187 | { 188 | "inputs": [], 189 | "name": "taxRate", 190 | "outputs": [ 191 | { 192 | "internalType": "uint256", 193 | "name": "", 194 | "type": "uint256" 195 | } 196 | ], 197 | "stateMutability": "view", 198 | "type": "function" 199 | }, 200 | { 201 | "inputs": [ 202 | { 203 | "internalType": "address", 204 | "name": "newOwner", 205 | "type": "address" 206 | } 207 | ], 208 | "name": "transferOwnership", 209 | "outputs": [], 210 | "stateMutability": "nonpayable", 211 | "type": "function" 212 | }, 213 | { 214 | "inputs": [ 215 | { 216 | "internalType": "address", 217 | "name": "bcoinCA_", 218 | "type": "address" 219 | }, 220 | { 221 | "internalType": "address", 222 | "name": "nftCA_", 223 | "type": "address" 224 | } 225 | ], 226 | "name": "initialize", 227 | "outputs": [], 228 | "stateMutability": "nonpayable", 229 | "type": "function" 230 | }, 231 | { 232 | "inputs": [], 233 | "name": "withdrawBalance", 234 | "outputs": [], 235 | "stateMutability": "nonpayable", 236 | "type": "function" 237 | }, 238 | { 239 | "inputs": [ 240 | { 241 | "internalType": "uint256", 242 | "name": "taxRate_", 243 | "type": "uint256" 244 | }, 245 | { 246 | "internalType": "uint256", 247 | "name": "cooldownBeforeCancel_", 248 | "type": "uint256" 249 | } 250 | ], 251 | "name": "changeSettings", 252 | "outputs": [], 253 | "stateMutability": "nonpayable", 254 | "type": "function" 255 | }, 256 | { 257 | "inputs": [], 258 | "name": "getBalance", 259 | "outputs": [ 260 | { 261 | "internalType": "uint256", 262 | "name": "", 263 | "type": "uint256" 264 | } 265 | ], 266 | "stateMutability": "view", 267 | "type": "function" 268 | }, 269 | { 270 | "inputs": [ 271 | { 272 | "internalType": "uint256", 273 | "name": "_tokenId", 274 | "type": "uint256" 275 | }, 276 | { 277 | "internalType": "uint256", 278 | "name": "_price", 279 | "type": "uint256" 280 | } 281 | ], 282 | "name": "createOrder", 283 | "outputs": [], 284 | "stateMutability": "nonpayable", 285 | "type": "function" 286 | }, 287 | { 288 | "inputs": [ 289 | { 290 | "internalType": "uint256", 291 | "name": "_tokenId", 292 | "type": "uint256" 293 | }, 294 | { 295 | "internalType": "uint256", 296 | "name": "_price", 297 | "type": "uint256" 298 | } 299 | ], 300 | "name": "buy", 301 | "outputs": [], 302 | "stateMutability": "nonpayable", 303 | "type": "function" 304 | }, 305 | { 306 | "inputs": [ 307 | { 308 | "internalType": "uint256", 309 | "name": "_tokenId", 310 | "type": "uint256" 311 | } 312 | ], 313 | "name": "cancelOrder", 314 | "outputs": [], 315 | "stateMutability": "nonpayable", 316 | "type": "function" 317 | }, 318 | { 319 | "inputs": [ 320 | { 321 | "internalType": "uint256", 322 | "name": "_tokenId", 323 | "type": "uint256" 324 | } 325 | ], 326 | "name": "cancelOrderWhenPaused", 327 | "outputs": [], 328 | "stateMutability": "nonpayable", 329 | "type": "function" 330 | }, 331 | { 332 | "inputs": [ 333 | { 334 | "internalType": "uint256", 335 | "name": "_tokenId", 336 | "type": "uint256" 337 | } 338 | ], 339 | "name": "getOrder", 340 | "outputs": [ 341 | { 342 | "internalType": "uint256", 343 | "name": "tokenDetail", 344 | "type": "uint256" 345 | }, 346 | { 347 | "internalType": "address", 348 | "name": "seller", 349 | "type": "address" 350 | }, 351 | { 352 | "internalType": "uint256", 353 | "name": "price", 354 | "type": "uint256" 355 | }, 356 | { 357 | "internalType": "uint256", 358 | "name": "startedAt", 359 | "type": "uint256" 360 | } 361 | ], 362 | "stateMutability": "view", 363 | "type": "function" 364 | }, 365 | { 366 | "inputs": [], 367 | "name": "myVersion", 368 | "outputs": [ 369 | { 370 | "internalType": "uint64", 371 | "name": "ver_", 372 | "type": "uint64" 373 | } 374 | ], 375 | "stateMutability": "pure", 376 | "type": "function" 377 | }, 378 | { 379 | "inputs": [], 380 | "name": "pause", 381 | "outputs": [], 382 | "stateMutability": "nonpayable", 383 | "type": "function" 384 | }, 385 | { 386 | "inputs": [], 387 | "name": "unpause", 388 | "outputs": [], 389 | "stateMutability": "nonpayable", 390 | "type": "function" 391 | }, 392 | { 393 | "inputs": [ 394 | { 395 | "internalType": "uint256", 396 | "name": "_tokenDetails", 397 | "type": "uint256" 398 | }, 399 | { 400 | "internalType": "uint256", 401 | "name": "_price", 402 | "type": "uint256" 403 | } 404 | ], 405 | "name": "isSellable", 406 | "outputs": [ 407 | { 408 | "internalType": "bool", 409 | "name": "", 410 | "type": "bool" 411 | } 412 | ], 413 | "stateMutability": "view", 414 | "type": "function" 415 | }, 416 | { 417 | "inputs": [ 418 | { 419 | "internalType": "uint256", 420 | "name": "_rarity", 421 | "type": "uint256" 422 | }, 423 | { 424 | "internalType": "bool", 425 | "name": "_isSellable", 426 | "type": "bool" 427 | }, 428 | { 429 | "internalType": "uint256", 430 | "name": "_minPrice", 431 | "type": "uint256" 432 | } 433 | ], 434 | "name": "setSellableRule", 435 | "outputs": [], 436 | "stateMutability": "nonpayable", 437 | "type": "function" 438 | }, 439 | { 440 | "inputs": [ 441 | { 442 | "internalType": "address[]", 443 | "name": "_addresses", 444 | "type": "address[]" 445 | } 446 | ], 447 | "name": "addToBacklist", 448 | "outputs": [], 449 | "stateMutability": "nonpayable", 450 | "type": "function" 451 | }, 452 | { 453 | "inputs": [ 454 | { 455 | "internalType": "address[]", 456 | "name": "_addresses", 457 | "type": "address[]" 458 | } 459 | ], 460 | "name": "removeFromBacklist", 461 | "outputs": [], 462 | "stateMutability": "nonpayable", 463 | "type": "function" 464 | }, 465 | { 466 | "inputs": [ 467 | { 468 | "internalType": "address", 469 | "name": "_address", 470 | "type": "address" 471 | } 472 | ], 473 | "name": "isBlacklist", 474 | "outputs": [ 475 | { 476 | "internalType": "bool", 477 | "name": "", 478 | "type": "bool" 479 | } 480 | ], 481 | "stateMutability": "view", 482 | "type": "function" 483 | }, 484 | { 485 | "inputs": [ 486 | { 487 | "internalType": "uint256", 488 | "name": "_new", 489 | "type": "uint256" 490 | } 491 | ], 492 | "name": "setCooldownByBlockNumber", 493 | "outputs": [], 494 | "stateMutability": "nonpayable", 495 | "type": "function" 496 | } 497 | ] -------------------------------------------------------------------------------- /src/adapters/ens/abi.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { "internalType": "contract BaseRegistrar", "name": "_base", "type": "address" }, 5 | { "internalType": "contract PriceOracle", "name": "_prices", "type": "address" }, 6 | { "internalType": "uint256", "name": "_minCommitmentAge", "type": "uint256" }, 7 | { "internalType": "uint256", "name": "_maxCommitmentAge", "type": "uint256" } 8 | ], 9 | "payable": false, 10 | "stateMutability": "nonpayable", 11 | "type": "constructor" 12 | }, 13 | { 14 | "anonymous": false, 15 | "inputs": [ 16 | { "indexed": false, "internalType": "string", "name": "name", "type": "string" }, 17 | { "indexed": true, "internalType": "bytes32", "name": "label", "type": "bytes32" }, 18 | { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, 19 | { "indexed": false, "internalType": "uint256", "name": "cost", "type": "uint256" }, 20 | { "indexed": false, "internalType": "uint256", "name": "expires", "type": "uint256" } 21 | ], 22 | "name": "NameRegistered", 23 | "type": "event" 24 | }, 25 | { 26 | "anonymous": false, 27 | "inputs": [ 28 | { "indexed": false, "internalType": "string", "name": "name", "type": "string" }, 29 | { "indexed": true, "internalType": "bytes32", "name": "label", "type": "bytes32" }, 30 | { "indexed": false, "internalType": "uint256", "name": "cost", "type": "uint256" }, 31 | { "indexed": false, "internalType": "uint256", "name": "expires", "type": "uint256" } 32 | ], 33 | "name": "NameRenewed", 34 | "type": "event" 35 | }, 36 | { 37 | "anonymous": false, 38 | "inputs": [{ "indexed": true, "internalType": "address", "name": "oracle", "type": "address" }], 39 | "name": "NewPriceOracle", 40 | "type": "event" 41 | }, 42 | { 43 | "anonymous": false, 44 | "inputs": [ 45 | { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, 46 | { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } 47 | ], 48 | "name": "OwnershipTransferred", 49 | "type": "event" 50 | }, 51 | { 52 | "constant": true, 53 | "inputs": [], 54 | "name": "MIN_REGISTRATION_DURATION", 55 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 56 | "payable": false, 57 | "stateMutability": "view", 58 | "type": "function" 59 | }, 60 | { 61 | "constant": true, 62 | "inputs": [{ "internalType": "string", "name": "name", "type": "string" }], 63 | "name": "available", 64 | "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], 65 | "payable": false, 66 | "stateMutability": "view", 67 | "type": "function" 68 | }, 69 | { 70 | "constant": false, 71 | "inputs": [{ "internalType": "bytes32", "name": "commitment", "type": "bytes32" }], 72 | "name": "commit", 73 | "outputs": [], 74 | "payable": false, 75 | "stateMutability": "nonpayable", 76 | "type": "function" 77 | }, 78 | { 79 | "constant": true, 80 | "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], 81 | "name": "commitments", 82 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 83 | "payable": false, 84 | "stateMutability": "view", 85 | "type": "function" 86 | }, 87 | { 88 | "constant": true, 89 | "inputs": [], 90 | "name": "isOwner", 91 | "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], 92 | "payable": false, 93 | "stateMutability": "view", 94 | "type": "function" 95 | }, 96 | { 97 | "constant": true, 98 | "inputs": [ 99 | { "internalType": "string", "name": "name", "type": "string" }, 100 | { "internalType": "address", "name": "owner", "type": "address" }, 101 | { "internalType": "bytes32", "name": "secret", "type": "bytes32" } 102 | ], 103 | "name": "makeCommitment", 104 | "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], 105 | "payable": false, 106 | "stateMutability": "pure", 107 | "type": "function" 108 | }, 109 | { 110 | "constant": true, 111 | "inputs": [ 112 | { "internalType": "string", "name": "name", "type": "string" }, 113 | { "internalType": "address", "name": "owner", "type": "address" }, 114 | { "internalType": "bytes32", "name": "secret", "type": "bytes32" }, 115 | { "internalType": "address", "name": "resolver", "type": "address" }, 116 | { "internalType": "address", "name": "addr", "type": "address" } 117 | ], 118 | "name": "makeCommitmentWithConfig", 119 | "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], 120 | "payable": false, 121 | "stateMutability": "pure", 122 | "type": "function" 123 | }, 124 | { 125 | "constant": true, 126 | "inputs": [], 127 | "name": "maxCommitmentAge", 128 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 129 | "payable": false, 130 | "stateMutability": "view", 131 | "type": "function" 132 | }, 133 | { 134 | "constant": true, 135 | "inputs": [], 136 | "name": "minCommitmentAge", 137 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 138 | "payable": false, 139 | "stateMutability": "view", 140 | "type": "function" 141 | }, 142 | { 143 | "constant": true, 144 | "inputs": [], 145 | "name": "owner", 146 | "outputs": [{ "internalType": "address", "name": "", "type": "address" }], 147 | "payable": false, 148 | "stateMutability": "view", 149 | "type": "function" 150 | }, 151 | { 152 | "constant": false, 153 | "inputs": [ 154 | { "internalType": "string", "name": "name", "type": "string" }, 155 | { "internalType": "address", "name": "owner", "type": "address" }, 156 | { "internalType": "uint256", "name": "duration", "type": "uint256" }, 157 | { "internalType": "bytes32", "name": "secret", "type": "bytes32" } 158 | ], 159 | "name": "register", 160 | "outputs": [], 161 | "payable": true, 162 | "stateMutability": "payable", 163 | "type": "function" 164 | }, 165 | { 166 | "constant": false, 167 | "inputs": [ 168 | { "internalType": "string", "name": "name", "type": "string" }, 169 | { "internalType": "address", "name": "owner", "type": "address" }, 170 | { "internalType": "uint256", "name": "duration", "type": "uint256" }, 171 | { "internalType": "bytes32", "name": "secret", "type": "bytes32" }, 172 | { "internalType": "address", "name": "resolver", "type": "address" }, 173 | { "internalType": "address", "name": "addr", "type": "address" } 174 | ], 175 | "name": "registerWithConfig", 176 | "outputs": [], 177 | "payable": true, 178 | "stateMutability": "payable", 179 | "type": "function" 180 | }, 181 | { 182 | "constant": false, 183 | "inputs": [ 184 | { "internalType": "string", "name": "name", "type": "string" }, 185 | { "internalType": "uint256", "name": "duration", "type": "uint256" } 186 | ], 187 | "name": "renew", 188 | "outputs": [], 189 | "payable": true, 190 | "stateMutability": "payable", 191 | "type": "function" 192 | }, 193 | { 194 | "constant": false, 195 | "inputs": [], 196 | "name": "renounceOwnership", 197 | "outputs": [], 198 | "payable": false, 199 | "stateMutability": "nonpayable", 200 | "type": "function" 201 | }, 202 | { 203 | "constant": true, 204 | "inputs": [ 205 | { "internalType": "string", "name": "name", "type": "string" }, 206 | { "internalType": "uint256", "name": "duration", "type": "uint256" } 207 | ], 208 | "name": "rentPrice", 209 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 210 | "payable": false, 211 | "stateMutability": "view", 212 | "type": "function" 213 | }, 214 | { 215 | "constant": false, 216 | "inputs": [ 217 | { "internalType": "uint256", "name": "_minCommitmentAge", "type": "uint256" }, 218 | { "internalType": "uint256", "name": "_maxCommitmentAge", "type": "uint256" } 219 | ], 220 | "name": "setCommitmentAges", 221 | "outputs": [], 222 | "payable": false, 223 | "stateMutability": "nonpayable", 224 | "type": "function" 225 | }, 226 | { 227 | "constant": false, 228 | "inputs": [{ "internalType": "contract PriceOracle", "name": "_prices", "type": "address" }], 229 | "name": "setPriceOracle", 230 | "outputs": [], 231 | "payable": false, 232 | "stateMutability": "nonpayable", 233 | "type": "function" 234 | }, 235 | { 236 | "constant": true, 237 | "inputs": [{ "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }], 238 | "name": "supportsInterface", 239 | "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], 240 | "payable": false, 241 | "stateMutability": "pure", 242 | "type": "function" 243 | }, 244 | { 245 | "constant": false, 246 | "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], 247 | "name": "transferOwnership", 248 | "outputs": [], 249 | "payable": false, 250 | "stateMutability": "nonpayable", 251 | "type": "function" 252 | }, 253 | { 254 | "constant": true, 255 | "inputs": [{ "internalType": "string", "name": "name", "type": "string" }], 256 | "name": "valid", 257 | "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], 258 | "payable": false, 259 | "stateMutability": "pure", 260 | "type": "function" 261 | }, 262 | { 263 | "constant": false, 264 | "inputs": [], 265 | "name": "withdraw", 266 | "outputs": [], 267 | "payable": false, 268 | "stateMutability": "nonpayable", 269 | "type": "function" 270 | } 271 | ] 272 | -------------------------------------------------------------------------------- /src/adapters/cryptopunks2/abi.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"address payable","name":"_marketer","type":"address"},{"internalType":"address payable","name":"_developer","type":"address"},{"internalType":"string","name":"_imageHash","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":true,"internalType":"address","name":"minter","type":"address"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"punkIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":true,"internalType":"address","name":"fromAddress","type":"address"}],"name":"PunkBidEntered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"punkIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":true,"internalType":"address","name":"fromAddress","type":"address"}],"name":"PunkBidWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"punkIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":true,"internalType":"address","name":"fromAddress","type":"address"},{"indexed":true,"internalType":"address","name":"toAddress","type":"address"}],"name":"PunkBought","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"punkIndex","type":"uint256"}],"name":"PunkNoLongerForSale","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"punkIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minValue","type":"uint256"},{"indexed":true,"internalType":"address","name":"toAddress","type":"address"}],"name":"PunkOffered","type":"event"},{"anonymous":false,"inputs":[],"name":"SaleBegins","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"TOKEN_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"punkIndex","type":"uint256"},{"internalType":"uint256","name":"minPrice","type":"uint256"}],"name":"acceptBidForPunk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_approved","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"punkIndex","type":"uint256"}],"name":"buyPunk","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"numberOfNfts","type":"uint256"}],"name":"calcMintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"cancelledOffers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractSealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentMarketingMints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"punkIndex","type":"uint256"}],"name":"enterBidForPunk","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"ethBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"imageHash","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"numberOfNfts","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"marketingClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxMarketingMints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"numberOfNfts","type":"uint256"},{"internalType":"address","name":"ref","type":"address"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintsRemaining","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"_name","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"punkIndex","type":"uint256"},{"internalType":"uint256","name":"minSalePriceInWei","type":"uint256"}],"name":"offerPunkForSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"punkIndex","type":"uint256"},{"internalType":"uint256","name":"minSalePriceInWei","type":"uint256"},{"internalType":"address","name":"toAddress","type":"address"}],"name":"offerPunkForSaleToAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"pauseMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"pendingWithdrawals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"punkBids","outputs":[{"internalType":"bool","name":"hasBid","type":"bool"},{"internalType":"uint256","name":"punkIndex","type":"uint256"},{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"punkIndex","type":"uint256"}],"name":"punkNoLongerForSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"punksOfferedForSale","outputs":[{"internalType":"bool","name":"isForSale","type":"bool"},{"internalType":"uint256","name":"punkIndex","type":"uint256"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"uint256","name":"minValue","type":"uint256"},{"internalType":"address","name":"onlySellTo","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"saleStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sealContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"_symbol","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"punkIndex","type":"uint256"}],"name":"withdrawBidForPunk","outputs":[],"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /src/adapters/thetan-arena/abi.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "uint256", 8 | "name": "tokenId", 9 | "type": "uint256" 10 | }, 11 | { 12 | "indexed": false, 13 | "internalType": "address", 14 | "name": "contractAddress", 15 | "type": "address" 16 | }, 17 | { 18 | "indexed": false, 19 | "internalType": "uint256", 20 | "name": "price", 21 | "type": "uint256" 22 | }, 23 | { 24 | "indexed": false, 25 | "internalType": "address", 26 | "name": "paymentToken", 27 | "type": "address" 28 | }, 29 | { 30 | "indexed": false, 31 | "internalType": "address", 32 | "name": "seller", 33 | "type": "address" 34 | }, 35 | { 36 | "indexed": false, 37 | "internalType": "address", 38 | "name": "buyer", 39 | "type": "address" 40 | }, 41 | { 42 | "indexed": false, 43 | "internalType": "uint256", 44 | "name": "fee", 45 | "type": "uint256" 46 | } 47 | ], 48 | "name": "MatchTransaction", 49 | "type": "event" 50 | }, 51 | { 52 | "anonymous": false, 53 | "inputs": [ 54 | { 55 | "indexed": true, 56 | "internalType": "address", 57 | "name": "previousOwner", 58 | "type": "address" 59 | }, 60 | { 61 | "indexed": true, 62 | "internalType": "address", 63 | "name": "newOwner", 64 | "type": "address" 65 | } 66 | ], 67 | "name": "OwnershipTransferred", 68 | "type": "event" 69 | }, 70 | { 71 | "inputs": [], 72 | "name": "feeToAddress", 73 | "outputs": [ 74 | { 75 | "internalType": "address", 76 | "name": "", 77 | "type": "address" 78 | } 79 | ], 80 | "stateMutability": "view", 81 | "type": "function" 82 | }, 83 | { 84 | "inputs": [ 85 | { 86 | "internalType": "bytes32", 87 | "name": "_messageHash", 88 | "type": "bytes32" 89 | } 90 | ], 91 | "name": "getEthSignedMessageHash", 92 | "outputs": [ 93 | { 94 | "internalType": "bytes32", 95 | "name": "", 96 | "type": "bytes32" 97 | } 98 | ], 99 | "stateMutability": "pure", 100 | "type": "function" 101 | }, 102 | { 103 | "inputs": [ 104 | { 105 | "internalType": "address", 106 | "name": "_nftAddress", 107 | "type": "address" 108 | }, 109 | { 110 | "internalType": "uint256", 111 | "name": "_tokenId", 112 | "type": "uint256" 113 | }, 114 | { 115 | "internalType": "address", 116 | "name": "_paymentErc20", 117 | "type": "address" 118 | }, 119 | { 120 | "internalType": "uint256", 121 | "name": "_price", 122 | "type": "uint256" 123 | }, 124 | { 125 | "internalType": "uint256", 126 | "name": "_saltNonce", 127 | "type": "uint256" 128 | } 129 | ], 130 | "name": "getMessageHash", 131 | "outputs": [ 132 | { 133 | "internalType": "bytes32", 134 | "name": "", 135 | "type": "bytes32" 136 | } 137 | ], 138 | "stateMutability": "pure", 139 | "type": "function" 140 | }, 141 | { 142 | "inputs": [ 143 | { 144 | "internalType": "address[2]", 145 | "name": "addresses", 146 | "type": "address[2]" 147 | }, 148 | { 149 | "internalType": "uint256[3]", 150 | "name": "values", 151 | "type": "uint256[3]" 152 | }, 153 | { 154 | "internalType": "bytes", 155 | "name": "signature", 156 | "type": "bytes" 157 | } 158 | ], 159 | "name": "ignoreSignature", 160 | "outputs": [], 161 | "stateMutability": "nonpayable", 162 | "type": "function" 163 | }, 164 | { 165 | "inputs": [ 166 | { 167 | "internalType": "address[3]", 168 | "name": "addresses", 169 | "type": "address[3]" 170 | }, 171 | { 172 | "internalType": "uint256[3]", 173 | "name": "values", 174 | "type": "uint256[3]" 175 | }, 176 | { 177 | "internalType": "bytes", 178 | "name": "signature", 179 | "type": "bytes" 180 | } 181 | ], 182 | "name": "matchTransaction", 183 | "outputs": [ 184 | { 185 | "internalType": "bool", 186 | "name": "", 187 | "type": "bool" 188 | } 189 | ], 190 | "stateMutability": "nonpayable", 191 | "type": "function" 192 | }, 193 | { 194 | "inputs": [], 195 | "name": "owner", 196 | "outputs": [ 197 | { 198 | "internalType": "address", 199 | "name": "", 200 | "type": "address" 201 | } 202 | ], 203 | "stateMutability": "view", 204 | "type": "function" 205 | }, 206 | { 207 | "inputs": [ 208 | { 209 | "internalType": "address", 210 | "name": "", 211 | "type": "address" 212 | } 213 | ], 214 | "name": "paymentTokens", 215 | "outputs": [ 216 | { 217 | "internalType": "bool", 218 | "name": "", 219 | "type": "bool" 220 | } 221 | ], 222 | "stateMutability": "view", 223 | "type": "function" 224 | }, 225 | { 226 | "inputs": [ 227 | { 228 | "internalType": "bytes32", 229 | "name": "_ethSignedMessageHash", 230 | "type": "bytes32" 231 | }, 232 | { 233 | "internalType": "bytes", 234 | "name": "_signature", 235 | "type": "bytes" 236 | } 237 | ], 238 | "name": "recoverSigner", 239 | "outputs": [ 240 | { 241 | "internalType": "address", 242 | "name": "", 243 | "type": "address" 244 | } 245 | ], 246 | "stateMutability": "pure", 247 | "type": "function" 248 | }, 249 | { 250 | "inputs": [ 251 | { 252 | "internalType": "address[]", 253 | "name": "_removedPaymentTokens", 254 | "type": "address[]" 255 | } 256 | ], 257 | "name": "removePaymentTokens", 258 | "outputs": [], 259 | "stateMutability": "nonpayable", 260 | "type": "function" 261 | }, 262 | { 263 | "inputs": [], 264 | "name": "renounceOwnership", 265 | "outputs": [], 266 | "stateMutability": "nonpayable", 267 | "type": "function" 268 | }, 269 | { 270 | "inputs": [ 271 | { 272 | "internalType": "address", 273 | "name": "_feeToAddress", 274 | "type": "address" 275 | } 276 | ], 277 | "name": "setFeeToAddress", 278 | "outputs": [], 279 | "stateMutability": "nonpayable", 280 | "type": "function" 281 | }, 282 | { 283 | "inputs": [ 284 | { 285 | "internalType": "address[]", 286 | "name": "_paymentTokens", 287 | "type": "address[]" 288 | } 289 | ], 290 | "name": "setPaymentTokens", 291 | "outputs": [], 292 | "stateMutability": "nonpayable", 293 | "type": "function" 294 | }, 295 | { 296 | "inputs": [ 297 | { 298 | "internalType": "uint256", 299 | "name": "_transactionFee", 300 | "type": "uint256" 301 | } 302 | ], 303 | "name": "setTransactionFee", 304 | "outputs": [], 305 | "stateMutability": "nonpayable", 306 | "type": "function" 307 | }, 308 | { 309 | "inputs": [ 310 | { 311 | "internalType": "bytes", 312 | "name": "sig", 313 | "type": "bytes" 314 | } 315 | ], 316 | "name": "splitSignature", 317 | "outputs": [ 318 | { 319 | "internalType": "bytes32", 320 | "name": "r", 321 | "type": "bytes32" 322 | }, 323 | { 324 | "internalType": "bytes32", 325 | "name": "s", 326 | "type": "bytes32" 327 | }, 328 | { 329 | "internalType": "uint8", 330 | "name": "v", 331 | "type": "uint8" 332 | } 333 | ], 334 | "stateMutability": "pure", 335 | "type": "function" 336 | }, 337 | { 338 | "inputs": [], 339 | "name": "transactionFee", 340 | "outputs": [ 341 | { 342 | "internalType": "uint256", 343 | "name": "", 344 | "type": "uint256" 345 | } 346 | ], 347 | "stateMutability": "view", 348 | "type": "function" 349 | }, 350 | { 351 | "inputs": [ 352 | { 353 | "internalType": "address", 354 | "name": "newOwner", 355 | "type": "address" 356 | } 357 | ], 358 | "name": "transferOwnership", 359 | "outputs": [], 360 | "stateMutability": "nonpayable", 361 | "type": "function" 362 | }, 363 | { 364 | "inputs": [ 365 | { 366 | "internalType": "bytes", 367 | "name": "", 368 | "type": "bytes" 369 | } 370 | ], 371 | "name": "usedSignatures", 372 | "outputs": [ 373 | { 374 | "internalType": "bool", 375 | "name": "", 376 | "type": "bool" 377 | } 378 | ], 379 | "stateMutability": "view", 380 | "type": "function" 381 | } 382 | ] 383 | -------------------------------------------------------------------------------- /src/adapters/nftkey-avalanche/abi.json: -------------------------------------------------------------------------------- 1 | [{ "inputs": [{ "internalType": "address", "name": "_paymentTokenAddress", "type": "address" }], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "erc721Address", "type": "address" }, { "indexed": true, "internalType": "address", "name": "recipient", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "feeFraction", "type": "uint256" }], "name": "SetRoyalty", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "erc721Address", "type": "address" }, { "indexed": true, "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "seller", "type": "address" }, { "components": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "address", "name": "bidder", "type": "address" }, { "internalType": "uint256", "name": "expireTimestamp", "type": "uint256" }], "indexed": false, "internalType": "struct INFTKEYMarketplaceV2.Bid", "name": "bid", "type": "tuple" }, { "indexed": false, "internalType": "uint256", "name": "serviceFee", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "royaltyFee", "type": "uint256" }], "name": "TokenBidAccepted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "erc721Address", "type": "address" }, { "indexed": true, "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "components": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "address", "name": "bidder", "type": "address" }, { "internalType": "uint256", "name": "expireTimestamp", "type": "uint256" }], "indexed": false, "internalType": "struct INFTKEYMarketplaceV2.Bid", "name": "bid", "type": "tuple" }], "name": "TokenBidEntered", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "erc721Address", "type": "address" }, { "indexed": true, "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "components": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "address", "name": "bidder", "type": "address" }, { "internalType": "uint256", "name": "expireTimestamp", "type": "uint256" }], "indexed": false, "internalType": "struct INFTKEYMarketplaceV2.Bid", "name": "bid", "type": "tuple" }], "name": "TokenBidWithdrawn", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "erc721Address", "type": "address" }, { "indexed": true, "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "buyer", "type": "address" }, { "components": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "address", "name": "seller", "type": "address" }, { "internalType": "uint256", "name": "expireTimestamp", "type": "uint256" }], "indexed": false, "internalType": "struct INFTKEYMarketplaceV2.Listing", "name": "listing", "type": "tuple" }, { "indexed": false, "internalType": "uint256", "name": "serviceFee", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "royaltyFee", "type": "uint256" }], "name": "TokenBought", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "erc721Address", "type": "address" }, { "indexed": true, "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "components": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "address", "name": "seller", "type": "address" }, { "internalType": "uint256", "name": "expireTimestamp", "type": "uint256" }], "indexed": false, "internalType": "struct INFTKEYMarketplaceV2.Listing", "name": "listing", "type": "tuple" }], "name": "TokenDelisted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "erc721Address", "type": "address" }, { "indexed": true, "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "components": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "address", "name": "seller", "type": "address" }, { "internalType": "uint256", "name": "expireTimestamp", "type": "uint256" }], "indexed": false, "internalType": "struct INFTKEYMarketplaceV2.Listing", "name": "listing", "type": "tuple" }], "name": "TokenListed", "type": "event" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }, { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "address", "name": "bidder", "type": "address" }, { "internalType": "uint256", "name": "value", "type": "uint256" }], "name": "acceptBidForToken", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "actionTimeOutRangeMax", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "actionTimeOutRangeMin", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }, { "internalType": "uint256", "name": "tokenId", "type": "uint256" }], "name": "buyToken", "outputs": [], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "bool", "name": "enabled", "type": "bool" }], "name": "changeMarketplaceStatus", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "timeInSec", "type": "uint256" }], "name": "changeMaxActionTimeLimit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "timeInSec", "type": "uint256" }], "name": "changeMinActionTimeLimit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint8", "name": "serviceFeeFraction_", "type": "uint8" }], "name": "changeSeriveFee", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "defaultRoyaltyFraction", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }, { "internalType": "uint256", "name": "tokenId", "type": "uint256" }], "name": "delistToken", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }, { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "uint256", "name": "expireTimestamp", "type": "uint256" }], "name": "enterBidForToken", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }, { "internalType": "address", "name": "bidder", "type": "address" }, { "internalType": "uint256", "name": "from", "type": "uint256" }, { "internalType": "uint256", "name": "size", "type": "uint256" }], "name": "getBidderBids", "outputs": [{ "components": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "address", "name": "bidder", "type": "address" }, { "internalType": "uint256", "name": "expireTimestamp", "type": "uint256" }], "internalType": "struct INFTKEYMarketplaceV2.Bid[]", "name": "bidderBids", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }, { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "address", "name": "bidder", "type": "address" }], "name": "getBidderTokenBid", "outputs": [{ "components": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "address", "name": "bidder", "type": "address" }, { "internalType": "uint256", "name": "expireTimestamp", "type": "uint256" }], "internalType": "struct INFTKEYMarketplaceV2.Bid", "name": "validBid", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }, { "internalType": "uint256", "name": "tokenId", "type": "uint256" }], "name": "getTokenBids", "outputs": [{ "components": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "address", "name": "bidder", "type": "address" }, { "internalType": "uint256", "name": "expireTimestamp", "type": "uint256" }], "internalType": "struct INFTKEYMarketplaceV2.Bid[]", "name": "bids", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }, { "internalType": "uint256", "name": "tokenId", "type": "uint256" }], "name": "getTokenHighestBid", "outputs": [{ "components": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "address", "name": "bidder", "type": "address" }, { "internalType": "uint256", "name": "expireTimestamp", "type": "uint256" }], "internalType": "struct INFTKEYMarketplaceV2.Bid", "name": "highestBid", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }, { "internalType": "uint256", "name": "from", "type": "uint256" }, { "internalType": "uint256", "name": "size", "type": "uint256" }], "name": "getTokenHighestBids", "outputs": [{ "components": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "address", "name": "bidder", "type": "address" }, { "internalType": "uint256", "name": "expireTimestamp", "type": "uint256" }], "internalType": "struct INFTKEYMarketplaceV2.Bid[]", "name": "highestBids", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }, { "internalType": "uint256", "name": "tokenId", "type": "uint256" }], "name": "getTokenListing", "outputs": [{ "components": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "address", "name": "seller", "type": "address" }, { "internalType": "uint256", "name": "expireTimestamp", "type": "uint256" }], "internalType": "struct INFTKEYMarketplaceV2.Listing", "name": "validListing", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }, { "internalType": "uint256", "name": "from", "type": "uint256" }, { "internalType": "uint256", "name": "size", "type": "uint256" }], "name": "getTokenListings", "outputs": [{ "components": [{ "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "address", "name": "seller", "type": "address" }, { "internalType": "uint256", "name": "expireTimestamp", "type": "uint256" }], "internalType": "struct INFTKEYMarketplaceV2.Listing[]", "name": "listings", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "isTradingEnabled", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }, { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "uint256", "name": "expireTimestamp", "type": "uint256" }], "name": "listToken", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }], "name": "numTokenListings", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }], "name": "numTokenWithBids", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "paymentToken", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }], "name": "royalty", "outputs": [{ "components": [{ "internalType": "address", "name": "recipient", "type": "address" }, { "internalType": "uint256", "name": "feeFraction", "type": "uint256" }, { "internalType": "address", "name": "setBy", "type": "address" }], "internalType": "struct INFTKEYMarketplaceRoyalty.ERC721CollectionRoyalty", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "royaltyUpperLimit", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "serviceFee", "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }, { "internalType": "address", "name": "newRecipient", "type": "address" }, { "internalType": "uint256", "name": "feeFraction", "type": "uint256" }], "name": "setRoyalty", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }, { "internalType": "address", "name": "newRecipient", "type": "address" }, { "internalType": "uint256", "name": "feeFraction", "type": "uint256" }], "name": "setRoyaltyForCollection", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_newUpperLimit", "type": "uint256" }], "name": "updateRoyaltyUpperLimit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "erc721Address", "type": "address" }, { "internalType": "uint256", "name": "tokenId", "type": "uint256" }], "name": "withdrawBidForToken", "outputs": [], "stateMutability": "nonpayable", "type": "function" }] -------------------------------------------------------------------------------- /src/adapters/galler/abi.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "uint256", 6 | "name": "chainId", 7 | "type": "uint256" 8 | }, 9 | { 10 | "internalType": "address[]", 11 | "name": "registryAddrs", 12 | "type": "address[]" 13 | }, 14 | { 15 | "internalType": "bytes", 16 | "name": "customPersonalSignPrefix", 17 | "type": "bytes" 18 | } 19 | ], 20 | "stateMutability": "nonpayable", 21 | "type": "constructor" 22 | }, 23 | { 24 | "anonymous": false, 25 | "inputs": [ 26 | { 27 | "indexed": true, 28 | "internalType": "bytes32", 29 | "name": "hash", 30 | "type": "bytes32" 31 | }, 32 | { 33 | "indexed": false, 34 | "internalType": "address", 35 | "name": "registry", 36 | "type": "address" 37 | }, 38 | { 39 | "indexed": true, 40 | "internalType": "address", 41 | "name": "maker", 42 | "type": "address" 43 | }, 44 | { 45 | "indexed": false, 46 | "internalType": "address", 47 | "name": "staticTarget", 48 | "type": "address" 49 | }, 50 | { 51 | "indexed": false, 52 | "internalType": "bytes4", 53 | "name": "staticSelector", 54 | "type": "bytes4" 55 | }, 56 | { 57 | "indexed": false, 58 | "internalType": "bytes", 59 | "name": "staticExtradata", 60 | "type": "bytes" 61 | }, 62 | { 63 | "indexed": false, 64 | "internalType": "uint256", 65 | "name": "maximumFill", 66 | "type": "uint256" 67 | }, 68 | { 69 | "indexed": false, 70 | "internalType": "uint256", 71 | "name": "listingTime", 72 | "type": "uint256" 73 | }, 74 | { 75 | "indexed": false, 76 | "internalType": "uint256", 77 | "name": "expirationTime", 78 | "type": "uint256" 79 | }, 80 | { 81 | "indexed": false, 82 | "internalType": "uint256", 83 | "name": "salt", 84 | "type": "uint256" 85 | }, 86 | { 87 | "indexed": false, 88 | "internalType": "bool", 89 | "name": "orderbookInclusionDesired", 90 | "type": "bool" 91 | } 92 | ], 93 | "name": "OrderApproved", 94 | "type": "event" 95 | }, 96 | { 97 | "anonymous": false, 98 | "inputs": [ 99 | { 100 | "indexed": true, 101 | "internalType": "bytes32", 102 | "name": "hash", 103 | "type": "bytes32" 104 | }, 105 | { 106 | "indexed": true, 107 | "internalType": "address", 108 | "name": "maker", 109 | "type": "address" 110 | }, 111 | { 112 | "indexed": false, 113 | "internalType": "uint256", 114 | "name": "newFill", 115 | "type": "uint256" 116 | } 117 | ], 118 | "name": "OrderFillChanged", 119 | "type": "event" 120 | }, 121 | { 122 | "anonymous": false, 123 | "inputs": [ 124 | { 125 | "indexed": false, 126 | "internalType": "bytes32", 127 | "name": "firstHash", 128 | "type": "bytes32" 129 | }, 130 | { 131 | "indexed": false, 132 | "internalType": "bytes32", 133 | "name": "secondHash", 134 | "type": "bytes32" 135 | }, 136 | { 137 | "indexed": true, 138 | "internalType": "address", 139 | "name": "firstMaker", 140 | "type": "address" 141 | }, 142 | { 143 | "indexed": true, 144 | "internalType": "address", 145 | "name": "secondMaker", 146 | "type": "address" 147 | }, 148 | { 149 | "indexed": false, 150 | "internalType": "uint256", 151 | "name": "newFirstFill", 152 | "type": "uint256" 153 | }, 154 | { 155 | "indexed": false, 156 | "internalType": "uint256", 157 | "name": "newSecondFill", 158 | "type": "uint256" 159 | }, 160 | { 161 | "indexed": true, 162 | "internalType": "bytes32", 163 | "name": "metadata", 164 | "type": "bytes32" 165 | } 166 | ], 167 | "name": "OrdersMatched", 168 | "type": "event" 169 | }, 170 | { 171 | "inputs": [ 172 | { 173 | "internalType": "bytes32", 174 | "name": "hash", 175 | "type": "bytes32" 176 | } 177 | ], 178 | "name": "approveOrderHash_", 179 | "outputs": [], 180 | "stateMutability": "nonpayable", 181 | "type": "function" 182 | }, 183 | { 184 | "inputs": [ 185 | { 186 | "internalType": "address", 187 | "name": "registry", 188 | "type": "address" 189 | }, 190 | { 191 | "internalType": "address", 192 | "name": "maker", 193 | "type": "address" 194 | }, 195 | { 196 | "internalType": "address", 197 | "name": "staticTarget", 198 | "type": "address" 199 | }, 200 | { 201 | "internalType": "bytes4", 202 | "name": "staticSelector", 203 | "type": "bytes4" 204 | }, 205 | { 206 | "internalType": "bytes", 207 | "name": "staticExtradata", 208 | "type": "bytes" 209 | }, 210 | { 211 | "internalType": "uint256", 212 | "name": "maximumFill", 213 | "type": "uint256" 214 | }, 215 | { 216 | "internalType": "uint256", 217 | "name": "listingTime", 218 | "type": "uint256" 219 | }, 220 | { 221 | "internalType": "uint256", 222 | "name": "expirationTime", 223 | "type": "uint256" 224 | }, 225 | { 226 | "internalType": "uint256", 227 | "name": "salt", 228 | "type": "uint256" 229 | }, 230 | { 231 | "internalType": "bool", 232 | "name": "orderbookInclusionDesired", 233 | "type": "bool" 234 | } 235 | ], 236 | "name": "approveOrder_", 237 | "outputs": [], 238 | "stateMutability": "nonpayable", 239 | "type": "function" 240 | }, 241 | { 242 | "inputs": [ 243 | { 244 | "internalType": "address", 245 | "name": "", 246 | "type": "address" 247 | }, 248 | { 249 | "internalType": "bytes32", 250 | "name": "", 251 | "type": "bytes32" 252 | } 253 | ], 254 | "name": "approved", 255 | "outputs": [ 256 | { 257 | "internalType": "bool", 258 | "name": "", 259 | "type": "bool" 260 | } 261 | ], 262 | "stateMutability": "view", 263 | "type": "function" 264 | }, 265 | { 266 | "inputs": [ 267 | { 268 | "internalType": "uint256[16]", 269 | "name": "uints", 270 | "type": "uint256[16]" 271 | }, 272 | { 273 | "internalType": "bytes4[2]", 274 | "name": "staticSelectors", 275 | "type": "bytes4[2]" 276 | }, 277 | { 278 | "internalType": "bytes", 279 | "name": "firstExtradata", 280 | "type": "bytes" 281 | }, 282 | { 283 | "internalType": "bytes", 284 | "name": "firstCalldata", 285 | "type": "bytes" 286 | }, 287 | { 288 | "internalType": "bytes", 289 | "name": "secondExtradata", 290 | "type": "bytes" 291 | }, 292 | { 293 | "internalType": "bytes", 294 | "name": "secondCalldata", 295 | "type": "bytes" 296 | }, 297 | { 298 | "internalType": "uint8[2]", 299 | "name": "howToCalls", 300 | "type": "uint8[2]" 301 | }, 302 | { 303 | "internalType": "bytes32", 304 | "name": "metadata", 305 | "type": "bytes32" 306 | }, 307 | { 308 | "internalType": "bytes", 309 | "name": "signatures", 310 | "type": "bytes" 311 | } 312 | ], 313 | "name": "atomicMatch_", 314 | "outputs": [], 315 | "stateMutability": "payable", 316 | "type": "function" 317 | }, 318 | { 319 | "inputs": [], 320 | "name": "codename", 321 | "outputs": [ 322 | { 323 | "internalType": "string", 324 | "name": "", 325 | "type": "string" 326 | } 327 | ], 328 | "stateMutability": "view", 329 | "type": "function" 330 | }, 331 | { 332 | "inputs": [ 333 | { 334 | "internalType": "address", 335 | "name": "", 336 | "type": "address" 337 | }, 338 | { 339 | "internalType": "bytes32", 340 | "name": "", 341 | "type": "bytes32" 342 | } 343 | ], 344 | "name": "fills", 345 | "outputs": [ 346 | { 347 | "internalType": "uint256", 348 | "name": "", 349 | "type": "uint256" 350 | } 351 | ], 352 | "stateMutability": "view", 353 | "type": "function" 354 | }, 355 | { 356 | "inputs": [ 357 | { 358 | "internalType": "address", 359 | "name": "registry", 360 | "type": "address" 361 | }, 362 | { 363 | "internalType": "address", 364 | "name": "maker", 365 | "type": "address" 366 | }, 367 | { 368 | "internalType": "address", 369 | "name": "staticTarget", 370 | "type": "address" 371 | }, 372 | { 373 | "internalType": "bytes4", 374 | "name": "staticSelector", 375 | "type": "bytes4" 376 | }, 377 | { 378 | "internalType": "bytes", 379 | "name": "staticExtradata", 380 | "type": "bytes" 381 | }, 382 | { 383 | "internalType": "uint256", 384 | "name": "maximumFill", 385 | "type": "uint256" 386 | }, 387 | { 388 | "internalType": "uint256", 389 | "name": "listingTime", 390 | "type": "uint256" 391 | }, 392 | { 393 | "internalType": "uint256", 394 | "name": "expirationTime", 395 | "type": "uint256" 396 | }, 397 | { 398 | "internalType": "uint256", 399 | "name": "salt", 400 | "type": "uint256" 401 | } 402 | ], 403 | "name": "hashOrder_", 404 | "outputs": [ 405 | { 406 | "internalType": "bytes32", 407 | "name": "hash", 408 | "type": "bytes32" 409 | } 410 | ], 411 | "stateMutability": "pure", 412 | "type": "function" 413 | }, 414 | { 415 | "inputs": [ 416 | { 417 | "internalType": "bytes32", 418 | "name": "orderHash", 419 | "type": "bytes32" 420 | } 421 | ], 422 | "name": "hashToSign_", 423 | "outputs": [ 424 | { 425 | "internalType": "bytes32", 426 | "name": "hash", 427 | "type": "bytes32" 428 | } 429 | ], 430 | "stateMutability": "view", 431 | "type": "function" 432 | }, 433 | { 434 | "inputs": [], 435 | "name": "name", 436 | "outputs": [ 437 | { 438 | "internalType": "string", 439 | "name": "", 440 | "type": "string" 441 | } 442 | ], 443 | "stateMutability": "view", 444 | "type": "function" 445 | }, 446 | { 447 | "inputs": [ 448 | { 449 | "internalType": "address", 450 | "name": "", 451 | "type": "address" 452 | } 453 | ], 454 | "name": "registries", 455 | "outputs": [ 456 | { 457 | "internalType": "bool", 458 | "name": "", 459 | "type": "bool" 460 | } 461 | ], 462 | "stateMutability": "view", 463 | "type": "function" 464 | }, 465 | { 466 | "inputs": [ 467 | { 468 | "internalType": "bytes32", 469 | "name": "hash", 470 | "type": "bytes32" 471 | }, 472 | { 473 | "internalType": "uint256", 474 | "name": "fill", 475 | "type": "uint256" 476 | } 477 | ], 478 | "name": "setOrderFill_", 479 | "outputs": [], 480 | "stateMutability": "nonpayable", 481 | "type": "function" 482 | }, 483 | { 484 | "inputs": [ 485 | { 486 | "internalType": "bytes32", 487 | "name": "hash", 488 | "type": "bytes32" 489 | }, 490 | { 491 | "internalType": "address", 492 | "name": "maker", 493 | "type": "address" 494 | }, 495 | { 496 | "internalType": "bytes", 497 | "name": "signature", 498 | "type": "bytes" 499 | } 500 | ], 501 | "name": "validateOrderAuthorization_", 502 | "outputs": [ 503 | { 504 | "internalType": "bool", 505 | "name": "", 506 | "type": "bool" 507 | } 508 | ], 509 | "stateMutability": "view", 510 | "type": "function" 511 | }, 512 | { 513 | "inputs": [ 514 | { 515 | "internalType": "address", 516 | "name": "registry", 517 | "type": "address" 518 | }, 519 | { 520 | "internalType": "address", 521 | "name": "maker", 522 | "type": "address" 523 | }, 524 | { 525 | "internalType": "address", 526 | "name": "staticTarget", 527 | "type": "address" 528 | }, 529 | { 530 | "internalType": "bytes4", 531 | "name": "staticSelector", 532 | "type": "bytes4" 533 | }, 534 | { 535 | "internalType": "bytes", 536 | "name": "staticExtradata", 537 | "type": "bytes" 538 | }, 539 | { 540 | "internalType": "uint256", 541 | "name": "maximumFill", 542 | "type": "uint256" 543 | }, 544 | { 545 | "internalType": "uint256", 546 | "name": "listingTime", 547 | "type": "uint256" 548 | }, 549 | { 550 | "internalType": "uint256", 551 | "name": "expirationTime", 552 | "type": "uint256" 553 | }, 554 | { 555 | "internalType": "uint256", 556 | "name": "salt", 557 | "type": "uint256" 558 | } 559 | ], 560 | "name": "validateOrderParameters_", 561 | "outputs": [ 562 | { 563 | "internalType": "bool", 564 | "name": "", 565 | "type": "bool" 566 | } 567 | ], 568 | "stateMutability": "view", 569 | "type": "function" 570 | }, 571 | { 572 | "inputs": [], 573 | "name": "version", 574 | "outputs": [ 575 | { 576 | "internalType": "string", 577 | "name": "", 578 | "type": "string" 579 | } 580 | ], 581 | "stateMutability": "view", 582 | "type": "function" 583 | } 584 | ] -------------------------------------------------------------------------------- /src/adapters/bazaar/abi.json: -------------------------------------------------------------------------------- 1 | [{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":true,"internalType":"contract IERC721","name":"nftAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"nftID","type":"uint256"}],"name":"CancelledListing","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":true,"internalType":"contract IERC721","name":"nftAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"nftID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"ListingPriceChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":true,"internalType":"contract IERC721","name":"nftAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"nftID","type":"uint256"},{"indexed":false,"internalType":"address","name":"newTargetBuyer","type":"address"}],"name":"ListingTargetBuyerChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":true,"internalType":"contract IERC721","name":"nftAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"nftID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"address","name":"targetBuyer","type":"address"}],"name":"NewListing","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"address","name":"seller","type":"address"},{"indexed":true,"internalType":"contract IERC721","name":"nftAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"nftID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"PurchasedListing","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GAME_ADMIN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"addFee","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"burningManager","outputs":[{"internalType":"contract BurningManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"changeFee","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultTax","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isTokenBanned","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isUserBanned","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceOracleSkillPerUsd","outputs":[{"internalType":"contract IPriceOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"skillToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tax","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"taxRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_skillToken","type":"address"},{"internalType":"address","name":"_taxRecipient","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract Characters","name":"_charactersContract","type":"address"},{"internalType":"contract Weapons","name":"_weaponsContract","type":"address"}],"name":"migrateTo_a98a9ac","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPriceOracle","name":"_priceOracleSkillPerUsd","type":"address"}],"name":"migrateTo_2316231","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract BurningManager","name":"_burningManager","type":"address"}],"name":"migrateTo_29635ef","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"}],"name":"isTokenAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllowedTokenTypes","outputs":[{"internalType":"contract IERC721[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getSellerOfNftID","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultTaxAsRoundedPercentRoughEstimate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getListedTokenTypes","outputs":[{"internalType":"contract IERC721[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"}],"name":"getListingIDs","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint8","name":"_limit","type":"uint8"},{"internalType":"uint256","name":"_pageNumber","type":"uint256"},{"internalType":"uint8","name":"_trait","type":"uint8"},{"internalType":"uint8","name":"_stars","type":"uint8"}],"name":"getWeaponListingIDsPage","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint8","name":"_limit","type":"uint8"},{"internalType":"uint256","name":"_pageNumber","type":"uint256"},{"internalType":"uint8","name":"_trait","type":"uint8"},{"internalType":"uint8","name":"_minLevel","type":"uint8"},{"internalType":"uint8","name":"_maxLevel","type":"uint8"}],"name":"getCharacterListingIDsPage","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"address","name":"_seller","type":"address"}],"name":"getNumberOfListingsBySeller","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"address","name":"_seller","type":"address"}],"name":"getListingIDsBySeller","outputs":[{"internalType":"uint256[]","name":"tokens","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"}],"name":"getNumberOfListingsForToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint8","name":"_trait","type":"uint8"},{"internalType":"uint8","name":"_minLevel","type":"uint8"},{"internalType":"uint8","name":"_maxLevel","type":"uint8"}],"name":"getNumberOfCharacterListings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint8","name":"_trait","type":"uint8"},{"internalType":"uint8","name":"_stars","type":"uint8"}],"name":"getNumberOfWeaponListings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getSellerPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getFinalPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getTaxOnListing","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getTargetBuyer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"length","type":"uint256"}],"name":"getListingSlice","outputs":[{"internalType":"uint256","name":"returnedCount","type":"uint256"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address[]","name":"sellers","type":"address[]"},{"internalType":"uint256[]","name":"prices","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"address","name":"_targetBuyer","type":"address"}],"name":"addListing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_newPrice","type":"uint256"}],"name":"changeListingPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"address","name":"_newTargetBuyer","type":"address"}],"name":"changeListingTargetBuyer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"cancelListing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_maxPrice","type":"uint256"}],"name":"purchaseListing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_maxPrice","type":"uint256"}],"name":"purchaseBurnCharacter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cents","type":"uint256"}],"name":"setAddValue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cents","type":"uint256"}],"name":"setChangeValue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_taxRecipient","type":"address"}],"name":"setTaxRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int128","name":"_defaultTax","type":"int128"}],"name":"setDefaultTax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_numerator","type":"uint256"},{"internalType":"uint256","name":"_denominator","type":"uint256"}],"name":"setDefaultTaxAsRational","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_percent","type":"uint256"}],"name":"setDefaultTaxAsPercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"int128","name":"_newTax","type":"int128"}],"name":"setTaxOnTokenType","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_numerator","type":"uint256"},{"internalType":"uint256","name":"_denominator","type":"uint256"}],"name":"setTaxOnTokenTypeAsRational","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_percent","type":"uint256"}],"name":"setTaxOnTokenTypeAsPercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bool","name":"to","type":"bool"}],"name":"setUserBan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"users","type":"address[]"},{"internalType":"bool","name":"to","type":"bool"}],"name":"setUserBans","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"unlistItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"}],"name":"unlistItems","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"}],"name":"allowToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_tokenAddress","type":"address"}],"name":"disallowToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"recoverSkill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int128","name":"usdAmount","type":"int128"}],"name":"usdToSkill","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"}] 2 | -------------------------------------------------------------------------------- /src/sdk/EVMC.ts: -------------------------------------------------------------------------------- 1 | import metadata from "./metadata"; 2 | import Web3 from "web3"; 3 | import _ from "lodash"; 4 | import fs from "fs"; 5 | import { asyncTimeout } from "./util"; 6 | import { WS_PROXY_URL, AVAILABLE_PROTOCOLS, API_KEY } from "./constants"; 7 | import BasicSDK from "./basic-sdk"; 8 | 9 | import { IDappRadarAPIHeaders } from "./Interfaces"; 10 | import { Log, TransactionReceipt, Transaction, PastLogsOptions } from "web3-core"; 11 | import { BlockTransactionString } from "web3-eth"; 12 | import { EventData, PastEventOptions, Contract } from "web3-eth-contract"; 13 | 14 | // Ethereum Virtual Machine compatible 15 | class EVMC extends BasicSDK { 16 | web3: any; 17 | running: boolean; 18 | range: number; 19 | protocol?: string; 20 | chunkSize?: number; 21 | 22 | constructor(provider: any) { 23 | super(provider); 24 | 25 | this.web3 = null; 26 | this.running = true; 27 | this.range = 100; 28 | } 29 | 30 | stop = (): void => { 31 | this.running = false; 32 | }; 33 | 34 | private _getOptions = (): object => { 35 | const headers: IDappRadarAPIHeaders = { 36 | key: API_KEY, 37 | protocol: AVAILABLE_PROTOCOLS.ETH, 38 | }; 39 | 40 | const customOptions = { 41 | headers, 42 | clientConfig: { 43 | maxReceivedFrameSize: 100 * 1000 * 1000, 44 | maxReceivedMessageSize: 100 * 1000 * 1000, 45 | }, 46 | reconnect: { 47 | auto: true, 48 | delay: 5000, 49 | maxAttempts: 1000, 50 | onTimeout: false, 51 | }, 52 | }; 53 | 54 | if (this.protocol) { 55 | customOptions.headers.protocol = this.protocol; 56 | } 57 | 58 | return customOptions; 59 | }; 60 | 61 | connect = (): void => { 62 | // @see https://web3js.readthedocs.io/en/v1.2.11/web3.html#configuration 63 | const customOptions = this._getOptions(); 64 | 65 | const Web3ClientSocket = new Web3.providers.WebsocketProvider(WS_PROXY_URL, customOptions); 66 | this.web3 = new Web3(Web3ClientSocket); 67 | this.web3.currentProvider.once("error", (error: Error): void => { 68 | console.error("Error in web3", error); 69 | throw error; 70 | }); 71 | }; 72 | 73 | // Ensure Web3 connection established. 74 | // Returns existing Web3 connection or creates new one of it does not exists. 75 | ensureWeb3 = (): any => { 76 | if (!this.web3) { 77 | this.connect(); 78 | } 79 | 80 | return this.web3; 81 | }; 82 | 83 | getBlock = async (number: number): Promise => { 84 | const callback = async () => { 85 | const response: any = await this.web3.eth.getBlock(number); 86 | 87 | if (null === response) { 88 | await asyncTimeout(60); 89 | throw new Error("null response"); 90 | } 91 | 92 | return response; 93 | }; 94 | 95 | return this.retry({ 96 | callback, 97 | customParams: { 98 | blockNumber: number, 99 | }, 100 | }); 101 | }; 102 | 103 | getCurrentBlock = async (): Promise => { 104 | const callback = async () => { 105 | this.ensureWeb3(); 106 | const response: number | null = await this.web3.eth.getBlockNumber(); 107 | 108 | if (null === response) { 109 | await asyncTimeout(60); 110 | throw new Error("null response"); 111 | } 112 | 113 | return response; 114 | }; 115 | 116 | return this.retry({ 117 | callback, 118 | }); 119 | }; 120 | 121 | getPastLogs = async (options: PastLogsOptions): Promise => { 122 | const callback = async () => { 123 | this.ensureWeb3(); 124 | const response: any = await this.web3.eth.getPastLogs(options); 125 | 126 | if (null === response) { 127 | await asyncTimeout(60); 128 | throw new Error("null response"); 129 | } 130 | 131 | return response; 132 | }; 133 | 134 | return this.retry({ 135 | callback, 136 | customParams: { 137 | options, 138 | }, 139 | }); 140 | }; 141 | 142 | getPastEvents = async (eventName: string, options: PastEventOptions): Promise => { 143 | const callback = async () => { 144 | this.ensureWeb3(); 145 | const contract = await this.getContract(); 146 | const response = await contract.getPastEvents(eventName, options); 147 | 148 | if (null === response) { 149 | await asyncTimeout(60); 150 | throw new Error("null response"); 151 | } 152 | 153 | return response; 154 | }; 155 | 156 | return this.retry({ 157 | callback, 158 | customParams: { 159 | eventName, 160 | options, 161 | }, 162 | }); 163 | }; 164 | 165 | getTransaction = async (transactionHash: string): Promise => { 166 | const callback = async () => { 167 | this.ensureWeb3(); 168 | const response = await this.web3.eth.getTransaction(transactionHash); 169 | 170 | if (null === response) { 171 | throw new Error("NULL response"); 172 | } 173 | 174 | return response; 175 | }; 176 | 177 | return this.retry({ 178 | callback, 179 | customParams: { 180 | transactionHash, 181 | }, 182 | }); 183 | }; 184 | 185 | getTransactionReceipt = async (transactionHash: string): Promise => { 186 | const callback = async () => { 187 | this.ensureWeb3(); 188 | const response = await this.web3.eth.getTransactionReceipt(transactionHash); 189 | 190 | if (null === response) { 191 | throw new Error("NULL response"); 192 | } 193 | 194 | return response; 195 | }; 196 | 197 | return this.retry({ 198 | callback, 199 | customParams: { 200 | transactionHash, 201 | }, 202 | }); 203 | }; 204 | 205 | callContractMethod = async (methodName: string, params: any[] = []): Promise => { 206 | const callback = async () => { 207 | this.ensureWeb3(); 208 | const contract = await this.getContract(); 209 | const response = await contract.methods[methodName](...params).call(); 210 | 211 | if (null === response) { 212 | await asyncTimeout(60); 213 | throw new Error("null response"); 214 | } 215 | 216 | return response; 217 | }; 218 | 219 | return this.retry({ 220 | callback, 221 | customParams: { 222 | methodName, 223 | params, 224 | }, 225 | }); 226 | }; 227 | 228 | /** 229 | * Run events parser 230 | */ 231 | run = async (): Promise => { 232 | // @todo this needs to have a reset for all providers where the range should be bigger 233 | if ("undefined" !== typeof this.provider.blockRange) { 234 | this.range = this.provider.blockRange; 235 | } 236 | this.ensureWeb3(); 237 | const block: number = +(await metadata.block(this.provider)); 238 | const currentBlock: number = await this.getCurrentBlock(); 239 | 240 | if ("topics" === this.provider.searchType) { 241 | await this.eventsByTopics(block, currentBlock); 242 | } else { 243 | await this.events(block, currentBlock); 244 | } 245 | }; 246 | 247 | /** 248 | * Check if contract is active based on the block number 249 | */ 250 | isDeprecated = (block: number): boolean => { 251 | if ("undefined" !== typeof this.provider.deprecatedAtBlock && block >= this.provider.deprecatedAtBlock) { 252 | console.log(`${this.provider.name} provider deprecated at ${this.provider.deprecatedAtBlock}`); 253 | 254 | return true; 255 | } 256 | 257 | return false; 258 | }; 259 | 260 | /** 261 | * Parse events by topics (signatures) 262 | */ 263 | eventsByTopics = async (block: number, currentBlock: number): Promise => { 264 | let run = true; 265 | let from: number = block; 266 | console.log("range", this.range); 267 | let to: number = block + this.range; 268 | 269 | while (run) { 270 | console.log(`processing past blocks for ${this.provider.name} from block ${from}`); 271 | const events: Log[] = await this.getPastLogs({ 272 | fromBlock: from, 273 | toBlock: to, 274 | address: this.provider.contract, 275 | topics: this.provider.eventsTopics, 276 | }); 277 | 278 | if (events.length) { 279 | console.log("Events in block range: " + events.length); 280 | const chunkedEvents: PastLogsOptions[][] = _.chunk(events, this.chunkSize); 281 | 282 | for (const i in chunkedEvents) { 283 | const promises: Promise[] = []; 284 | for (const event of chunkedEvents[i]) { 285 | promises.push(this.provider.process(event)); 286 | } 287 | await Promise.all(promises); 288 | } 289 | } 290 | 291 | await metadata.update(this.provider, to); 292 | if (this.isDeprecated(to)) { 293 | return; 294 | } 295 | 296 | from = to + 1; 297 | to = to + this.range; 298 | // If we don't update current block number, we'll always check with the same block. 299 | // That might cause us trying to parse events from future. 300 | currentBlock = await this.getCurrentBlock(); 301 | 302 | if (to > currentBlock) { 303 | run = false; 304 | await metadata.update(this.provider, currentBlock); 305 | await this._subscribeEventsByTopics(currentBlock); 306 | } 307 | } 308 | }; 309 | 310 | /** 311 | * Subscribe to events by topics (signatures) since specified block 312 | */ 313 | private _subscribeEventsByTopics = async (block: number): Promise => { 314 | const callback = async () => { 315 | await new Promise(() => { 316 | const web3 = this.ensureWeb3(); 317 | web3.eth 318 | .subscribe( 319 | "logs", 320 | { 321 | address: this.provider.contract, 322 | topics: this.provider.eventsTopics, 323 | }, 324 | (err: Error, log: Log) => { 325 | if (err) { 326 | console.log("ethereum event subscription error " + err, err); 327 | throw err; 328 | } 329 | 330 | if (log) { 331 | console.log(`event for ${this.provider.name} on block ${log.blockNumber}`); 332 | 333 | this.provider.process(log); 334 | metadata.update(this.provider, log.blockNumber - 1); 335 | } 336 | }, 337 | ) 338 | .on("connected", () => { 339 | console.log(`subscribed to ${this.provider.name} events by topics from block ${block}`); 340 | }); 341 | }); 342 | }; 343 | 344 | return this.retry({ 345 | callback, 346 | customParams: { 347 | blockNumber: block, 348 | contract: this.provider.contract, 349 | topics: this.provider.eventsTopics, 350 | }, 351 | }); 352 | }; 353 | 354 | /** 355 | * Parse events by event name 356 | */ 357 | events = async (block: number, currentBlock: number): Promise => { 358 | let run = true; 359 | let from: number = block; 360 | let to: number = block + this.range; 361 | if (to > currentBlock) { 362 | to = currentBlock; 363 | } 364 | 365 | while (run && this.running) { 366 | console.log(`processing past blocks for ${this.provider.name} from block ${from} to block ${to}`); 367 | 368 | for (const eventName of this.provider.events) { 369 | if (!this.running) { 370 | break; 371 | } 372 | const events: EventData[] = await this.getPastEvents(eventName, { 373 | fromBlock: from, 374 | toBlock: to, 375 | }); 376 | if (events.length) { 377 | console.log( 378 | `found ${events.length} events for ${this.provider.name} in range from block ${from} to ${to}`, 379 | ); 380 | const chunks: EventData[][] = _.chunk(events, this.chunkSize); 381 | 382 | for (const chunk in chunks) { 383 | const promises: Promise[] = []; 384 | for (const event of chunks[chunk]) { 385 | promises.push(this.provider.process(event)); 386 | } 387 | 388 | await Promise.all(promises); 389 | } 390 | } 391 | } 392 | 393 | await metadata.update(this.provider, to); 394 | 395 | if (this.isDeprecated(to)) { 396 | return; 397 | } 398 | 399 | from = to + 1; 400 | to = to + this.range; 401 | // If we don't update current block number, we'll always check with the same block. 402 | // That might cause us trying to parse events from future. 403 | currentBlock = await this.getCurrentBlock(); 404 | 405 | if (to >= currentBlock) { 406 | run = false; 407 | await metadata.update(this.provider, currentBlock); 408 | await this._subscribeEvents(currentBlock); 409 | } 410 | } 411 | return; 412 | }; 413 | 414 | /** 415 | * Subscribe to events by event names since specified block 416 | */ 417 | private _subscribeEvents = async (block: number): Promise => { 418 | for (const name of this.provider.events) { 419 | try { 420 | const contract: Contract = await this.getContract(); 421 | contract.events[name]({ fromBlock: block }, async (error: Error, event: EventData) => { 422 | if (error) { 423 | throw new Error(); 424 | } 425 | 426 | if (event) { 427 | this.provider.process(event); 428 | metadata.update(this.provider, event.blockNumber - 1); 429 | } 430 | }).on("connected", (id: number): void => { 431 | console.log(`subscribed to ${this.provider.name} event ${name} with ID ${id} from block ${block}`); 432 | }); 433 | } catch (err) { 434 | console.error({ 435 | action: "Subscribe to events", 436 | error: err?.message || "n/a", 437 | provider: this.provider.name, 438 | sdk: this.constructor.name, 439 | function: "_subscribeEvents", 440 | }); 441 | await asyncTimeout(); 442 | process.exit(1); 443 | } 444 | } 445 | }; 446 | 447 | /** 448 | * Parse address from hexadecimal string 449 | */ 450 | hexToAddress = (input: string): string => ("0x" + input.substr(input.length - 40)).toLowerCase(); 451 | 452 | /** 453 | * Parse array from transaction input data string 454 | */ 455 | txDataToArray = (input: string): string[] => input.substring(2).match(/.{1,64}/g) || []; 456 | 457 | /** 458 | * Parse array from transaction input data string 459 | */ 460 | getInputData = (input: string): RegExpMatchArray | null => input.substring(10).match(/.{1,64}/g); 461 | 462 | getContract = async (): Promise => { 463 | const web3 = this.ensureWeb3(); 464 | 465 | return new web3.eth.Contract(await this.getAbi(), this.provider.contract); 466 | }; 467 | 468 | hexToTopic = (input: string): string => { 469 | const string = "0000000000000000000000000000000000000000000000000000000000000000" + input.substring(2); 470 | return "0x" + string.slice(string.length - 64); 471 | }; 472 | 473 | getAbi = async (): Promise => { 474 | if (this.provider.hasOwnProperty("getAbi")) { 475 | return await this.provider.getAbi(); 476 | } 477 | 478 | if (this.provider.hasOwnProperty("abi") && "object" === typeof this.provider.abi) { 479 | return this.provider.abi; 480 | } 481 | 482 | if (!this.provider.hasOwnProperty("pathToAbi")) { 483 | throw new Error("invalid path to abi, must provider full path"); 484 | } 485 | 486 | const stringifiedAbi: string = await fs.promises.readFile(this.provider.pathToAbi, "utf8"); 487 | const abi: object = JSON.parse(stringifiedAbi || "[]"); 488 | this.provider.abi = abi; 489 | return abi; 490 | }; 491 | } 492 | 493 | export default EVMC; 494 | --------------------------------------------------------------------------------