Proxy in Solidity

Solidity Programming Language
2 min readFeb 17, 2022

(CALLDATA VERSION)

Code: https://github.com/grandzero/SecureumBootcamp/blob/main/solidity101/ProxyContract.sol

Thanks to Grandzero

I changed the above code and new code is very short.

CODE I

We deploy RealContract

We copy the the address of the RealContract and we deploy ProxyContractWithCallNoStorage with the address of the RealContract.

We start with RealContract

SetTest function is working and test variable gives us the number.

Our aim is to sent the number to test variable in the RealContract using proxy contract.

ProxyContractWithCallNoStorage has “returnHex” function and this function turns hex to us.

We paste this hex to calldata section

We sent the number to test variable in the RealContract using proxy contract.

Check it !

Everthing is ok !

No!

We sent this number with calldata

When we change the address of pointing contract, we can’t access old datas anymore .

All datas are lost now.

We need to sent this number with Delegatecall.

Click it

--

--

Solidity Programming Language

Solidity basics for beginners: Learn the fundamentals of smart contract development and build your first DApp! #Solidity #Foundry #Ethereum #Opcodes #DApps