This page provides an overview of the Policy Engine’s support for parsing calls to Smart Contracts on Ethereum and Programs on Solana by uploading the JSON respresentation of the respective ABI (Ethereum) or IDL (Solana)
MapKey
access pattern. All arguments are named and are accessed using the syntax as such:
signer
instead of isSigner
, or the optional boolean writable
instead of isMut
) – the format detailed below is the most widely used format, for reference.
Instructions Array
The instructions array is a list of objects, each defining an instruction callable by the program.
anchor idl <program_account_string>
parsed_instruction_data
namespace. The subfields will be as follows:
MapKey
access pattern. All arguments are named and are accessed using the syntax as such:
route
instruction:
Address
section of the smart contract interface creation is populated with the correct Address. It is case insensitive with Ethereum, but case sensitive with Solana.
transfer
function call. It has two arguments: wad
(uint256) and dst
(address), corresponding to the amount and destination, respectively. We can now next construct a policy like the following:
dst
is a specific address (our testnet warchest).
We can create this policy via the same Security tab:
transfer
call, we can enforce it within a policy via the following:
0x
prefix is necessary when writing a policy against function signatures. Generally, you can find function signatures on an explorer like Etherscan. In this case, the function signature for WETH’s transfer
can be found here.
Note that these two operations, creating a new Smart Contract Interface and a Policy, can be performed programmatically as well. Here’s are two respective sample snippets that use our @turnkey/sdk-server
package:
JSON.stringify()
, or a webtool like https://codebeautify.org/jsonminifier .