1

I am looking Sushiswap Hardhat compilation output. Specifically, UniswapV2Router02 output.

UniswapV2Router02 router refers to UniswapV2Library. However, there are no link references for this library in the generated compilation artefact:

  "bytecode": "0x60c06...",
  "deployedBytecode": "0x60806...",
  "linkReferences": {},
  "deployedLinkReferences": {}

There are no symbolic references in the bytecode either.

How solc / Hardhat knows to "link" UniswapV2Library when the contract is deployed? Is there a deterministic address for the UniswapV2Library library? Is the library inlined? Do the library contract need to be deployed separately, or is it somehow done automatically in some of the Hardhat steps?

1 Answer 1

2

It is solc the responsible. All functions in UniswapV2Library are marked as internal, so they are inlined in the contract calling them.

Similar thing used to happen with SafeMath, internal functions are inlined. The only functions requiring a link are external or public.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.