Open ClementWalter opened 1 month ago
Currently, the Kakarot contract is one single file with all the entry points.
As the contract gets bigger, it becomes difficult to read and understand what does what.
Create several sub contract with meaningful entrypoints
keep in the main kakarot.cairo only the constructor and imports all the functions defined in the other sub contracts (presets)
The simple getter and setter defined in the library.cairo should also be directly inlined in the corresponding entry points
library.cairo
(e.g.
@view func get_native_token{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}() -> ( native_token_address: felt ) { return Kakarot.get_native_token(); }
should be inlined in Kakarot.get_native_token)
Kakarot.get_native_token
This is partially done (see #1352) we could do the others as well. tbd
Why
Currently, the Kakarot contract is one single file with all the entry points.
As the contract gets bigger, it becomes difficult to read and understand what does what.
What
Create several sub contract with meaningful entrypoints
keep in the main kakarot.cairo only the constructor and imports all the functions defined in the other sub contracts (presets)
The simple getter and setter defined in the
library.cairo
should also be directly inlined in the corresponding entry points(e.g.
should be inlined in
Kakarot.get_native_token
)