Skip to main content

Solana Policies

This section provides examples of common Solana policies.

SPL Token Transfer Limit

Allow transfer of a specific SPL token (e.g., USDC) and restrict the amount.

{
"version": "1.0",
"description": "Limit USDC transfer on Solana",
"rules": [
{
"description": "Allow USDC transfer <= 100",
"issuer": [{ "type": "*", "id": "*" }],
"action": "allow",
"logic": "and",
"chain_type": "solana",
"conditions": [
{
"logic": "and",
"group": [
{
"transaction_type": "solanaTransaction",
"transaction_attr": "splTokenMint",
"operator": "eq",
"value": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
},
{
"transaction_type": "solanaTransaction",
"transaction_attr": "splTransferAmount",
"operator": "lte",
"value": 100000000
}
]
}
]
}
]
}

Native SOL Transfer Limit

Restrict SOL transfers to a maximum of 1 SOL.

{
"version": "1.0",
"description": "Cap SOL transfers at 1 SOL",
"rules": [
{
"description": "Allow SOL transfer <= 1.0",
"issuer": [{ "type": "*", "id": "*" }],
"action": "allow",
"logic": "and",
"chain_type": "solana",
"conditions": [
{
"transaction_type": "nativeTransfer",
"transaction_attr": "nativeValue",
"operator": "lte",
"value": 1000000000
}
]
}
]
}

Program Interaction Restriction

Only allow interactions with a specific Program ID.

{
"version": "1.0",
"description": "Restrict to specific Program ID",
"rules": [
{
"description": "Allow interaction with Program X",
"issuer": [{ "type": "*", "id": "*" }],
"action": "allow",
"logic": "and",
"chain_type": "solana",
"conditions": [
{
"transaction_type": "solanaTransaction",
"transaction_attr": "solanaAccountKeys",
"operator": "in",
"value": ["ProgramId1111111111111111111111111111111111"]
}
]
}
]
}

Allow a SOL Transfer instruction with a max value to allowlisted recipients

Allow a transfer instruction to specific allowlisted accounts with a maximum value.

{
"version": "1.0",
"description": "Allow transfer to allowlisted recipients with max value",
"rules": [
{
"description": "Allow transfer if recipient is allowlisted and amount <= limit",
"issuer": [{ "type": "*", "id": "*" }],
"action": "allow",
"logic": "and",
"chain_type": "solana",
"conditions": [
{
"logic": "and",
"group": [
{
"transaction_type": "solanaTransaction",
"transaction_attr": "solanaAccountKeys",
"operator": "in",
"value": ["RecipientAddress1", "RecipientAddress2"]
},
{
"transaction_type": "solanaTransaction",
"transaction_attr": "splTransferAmount",
"operator": "lte",
"value": 1000000
}
]
}
]
}
]
}

Allowlist system program instructions and token program instructions

Allow a transaction that includes a System Program instruction (Transfer or CreateAccount) and a Token Program instruction (Transfer).

{
"version": "1.0",
"description": "Multi Instruction Policy",
"rules": [
{
"description": "Allow if contains Transfer",
"issuer": [{ "type": "*", "id": "*" }],
"action": "allow",
"chain_type": "solana",
"conditions": [
{
"transaction_type": "solanaTransaction",
"transaction_attr": "systemInstructionName",
"operator": "in",
"value": ["Transfer", "CreateAccount"]
},
{
"transaction_type": "solanaTransaction",
"transaction_attr": "splInstructionName",
"operator": "eq",
"value": "Transfer"
}
]
}
]
}

Allow specific NFT Transfer

Allow transferring a specific NFT (identified by its Mint address).

{
"version": "1.0",
"description": "Allow specific NFT transfer",
"rules": [
{
"description": "Allow transfer of NFT with specific Mint",
"issuer": [{ "type": "*", "id": "*" }],
"action": "allow",
"logic": "and",
"chain_type": "solana",
"conditions": [
{
"logic": "and",
"group": [
{
"transaction_type": "solanaTransaction",
"transaction_attr": "splTokenMint",
"operator": "eq",
"value": "NftMintAddress111111111111111111111111111111"
},
{
"transaction_type": "solanaTransaction",
"transaction_attr": "splTransferAmount",
"operator": "eq",
"value": 1
}
]
}
]
}
]
}

Custom Program Interaction (Safe Swap)

Allow a specific custom program instruction (e.g., "swap") with defined arguments and accounts, validated against the program's IDL (JSON format).

{
"version": "1.0",
"description": "Safe Swap Policy",
"rules": [
{
"description": "Allow safe swaps",
"issuer": [
{
"id": "alice",
"type": "UserId"
}
],
"action": "allow",
"chain_type": "solana",
"conditions": [
{
"abi": {
"instructions": [
{
"accounts": [
{
"isMut": true,
"isSigner": true,
"name": "user"
},
{
"isMut": true,
"name": "pool"
}
],
"args": [
{
"name": "amount_in",
"type": "u64"
},
{
"name": "min_out",
"type": "u64"
}
],
"name": "swap"
}
],
"name": "my_dex",
"version": "0.1.0"
},
"operator": "in",
"transaction_attr": "customProgramInstruction",
"transaction_type": "solanaTransaction",
"value": [
"{\"accounts\":{\"pool\":\"1119DWteoLSdjvrT6g6L8C2PfDD2faiTQUpsjY2RiF\",\"user\":\"1117mWrzzrZr312ebPDHu8tbfMwFNvCvMbr6WepCNG\"},\"args\":{\"amount_in\":1000,\"min_out\":950},\"discriminator\":[248,198,158,145,225,117,135,200],\"name\":\"swap\"}"
]
},
{
"abi": {
"instructions": [
{
"accounts": [
{
"isMut": true,
"isSigner": true,
"name": "user"
},
{
"isMut": true,
"name": "pool"
}
],
"args": [
{
"name": "amount_in",
"type": "u64"
},
{
"name": "min_out",
"type": "u64"
}
],
"name": "swap"
}
],
"name": "my_dex",
"version": "0.1.0"
},
"operator": "lt",
"transaction_attr": "amount_in",
"transaction_type": "solanaTransaction",
"value": 2000
},
{
"abi": {
"instructions": [
{
"accounts": [
{
"isMut": true,
"isSigner": true,
"name": "user"
},
{
"isMut": true,
"name": "pool"
}
],
"args": [
{
"name": "amount_in",
"type": "u64"
},
{
"name": "min_out",
"type": "u64"
}
],
"name": "swap"
}
],
"name": "my_dex",
"version": "0.1.0"
},
"operator": "gte",
"transaction_attr": "min_out",
"transaction_type": "solanaTransaction",
"value": 900
}
]
}
]
}