Integrate GDEX DEX trading into Automaton runtime for autonomous revenue generation#2
Draft
Integrate GDEX DEX trading into Automaton runtime for autonomous revenue generation#2
Conversation
Co-authored-by: kingassune <6126851+kingassune@users.noreply.github.com>
…e, and tests Co-authored-by: kingassune <6126851+kingassune@users.noreply.github.com>
…OUR_MS, fix Function() constructor Co-authored-by: kingassune <6126851+kingassune@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Integrate GDEX SDK for crypto trading functionality
Integrate GDEX DEX trading into Automaton runtime for autonomous revenue generation
Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds GDEX multi-chain DEX trading capability to the Automaton agent so it can trade crypto to earn revenue and sustain itself. The GDEX custodial wallet is kept strictly separate from the agent's Conway operating wallet.
New modules
src/gdex/config.ts— ResolvesGDEX_PRIVATE_KEYfrom env/config; defaults: $5 max trade, 10 trades/hrsrc/gdex/client.ts— Fetch-based GDEX API wrapper with required browser headers (User-Agent,Origin,Referer), optionalgdex.pro-sdkfallback via dynamic import, and error-safe auth wrapping in all trade methodssrc/gdex/tools.ts— 9AutomatonTooldefinitions, allcategory: "financial":gdex_get_balancegdex_get_pricegdex_buy_tokengdex_sell_tokengdex_scan_solanagdex_limit_ordergdex_copy_tradegdex_trendinggdex_positionsskills/gdex-trading/SKILL.md— Auto-activating skill file (requiresGDEX_PRIVATE_KEY) with full trading workflow instructions for the agentSafety guardrails (enforced in every trade tool)
Type / config changes
AutomatonConfiggains:gdexPrivateKey?,gdexApiUrl?,gdexDefaultChain?,gdexMaxTradeSizeUsd?,gdexMaxTradesPerHour?ModificationTypegains:"tool_use"GdexTradeResult,GdexTokenInfo,GdexBalance,GdexPositionWiring
src/agent/tools.tsspreadscreateGdexTools()into the built-in tool registrypackage.jsonadds:gdex.pro-sdk,ethers ^6.16,@solana/web3.js ^1.98,bs58 ^6Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
mainnet.base.org/opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node --conditions development --conditions node /home/REDACTED/work/automaton/automaton/node_modules/.pnpm/tinypool@1.1.1/node_modules/tinypool/dist/entry/process.js(dns block)/opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node --conditions development --conditions node /home/REDACTED/work/automaton/automaton/node_modules/.pnpm/tinypool@1.1.1/node_modules/tinypool/dist/entry/process.js ng(dns block)/opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node --conditions development --conditions node /home/REDACTED/work/automaton/automaton/node_modules/.pnpm/tinypool@1.1.1/node_modules/tinypool/dist/entry/process.js ite3.o ndor/bin/as(dns block)trade-api.gemach.io/opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node --conditions development --conditions node /home/REDACTED/work/automaton/automaton/node_modules/.pnpm/tinypool@1.1.1/node_modules/tinypool/dist/entry/process.js ng(dns block)/opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node --conditions development --conditions node /home/REDACTED/work/automaton/automaton/node_modules/.pnpm/tinypool@1.1.1/node_modules/tinypool/dist/entry/process.js(dns block)/opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node --conditions development --conditions node /home/REDACTED/work/automaton/automaton/node_modules/.pnpm/tinypool@1.1.1/node_modules/tinypool/dist/entry/process.js ite3.o cal/bin/bash(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Goal
Integrate the GemachDAO/gdex-trading- SDK into the Automaton runtime so the autonomous agent can trade crypto to earn revenue and survive.
Context
The Automaton is a sovereign AI agent that runs a continuous loop (Think → Act → Observe → Repeat). It has:
src/identity/wallet.ts) usingviemsrc/survival/) — if credits hit $0, the agent diessrc/agent/tools.ts) with categories like"financial","vm","self_mod"src/skills/loader.ts) that reads.mdfiles with frontmatter from~/.automaton/skills/src/self-mod/) for installing tools at runtimeThe GDEX SDK (
GemachDAO/gdex-trading-) provides:gdex.pro-sdk,ethers,ws,@solana/web3.js,bs58https://trade-api.gemach.ioUser-Agent(browser-like),Origin: https://gdex.pro,Referer: https://gdex.pro/What needs to be built
1. GDEX Skill File:
skills/gdex-trading.mdCreate a skill file in the Automaton skills directory with proper frontmatter that the skill loader can parse. This should contain comprehensive instructions for the agent on how to use GDEX — based on the existing
SKILL.mdfrom the GDEX repo (51KB of documentation). Include:createAuthenticatedSession())Use the frontmatter format:
2. GDEX Trading Tools:
src/gdex/Create a new
src/gdex/directory with modules:src/gdex/client.ts— GDEX SDK wrappergdex.pro-sdkwith authenticated sessionsrc/identity/wallet.ts) OR a separateGDEX_PRIVATE_KEYfrom env/configbuyToken(),sellToken(),getBalance(),getPrice(),scanTokens(),copyTrade(),createLimitOrder()src/gdex/tools.ts— Automaton tool definitionsRegister new
AutomatonTool[]entries that the agent loop can call. Each tool should follow the existing pattern insrc/agent/tools.ts. Tools to create:gdex_get_balancefinancialgdex_buy_tokenfinancialgdex_sell_tokenfinancialgdex_get_pricefinancialgdex_scan_solanafinancialgdex_limit_orderfinancialgdex_copy_tradefinancialgdex_trendingfinancialgdex_positionsfinancialEach tool's
executefunction should:criticalordead)self-mod/audit-log.ts)src/gdex/config.ts— GDEX-specific configurationgdexPrivateKey,gdexApiUrl,gdexDefaultChainfields3. Wire into the main runtime
src/agent/tools.ts— Register GDEX toolsImport and register the new GDEX tools alongside existing tools. The agent's tool array in
tools.tsis a protected file, so this must be done here (not via self-mod). Add the GDEX tools to the tool registry so the agent can call them during its ReAct loop.src/config.ts— Add GDEX config fieldsAdd optional GDEX configuration to
AutomatonConfig:src/types.ts— Add GDEX-related typesAdd any new types needed for GDEX integration (trade results, token info, etc.)
package.json— Add GDEX dependenciesAdd to dependencies:
Note:
ethersmay conflict with the existingviemusage. Both can coexist —viemfor ...This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.