Salmon

Developers

A key, a rule, a webhook. Then, when you want the chain to check the condition itself, a receiver contract.

Get a key

One call, no account. The key and the webhook secret are shown once.

Create a rule

JSON conditions on Hyperliquid perp markets. Replay it on the past before it goes live.

Receive the run

A signed webhook, the event stream, or a call to your contract on Elysium.

TypeScript SDK

No dependency. Node 18+ and browsers. Ships in the sdk/ folder of the project.

import { Salmon, verifyWebhook } from "salmon-sdk";

const salmon = new Salmon({ baseUrl: location.origin });
await salmon.createKey();

const rule = {
  name: "Funding spike",
  conditions: [{ market: "BTC", metric: "funding", op: ">", value: 0.01 }],
  action: { type: "webhook", url: "https://your.app/hooks/salmon" },
};
const replay = await salmon.simulate({ ...rule, days: 14 });
const automation = await salmon.automations.create(rule);

for await (const ev of salmon.stream({ own: true }))
  console.log(ev.type, ev.name);

On-chain receiver

Your contract implements one function. The registry is shared by every user, so check owner.

interface ISalmonReceiver {
  function onSalmon(uint256 id, address owner,
    int256[] calldata values, bytes calldata data) external;
}

contract Vault is ISalmonReceiver {
  address immutable salmon; address immutable me;
  bool public paused;

  function onSalmon(uint256, address owner,
      int256[] calldata, bytes calldata) external {
    require(msg.sender == salmon, "not salmon");
    require(owner == me, "not my automation");
    paused = true;
  }
}

API reference

Every endpoint, the rule format, the event schema, webhook signatures and limits.

Read the docs

On-chain automations

Create one from your wallet, see the keeper run it, read the contract addresses.

Open on-chain

Run a keeper

Execution is open: anyone can call execute with a signed observation and earn the bounty.

Keeper network