Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
9yoi authored Feb 19, 2024
2 parents b250b15 + cd9c8b3 commit 67ed274
Show file tree
Hide file tree
Showing 19 changed files with 4,200 additions and 566 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/clear-stale-PRs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: clear-stale-PRs

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *" # UTC Midnight everyday

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Close Stale Issues
uses: actions/[email protected]
with:
repo-token: ${{ secrets.PAT }}
# ====== for pr
exempt-pr-labels: pinned,security,good-first-issue,in-progress

ascending: true # gets in ascending order
stale-issue-label: "stale"
days-before-pr-stale: 21
stale-pr-message: |
This pull request has been automatically marked as stale because it
has not had recent activity. It will be closed if no further activity
occurs - please feel free to re-open when your project has more traction.
days-before-pr-close: 7
close-pr-message: |
This pull request has not seen any activity since it was marked stale.
Closing.
operations-per-run: 250
debug-only: false # true for dry run, false to actually perform the operations
5 changes: 5 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": "ts-node/register",
"extension": ["ts"],
"watch-files": ["src/**/*.ts"]
}
16 changes: 16 additions & 0 deletions PR-KPOP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Validate [{KPOP}](https://solscan.io/token/{DcUoGUeNTLhhzyrcz49LE7z3MEFwca2N9uSw1xbVi1gm})

## Attestations (Please provide links):
- Tweet from Twitter Account attesting the Mint address, tagging [@JupiterExchange](https://twitter.com/JupiterExchange) and showing community support: (https://x.com/kpopsolana/status/1738601649499693512?s=20)
- Coingecko/ CMC URL (If available): [https://www.coingecko.com/en/coins/{id}](https://www.coingecko.com/en/coins/k-pop-on-solana)

## Validation (Please check off boxes):
- [X] The metadata provided in the PR matches what is on-chain (Mandatory)
- [X] Does not duplicate the symbol of another token on Jupiter's strict list (If not, review will be delayed)
- [X] Is Listed on Coingecko / CMC (Optional, but helpful for reviewers)

## Acknowledgement (Please check off boxes)
- [X] My change matches the format in the file (no spaces between fields).
- [X] My token is already live and trading on Jupiter.
- [X] !!! I read the README section on Community-Driven Validation and understand this PR will be only be reviewed when there is community support on Twitter.
- [X] Please make sure your pull request title has your token name. If it just says "Main", or "Validate", it will automatically be closed. PRs containing broken attestation or solscan links will also be closed.
16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,36 @@
"license": "MIT",
"scripts": {
"validate-PR": "yarn build && node dist/main.js",
"build": "yarn tsc",
"build": "tsc",
"update-partners": "yarn build && node dist/partners/scripts/get-wormhole.js && node dist/partners/scripts/get-solana-fm.js",
"get-wormhole": "yarn build && node dist/partners/scripts/get-wormhole.js",
"check-wormhole": "yarn build && node dist/partners/scripts/check-wormhole-with-verified.js",
"get-solana-fm": "yarn build && node dist/partners/scripts/get-solana-fm.js",
"format": "yarn prettier --write **/*.ts",
"format-check": "yarn prettier --check **/*.ts",
"lint": "eslint src/**/*.ts"
"lint": "eslint src/**/*.ts",
"test": "vitest --test-timeout 20000 src/**/*.ts"
},
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.1",
"@actions/github": "^5.1.1",
"@solana/web3.js": "^1.73.2",
"@metaplex-foundation/js": "^0.20.1",
"@solana/spl-token": "^0.4.0",
"@solana/web3.js": "^1.90.0",
"@types/minimist": "^1.2.5",
"csv-writer": "^1.6.0",
"minimist": "^1.2.8",
"node-downloader-helper": "^2.1.6",
"node-fetch": "^2.6.6"
"node-fetch": "^2.6.6",
"typescript-node": "^0.1.3"
},
"devDependencies": {
"@types/node": "^18.13.0",
"@types/node-fetch": "^2.6.2",
"csv-parse": "^5.5.3",
"typescript": "^4.9.5"
"ts-node": "^10.9.2",
"typescript": "^4.9.5",
"vitest": "^1.2.2"
}
}
16 changes: 0 additions & 16 deletions pull_request_template.md

This file was deleted.

28 changes: 18 additions & 10 deletions src/logic.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as core from "@actions/core";
import { exec } from "@actions/exec";
import { detectDuplicateSymbol, detectDuplicateMints, canOnlyAddOneToken, validMintAddress, noEditsToPreviousLinesAllowed, isCommunityValidated, isSymbolConfusing } from "./utils/validate";
import { detectDuplicateSymbol, detectDuplicateMints, canOnlyAddOneToken, validMintAddress, noEditsToPreviousLinesAllowed, isCommunityValidated, isSymbolConfusing, newTokensHaveMatchingOnchainMeta, findAddedTokens} from "./utils/validate";
import { ValidatedTokensData } from "./types/types";
import { Connection, clusterApiUrl } from "@solana/web3.js";
import { indexToLineNumber } from "./utils/validate";
import { parse } from "csv-parse/sync";
import fs from "fs";
Expand All @@ -13,14 +14,15 @@ export async function validateValidatedTokensCsv(filename: string): Promise<numb
const recordsPreviousRaw = await gitPreviousVersion("validated-tokens.csv");
fs.writeFileSync(".validated-tokens-0.csv", recordsPreviousRaw);
const [recordsPrevious, _] = parseCsv(".validated-tokens-0.csv")

let duplicateSymbols;
let duplicateMints;
let attemptsToAddMultipleTokens;
let invalidMintAddresses;
let notCommunityValidated;
let noEditsAllowed;
let potentiallyConfusingSymbols;
const connection = new Connection(clusterApiUrl("mainnet-beta"), "confirmed");
let duplicateSymbols = 0;
let duplicateMints = 0;
let attemptsToAddMultipleTokens = 0;
let invalidMintAddresses = 0;
let notCommunityValidated = 0;
let noEditsAllowed = 0;
let potentiallyConfusingSymbols = 0;
let doubleCheckMetadataOnChain = 0;

duplicateSymbols = detectDuplicateSymbol(recordsPrevious, records);
duplicateMints = detectDuplicateMints(records);
Expand All @@ -30,14 +32,20 @@ export async function validateValidatedTokensCsv(filename: string): Promise<numb
notCommunityValidated = isCommunityValidated(records);
potentiallyConfusingSymbols = isSymbolConfusing(recordsPrevious, records);

// other validations have their own way of finding newly added tokens. no
// time to go through all of them, plus they do something different.
const newTokens = findAddedTokens(recordsPrevious, records);
doubleCheckMetadataOnChain = await newTokensHaveMatchingOnchainMeta(connection, newTokens);

console.log("No More Duplicate Symbols:", duplicateSymbols, `(${allowedDuplicateSymbols.length} exceptions)`);
console.log("Duplicate Mints:", duplicateMints);
console.log("Attempts to Add Multiple Tokens:", attemptsToAddMultipleTokens);
console.log("Invalid Mint Addresses:", invalidMintAddresses);
console.log("Not Community Validated:", notCommunityValidated, `(${allowedNotCommunityValidated.length} exceptions)`);
console.log("Edits to Existing Tokens:", noEditsAllowed);
console.log("Issues with Symbols in Added Tokens:", potentiallyConfusingSymbols);
return (duplicateSymbols + duplicateMints + attemptsToAddMultipleTokens + invalidMintAddresses + noEditsAllowed)
console.log("Onchain Metadata Mismatches:", doubleCheckMetadataOnChain);
return (duplicateSymbols + duplicateMints + attemptsToAddMultipleTokens + invalidMintAddresses + noEditsAllowed + doubleCheckMetadataOnChain)
}

// Get previous version of validated-tokens.csv from last commit
Expand Down
Loading

0 comments on commit 67ed274

Please sign in to comment.