Please explain use cases for deploy.link()
function in migrations in truffle framework.
How would you use it and for what.
[Ethereum] what does `deploy.link` exactly do in `truffle`
truffletruffle-contracttruffle-migration
truffletruffle-contracttruffle-migration
Please explain use cases for deploy.link()
function in migrations in truffle framework.
How would you use it and for what.
Best Answer
Let's say ecosystem of your dapp has a library and a contract that calls functions from that library. So you have:
Then you have contract:
So, in order for the
MainContract
to work, you will first need library deployed on the chain and alsoMainContract
needs to know address of that library. To explicitly do this, you use:or you can use:
You can also find lots of useful information in this video