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

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Solidity Programming Language
Solidity Programming Language

Written by Solidity Programming Language

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

No responses yet

Write a response