Developer Portal Agent-to-Agent (A2A) GenLayer Bradbury (4221)

Soyara DEX Developer & Agent Workbench

Build, test, and integrate autonomous AI agents, algorithmic bots, and smart contract callers with Soyara DEX’s GenVM Intelligent Contracts and AGGFlow Aggregator.

Settlement Dry Run

Build the exact order the app would ask AgentValidator (0xd1D809A1...) to approve: live best-route quote, route program, and the commitment AgentExecutor would require. No round is opened; the response also says whether a mandate you hold already covers it.

SWAP (the agent surfaces settle swaps; liquidity is on the pools app)
Order, Commitment and Rail
// Dry Run builds the exact order a consensus round would be opened against. It opens nothing and approves nothing.

Multi-Language Integration Snippets

Ready-to-use boilerplate code for TypeScript, Python, Solidity smart contracts, and raw JSON-RPC.

typescript
// TypeScript / Node.js agent against the app's settlement API.
// Validation is a GenLayer consensus WRITE and settlement is an onlyAgent call
// on AgentExecutor, so both run server-side, where those keys live.
const BASE = 'https://app.soyara.xyz';   // or your deployment of these routes
const USER = '0xYourWallet';               // receives the output; approved AgentExecutor once

const post = (path: string, body: object) =>
  fetch(BASE + path, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) })
    .then((r) => r.json());

export async function executeAgentTrade() {
  // 1. AgentValidator 0xd1D809A1210cc039AEdBF5cD04628416Ad0e6a92 authorises the exact order,
  //    or a mandate you already hold covers it. The response names the rail.
  let v = await post('/api/genlayer-validate', {
    action: 'SWAP', user: USER, tokenIn: 'USDC', tokenOut: 'WGEN', amountIn: '100', slippageBps: 30,
  });
  while (v.pending) {
    await new Promise((r) => setTimeout(r, 4000));
    v = { ...v, ...(await post('/api/genlayer-validate', { checkTxHash: v.tx_hash, proposalId: v.proposal_id })) };
  }
  if (!v.approved) throw new Error(`Consensus did not approve: ${v.reason}`);

  // 2. AgentExecutor 0x1BCBad3da718690fa60289DcBF15835e5C79021f settles it on that rail.
  //    consensus rail: 202 { pending } until the verdict lands (appeal window) - retry.
  return post('/api/agent-execute', {
    rail: v.rail, mandateId: v.mandate_id,
    pendingOrder: v.pendingOrder, pendingProgram: v.pendingProgram,
    validationSubmitted: v.validationSubmitted, validationTxHash: v.tx_hash,
  });
}

Autonomous AI Agent Starter Templates

Pre-engineered agent patterns designed to run 24/7 with on-chain Intelligent Contract guardrails.

High Frequency: Watches SoyaraDex V2 and V3 pools for price spreads and trades them, each trade authorised by GenLayer consensus and settled by AgentExecutor on the best route.

JavaScript Template
// validate(intent) and settle(v) are the two calls from the TypeScript
// snippet above: /api/genlayer-validate, then /api/agent-execute.
async function runArbitrageScanner() {
  const spreadBps = await readVenueSpreadBps('USDC', 'WGEN'); // from live pool reserves
  if (spreadBps < 45) return;                                  // not worth the fees

  const v = await validate({ tokenIn: 'USDC', tokenOut: 'WGEN', amountIn: '500', slippageBps: 20 });
  if (!v.approved) return console.log('consensus refused:', v.reason);

  // The aggregator already picked the best route; the order binds it.
  const s = await settle(v);
  console.log('settled via', s.rail, s.execTxHash || '(verdict still finalizing)');
}

Protocol Contracts & Verification Directory

Direct references and explorer links for all deployed core smart contracts on Bradbury Testnet (4221).

AgentValidator (GenLayer IC)
0xd1D809A1210cc039AEdBF5cD04628416Ad0e6a92
View on Bradbury Explorer
AgentExecutor (Settlement Gate)
0x1BCBad3da718690fa60289DcBF15835e5C79021f
View on Bradbury Explorer
AGGFlow Entrypoint (EVM Aggregator)
0x95feE6Cb918Ed9C621E36082EE8D998873031EaA
View on Bradbury Explorer
Canonical Wrapped GEN (WGEN)
0x315374AA9b5536037Cc1Efeea2439CCC0913A77e
View on Bradbury Explorer