Skip to main content
This guide covers the key implementation decisions for securing smart contract operations, then walks through the contract lifecycle end-to-end: permissioned deployment, function-level interaction policies, and minimizing risk during upgrades. For basic signing, start with the Quickstart.

Powered by Turnkey

Teams managing high-value contracts use Turnkey for policy-enforced signing at every stage:
  • Polymarket transitioned to Turnkey for secure contract interactions at scale, including Safe deployment and gasless trading infrastructure.
  • Brale uses Turnkey’s policy engine to constrain stablecoin minting and transfer operations to an allowlist of approved contracts.
Turnkey also fits existing contract deployments. You don’t need to redeploy to start managing signing through Turnkey.

Key implementation decisions

Example: stablecoins and RWAs

Stablecoins and tokenized Real-World Assets often secure billions of dollars in value. These contracts typically involve minting, burning, pausing, and upgrades, each requiring different levels of authorization. rbac

Implementation steps

This guide assumes you’ve completed the Quickstart and have a Turnkey client initialized. If not, start there first.
1

Permissioned contract deployment

Deployment is strictly permissioned. A designated deployer user must have a policy that explicitly grants them permission to sign the deployment transaction for a specific wallet and network.
The eth.tx.to == '' condition matches contract creation transactions (where the to field is empty). Combined with a chain ID constraint, this ensures the deployer can only deploy on the intended network.
2

Function-level interaction policies

Once deployed, interactions like minting new token supply are governed by precise policies. For example, a minting policy can be configured to:
  • Allow a specific operator user to sign
  • Require the transaction to originate from a designated wallet
  • Target the deployed contract’s exact address
  • Call only the mint function
The 0x40c10f19 value is the function selector for mint(address,uint256). For production use, the recommended approach is to upload the contract ABI so policies can reference function names and constrain arguments directly (e.g., bounding mint amounts or requiring multi-party approval above a threshold).
3

Safe contract upgrades

Upgrading a contract redirects the underlying implementation logic, making it one of the most sensitive operations. Turnkey minimizes the risk window:
  1. Designate a specific upgrade owner wallet (separate from the operator wallet).
  2. Create a temporary, highly restrictive policy only when an upgrade is needed, granting the upgrade owner permission to sign the upgrade transaction.
  3. Once the upgrade is complete, remove the policy. The wallet remains dormant and secured until the next upgrade.
The 0x3659cfe6 selector matches upgradeTo(address). After the upgrade completes, delete this policy to close the window.
This lifecycle is further explored in the Smart Contract Management demo on GitHub.

Next steps