Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
9yoi authored Mar 5, 2024
2 parents 9cfb33c + 7f1983f commit 4c8102a
Show file tree
Hide file tree
Showing 18 changed files with 4,239 additions and 561 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: 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"
}
}
8 changes: 4 additions & 4 deletions pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Validate [{Token Symbol}](https://solscan.io/token/{mint_address})
# Validate [TOKEN_SYMBOL_HERE](https://solscan.io/token/MINT_ADDRES_HERE)

## Attestations (Please provide links):
- Tweet from your Twitter Account attesting the Mint address, tagging [@JupiterExchange](https://twitter.com/JupiterExchange) and showing community support: https://twitter.com/{your_account}/status/{your_tweet_id}
- Coingecko/ CMC URL (If available): https://www.coingecko.com/en/coins/{id}
- Tweet from your Twitter Account attesting the Mint address, tagging [@JupiterExchange](https://twitter.com/JupiterExchange) and showing community support: https://twitter.com/YOUR_ACCOUNT_NAME_HERE/status/YOUR_TWEET_ID_HERE
- Coingecko/ CMC URL (If available): https://www.coingecko.com/en/coins/YOUR_ID_HERE

## Validation (Please check off boxes):
- [ ] The metadata provided in the PR matches what is on-chain (Mandatory)
Expand All @@ -13,4 +13,4 @@
- [ ] My change matches the format in the file (no spaces between fields).
- [ ] My token is already live and trading on Jupiter.
- [ ] !!! 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.
- [ ] 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.
- [ ] 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.
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 4c8102a

Please sign in to comment.