Advanced · Lesson 15

Smart contract risk and advanced risk management

Advanced risk management is not predicting exploits. It is arranging your exposure so that one exploit is survivable.

Advanced13 min readUpdated 8 Nov 2026

You will not spot the bug. Neither will the auditor, the fund that led the round, or the contributor who has been shipping for three years. The useful question is not «is this safe» but «what happens to me if it is not», and that question has an arithmetic answer.

Five things that fail

Contract risk is usually described as one risk. It is at least five, with different defences.

  • The code. A logic error, an unchecked input, a rounding direction that favours the wrong side.
  • The permissions. An upgradeable proxy, an admin key, a pause switch, a mint function. The rules you read are not always the rules that will run.
  • The inputs. An oracle that reports a price from one venue, or reports it late. The contract is correct and still does the wrong thing.
  • The edges. A bridge, a wrapped asset, a token issued by someone else. These fail completely rather than partially.
  • The interface. A front end that points at a different contract, or a signature that authorises more than the page admitted.

Approvals are standing instructions

An ERC-20 approval is not a payment. It is a permission: this contract may move up to a certain amount of this token until the allowance is spent or you remove it. Approve an unlimited amount once and the permission outlives the website, the team and the audit.

Approve the exact amount you intend to spend. Use a separate wallet for contracts you have not used before, funded with what you are willing to lose. Revoke allowances when you are done, starting with the oldest. Read the spender address rather than the name of the site. Signature-based permits are not safer: a signature can hand over the same permission with no gas and no meaningful confirmation screen.

Upgradeability and admin keys

Most contracts you interact with are proxies: the address stays the same while the code behind it can be replaced. That is how bugs get fixed, and how the terms you agreed to can change after your deposit.

Four questions, in order. Can the implementation be replaced? Who holds that power, and is it a single key or a multisig with named signers? Is there a timelock, and how long? Can the admin pause withdrawals, change fees, or mint?

A forty-eight hour timelock is an exit window. A three-of-five multisig with anonymous signers is a promise. An immutable contract removes the admin risk and keeps the bug risk, including the bugs nobody can patch. Both configurations are defensible; what is not defensible is not knowing which one you are in.

Audits judge a commit, not a protocol

An audit is a review by people paid by the project, of a particular version of the code, at a particular time. It does not cover changes made afterwards, the front end, the operational keys, the economic assumptions, or the chain's ability to include your transaction at all.

It does give you evidence that someone competent read the code and that findings were answered. Read the report rather than the badge: how many critical findings, how were they closed, is the deployed code the audited commit. A bug bounty and a second audit are better signals than a logo, and none of them proves safety.

Position sizing, applied twice

The first is the familiar one: a trade with a stop. Take a portfolio of 25,000 and a rule that no idea may cost more than 1%, or 250. Entry at 40, stop at 37, so each unit risks 3. The position is 250 ÷ 3 = 83.3 units, or about 3,333 in notional. If the stop holds, the loss is 250. If the asset gaps through the stop, the loss is larger: a property of the market, not of the formula.

The second is for a position that can fail rather than fall, such as a deposit in a new contract. There is no stop, so size depends on the assumed loss:

Assumed loss if it failsMaximum position
100%, total loss250
50%, partial recovery500
20%, impaired but working1,250

The same risk budget thus produces very different positions, and exposes the aggregate mistake: ten positions of 250 each is 2,500, or 10% of the portfolio, if they all fail together. Contracts sharing a chain, a bridge and a stablecoin fail together more often than independence suggests. Cap the total at something like 5% and the sum stays survivable.

Correlate the custody, not just the assets

Holding five different tokens in one wallet on one chain is not diversification; it is one key, one chain and one bridge. The structure that survives is boring: a cold wallet holding the majority, a hot wallet with an amount you would miss but not mourn, and a burner for anything new. Add the counterparties a balance sheet would list: one exchange, one stablecoin issuer, one bridge, one hardware vendor.

Before, not during

Write the answer to three questions while nothing is wrong. Where is each position, by contract address and chain? What is the exit, and does it depend on a bridge, a queue or a timelock? What would you revoke first if a contract were drained tonight?

The line that decides the size. If losing the whole position would change your plan, the position is too big, whatever the contract's reputation says.

Check yourself

  • With 25,000 and a 1% risk budget, entry at 40 and a stop at 37, how many units do you buy and what is the notional?
  • Why does an unlimited approval survive the shutdown of the site that requested it?
  • Name three things an audit does not cover.

The glossary defines approval, revoke, oracle and bridge without euphemism. Smart contracts and dApps explains what the code executes, Layer 2, rollups and MEV covers where the ordering happens, and the position size calculator does the first sum above with your own numbers. The smart contract and bridge risk checklist is the operational side: what to revoke, in what order, tonight.