← Digital Assets

Solana transaction policies

Set rules for the programs your service may call and the accounts and instructions it may use.

Program instructions

Declare program instructions and their layouts. Check decoded arguments and account roles, and set limits across the transaction.

Integration guide
Edict exampleshowcase-solana.edict
authority "showcase-solana" {
    intent = "solana.transaction"
    version = "1"

    program system: solana {
        address = "11111111111111111111111111111111"

        fn transfer(lamports: u64) {
            discriminator = "02000000"
            accounts = [
                {
                    name = "from",
                    signer = true,
                    writable = true
                },
                {
                    name = "to",
                    signer = false,
                    writable = true
                }
            ]
        }
    }

    let SOL = 1000000000

    approver treasury {
        type = "reference"
        id = "treasury"
        ref = "treasury@sha256:<digest>"
    }

    approver security {
        type = "reference"
        id = "security"
        ref = "security@sha256:<digest>"
    }

    policy "reviewed-transfers" {
        let total = system.transfer.sum(call -> call.lamports)

        allow when {
            transaction.requiredSignatures == 1
            system.transfer.count() > 0
            system.transfer.count() <= 5
            system.transfer.all(call -> call.accounts.from.address == transaction.feePayer)
            system.transfer.all(call -> call.lamports > 0)
            total <= 10 * SOL
        }

        require 2 of [treasury, security] if (total > SOL)
    }
}