🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@flipcoin/plugin-elizaos

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flipcoin/plugin-elizaos

ElizaOS plugin for FlipCoin prediction markets on Base

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

@flipcoin/plugin-elizaos

ElizaOS plugin for FlipCoin prediction markets on Base.

What it does

Gives any ElizaOS agent the ability to:

  • Browse and search prediction markets
  • Get price quotes (LMSR AMM)
  • Buy/sell YES and NO shares
  • Track portfolio positions and vault balance

Built-in risk guardrails: max trade size, daily spend limits, price impact checks, and idempotent trade execution.

Install

# From npm (when published)
npm install @flipcoin/plugin-elizaos

# From GitHub
npm install github:flipcoin-fun/eliza-plugin-flipcoin

Quick start

import { flipcoinPlugin } from "@flipcoin/plugin-elizaos";

// Add to your ElizaOS character config
const character = {
  // ...
  plugins: [flipcoinPlugin],
  settings: {
    FLIPCOIN_API_KEY: "fc_agent_live_...",    // Required
    FLIPCOIN_AUTO_SIGN: "true",               // Enable autonomous execution
    FLIPCOIN_MAX_TRADE_USDC: "50",            // Max per trade (default: $50)
    FLIPCOIN_MAX_DAILY_USDC: "200",           // Max daily spend (default: $200)
  },
};

Setup guide

What you need depends on what your agent will do:

GoalWhat's required
Read markets & quotesAPI key only
Trial market (free)API key + auto_sign setup
Buy sharesAPI key + Vault deposit + auto_sign
Sell sharesAll of the above + ShareToken approval

Step 1: Create agent & get API key

  • Go to flipcoin.fun/agents
  • Connect your wallet (MetaMask, Coinbase Wallet, etc.)
  • Click Create Agent and fill in agent details
  • Generate an API key — copy it immediately, it won't be shown again

Verify it works:

curl -s https://www.flipcoin.fun/api/agent/ping \
  -H "Authorization: Bearer fc_agent_live_..."
# → { "ok": true, "agentId": "...", ... }

Just want to read markets? You're done — skip to Configuration.

Step 2: Deposit USDC to Vault

Your agent trades from a VaultV2 balance, not your wallet balance directly. Two on-chain transactions are needed from the owner wallet:

  • Approve: USDC.approve(VaultV2, amount) — allow VaultV2 to spend your USDC
  • Deposit: VaultV2.deposit(amount) — transfer USDC into the Vault ledger

Easier option: Use the "Add Funds" button on the Agents page or Settings page — it handles approve + deposit in one flow.

Minimum deposits by tier:

TierDepositUse case
Trial$0 (platform-funded)First market free via Trial Program
Low$35Small markets
Medium$139Standard markets
High$693High-liquidity markets

Contract addresses (Base Sepolia):

  • USDC: 0xf60a8672FB18f66Ed21b2EaB872188A2b75a7433
  • VaultV2: 0xf2355D5AcB84e964A1564f1Db16a1a0571c4C71A

Step 3: Set up auto_sign (autonomous mode)

For your agent to trade without manual wallet signatures, you need a session key with on-chain delegation:

  • Go to flipcoin.fun/agents → your agent → Session Keys
  • Click Create Session Key — the UI generates a key pair
  • Approve the DelegationRegistry.setDelegation() transaction in your wallet
  • Done — the UI confirms delegation automatically

DelegationRegistry address (Base Sepolia): 0x945f3848D818FD4Fbc399cB13B647E4c89e744aa

Trial market shortcut: With auto_sign enabled, you can create your first market for free — no Vault deposit needed. See Trial Program.

Step 4: ShareToken approval (for selling)

Before selling shares, the owner wallet must approve the operator contracts to transfer ERC-1155 tokens. These are one-time transactions:

  • LMSR sells: ShareToken.setApprovalForAll(backstopRouterAddress, true)
  • CLOB sells: ShareToken.setApprovalForAll(exchangeAddress, true)

Get contract addresses from the config endpoint:

curl -s https://www.flipcoin.fun/api/agent/config \
  -H "Authorization: Bearer $API_KEY" | jq '.contracts'

If approval is missing, the API returns SHARE_TOKEN_NOT_APPROVED with the exact contract and function to call.

Troubleshooting

ErrorCauseFix
UNAUTHORIZEDInvalid or missing API keyCheck FLIPCOIN_API_KEY value
INSUFFICIENT_VAULT_BALANCENot enough USDC in VaultDeposit via UI or contract
DELEGATION_NOT_CONFIRMEDSession key not confirmed in DBComplete setDelegation() tx, then confirm in UI
NOT_DELEGATEDSession key not registered on-chainCall setDelegation() on DelegationRegistry
SHARE_TOKEN_NOT_APPROVEDMissing ERC-1155 approval for sellsCall setApprovalForAll() from owner wallet
INTENT_EXPIREDToo much time between intent and relayPlugin handles this automatically; check network latency
ORACLE_MISMATCHMarket uses a different oracle than expectedRetry or check market details

Configuration

SettingRequiredDefaultDescription
FLIPCOIN_API_KEYYesAgent API key from FlipCoin
FLIPCOIN_AUTO_SIGNNofalseEnable server-side signing for autonomous trades
FLIPCOIN_MAX_TRADE_USDCNo50Maximum single trade size in USDC
FLIPCOIN_MAX_DAILY_USDCNo200Maximum daily spend in USDC
FLIPCOIN_BASE_URLNohttps://www.flipcoin.funAPI base URL

Actions

ActionDescription
LIST_MARKETSBrowse open prediction markets with filters
GET_MARKETGet detailed info about a specific market
GET_QUOTEPreview a trade without executing
BUY_YESBuy YES shares on a market
BUY_NOBuy NO shares on a market
SELL_YESSell YES shares
SELL_NOSell NO shares

Providers

ProviderDescription
flipcoin-marketsTop open markets injected into agent context
flipcoin-portfolioVault balance and top positions summary
flipcoin-capabilitiesWhat the agent can do, trade limits, daily budget

Architecture

Agent message
  → shouldTrade evaluator (soft gate: budget, capabilities)
  → Action handler (e.g. BUY_YES)
    → MarketService.getQuote() (preview)
    → PolicyService.assertCanTrade() (hard gate: limits, impact, market status)
    → TradingService.executeTrade() (intent → relay → receipt)
      → Idempotency journal (dedup within 10s window)
    → PolicyService.recordSpend()
  → TradeReceipt returned to agent

Known limitations

  • Daily spend tracking is in-memory: resets on agent restart. Server-side limits (DelegationRegistry) provide the durable safety net.
  • Sell actions accept USDC amount: for sell trades, the amount is specified in USDC (not shares). Share-based sells are planned for Phase 2.

Roadmap

  • Phase 1 (current): Read markets + LMSR trading
  • Phase 2: Market creation, feed/webhooks, agent stats
  • Phase 3: CLOB limit orders, autonomous strategies, comments

Resources

Development

npm install
npm run build     # Build with tsup
npm test          # Run tests (vitest)
npm run dev       # Watch mode

License

MIT

Keywords

elizaos

FAQs

Package last updated on 20 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts