Skip to content

Commit

Permalink
fix: rebase conflicts and errors message
Browse files Browse the repository at this point in the history
  • Loading branch information
FabienCoutant committed Jan 5, 2024
1 parent e3dd8a8 commit 50cb619
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 25 deletions.
15 changes: 6 additions & 9 deletions src/core/debt_token.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ mod DebtToken {

fn add_whitelist(ref self: ContractState, address: ContractAddress) {
self.ownable.assert_only_owner();
assert(address.is_non_zero(), CommunErrors::CommunErrors__AddressZero);
assert(address.is_non_zero(), CommunErrors::AddressZero);
assert(!self.is_whitelisted(address), Errors::AlreadyWhitelisted);
self.whitelisted_contracts.write(address, true);
self.emit(WhitelistChanged { address: address, is_whitelisted: true });
Expand All @@ -127,7 +127,7 @@ mod DebtToken {
#[inline(always)]
fn assert_caller_is_whitelisted_contract(self: @ContractState) {
let caller = get_caller_address();
assert(self.is_whitelisted(caller), CommunErrors::CommunErrors__CallerNotAuthorized);
assert(self.is_whitelisted(caller), CommunErrors::CallerNotAuthorized);
}

#[inline(always)]
Expand All @@ -137,10 +137,7 @@ mod DebtToken {
.address_provider
.read()
.get_address(AddressesKey::borrower_operations);
assert(
caller == borrower_operations_manager,
CommunErrors::CommunErrors__CallerNotAuthorized
);
assert(caller == borrower_operations_manager, CommunErrors::CallerNotAuthorized);
}

#[inline(always)]
Expand All @@ -155,7 +152,7 @@ mod DebtToken {
caller == borrower_operations_manager
|| caller == vessel_manager
|| caller == stability_pool,
CommunErrors::CommunErrors__CallerNotAuthorized
CommunErrors::CallerNotAuthorized
);
}

Expand All @@ -164,7 +161,7 @@ mod DebtToken {
let caller = get_caller_address();
let address_provider = self.address_provider.read();
let stability_pool = address_provider.get_address(AddressesKey::stability_pool);
assert(caller == stability_pool, CommunErrors::CommunErrors__CallerNotAuthorized);
assert(caller == stability_pool, CommunErrors::CallerNotAuthorized);
}

#[inline(always)]
Expand All @@ -175,7 +172,7 @@ mod DebtToken {
let stability_pool = address_provider.get_address(AddressesKey::stability_pool);
assert(
caller == vessel_manager || caller == stability_pool,
CommunErrors::CommunErrors__CallerNotAuthorized
CommunErrors::CallerNotAuthorized
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/errors.cairo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod CommunErrors {
const AddressZero: felt252 = 'Address is zero';
const CantBeZero: felt252 = 'Value is zero';
const OnlyTimelock: felt252 = 'Caller not Timelock';
const CallerNotAuthorized: felt252 = 'Caller not authorized';
const OnlyTimelock: felt252 = 'Caller is not Timelock';
const CallerNotAuthorized: felt252 = 'Caller is not authorized';
const Invalid_amount: felt252 = 'Amount Invalid';
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn given_setup_not_initialized_and_caller_is_not_owner_it_should_revert() {
}

#[test]
#[should_panic(expected: ('Caller not Timelock',))]
#[should_panic(expected: ('Caller is not Timelock',))]
fn given_setup_is_initialized_and_caller_is_not_timelock_it_should_revert() {
let (admin_contract, _) = setup();
admin_contract.set_setup_initialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn given_setup_not_initialized_and_caller_is_not_owner_it_should_revert() {
}

#[test]
#[should_panic(expected: ('Caller not Timelock',))]
#[should_panic(expected: ('Caller is not Timelock',))]
fn given_setup_is_initialized_and_caller_is_not_timelock_it_should_revert() {
let (admin_contract, collateral_address, _) = test_setup();
admin_contract.set_setup_initialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn given_setup_not_initialized_and_caller_is_not_owner_it_should_revert() {
}

#[test]
#[should_panic(expected: ('Caller not Timelock',))]
#[should_panic(expected: ('Caller is not Timelock',))]
fn given_setup_is_initialized_and_caller_is_not_timelock_it_should_revert() {
let (admin_contract, collateral_address, _) = test_setup();
admin_contract.set_setup_initialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn given_setup_not_initialized_and_caller_is_not_owner_it_should_revert() {
}

#[test]
#[should_panic(expected: ('Caller not Timelock',))]
#[should_panic(expected: ('Caller is not Timelock',))]
fn given_setup_is_initialized_and_caller_is_not_timelock_it_should_revert() {
let (admin_contract, collateral_address, _) = test_setup();
admin_contract.set_setup_initialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn given_setup_not_initialized_and_caller_is_not_owner_it_should_revert() {
}

#[test]
#[should_panic(expected: ('Caller not Timelock',))]
#[should_panic(expected: ('Caller is not Timelock',))]
fn given_setup_is_initialized_and_caller_is_not_timelock_it_should_revert() {
let (admin_contract, collateral_address, _) = test_setup();
admin_contract.set_setup_initialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn given_setup_not_initialized_and_caller_is_not_owner_it_should_revert() {
}

#[test]
#[should_panic(expected: ('Caller not Timelock',))]
#[should_panic(expected: ('Caller is not Timelock',))]
fn given_setup_is_initialized_and_caller_is_not_timelock_it_should_revert() {
let (admin_contract, collateral_address, _) = test_setup();
admin_contract.set_setup_initialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn given_setup_not_initialized_and_caller_is_not_owner_it_should_revert() {
}

#[test]
#[should_panic(expected: ('Caller not Timelock',))]
#[should_panic(expected: ('Caller is not Timelock',))]
fn given_setup_is_initialized_and_caller_is_not_timelock_it_should_revert() {
let (admin_contract, collateral_address, _) = test_setup();
admin_contract.set_setup_initialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn given_setup_not_initialized_and_caller_is_not_owner_it_should_revert() {
}

#[test]
#[should_panic(expected: ('Caller not Timelock',))]
#[should_panic(expected: ('Caller is not Timelock',))]
fn given_setup_is_initialized_and_caller_is_not_timelock_it_should_revert() {
let (admin_contract, collateral_address, _) = test_setup();
admin_contract.set_setup_initialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn given_setup_not_initialized_and_caller_is_not_owner_it_should_revert() {
}

#[test]
#[should_panic(expected: ('Caller not Timelock',))]
#[should_panic(expected: ('Caller is not Timelock',))]
fn given_setup_is_initialized_and_caller_is_not_timelock_it_should_revert() {
let (admin_contract, collateral_address, _) = test_setup();
admin_contract.set_setup_initialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn given_setup_not_initialized_and_caller_is_not_owner_it_should_revert() {
}

#[test]
#[should_panic(expected: ('Caller not Timelock',))]
#[should_panic(expected: ('Caller is not Timelock',))]
fn given_setup_is_initialized_and_caller_is_not_timelock_it_should_revert() {
let (admin_contract, collateral_address, _) = test_setup();
admin_contract.set_setup_initialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn given_setup_not_initialized_and_caller_is_not_owner_it_should_revert() {
}

#[test]
#[should_panic(expected: ('Caller not Timelock',))]
#[should_panic(expected: ('Caller is not Timelock',))]
fn given_setup_is_initialized_and_caller_is_not_timelock_it_should_revert() {
let (admin_contract, collateral_address, _) = test_setup();
admin_contract.set_setup_initialized();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
test_set_oracle.cairo
├── when set a new oracle and caller not owner
│ └── it should revert
├── when set an oracle that alreay exist and caller not timelock contract
├── when set an oracle that alreay exist and Caller is not Timelock contract
│ └── it should revert with TimelockOnlyError
└── when caller is valid
├── when decimals is zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn given_caller_is_owner_setting_new_address_zero_it_should_revert() {


#[test]
#[should_panic(expected: ('Caller not Timelock',))]
#[should_panic(expected: ('Caller is not Timelock',))]
fn given_caller_is_owner_and_key_already_has_an_address_it_should_revert() {
let (address_provider, address_provider_address) = setup();
address_provider
Expand Down Expand Up @@ -77,7 +77,7 @@ fn given_caller_is_owner_it_should_set_new_address() {
}

#[test]
#[should_panic(expected: ('Caller not Timelock',))]
#[should_panic(expected: ('Caller is not Timelock',))]
fn given_caller_is_not_timelock_and_updating_address_of_key_it_should_revert() {
let (address_provider, address_provider_address) = setup();
address_provider
Expand Down

0 comments on commit 50cb619

Please sign in to comment.