From e4e4d0671695ba6d245314890bbe2c83f4f17913 Mon Sep 17 00:00:00 2001 From: Tristan <122918260+TAdev0@users.noreply.github.com> Date: Sun, 5 Jan 2025 16:52:27 +0100 Subject: [PATCH] Core Lib Documentation: `address_helper` module (#7002) --- corelib/src/starknet/address_helper.cairo | 45 ----------------------- 1 file changed, 45 deletions(-) delete mode 100644 corelib/src/starknet/address_helper.cairo diff --git a/corelib/src/starknet/address_helper.cairo b/corelib/src/starknet/address_helper.cairo deleted file mode 100644 index e1d500bf903..00000000000 --- a/corelib/src/starknet/address_helper.cairo +++ /dev/null @@ -1,45 +0,0 @@ -use starknet::{ClassHash, ContractAddress, StorageBaseAddress}; - -const U251_MAX: felt252 = 0x7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; -type u251 = core::internal::BoundedInt<0, U251_MAX>; -const STORAGE_BASE_MAX: felt252 = U251_MAX - 256; - -extern fn class_hash_const() -> ClassHash nopanic; -extern fn contract_address_const() -> ContractAddress nopanic; - -type StorageBaseRange = core::internal::BoundedInt<0, STORAGE_BASE_MAX>; -extern fn storage_base_address_const< - const address: StorageBaseRange, ->() -> StorageBaseAddress nopanic; - -trait AddressTrait
{ - type Range; - fn from_const() -> Address; -} - -impl ClassHashAddressTrait of AddressTrait { - type Range = u251; - fn from_const() -> ClassHash { - class_hash_const::() - } -} - -impl ContractAddressAddressTrait of AddressTrait { - type Range = u251; - fn from_const() -> ContractAddress { - contract_address_const::() - } -} - -impl StorageBaseAddressAddressTrait of AddressTrait { - type Range = StorageBaseRange; - fn from_const() -> StorageBaseAddress { - storage_base_address_const::() - } -} - -pub fn address< - const VALUE: AddressImpl::Range, Address, impl AddressImpl: AddressTrait
, ->() -> Address { - AddressImpl::from_const::() -}