kakarot
kakarot copied to clipboard
feat: add eth_chain_id to Kakarot contract
Feature Request
Describe the Feature Request
Add a @view
function to retrieve the chain_id of Kakarot.
The Kakarot chain_id is actually the underlying Starknet chain id but modulo 2**32. This operation would be better done only once at the Kakarot level.
What
Add
@view
func eth_chain_id{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}() -> (
chain_id: felt,
) {
let (tx_info) = get_tx_info();
let (_, chain_id) = unsigned_div_rem(tx_info.chain_id, 2 ** 32);
return (chain_id=chain_id);
}
to kakarot.cairo
and use IKakarot.eth_chain_id
everywhere