{
  "address": "R467NctqAyhF21QV2BAVRUW8D9iT6bXuWAUYxJWmKb9",
  "metadata": {
    "name": "agent_vault",
    "version": "0.1.0",
    "spec": "0.1.0",
    "description": "The charter-bounded creator of an agent Dual Fill's Solana side"
  },
  "docs": [
    "The creator of an agent Dual Fill's Solana side. An `Agent` holds a charter; its vault, a",
    "system account only this program signs for, creates the fill, receives the launch's creator",
    "income once the fill opens, and spends it on the operator's buys and payouts within the",
    "charter's limits."
  ],
  "instructions": [
    {
      "name": "bind",
      "discriminator": [
        178,
        57,
        187,
        254,
        138,
        43,
        99,
        134
      ],
      "accounts": [
        {
          "name": "agent",
          "writable": true
        },
        {
          "name": "fill",
          "relations": [
            "agent"
          ]
        },
        {
          "name": "launch",
          "relations": [
            "agent"
          ]
        }
      ],
      "args": []
    },
    {
      "name": "buy",
      "discriminator": [
        102,
        6,
        61,
        18,
        1,
        218,
        235,
        234
      ],
      "accounts": [
        {
          "name": "operator",
          "signer": true,
          "relations": [
            "agent"
          ]
        },
        {
          "name": "agent",
          "writable": true
        },
        {
          "name": "vault",
          "writable": true,
          "relations": [
            "agent"
          ]
        },
        {
          "name": "fill",
          "relations": [
            "agent"
          ]
        },
        {
          "name": "config"
        },
        {
          "name": "launch",
          "writable": true,
          "relations": [
            "agent"
          ]
        },
        {
          "name": "launch_authority"
        },
        {
          "name": "mint",
          "relations": [
            "agent"
          ]
        },
        {
          "name": "token_vault",
          "writable": true
        },
        {
          "name": "vault_token",
          "writable": true
        },
        {
          "name": "treasury",
          "writable": true
        },
        {
          "name": "buyback_vault",
          "writable": true
        },
        {
          "name": "token_program",
          "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
        },
        {
          "name": "associated_token_program",
          "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        },
        {
          "name": "ripples_program",
          "address": "RippcKjgg9pkjHY7RKp6R1K8jPGwq2BRSJcgbErufjF"
        }
      ],
      "args": [
        {
          "name": "quote_in",
          "type": "u64"
        },
        {
          "name": "min_tokens_out",
          "type": "u64"
        }
      ]
    },
    {
      "name": "cancel_fill",
      "discriminator": [
        72,
        168,
        2,
        51,
        128,
        94,
        45,
        22
      ],
      "accounts": [
        {
          "name": "sponsor",
          "signer": true,
          "relations": [
            "agent"
          ]
        },
        {
          "name": "agent"
        },
        {
          "name": "vault",
          "relations": [
            "agent"
          ]
        },
        {
          "name": "fill",
          "writable": true,
          "relations": [
            "agent"
          ]
        },
        {
          "name": "dual_fill_program",
          "address": "98pdDLeZS9qJxz8e5TubnNyVh4YT5rsA2Vm8X7NbpNRT"
        }
      ],
      "args": []
    },
    {
      "name": "collect_wsol",
      "discriminator": [
        157,
        47,
        46,
        132,
        115,
        245,
        221,
        11
      ],
      "accounts": [
        {
          "name": "agent"
        },
        {
          "name": "vault",
          "writable": true,
          "relations": [
            "agent"
          ]
        },
        {
          "name": "fill",
          "relations": [
            "agent"
          ]
        },
        {
          "name": "vault_wsol",
          "writable": true
        },
        {
          "name": "token_program",
          "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
        }
      ],
      "args": []
    },
    {
      "name": "create_agent",
      "discriminator": [
        143,
        66,
        198,
        95,
        110,
        85,
        83,
        249
      ],
      "accounts": [
        {
          "name": "sponsor",
          "writable": true,
          "signer": true
        },
        {
          "name": "agent",
          "writable": true
        },
        {
          "name": "vault",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  118,
                  97,
                  117,
                  108,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "agent"
              }
            ]
          }
        },
        {
          "name": "fill",
          "writable": true
        },
        {
          "name": "fill_vault",
          "writable": true
        },
        {
          "name": "ripples_config"
        },
        {
          "name": "dual_fill_program",
          "address": "98pdDLeZS9qJxz8e5TubnNyVh4YT5rsA2Vm8X7NbpNRT"
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        }
      ],
      "args": [
        {
          "name": "charter",
          "type": {
            "defined": {
              "name": "Charter"
            }
          }
        },
        {
          "name": "runway",
          "type": "u64"
        },
        {
          "name": "fill_args",
          "type": {
            "defined": {
              "name": "CreateFillArgs"
            }
          }
        }
      ]
    },
    {
      "name": "note",
      "discriminator": [
        113,
        25,
        178,
        116,
        227,
        171,
        81,
        41
      ],
      "accounts": [
        {
          "name": "operator",
          "signer": true,
          "relations": [
            "agent"
          ]
        },
        {
          "name": "agent"
        }
      ],
      "args": [
        {
          "name": "digest",
          "type": {
            "array": [
              "u8",
              32
            ]
          }
        },
        {
          "name": "uri",
          "type": "string"
        }
      ]
    },
    {
      "name": "pay",
      "discriminator": [
        119,
        18,
        216,
        65,
        192,
        117,
        122,
        220
      ],
      "accounts": [
        {
          "name": "operator",
          "signer": true,
          "relations": [
            "agent"
          ]
        },
        {
          "name": "agent",
          "writable": true
        },
        {
          "name": "vault",
          "writable": true,
          "relations": [
            "agent"
          ]
        },
        {
          "name": "fill",
          "relations": [
            "agent"
          ]
        },
        {
          "name": "launch",
          "relations": [
            "agent"
          ]
        },
        {
          "name": "payee",
          "writable": true
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        }
      ],
      "args": [
        {
          "name": "amount",
          "type": "u64"
        }
      ]
    },
    {
      "name": "release_runway",
      "discriminator": [
        70,
        148,
        172,
        226,
        199,
        5,
        21,
        93
      ],
      "accounts": [
        {
          "name": "agent",
          "writable": true
        },
        {
          "name": "vault",
          "writable": true,
          "relations": [
            "agent"
          ]
        },
        {
          "name": "fill",
          "relations": [
            "agent"
          ]
        },
        {
          "name": "sponsor",
          "writable": true,
          "relations": [
            "agent"
          ]
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        }
      ],
      "args": []
    },
    {
      "name": "retire_operator",
      "discriminator": [
        168,
        74,
        237,
        219,
        153,
        216,
        197,
        49
      ],
      "accounts": [
        {
          "name": "sponsor",
          "signer": true,
          "relations": [
            "agent"
          ]
        },
        {
          "name": "agent",
          "writable": true
        }
      ],
      "args": []
    }
  ],
  "accounts": [
    {
      "name": "Agent",
      "discriminator": [
        47,
        166,
        112,
        147,
        155,
        197,
        86,
        7
      ]
    }
  ],
  "events": [
    {
      "name": "AgentBought",
      "discriminator": [
        226,
        9,
        125,
        97,
        246,
        13,
        249,
        217
      ]
    },
    {
      "name": "AgentCreated",
      "discriminator": [
        237,
        44,
        61,
        111,
        90,
        251,
        241,
        34
      ]
    },
    {
      "name": "AgentFillCancelled",
      "discriminator": [
        192,
        70,
        21,
        61,
        17,
        156,
        207,
        202
      ]
    },
    {
      "name": "AgentNoted",
      "discriminator": [
        115,
        12,
        59,
        185,
        204,
        109,
        34,
        163
      ]
    },
    {
      "name": "AgentPaid",
      "discriminator": [
        139,
        166,
        125,
        203,
        163,
        24,
        31,
        93
      ]
    },
    {
      "name": "OperatorRetired",
      "discriminator": [
        64,
        205,
        193,
        232,
        166,
        247,
        2,
        36
      ]
    },
    {
      "name": "RunwayReleased",
      "discriminator": [
        215,
        79,
        14,
        188,
        53,
        182,
        168,
        211
      ]
    },
    {
      "name": "WsolCollected",
      "discriminator": [
        190,
        210,
        57,
        195,
        83,
        51,
        245,
        29
      ]
    }
  ],
  "errors": [
    {
      "code": 6000,
      "name": "InvalidOperator",
      "msg": "The operator must be an address other than the sponsor"
    },
    {
      "code": 6001,
      "name": "InvalidSpendLimits",
      "msg": "The daily limit must be above zero and the per-call limit above zero and within it"
    },
    {
      "code": 6002,
      "name": "AboveCap",
      "msg": "A spending limit is above its cap for this market's opening reserve"
    },
    {
      "code": 6003,
      "name": "TooManyPayees",
      "msg": "A charter names at most eight payees"
    },
    {
      "code": 6004,
      "name": "InvalidPayee",
      "msg": "A payee is empty, repeated, the sponsor, the agent or its vault"
    },
    {
      "code": 6005,
      "name": "NoRunway",
      "msg": "An agent needs a runway"
    },
    {
      "code": 6006,
      "name": "ShapeUnavailable",
      "msg": "Agents take token Dual Fill terms only"
    },
    {
      "code": 6007,
      "name": "FillMismatch",
      "msg": "The fill or launch is not this agent's"
    },
    {
      "code": 6008,
      "name": "NotOpened",
      "msg": "The agent's fill has not opened"
    },
    {
      "code": 6009,
      "name": "NotTrading",
      "msg": "The agent's market is no longer trading on its curve"
    },
    {
      "code": 6010,
      "name": "TokenQuoted",
      "msg": "The agent's market is not quoted in SOL"
    },
    {
      "code": 6011,
      "name": "PayoutElsewhere",
      "msg": "The market's creator income does not reach the agent's vault"
    },
    {
      "code": 6012,
      "name": "NotOperator",
      "msg": "Only the agent's operator may do this"
    },
    {
      "code": 6013,
      "name": "NotSponsor",
      "msg": "Only the agent's sponsor may do this"
    },
    {
      "code": 6014,
      "name": "OverCallSpend",
      "msg": "The spend is above the per-call limit"
    },
    {
      "code": 6015,
      "name": "OverDailySpend",
      "msg": "The spend would pass the daily limit"
    },
    {
      "code": 6016,
      "name": "NotPayee",
      "msg": "The address is not one of the agent's payees"
    },
    {
      "code": 6017,
      "name": "ZeroAmount",
      "msg": "Amount is zero"
    },
    {
      "code": 6018,
      "name": "BelowRentFloor",
      "msg": "The vault would fall below its rent floor"
    },
    {
      "code": 6019,
      "name": "UnexpectedBalance",
      "msg": "The buy delivered fewer tokens than it asked for"
    },
    {
      "code": 6020,
      "name": "FillAlive",
      "msg": "The agent's fill can still open"
    },
    {
      "code": 6021,
      "name": "AlreadyLive",
      "msg": "The agent's market has opened"
    },
    {
      "code": 6022,
      "name": "NoteTooLong",
      "msg": "Note URI is too long"
    },
    {
      "code": 6023,
      "name": "NothingToCollect",
      "msg": "The vault holds no wrapped SOL account"
    },
    {
      "code": 6024,
      "name": "Overflow",
      "msg": "Arithmetic overflow"
    },
    {
      "code": 6025,
      "name": "OperatorRetired",
      "msg": "The sponsor has stopped this agent"
    },
    {
      "code": 6026,
      "name": "AlreadyRetired",
      "msg": "The agent is already stopped"
    },
    {
      "code": 6027,
      "name": "SnipeWindowOpen",
      "msg": "The market's opening charge window has not passed"
    },
    {
      "code": 6028,
      "name": "VaultAltered",
      "msg": "A program the vault signed for changed the vault or its token account's authority"
    },
    {
      "code": 6029,
      "name": "PerCallBelowRent",
      "msg": "The per-call limit must be above the rent of the vault's token account"
    }
  ],
  "types": [
    {
      "name": "Agent",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "sponsor",
            "docs": [
              "Funded the runway and created the fill. May cancel the fill while it is filling and stop",
              "the operator for good, and neither moves any funds. A side that never opens returns its",
              "runway here."
            ],
            "type": "pubkey"
          },
          {
            "name": "operator",
            "type": "pubkey"
          },
          {
            "name": "vault",
            "docs": [
              "The fill's creator and, once the fill opens, where its launch pays creator income."
            ],
            "type": "pubkey"
          },
          {
            "name": "fill",
            "type": "pubkey"
          },
          {
            "name": "launch",
            "type": "pubkey"
          },
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "dual_fill_key",
            "type": {
              "array": [
                "u8",
                32
              ]
            }
          },
          {
            "name": "daily_spend",
            "type": "u64"
          },
          {
            "name": "per_call_spend",
            "type": "u64"
          },
          {
            "name": "spend",
            "type": {
              "defined": {
                "name": "Meter"
              }
            }
          },
          {
            "name": "created_at",
            "type": "i64"
          },
          {
            "name": "live",
            "docs": [
              "Set by `bind` or the first spend after the fill opened, once the fill and its launch were",
              "checked."
            ],
            "type": "bool"
          },
          {
            "name": "released",
            "docs": [
              "Set by the first `release_runway`."
            ],
            "type": "bool"
          },
          {
            "name": "retired",
            "docs": [
              "Set by `retire_operator`, and never cleared."
            ],
            "type": "bool"
          },
          {
            "name": "bump",
            "type": "u8"
          },
          {
            "name": "vault_bump",
            "type": "u8"
          },
          {
            "name": "payees",
            "type": {
              "vec": "pubkey"
            }
          }
        ]
      }
    },
    {
      "name": "AgentBought",
      "docs": [
        "`spent` is what the meter counted: the quote paid in, or the vault's whole loss when that was",
        "larger, as when the first buy also pays for the vault's token account."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "agent",
            "type": "pubkey"
          },
          {
            "name": "quote_in",
            "type": "u64"
          },
          {
            "name": "spent",
            "type": "u64"
          },
          {
            "name": "tokens",
            "type": "u64"
          },
          {
            "name": "spend_used",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "AgentCreated",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "agent",
            "type": "pubkey"
          },
          {
            "name": "vault",
            "type": "pubkey"
          },
          {
            "name": "sponsor",
            "type": "pubkey"
          },
          {
            "name": "operator",
            "type": "pubkey"
          },
          {
            "name": "fill",
            "type": "pubkey"
          },
          {
            "name": "dual_fill_key",
            "type": {
              "array": [
                "u8",
                32
              ]
            }
          },
          {
            "name": "runway",
            "type": "u64"
          },
          {
            "name": "daily_spend",
            "type": "u64"
          },
          {
            "name": "per_call_spend",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "AgentFillCancelled",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "agent",
            "type": "pubkey"
          },
          {
            "name": "fill",
            "type": "pubkey"
          }
        ]
      }
    },
    {
      "name": "AgentNoted",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "agent",
            "type": "pubkey"
          },
          {
            "name": "digest",
            "type": {
              "array": [
                "u8",
                32
              ]
            }
          },
          {
            "name": "uri",
            "type": "string"
          }
        ]
      }
    },
    {
      "name": "AgentPaid",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "agent",
            "type": "pubkey"
          },
          {
            "name": "payee",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "type": "u64"
          },
          {
            "name": "spend_used",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "Charter",
      "docs": [
        "What an agent may do, fixed when it is created: who operates it, how much it may spend in one",
        "call and over a rolling day, and the only addresses it may pay."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "operator",
            "type": "pubkey"
          },
          {
            "name": "daily_spend",
            "type": "u64"
          },
          {
            "name": "per_call_spend",
            "type": "u64"
          },
          {
            "name": "payees",
            "type": {
              "vec": "pubkey"
            }
          }
        ]
      }
    },
    {
      "name": "CreateFillArgs",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "dual_fill_key",
            "type": {
              "array": [
                "u8",
                32
              ]
            }
          },
          {
            "name": "opener",
            "type": "pubkey"
          },
          {
            "name": "open_alone",
            "type": "bool"
          },
          {
            "name": "target",
            "type": "u64"
          },
          {
            "name": "deadline",
            "type": "i64"
          },
          {
            "name": "public_until",
            "type": "i64"
          },
          {
            "name": "terms",
            "type": {
              "defined": {
                "name": "Terms"
              }
            }
          },
          {
            "name": "quote_mint",
            "type": "pubkey"
          }
        ]
      }
    },
    {
      "name": "Meter",
      "docs": [
        "What buys and payouts have spent over a rolling day. The count falls by the daily limit over",
        "every 86,400 seconds, a second at a time, so the limit never renews all at once."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "at",
            "docs": [
              "When the count was last booked."
            ],
            "type": "i64"
          },
          {
            "name": "used",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "OperatorRetired",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "agent",
            "type": "pubkey"
          },
          {
            "name": "sponsor",
            "type": "pubkey"
          }
        ]
      }
    },
    {
      "name": "RunwayReleased",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "agent",
            "type": "pubkey"
          },
          {
            "name": "sponsor",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "Terms",
      "docs": [
        "Everything `create_launch` will be called with that is not a program constant. Written once",
        "at `create_fill`; `open` takes no arguments, so nothing about the launch is chosen by the key",
        "that opens it."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "nonce",
            "type": "u64"
          },
          {
            "name": "virtual_quote",
            "type": "u64"
          },
          {
            "name": "graduation_quote",
            "type": "u64"
          },
          {
            "name": "creator_tax_bps",
            "type": "u16"
          },
          {
            "name": "name",
            "type": "string"
          },
          {
            "name": "symbol",
            "type": "string"
          },
          {
            "name": "uri",
            "type": "string"
          }
        ]
      }
    },
    {
      "name": "WsolCollected",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "agent",
            "type": "pubkey"
          },
          {
            "name": "lamports",
            "type": "u64"
          }
        ]
      }
    }
  ]
}