
Autonomous social-sentiment rotation kernel · EIP-7702 × x402 V2 × TEE sybil sentinel
Turn real-time social signals into machine-to-machine executable financial primitives. Built for the OKX Onchain OS Hackathon.
Today's SocialFi ends at "launch a token." Social-Pulse treats social signals as a paid data stream that an autonomous agent consumes, validates, and converts into atomic on-chain rotations — without ever holding the user's private key.
Rotation executes on Arbitrum (where Uniswap V3 + Aave V3 live). Audit + medal mint land on X Layer (zero gas, high throughput). Both sides sign through the same TEE.
┌────────────────── Social-Pulse Agent (TypeScript) ──────────────────┐
│ │
│ x402 V2 session ──► sentiment-engine ──► decide ──► sybil-sentinel │
│ OKX DEX Signal ───► │ │
│ HOLD | GO_RISK | GO_HEDGE │
│ │
│ TEE (Agentic Wallet) signs Type-4 tx + follow-ups │
└────────────┬──────────────────────────────────────────┬──────────────┘
│ Arbitrum │ X Layer (zero gas)
▼ ▼
┌────────────────────────────────┐ ┌──────────────────────────────────┐
│ SocialPulseDelegate │ │ SocialPulseLog append-only log │
│ executeBatch([NPM,OKX,Aave]) │ │ SocialPulseMedal ERC-721 receipt │
└────────────────────────────────┘ └──────────────────────────────────┘Opens a session with a single EIP-3009 payment auth. Subsequent GET /sentiment hits are quota-metered, TTL-capped, and auto-refresh when ≤10% queries remain. $0.005 USDC per query. Protocol-level session semantics are real even against the local mock.
The EOA authorizes SocialPulseDelegate via an authorizationList tuple signed over keccak256(0x05 ‖ rlp([chainId, address, nonce])). Within a single Type-4 tx, executeBatch runs Aave.withdraw → OKX DEX swap → UniV3 increaseLiquidity. Reverts to pure EOA after — no idle-gas tax.
Three parallel checks gate every signature: (1) velocity z-score vs trailing hour, (2) author cluster Shannon entropy, (3) paid-sentiment vs smart-money divergence. Flagged? The agent refuses to call sign-typed-data. HOLD + flags still hit the on-chain log for audit.
GO_RISK = Aave.withdraw → OKX Router swap USDC→risk-asset → NPM.increaseLiquidity. GO_HEDGE = NPM.decreaseLiquidity + collect → OKX Router swap risk→USDC → Aave.supply. SocialPulseDelegate allowlist is immutable, checked on-chain.
Key algorithms, on-chain shapes, and the exact OKX surface. Every box maps to a file in the repo.
score = clamp01( 0.4 · (polarity + 100) / 200 // paid x402 polarity + 0.3 · (0.5 + smDelta / 1e7) // smart-money 24h USD + 0.2 · (velocityZ / 4) // mention-rate z-score + 0.1 · (signalCount / 10) // OKX signal events ) · 100
bit0 velocityZ ≥ 3.0 bit1 clusterEntropy < 1.2 bit2 polarity > +25 ∧ smDelta < -$500k ok = flags === 0 // No signature produced if !ok. // HOLD + flags still logged to X Layer.
keccak256(
0x05 ‖ rlp([
chainId, // 42161 (Arbitrum)
delegate, // SocialPulseDelegate
nonce
])
)
// TEE returns { yParity, r, s }
// Assembled into authorizationList tuple.executeBatch([
Aave.withdraw(USDC, amt, delegate),
OKXRouter.<swap>(USDC→riskAsset),
UniV3NPM.increaseLiquidity(pos),
])
// Allowlist: {NPM, Aave Pool, OKX Router}
// Any other target → TargetNotAllowed revertPOST /session/open
{ signature, authorization,
ttlSeconds: 300, maxQueries: 1000 }
→ { sessionId, ttl, maxQueries }
GET /sentiment?session=<id>&ticker=<t>
→ { polarity, velocityZ,
authorClusterEntropy, signalCount }
Refresh when queriesLeft < 10% or TTL < 30s.struct Entry {
uint64 timestamp;
address owner;
address agent;
Direction direction; // HOLD / GO_RISK / GO_HEDGE
uint8 sentimentScore;// 0-100
uint8 sybilFlags; // bitmask
uint256 usdAmount;
bytes32 batchTxHash; // Arbitrum tx
uint256 medalTokenId;
string reason;
}Streamed over SSE from the monitor loop. Heartbeat tick, composed score, last rotation card, and the addresses of the deployed on-chain infra.
○ OFFLINE — start with pnpm agent:startNo rotation yet — agent is in HEDGE-only heartbeat mode. Fire one from thesocial-pulse-action skill or setDEMO_MODE=true and inject a sentiment score.
Everything here is a link you can click and verify on a public explorer. No mocks, no testnets.
Zero-gas on X Layer — every decision (including HOLDs flagged by the sybil sentinel) is appended to the ledger.
Full-path test run on X Layer — OKX DEX swap, pre-execution security scan, TEE EIP-712 signing, native transfer.