Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: panic can't be excepted so we return empty array (0) #23

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions src/naming/main.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,22 @@ mod Naming {
contract_address: self.starknetid_contract.read()
};
let id = identity.get_main_id(address);
assert(id != 0, 'an id cannot be null');
// todo: revert when try catch are available
// assert(id != 0, 'an id cannot be null');
if id == 0 {
return array![].span();
}
let id_hashed_domain = identity
.get_verifier_data(id, 'name', get_contract_address(), 0);
let domain = self.unhash_domain(id_hashed_domain);
assert(
self.domain_to_address(domain, array![].span()) == address,
'domain not pointing back'
);
// todo: revert when try catch are available
// assert(
// self.domain_to_address(domain, array![].span()) == address,
// 'domain not pointing back'
// );
if self.domain_to_address(domain, array![].span()) != address {
return array![].span();
}
domain
}
}
Expand Down Expand Up @@ -317,8 +325,7 @@ mod Naming {
}
.compute_buy_price(domain_len, days);
// compute domain cost in altcoin
let price_in_altcoin = self
.get_altcoin_price(quote, price_in_eth.try_into().unwrap());
let price_in_altcoin = self.get_altcoin_price(quote, price_in_eth.try_into().unwrap());
self
.pay_domain(
domain_len,
Expand Down Expand Up @@ -416,8 +423,7 @@ mod Naming {
}
.compute_renew_price(domain_len, days);
// compute domain cost in altcoin
let price_in_altcoin = self
.get_altcoin_price(quote, price_in_eth.try_into().unwrap());
let price_in_altcoin = self.get_altcoin_price(quote, price_in_eth.try_into().unwrap());
self
.pay_domain(
domain_len,
Expand Down
Loading