https://t.me/EthSecurity1/664
@karola96 @FreezyEth
I need to understand how Libraries can be used in upgradeable contracts
As far as I've seen, libraries are instantiated in a contract in either of these two ways
1. Using: using Mylib for uint256
2. State Var: import the library and call it's functions
import {MyLib} from "./myLib.sol" // import
myLib.add(x, g) // call it's function
Oct 5, 2023, 12:11 PM
rose deleted it
Oct 5, 2023, 12:11 PM
Yea, I figured cause of the link, and the speed it took to delete lol
I just wanted y'all to have a full context of the message
I just wanted y'all to have a full context of the message
Oct 5, 2023, 12:12 PM
which is your question
Oct 5, 2023, 12:13 PM
How do I use libraries in a smart contract to make it upgradable
Oct 5, 2023, 12:15 PM
mm I think I didn't understan the question
You want to make a contract upgradable thanks to a library?
You want to make a contract upgradable thanks to a library?
Oct 5, 2023, 12:15 PM
In a case where I want to update the functions of the library, how do I update the contract to know that a new library is in place
Yeah
Oct 5, 2023, 12:16 PM
which library'
Oct 5, 2023, 12:16 PM
A custom one
Oct 5, 2023, 12:16 PM
ahhh you want to make a library upgradable
Oct 5, 2023, 12:16 PM
Say, myLib.add(x, y) does x + y yeah?
Now, let's say I want it to do (x + y ^²)
On the same .add()
Now, let's say I want it to do (x + y ^²)
On the same .add()
Oct 5, 2023, 12:17 PM
why you should do this instead of deploying a new library only
Oct 5, 2023, 12:18 PM
Yea, I prefer to deploy a new library instead
But how will the contract,get to use this new library
But how will the contract,get to use this new library
Are there any other ways to instantiate and use a library in Solidity aside these two methods I listed here???
Oct 5, 2023, 12:19 PM
depends how you use the library.
if it is deployed as standalone you can change the address
Oct 5, 2023, 12:19 PM
So you can deploy a library standalone?
How would you instantiate it in the contract
How would you instantiate it in the contract
How would you do it
Oct 5, 2023, 12:21 PM
as I said
depends
depends
on the case
Oct 5, 2023, 12:21 PM
In my example though
The MyLib example
The MyLib example
How would you approach deploying the library and updating the contract so it uses the new functionality of the updated library
Sorry if I'm asking too many questions or misunderstanding
Oct 5, 2023, 12:22 PM
without knowing what you need to do is impossible to answer these questions
it depends on the case.
you are too generic
I never deployed a standalone library because I never needed it
Oct 5, 2023, 12:24 PM
I'm not doing anything at the moment
I've just been confused about it
Do you have any resources I can review about it?
I've just been confused about it
Do you have any resources I can review about it?
🥲🥲🥲
Oct 5, 2023, 12:24 PM
google only
Oct 5, 2023, 12:24 PM
You simply use upgradeable proxies yea
Oct 5, 2023, 12:24 PM
i think you are overcomplicating it
when I need
yes
yes
Oct 5, 2023, 12:25 PM
😅😅 yes sirskies
Oct 5, 2023, 12:25 PM
I rarely needed a library
Oct 5, 2023, 12:25 PM
I guess I'll stick to upgradeable proxies 🥲
I'm just discovering how much work load they tend to relieve from the main smart contract and I'm trying to explore further down the road
Oct 5, 2023, 12:25 PM
libraries make sense only if you need to use those functions in many different places
Oct 5, 2023, 12:26 PM
IterableMapping 👀
your post on OZ resolved my first problem with it's verification hahaha
Oct 5, 2023, 2:13 PM
that was before changing everything to internal🤣
Oct 5, 2023, 2:13 PM
yep
TikiToken/BabyCake times 😞
Oct 5, 2023, 2:13 PM
g(old)
Oct 5, 2023, 2:13 PM