diff --git a/.github/workflows/cleanup-branches.yml b/.github/workflows/cleanup-branches.yml deleted file mode 100644 index fe10747..0000000 --- a/.github/workflows/cleanup-branches.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Cleanup Stale Branches - -on: - schedule: - # Runs at 00:00 every day - - cron: "0 0 * * *" - workflow_dispatch: - -jobs: - delete_old_branches: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Fetch all branches - run: git fetch --all - - - name: Delete stale branches - run: | - # Get the date 7 days ago in YYYY-MM-DD format - seven_days_ago=$(date -d '7 days ago' +%Y-%m-%d) - - # List branches that haven't been updated in the last 7 days - for branch in $(git for-each-ref --format='%(refname:short) %(committerdate:short)' refs/remotes/origin | awk -v date="$seven_days_ago" '$2 <= date {print $1}'); do - # Ensure the branch is not 'main', 'master', or any protected branches - if [[ "$branch" != "origin/main" && "$branch" != "origin/master" && "$branch" != *"HEAD"* ]]; then - git push origin --delete ${branch#origin/} - echo "Deleted branch $branch" - fi - done - - - name: Cleanup - run: git remote prune origin diff --git a/.github/workflows/update-token-list.yml b/.github/workflows/update-token-list.yml deleted file mode 100644 index eef9a27..0000000 --- a/.github/workflows/update-token-list.yml +++ /dev/null @@ -1,178 +0,0 @@ -name: Update Token List - -on: - workflow_dispatch: - inputs: - name: - description: "Token name" - required: true - chainId: - description: "Chain ID" - required: true - symbol: - description: "Token symbol" - required: true - address: - description: "Token address" - required: true - decimals: - description: "Token decimals" - required: true - image: - description: "Token logo (base64 encoded)" - required: true - twitter: - description: "Twitter handle" - required: false - website: - description: "Website URL" - required: false - -jobs: - update-token-list: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "20" - - - name: Set up Git configuration - run: | - git config user.name "GitHub Actions" - git config user.email "actions@github.com" - git config core.autocrlf input - - - name: Determine logo file name - id: determine_logo - run: | - case "${{ github.event.inputs.chainId }}" in - 530) - logo_filename="logo.png" - ;; - 90001) - logo_filename="logo-testnet.png" - ;; - 7000) - logo_filename="logo-zeta.png" - ;; - 7001) - logo_filename="logo-athens.png" - ;; - *) - logo_filename="logo.png" - ;; - esac - echo "logo_filename=$logo_filename" >> $GITHUB_ENV - - - name: Debug inputs - run: | - echo "Twitter: '${{ github.event.inputs.twitter }}'" - echo "Website: '${{ github.event.inputs.website }}'" - - - name: Decode and save image - run: | - mkdir -p Tokens/${{ github.event.inputs.address }} - echo "${{ github.event.inputs.image }}" | base64 --decode > Tokens/${{ github.event.inputs.address }}/${{ env.logo_filename }} - - - name: List files in Tokens directory - run: ls -R Tokens/ - - - name: Prepare branch and token entry - id: prepare - run: | - name="${{ github.event.inputs.name }}" - symbol="${{ github.event.inputs.symbol }}" - address="${{ github.event.inputs.address }}" - sanitized_name=$(echo "$name" | tr ' ' '-' | tr -cd '[:alnum:]-') - sanitized_symbol=$(echo "$symbol" | tr ' ' '-' | tr -cd '[:alnum:]-') - sanitized_address=$(echo "$address" | tr ' ' '-' | tr -cd '[:alnum:]-') - branch_name="add-token-$sanitized_address-$sanitized_name-$sanitized_symbol" - - # Save branch name to be used in subsequent steps - echo "branch_name=$branch_name" >> $GITHUB_ENV - - - name: Pull latest changes from main - run: | - git checkout main - git pull origin main - - - name: Print branch name - run: | - echo "Branch name: ${{ env.branch_name }}" - - - name: Normalize line endings in FXList.json - run: | - awk '{ sub("\r$", ""); print }' FXList.json > tmp.FXList.json && mv tmp.FXList.json FXList.json - - - name: Format FXList.json before changes - run: | - jq --indent 4 . FXList.json > tmp.FXList.json && mv tmp.FXList.json FXList.json - - - name: Append new token to FXList.json - run: | - logoURI="https://raw.githubusercontent.com/FunctionX-SG/FXSwap-TokenList/main/Tokens/${{ github.event.inputs.address }}/${{ env.logo_filename }}" - # Create token entry - token_entry=$(jq -n \ - --arg name "${{ github.event.inputs.name }}" \ - --argjson chainId "${{ github.event.inputs.chainId }}" \ - --arg symbol "${{ github.event.inputs.symbol }}" \ - --argjson decimals "${{ github.event.inputs.decimals }}" \ - --arg address "${{ github.event.inputs.address }}" \ - --arg logoURI "$logoURI" \ - --arg twitter "${{ github.event.inputs.twitter }}" \ - --arg website "${{ github.event.inputs.website }}" \ - '{name: $name, chainId: $chainId, symbol: $symbol, decimals: $decimals, address: $address, logoURI: $logoURI, extensions: {twitter: $twitter, website: $website}} | with_entries(select(.value != "" and .value != null)) | .extensions |= with_entries(select(.value != "" and .value != null))') - # Append the new entry to the tokens array in FXList.json - jq --argjson token_entry "$token_entry" '.tokens += [$token_entry]' FXList.json > tmp.FXList.json && mv tmp.FXList.json FXList.json - - - name: Format FXList.json after changes - run: | - jq --indent 4 . FXList.json > tmp.FXList.json && mv tmp.FXList.json FXList.json - - - name: Check if branch exists locally and delete if it does - run: | - if git show-ref --quiet refs/heads/${{ env.branch_name }}; then - echo "Branch exists locally. Deleting local branch ${{ env.branch_name }}." - git branch -D ${{ env.branch_name }} - else - echo "Branch does not exist locally." - fi - - - name: Check if branch exists remotely and delete if it does - run: | - if git ls-remote --exit-code --heads origin ${{ env.branch_name }}; then - echo "Branch exists remotely. Deleting remote branch ${{ env.branch_name }}." - git push origin --delete ${{ env.branch_name }} - else - echo "Branch does not exist remotely." - fi - - - name: Commit changes - run: | - git checkout -b ${{ env.branch_name }} - git rm -r .github/workflows/cleanup-branches.yml .github/workflows/update-token-list.yml - git add FXList.json Tokens/${{ github.event.inputs.address }}/${{ env.logo_filename }} - git commit -m "Add token ${{ github.event.inputs.address }} ${{ github.event.inputs.name }} (${{ github.event.inputs.symbol }})" - git pull origin main --rebase - git push origin ${{ env.branch_name }} - - - name: Install GitHub CLI - run: | - sudo apt-get update - sudo apt-get install gh - - - name: Create Pull Request with GH CLI - env: - GH_TOKEN: ${{ secrets.TOKEN }} - run: | - gh pr create --repo FunctionX-SG/FXSwap-TokenList --base main --head marginx-spot-trade:${{ env.branch_name }} --title "Add ${{ github.event.inputs.name }} Token" --body "This PR adds a new token with address ${{ github.event.inputs.address }}, name '${{ github.event.inputs.name }}' and symbol '${{ github.event.inputs.symbol }}'." - - # gh pr create --title "Add ${{ github.event.inputs.name }} Token" \ - # --body "This PR adds a new token with name '${{ github.event.inputs.name }}' and symbol '${{ github.event.inputs.symbol }}'." \ - # --base main \ - # --head marginx-spot-trade:${{ env.branch_name }} diff --git a/FXList.json b/FXList.json index 5715374..b1e244b 100644 --- a/FXList.json +++ b/FXList.json @@ -1086,6 +1086,15 @@ "address": "0x4F7A8B0C35Aa437a8aB1cB414A71FA0950cEeAE1", "logoURI": "https://raw.githubusercontent.com/FunctionX-SG/FXSwap-TokenList/main/Tokens/0x4F7A8B0C35Aa437a8aB1cB414A71FA0950cEeAE1/logo.png", "extensions": {} + }, + { + "name": "Chiserli", + "chainId": 530, + "symbol": "CHIS", + "decimals": 18, + "address": "0xA90D86BF4A86E9dA647ea4a744Ee25826cf41Af0", + "logoURI": "https://raw.githubusercontent.com/FunctionX-SG/FXSwap-TokenList/main/Tokens/0xA90D86BF4A86E9dA647ea4a744Ee25826cf41Af0/logo.png", + "extensions": {} } ] } diff --git a/Tokens/0xA90D86BF4A86E9dA647ea4a744Ee25826cf41Af0/logo.png b/Tokens/0xA90D86BF4A86E9dA647ea4a744Ee25826cf41Af0/logo.png new file mode 100644 index 0000000..9ba6e3a Binary files /dev/null and b/Tokens/0xA90D86BF4A86E9dA647ea4a744Ee25826cf41Af0/logo.png differ