Upgradable Smart Contracts

Olympix
2 min readApr 17, 2023

--

Upgradable Smart Contracts and How Proxy Contracts Work

Smart contracts have a unique feature of autonomous execution of code on the blockchain. However, once deployed, they become immutable and cannot be updated. Upgradable smart contracts, also known as smart contract proxies, offer a solution to this problem.

What are Upgradable Smart Contracts?

Upgradable smart contracts are a new approach to smart contract development where the code of the contract is separated into two distinct parts, the logic contract and the proxy contract. The logic contract contains the business logic and data of the contract, while the proxy contract contains the address of the logic contract and the upgrade mechanism. The proxy contract acts as an interface to the logic contract and is responsible for executing the code.

How do Proxy Contracts Work?

Proxy contracts work by using a proxy pattern that acts as a middle layer between the user and the logic contract. When a user interacts with the proxy contract, the proxy contract delegates the call to the logic contract. If the logic contract needs to be updated, a new contract with the updated code is deployed to a new address. The proxy contract then updates its internal reference to the new contract address, allowing users to interact with the updated logic contract through the same proxy contract interface.

Why use Upgradable Smart Contracts?

Upgradable smart contracts have several advantages over traditional smart contracts. The main advantage is the ability to update the contract logic without disrupting the existing data and contract functionality. This is particularly important in situations where bugs or vulnerabilities are discovered in the contract after deployment. Instead of creating a new contract and migrating data, the contract owner can simply update the logic contract and point the proxy contract to the new contract address.

Olympix Static Analyzer and Proxy Contracts

The Olympix static analyzer is a tool designed to identify vulnerabilities in smart contracts. It has built-in methods to identify if you are scanning a proxy contract, which is important because scanning a proxy contract is different from scanning a traditional smart contract.

In conclusion, upgradable smart contracts are an innovative approach to smart contract development that allows for the updating of contract logic without disrupting the existing contract functionality. Proxy contracts act as an interface to the logic contract and are responsible for executing the code.

--

--

Olympix
Olympix

Written by Olympix

The future of web3 security.

No responses yet