Skip to content

Commit

Permalink
Update error msg change name of transfer interface and add check
Browse files Browse the repository at this point in the history
  • Loading branch information
Arn0d committed Feb 6, 2024
1 parent 47571a3 commit d76fede
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
9 changes: 2 additions & 7 deletions src/components/absorber/carbon.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ mod AbsorberComponent {
}

mod Errors {
const INVALID_ARRAY_LENGTH: felt252 = 'ERC1155: invalid array length';
const INVALID_ARRAY_LENGTH: felt252 = 'Absorber: invalid array length';
}

#[embeddable_as(AbsorberImpl)]
Expand Down Expand Up @@ -213,12 +213,7 @@ mod AbsorberComponent {
current_absorption = *absorptions_u256[index] - *absorptions_u256[index - 1];
}

cc_distribution
.append(
(current_absorption * share / MULT_ACCURATE_SHARE)
.try_into()
.expect('CC: Distribution overflow')
);
cc_distribution.append((current_absorption * share / MULT_ACCURATE_SHARE));
index += 1;
};
cc_distribution.span()
Expand Down
2 changes: 1 addition & 1 deletion src/components/minter/interface.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trait IMint<TContractState> {
fn set_min_money_amount_per_tx(ref self: TContractState, min_money_amount_per_tx: u256);
fn set_unit_price(ref self: TContractState, unit_price: u256);
fn withdraw(ref self: TContractState);
fn transfer(
fn retrieve_amount(
ref self: TContractState,
token_address: ContractAddress,
recipient: ContractAddress,
Expand Down
8 changes: 7 additions & 1 deletion src/components/minter/mint.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ mod MintComponent {
}

mod Errors {
const INVALID_ARRAY_LENGTH: felt252 = 'ERC1155: invalid array length';
const INVALID_ARRAY_LENGTH: felt252 = 'Mint: invalid array length';
}

#[embeddable_as(MintImpl)]
Expand Down Expand Up @@ -180,6 +180,12 @@ mod MintComponent {
fn set_min_money_amount_per_tx(
ref self: ComponentState<TContractState>, min_money_amount_per_tx: u256
) {
// [Check] Value in range
let max_money_amount_per_tx = self.Mint_max_money_amount.read();
assert(
max_money_amount_per_tx >= min_money_amount_per_tx,
'Invalid min money amount per tx'
);
// [Effect] Store value
self.Mint_min_money_amount_per_tx.write(min_money_amount_per_tx);
}
Expand Down

0 comments on commit d76fede

Please sign in to comment.