Skip to content

Commit

Permalink
protocol handler: mod errors
Browse files Browse the repository at this point in the history
  • Loading branch information
obatirou committed Oct 28, 2024
1 parent ee0a5dd commit 2eba87d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cairo/protocol_handler/src/protocol_handler.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ pub mod ProtocolHandler {
pub const SOFT_PAUSE_DELAY: u64 = 12 * 60 * 60; // 12 hours
pub const HARD_PAUSE_DELAY: u64 = 7 * 24 * 60 * 60; // 7 days


//* ------------------------------------------------------------------------ *//
//* ERRORS *//
//* ------------------------------------------------------------------------ *//

pub mod errors {
pub const ONLY_KAKAROT_CAN_BE_CALLED: felt252 = 'ONLY_KAKAROT_CAN_BE_CALLED';
}

//* ------------------------------------------------------------------------ *//
//* STORAGE *//
//* ------------------------------------------------------------------------ *//
Expand Down Expand Up @@ -191,7 +200,7 @@ pub mod ProtocolHandler {
// Check if the call is to the Kakarot contract
let kakarot = self.kakarot.read().contract_address;
let Call { to, selector, calldata } = call;
assert(to == kakarot, 'ONLY_KAKAROT_CAN_BE_CALLED');
assert(to == kakarot, errors::ONLY_KAKAROT_CAN_BE_CALLED);

// Call Kakarot with syscall
starknet::syscalls::call_contract_syscall(to, selector, calldata).unwrap_syscall();
Expand Down

0 comments on commit 2eba87d

Please sign in to comment.