StarknetByExample
StarknetByExample copied to clipboard
feat: library calls
In this section, we show an example of how to perform a Library Call in Cairo using the high-levels LibraryDispatcher
and LibraryDispatcherTrait
which perform a library_call
syscall (reference here https://docs.starknet.io/documentation/architecture_and_concepts/Contracts/system-calls/#library_call)
Library calls are used to invoke functions from classes directly, not contracts. It is already covered in surface in the Cairo book but the section needs to be reworked.
This example will demonstrate the implementation of a very simple contract intended to be used as a library, and how we can use XXXLibraryDispatcher
to make library calls to this contract from another contract.
A simple could be a contract named MathUtils
with a add
function and from our contract we could call IMathUtilsLibraryDispatcher.add(a,b)
Is this for using a library via Scarb?
Just updated the description @neelkamath, sorry for the confusion
Is this issue still open? I'd love to work on it @julio4 @enitrat
Is this issue still open? I'd love to work on it @julio4 @enitrat
Hello, yes I can assign you!
Is this issue still open? I'd love to work on it @julio4 @enitrat
Hello, yes I can assign you!
Okay, thank you
@OkoliEvans Do you need any help for this?
I started working on it this morning, I have not had any blocks yet. I will reach out if I need any assistance @julio4