Skip to content

Commit

Permalink
Feat: Refactor and documentation (#42)
Browse files Browse the repository at this point in the history
* feat: function documentation

* feat: docs

* feat: docs

* feat: docs

* fix: remove warnings /unused variables

---------

Co-authored-by: 0xevolve <[email protected]>
  • Loading branch information
JordyRo1 and EvolveArt authored Jun 19, 2024
1 parent f79562f commit 1457f33
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions contracts/src/contracts/mailbox.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ pub mod mailbox {
///
/// # Returns
///
/// * The message ID inserted into the Mailbox's merkle tree
/// * The payment required to dispatch the message
fn quote_dispatch(
self: @ContractState,
_destination_domain: u32,
Expand All @@ -365,7 +365,7 @@ pub mod mailbox {
Option::Some(hook_metadata) => hook_metadata,
Option::None(()) => BytesTrait::new_empty(),
};
let (id, message) = build_message(
let (_, message) = build_message(
self, _destination_domain, _recipient_address, _message_body.clone()
);
let required_hook_address = self.required_hook.read();
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/tests/hooks/test_merkle_tree_hook.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ fn test_quote_dispatch_fails_if_invalid_variant() {

#[test]
fn test_count() {
let (merkle_tree, post_dispatch_hook, mut spy) = setup_merkle_tree_hook();
let (merkle_tree, _, _) = setup_merkle_tree_hook();
let count = merkle_tree.count();
assert_eq!(count, 0);
}
Expand Down
6 changes: 3 additions & 3 deletions contracts/src/tests/hooks/test_protocol_fee.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fn test_collect_protocol_fee() {
#[test]
#[should_panic(expected: ('Insufficient balance',))]
fn test_collect_protocol_fee_fails_if_insufficient_balance() {
let (fee_token, protocol_fee, _) = setup_protocol_fee();
let (_, protocol_fee, _) = setup_protocol_fee();
protocol_fee.collect_protocol_fees();
}

Expand Down Expand Up @@ -159,10 +159,10 @@ fn test_quote_dispatch() {
#[test]
#[should_panic(expected: ('Invalid metadata variant',))]
fn test_quote_dispatch_fails_if_invalid_variant() {
let (fee_token, _, post_dispatch_hook) = setup_protocol_fee();
let (_, _, post_dispatch_hook) = setup_protocol_fee();
let mut metadata = BytesTrait::new_empty();
let variant = 2;
metadata.append_u16(variant);
let message = MessageTrait::default();
let res = post_dispatch_hook.quote_dispatch(metadata, message);
post_dispatch_hook.quote_dispatch(metadata, message);
}
2 changes: 1 addition & 1 deletion contracts/src/utils/store_arrays.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub impl StoreFelt252Array of Store<Array<felt252>> {
) -> SyscallResult<()> {
// // Store the length of the array in the first storage slot.
let len: u8 = value.len().try_into().expect('Storage - Span too large');
Store::<u8>::write_at_offset(address_domain, base, offset, len);
Store::<u8>::write_at_offset(address_domain, base, offset, len).unwrap();
offset += 1;

// Store the array elements sequentially
Expand Down

0 comments on commit 1457f33

Please sign in to comment.