![](https://cdn.nodeguardians.io/backend-production/cairo_bg_765cee7594/cairo_bg_765cee7594.webp)
Standalone
Vanity Addresses
![](https://cdn.nodeguardians.io/backend-production/Vanity_Addresses_part1_d30974f261/Vanity_Addresses_part1_d30974f261.webp)
Vanity Addresses
Download quests in Questplay
View the contracts and any other additional content from your IDE.
Starknet relies on salted hashing in its computation of contract addresses. A positive side-effect of this is that it is possible to deploy accounts and other smart contracts onto vanity addresses. Vanity addresses are addresses that contain a easily distinguishable hexadecimal segment. For example, 0x0000...
or 0xdead...
.
Your quest is simple, can you find an 04515
?
Your Task
Set is_oasis_found
in EndlessDesert
to true
.
Contract Code
#[starknet::interface]
trait IDesert<TContractState> {
fn is_oasis_found(self: @TContractState) -> bool;
fn find_oasis(ref self: TContractState);
}
#[starknet::contract]
mod EndlessDesert {
use starknet::{ ContractAddress, get_caller_address };
use traits::Into;
use super::IDesert;
#[storage]
struct Storage {
is_oasis_found: bool,
}
#[abi(embed_v0)]
impl EndlessDesert of IDesert<ContractState> {
fn is_oasis_found(self: @ContractState) -> bool {
self.is_oasis_found.read()
}
fn find_oasis(ref self: ContractState) {
let caller = get_caller_address();
assert(is_oasis(caller), 'NOT_OASIS');
self.is_oasis_found.write(true);
}
}
#[inline(always)]
fn is_oasis(address: ContractAddress) -> bool {
let addr_as_felt: felt252 = address.into();
let addr_as_u256: u256 = addr_as_felt.into();
let prefix = addr_as_u256.high / 0x1000000000000000000000000000;
prefix == 0x04515
}
}
![](https://cdn.nodeguardians.io/backend-production/Vanity_Addresses_part1_d30974f261/Vanity_Addresses_part1_d30974f261.webp)
To safely cross the desert, you need to find the oasis…