Skip to main content
Smart contracts are self-executing programs on the blockchain. Porto allows advanced users to interact with any smart contract, from common DeFi protocols to custom enterprise contracts. This guide covers contract interactions, approval management, and best practices.
This page is for advanced users. If you’re new to smart contracts, see Using DApps and smart contracts first.

What is a smart contract interaction

A smart contract interaction is a transaction that:
  • Calls a function on a smart contract (not just sending assets)
  • May execute complex logic (trading, lending, voting, etc.)
  • Can be reverted if something goes wrong (but you still pay gas)
  • Requires the contract address and function details to execute
Smart contracts include:
  • DeFi protocols — Uniswap, Aave, Curve, etc.
  • Governance contracts — Voting and proposal contracts
  • Bridge contracts — Cross-chain asset transfers
  • Custom enterprise contracts — Organizations’ internal smart contracts
  • NFT contracts — Minting, trading, staking contracts

Connect to a smart contract

There are several ways to interact with smart contracts from Porto:

Via a DApp interface

Most smart contracts have a user interface (DApp). See Using DApps for the standard flow.

Direct contract interaction

For contracts without a user interface:
1

Prepare contract details

You’ll need:
  • Contract address — The blockchain address of the contract (e.g., 0x…)
  • Function signature — The name and parameters of the function you’re calling
  • Contract ABI — Application Binary Interface (tells Porto how to call the contract)
  • Parameters — Values to pass to the function
2

Open Porto's advanced interaction

Look for Contract interaction, Direct contract call, or Custom contract in Porto’s settings or advanced menu. This feature may require admin permissions.
3

Enter contract address

Paste the contract address carefully. Verify it matches the official contract (check multiple sources).
4

Select function

If you have the contract ABI, Porto can show you available functions. Otherwise, you’ll need to enter the function signature manually.
5

Enter parameters

Fill in the parameters the function requires. Be precise — wrong values will cause the transaction to fail.
6

Review and approve

Porto will show you the transaction details before execution. Review carefully.
7

Execute

Complete biometric authentication to execute the contract call.

Approvals and token permissions

Many DeFi operations require granting a contract permission to spend your tokens. This happens in two steps:
  1. Approve — You approve a contract to spend up to a certain amount of a token
  2. Execute — The contract then uses that allowance to execute the operation

Approving a token spend

1

Identify the contract

Determine which contract needs approval (usually the DEX or protocol you’re using).
2

Determine the amount

Decide how much of your token to approve:
  • Exact amount — Approve only what you need for one transaction
  • High amount — Approve a large amount for multiple transactions (more convenient, slightly riskier)
  • Unlimited — Some users approve unlimited amounts (highest convenience, highest risk)
3

Submit approval

Create an approval transaction. This transaction has no direct effect but grants permission.
4

Wait for confirmation

The approval must confirm on-chain before the next transaction can use it.
5

Execute your operation

Once approved, the contract can execute your transaction (swap, stake, lend, etc.).

Common smart contract interactions

Understanding gas and transaction costs

Every smart contract call costs gas (network fees):
  • Gas price — Set by the blockchain network (you cannot control this)
  • Gas limit — Maximum gas this transaction can use (set by the contract or estimated)
  • Total cost — Gas price × Gas used = Transaction cost
Porto will show you estimated gas costs before execution. Actual costs may vary based on network congestion.

Recognizing risky contracts

Be cautious of smart contracts that:
  • Lack code verification — Check if the contract has been audited and code verified on a block explorer
  • Require your private key — Never share your private key with any contract or off-chain tool
  • Request unusual permissions — Be suspicious of contracts asking for unlimited approvals
  • Are newly deployed — New contracts have higher risk of bugs or scams
  • Have no documentation — Avoid contracts with no clear description of what they do
  • Demand urgent action — Scams often create artificial time pressure
Always research a contract on community forums and block explorers before using it.

Reverting failed transactions

If a smart contract transaction fails (reverts):
  1. Check the reason — Your transaction receipt will show why it failed (insufficient balance, wrong parameters, etc.)
  2. Fix and retry — Correct the issue and resubmit the transaction
  3. You still pay gas — Even if the transaction fails, you pay gas fees
  4. Check for slippage — If swapping, slippage or price impact may have caused failure

Gas estimation and optimization

Porto estimates gas before you execute a transaction. Tips to reduce gas costs:
  • Lower gas price — During quiet times, gas is cheaper; use lower gas if you’re not in a hurry
  • Batch operations — Combine multiple interactions into one transaction if possible
  • Use efficient chains — Layer 2 networks (Arbitrum, Optimism) have much lower gas costs
  • Avoid peak times — Avoid network peaks when everyone is transacting

Security best practices

  • Never share your seed phrase — Even with trusted contracts or platforms
  • Verify contract addresses — Always check contract addresses from official sources, not user recommendations
  • Use trusted destinations — For known contracts you use frequently
  • Start small — Test new contracts with small amounts first
  • Understand the contract — Read documentation or code before using
  • Keep backups — Store recovery materials securely in case you need to recover wallets
  • Monitor approvals — Periodically review contracts you’ve approved for token spend
  • Revoke unused approvals — If you no longer use a contract, you can revoke its token approval

Revoking token approvals

If you’ve approved a contract but no longer want it to have access:
1

Identify the contract to revoke

Go to a block explorer and find the token contract’s approval history, or use a tool like etherscan.io to see all your approvals.
2

Create revoke transaction

Call the token contract’s approve() function with amount 0 to revoke the approval.
3

Submit revocation

Execute the revoke transaction through Porto or a transaction builder.
4

Verify revocation

Check the block explorer to confirm the approval amount is now 0.

For organization administrators

If you’re managing smart contract interactions for your organization, see your admin settings for:
  • Whitelisting specific contracts users can interact with
  • Setting approval limits on contract interactions
  • Monitoring contract usage across your vaults
  • Requiring additional approvals for high-risk contracts