{
  "address": "G1NTsQ36mjPe89HtPYqxKsjY5HmYsDR6CbD2gd2U2pta",
  "metadata": {
    "name": "ext_spl",
    "version": "1.0.1",
    "spec": "0.1.0",
    "description": "SPL integration for GLAM Protocol"
  },
  "instructions": [
    {
      "name": "set_token_transfer_policy",
      "discriminator": [
        0,
        144,
        15,
        4,
        149,
        22,
        95,
        50
      ],
      "accounts": [
        {
          "name": "glam_state",
          "writable": true
        },
        {
          "name": "glam_signer",
          "writable": true,
          "signer": true
        },
        {
          "name": "glam_protocol_program",
          "address": "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"
        }
      ],
      "args": [
        {
          "name": "policy",
          "type": {
            "defined": {
              "name": "TransferPolicy"
            }
          }
        }
      ]
    },
    {
      "name": "token_close_account",
      "discriminator": [
        240,
        32,
        179,
        154,
        96,
        110,
        43,
        79
      ],
      "accounts": [
        {
          "name": "glam_state",
          "writable": true
        },
        {
          "name": "glam_vault",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  118,
                  97,
                  117,
                  108,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "glam_state"
              }
            ],
            "program": {
              "kind": "account",
              "path": "glam_protocol_program"
            }
          }
        },
        {
          "name": "glam_signer",
          "writable": true,
          "signer": true
        },
        {
          "name": "integration_authority",
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  105,
                  110,
                  116,
                  101,
                  103,
                  114,
                  97,
                  116,
                  105,
                  111,
                  110,
                  45,
                  97,
                  117,
                  116,
                  104,
                  111,
                  114,
                  105,
                  116,
                  121
                ]
              }
            ]
          }
        },
        {
          "name": "cpi_program"
        },
        {
          "name": "glam_protocol_program",
          "address": "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        },
        {
          "name": "token_account",
          "writable": true
        }
      ],
      "args": []
    },
    {
      "name": "token_transfer_checked",
      "discriminator": [
        169,
        178,
        117,
        156,
        169,
        191,
        199,
        116
      ],
      "accounts": [
        {
          "name": "glam_state",
          "writable": true
        },
        {
          "name": "glam_vault",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  118,
                  97,
                  117,
                  108,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "glam_state"
              }
            ],
            "program": {
              "kind": "account",
              "path": "glam_protocol_program"
            }
          }
        },
        {
          "name": "glam_signer",
          "writable": true,
          "signer": true
        },
        {
          "name": "integration_authority",
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  105,
                  110,
                  116,
                  101,
                  103,
                  114,
                  97,
                  116,
                  105,
                  111,
                  110,
                  45,
                  97,
                  117,
                  116,
                  104,
                  111,
                  114,
                  105,
                  116,
                  121
                ]
              }
            ]
          }
        },
        {
          "name": "cpi_program"
        },
        {
          "name": "glam_protocol_program",
          "address": "GLAMpaME8wdTEzxtiYEAa5yD8fZbxZiz2hNtV58RZiEz"
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        },
        {
          "name": "from",
          "writable": true
        },
        {
          "name": "mint"
        },
        {
          "name": "to",
          "writable": true
        }
      ],
      "args": [
        {
          "name": "amount",
          "type": "u64"
        },
        {
          "name": "decimals",
          "type": "u8"
        }
      ]
    }
  ],
  "accounts": [
    {
      "name": "StateAccount",
      "discriminator": [
        142,
        247,
        54,
        95,
        85,
        133,
        249,
        103
      ]
    }
  ],
  "types": [
    {
      "name": "AccountType",
      "type": {
        "kind": "enum",
        "variants": [
          {
            "name": "Vault"
          },
          {
            "name": "TokenizedVault"
          },
          {
            "name": "Mint"
          },
          {
            "name": "SingleAssetVault"
          }
        ]
      }
    },
    {
      "name": "AccruedFees",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "vault_subscription_fee",
            "type": "u128"
          },
          {
            "name": "vault_redemption_fee",
            "type": "u128"
          },
          {
            "name": "manager_subscription_fee",
            "type": "u128"
          },
          {
            "name": "manager_redemption_fee",
            "type": "u128"
          },
          {
            "name": "management_fee",
            "type": "u128"
          },
          {
            "name": "performance_fee",
            "type": "u128"
          },
          {
            "name": "protocol_base_fee",
            "type": "u128"
          },
          {
            "name": "protocol_flow_fee",
            "type": "u128"
          }
        ]
      }
    },
    {
      "name": "CreatedModel",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "key",
            "type": {
              "array": [
                "u8",
                8
              ]
            }
          },
          {
            "name": "created_by",
            "type": "pubkey"
          },
          {
            "name": "created_at",
            "type": "i64"
          }
        ]
      }
    },
    {
      "name": "DelegateAcl",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "pubkey",
            "type": "pubkey"
          },
          {
            "name": "integration_permissions",
            "type": {
              "vec": {
                "defined": {
                  "name": "IntegrationPermissions"
                }
              }
            }
          },
          {
            "name": "expires_at",
            "type": "i64"
          }
        ]
      }
    },
    {
      "name": "EngineField",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "name",
            "type": {
              "defined": {
                "name": "EngineFieldName"
              }
            }
          },
          {
            "name": "value",
            "type": {
              "defined": {
                "name": "EngineFieldValue"
              }
            }
          }
        ]
      }
    },
    {
      "name": "EngineFieldName",
      "type": {
        "kind": "enum",
        "variants": [
          {
            "name": "Owner"
          },
          {
            "name": "PortfolioManagerName"
          },
          {
            "name": "Name"
          },
          {
            "name": "Uri"
          },
          {
            "name": "Assets"
          },
          {
            "name": "DelegateAcls"
          },
          {
            "name": "IntegrationAcls"
          },
          {
            "name": "TimelockDuration"
          },
          {
            "name": "Borrowable"
          },
          {
            "name": "DefaultAccountStateFrozen"
          },
          {
            "name": "PermanentDelegate"
          },
          {
            "name": "NotifyAndSettle"
          },
          {
            "name": "FeeStructure"
          },
          {
            "name": "FeeParams"
          },
          {
            "name": "ClaimableFees"
          },
          {
            "name": "ClaimedFees"
          },
          {
            "name": "OracleConfigs"
          }
        ]
      }
    },
    {
      "name": "EngineFieldValue",
      "type": {
        "kind": "enum",
        "variants": [
          {
            "name": "Boolean",
            "fields": [
              {
                "name": "val",
                "type": "bool"
              }
            ]
          },
          {
            "name": "U8",
            "fields": [
              {
                "name": "val",
                "type": "u8"
              }
            ]
          },
          {
            "name": "U32",
            "fields": [
              {
                "name": "val",
                "type": "u32"
              }
            ]
          },
          {
            "name": "U64",
            "fields": [
              {
                "name": "val",
                "type": "u64"
              }
            ]
          },
          {
            "name": "String",
            "fields": [
              {
                "name": "val",
                "type": "string"
              }
            ]
          },
          {
            "name": "Pubkey",
            "fields": [
              {
                "name": "val",
                "type": "pubkey"
              }
            ]
          },
          {
            "name": "VecPubkey",
            "fields": [
              {
                "name": "val",
                "type": {
                  "vec": "pubkey"
                }
              }
            ]
          },
          {
            "name": "VecU8",
            "fields": [
              {
                "name": "val",
                "type": "bytes"
              }
            ]
          },
          {
            "name": "VecU32",
            "fields": [
              {
                "name": "val",
                "type": {
                  "vec": "u32"
                }
              }
            ]
          },
          {
            "name": "VecDelegateAcl",
            "fields": [
              {
                "name": "val",
                "type": {
                  "vec": {
                    "defined": {
                      "name": "DelegateAcl"
                    }
                  }
                }
              }
            ]
          },
          {
            "name": "VecIntegrationAcl",
            "fields": [
              {
                "name": "val",
                "type": {
                  "vec": {
                    "defined": {
                      "name": "IntegrationAcl"
                    }
                  }
                }
              }
            ]
          },
          {
            "name": "FeeStructure",
            "fields": [
              {
                "name": "val",
                "type": {
                  "defined": {
                    "name": "FeeStructure"
                  }
                }
              }
            ]
          },
          {
            "name": "FeeParams",
            "fields": [
              {
                "name": "val",
                "type": {
                  "defined": {
                    "name": "FeeParams"
                  }
                }
              }
            ]
          },
          {
            "name": "AccruedFees",
            "fields": [
              {
                "name": "val",
                "type": {
                  "defined": {
                    "name": "AccruedFees"
                  }
                }
              }
            ]
          },
          {
            "name": "NotifyAndSettle",
            "fields": [
              {
                "name": "val",
                "type": {
                  "defined": {
                    "name": "NotifyAndSettle"
                  }
                }
              }
            ]
          },
          {
            "name": "OracleConfigs",
            "fields": [
              {
                "name": "val",
                "type": {
                  "defined": {
                    "name": "OracleConfigs"
                  }
                }
              }
            ]
          }
        ]
      }
    },
    {
      "name": "EntryExitFees",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "subscription_fee_bps",
            "type": "u16"
          },
          {
            "name": "redemption_fee_bps",
            "type": "u16"
          }
        ]
      }
    },
    {
      "name": "FeeParams",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "year_in_seconds",
            "type": "u32"
          },
          {
            "name": "pa_high_water_mark",
            "type": "i128"
          },
          {
            "name": "pa_last_nav",
            "type": "i128"
          },
          {
            "name": "last_aum",
            "type": "i128"
          },
          {
            "name": "last_performance_fee_crystallized",
            "type": "i64"
          },
          {
            "name": "last_management_fee_crystallized",
            "type": "i64"
          },
          {
            "name": "last_protocol_fee_crystallized",
            "type": "i64"
          }
        ]
      }
    },
    {
      "name": "FeeStructure",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "vault",
            "type": {
              "defined": {
                "name": "EntryExitFees"
              }
            }
          },
          {
            "name": "manager",
            "type": {
              "defined": {
                "name": "EntryExitFees"
              }
            }
          },
          {
            "name": "management",
            "type": {
              "defined": {
                "name": "ManagementFee"
              }
            }
          },
          {
            "name": "performance",
            "type": {
              "defined": {
                "name": "PerformanceFee"
              }
            }
          },
          {
            "name": "protocol",
            "type": {
              "defined": {
                "name": "ProtocolFees"
              }
            }
          }
        ]
      }
    },
    {
      "name": "HurdleType",
      "type": {
        "kind": "enum",
        "variants": [
          {
            "name": "Hard"
          },
          {
            "name": "Soft"
          }
        ]
      }
    },
    {
      "name": "IntegrationAcl",
      "docs": [
        "An integration program can have multiple protocols supported.",
        "Enabled protocols are stored in a bitmask, and each protocol can have its own policy."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "integration_program",
            "type": "pubkey"
          },
          {
            "name": "protocols_bitmask",
            "type": "u16"
          },
          {
            "name": "protocol_policies",
            "type": {
              "vec": {
                "defined": {
                  "name": "ProtocolPolicy"
                }
              }
            }
          }
        ]
      }
    },
    {
      "name": "IntegrationPermissions",
      "docs": [
        "Stores delegate permissions for an integration program."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "integration_program",
            "type": "pubkey"
          },
          {
            "name": "protocol_permissions",
            "type": {
              "vec": {
                "defined": {
                  "name": "ProtocolPermissions"
                }
              }
            }
          }
        ]
      }
    },
    {
      "name": "ManagementFee",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "fee_bps",
            "type": "u16"
          }
        ]
      }
    },
    {
      "name": "NoticePeriodType",
      "type": {
        "kind": "enum",
        "variants": [
          {
            "name": "Hard"
          },
          {
            "name": "Soft"
          }
        ]
      }
    },
    {
      "name": "NotifyAndSettle",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "model",
            "type": {
              "defined": {
                "name": "ValuationModel"
              }
            }
          },
          {
            "name": "permissionless_fulfillment",
            "type": "bool"
          },
          {
            "name": "subscribe_notice_period_type",
            "type": {
              "defined": {
                "name": "NoticePeriodType"
              }
            }
          },
          {
            "name": "subscribe_notice_period",
            "type": "u64"
          },
          {
            "name": "subscribe_settlement_period",
            "type": "u64"
          },
          {
            "name": "subscribe_cancellation_window",
            "type": "u64"
          },
          {
            "name": "redeem_notice_period_type",
            "type": {
              "defined": {
                "name": "NoticePeriodType"
              }
            }
          },
          {
            "name": "redeem_notice_period",
            "type": "u64"
          },
          {
            "name": "redeem_settlement_period",
            "type": "u64"
          },
          {
            "name": "redeem_cancellation_window",
            "type": "u64"
          },
          {
            "name": "time_unit",
            "type": {
              "defined": {
                "name": "TimeUnit"
              }
            }
          },
          {
            "name": "_padding",
            "type": {
              "array": [
                "u8",
                3
              ]
            }
          }
        ]
      }
    },
    {
      "name": "OracleConfigs",
      "docs": [
        "Vault-specific oracle configs. If available, these configs are preferred over the global config."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "max_ages_seconds",
            "type": {
              "vec": {
                "array": [
                  "u16",
                  2
                ]
              }
            }
          },
          {
            "name": "padding",
            "type": {
              "array": [
                "u8",
                12
              ]
            }
          }
        ]
      }
    },
    {
      "name": "PerformanceFee",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "fee_bps",
            "type": "u16"
          },
          {
            "name": "hurdle_rate_bps",
            "type": "u16"
          },
          {
            "name": "hurdle_type",
            "type": {
              "defined": {
                "name": "HurdleType"
              }
            }
          }
        ]
      }
    },
    {
      "name": "PricedProtocol",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "rent",
            "type": "u64"
          },
          {
            "name": "amount",
            "type": "i128"
          },
          {
            "name": "decimals",
            "type": "u8"
          },
          {
            "name": "last_updated_slot",
            "type": "u64"
          },
          {
            "name": "integration_program",
            "type": "pubkey"
          },
          {
            "name": "protocol_bitflag",
            "type": "u16"
          },
          {
            "name": "positions",
            "type": {
              "vec": "pubkey"
            }
          }
        ]
      }
    },
    {
      "name": "ProtocolFees",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "base_fee_bps",
            "type": "u16"
          },
          {
            "name": "flow_fee_bps",
            "type": "u16"
          }
        ]
      }
    },
    {
      "name": "ProtocolPermissions",
      "docs": [
        "Represents a delegate's permissions for a specific protocol"
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "protocol_bitflag",
            "type": "u16"
          },
          {
            "name": "permissions_bitmask",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "ProtocolPolicy",
      "docs": [
        "Stores policy data for an integrated protocol.",
        "Integration programs serialize/deserialize this data."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "protocol_bitflag",
            "type": "u16"
          },
          {
            "name": "data",
            "type": "bytes"
          }
        ]
      }
    },
    {
      "name": "StateAccount",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "account_type",
            "type": {
              "defined": {
                "name": "AccountType"
              }
            }
          },
          {
            "name": "enabled",
            "type": "bool"
          },
          {
            "name": "vault",
            "type": "pubkey"
          },
          {
            "name": "owner",
            "type": "pubkey"
          },
          {
            "name": "portfolio_manager_name",
            "type": {
              "array": [
                "u8",
                32
              ]
            }
          },
          {
            "name": "created",
            "type": {
              "defined": {
                "name": "CreatedModel"
              }
            }
          },
          {
            "name": "base_asset_mint",
            "type": "pubkey"
          },
          {
            "name": "base_asset_decimals",
            "type": "u8"
          },
          {
            "name": "base_asset_token_program",
            "type": "u8"
          },
          {
            "name": "name",
            "type": {
              "array": [
                "u8",
                32
              ]
            }
          },
          {
            "name": "timelock_duration",
            "type": "u32"
          },
          {
            "name": "timelock_expires_at",
            "type": "u64"
          },
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "assets",
            "type": {
              "vec": "pubkey"
            }
          },
          {
            "name": "integration_acls",
            "type": {
              "vec": {
                "defined": {
                  "name": "IntegrationAcl"
                }
              }
            }
          },
          {
            "name": "delegate_acls",
            "type": {
              "vec": {
                "defined": {
                  "name": "DelegateAcl"
                }
              }
            }
          },
          {
            "name": "external_positions",
            "type": {
              "vec": "pubkey"
            }
          },
          {
            "name": "priced_protocols",
            "type": {
              "vec": {
                "defined": {
                  "name": "PricedProtocol"
                }
              }
            }
          },
          {
            "name": "params",
            "type": {
              "vec": {
                "vec": {
                  "defined": {
                    "name": "EngineField"
                  }
                }
              }
            }
          }
        ]
      }
    },
    {
      "name": "TimeUnit",
      "type": {
        "kind": "enum",
        "variants": [
          {
            "name": "Second"
          },
          {
            "name": "Slot"
          }
        ]
      }
    },
    {
      "name": "TransferPolicy",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "allowlist",
            "type": {
              "vec": "pubkey"
            }
          }
        ]
      }
    },
    {
      "name": "ValuationModel",
      "type": {
        "kind": "enum",
        "variants": [
          {
            "name": "Continuous"
          },
          {
            "name": "Periodic"
          }
        ]
      }
    }
  ],
  "constants": [
    {
      "name": "PROTO_TOKEN",
      "type": "u16",
      "value": "1"
    },
    {
      "name": "PROTO_TOKEN_PERM_TRANSFER",
      "type": "u64",
      "value": "1"
    }
  ]
}