StarknetByExample icon indicating copy to clipboard operation
StarknetByExample copied to clipboard

feat: library calls

Open enitrat opened this issue 1 year ago • 5 comments

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)

enitrat avatar Jun 21 '23 20:06 enitrat

Is this for using a library via Scarb?

neelkamath avatar Jun 30 '23 12:06 neelkamath

Just updated the description @neelkamath, sorry for the confusion

enitrat avatar Jun 30 '23 12:06 enitrat

Is this issue still open? I'd love to work on it @julio4 @enitrat

OkoliEvans avatar May 16 '24 11:05 OkoliEvans

Is this issue still open? I'd love to work on it @julio4 @enitrat

Hello, yes I can assign you!

julio4 avatar May 16 '24 11:05 julio4

Is this issue still open? I'd love to work on it @julio4 @enitrat

Hello, yes I can assign you!

Okay, thank you

OkoliEvans avatar May 16 '24 11:05 OkoliEvans

@OkoliEvans Do you need any help for this?

julio4 avatar May 23 '24 06:05 julio4

I started working on it this morning, I have not had any blocks yet. I will reach out if I need any assistance @julio4

OkoliEvans avatar May 23 '24 11:05 OkoliEvans