-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
100 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
mod pricing; | ||
mod pricing; | ||
mod naming; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
use starknet::ContractAddress; | ||
|
||
#[starknet::interface] | ||
trait INaming<TContractState> { | ||
fn resolve(self: @TContractState, domain: felt252, field: felt252) -> felt252; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
mod upgrades; | ||
mod interface; | ||
mod pricing; | ||
mod tests; | ||
mod naming; | ||
mod tests; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mod main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#[starknet::contract] | ||
mod Naming { | ||
use starknet::ContractAddress; | ||
use starknet::{get_caller_address, get_contract_address}; | ||
use traits::Into; | ||
use array::{ArrayTrait}; | ||
use zeroable::Zeroable; | ||
use starknet::class_hash::ClassHash; | ||
use naming::interface::naming::{INaming, INamingDispatcher, INamingDispatcherTrait}; | ||
use integer::{u256_safe_divmod, u256_as_non_zero}; | ||
|
||
#[storage] | ||
struct Storage { | ||
starknetid_contract: ContractAddress, | ||
_pricing_contract: ContractAddress, | ||
_admin_address: ContractAddress, | ||
} | ||
|
||
#[constructor] | ||
fn constructor( | ||
ref self: ContractState, | ||
starknetid: ContractAddress, | ||
pricing: ContractAddress, | ||
admin: ContractAddress | ||
) { | ||
self.starknetid_contract.write(starknetid); | ||
self._pricing_contract.write(pricing); | ||
self._admin_address.write(admin); | ||
} | ||
|
||
|
||
#[external(v0)] | ||
impl PricingImpl of INaming<ContractState> { | ||
fn resolve(self: @ContractState, domain: felt252, field: felt252) -> felt252 { | ||
1 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
mod utils; | ||
mod test_pricing; | ||
mod test_naming; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use array::ArrayTrait; | ||
use debug::PrintTrait; | ||
use zeroable::Zeroable; | ||
use traits::Into; | ||
|
||
use starknet::ContractAddress; | ||
use starknet::testing; | ||
use super::utils; | ||
use naming::interface::naming::{INamingDispatcher, INamingDispatcherTrait}; | ||
use naming::naming::main::Naming; | ||
use naming::pricing::Pricing; | ||
|
||
#[cfg(test)] | ||
fn deploy() -> INamingDispatcher { | ||
|
||
//erc20 | ||
let mut calldata = ArrayTrait::<felt252>::new(); | ||
calldata.append(0x789); | ||
let pricing = utils::deploy(Pricing::TEST_CLASS_HASH, calldata); | ||
|
||
// pricing | ||
let mut calldata = ArrayTrait::<felt252>::new(); | ||
calldata.append(0x789); | ||
let pricing = utils::deploy(Pricing::TEST_CLASS_HASH, calldata); | ||
|
||
// naming | ||
let mut calldata = ArrayTrait::<felt252>::new(); | ||
let starknetid = 0x456; | ||
let admin = 0x123; | ||
calldata.append(starknetid); | ||
calldata.append(pricing.into()); | ||
calldata.append(admin); | ||
let address = utils::deploy(Naming::TEST_CLASS_HASH, calldata); | ||
INamingDispatcher { contract_address: address } | ||
} | ||
|
||
#[cfg(test)] | ||
#[test] | ||
#[available_gas(20000000000)] | ||
fn test_buy_price() { | ||
deploy(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,4 +94,4 @@ fn test_get_amount_of_chars() { | |
) == 30, | ||
'Should return 30' | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,4 @@ fn deploy(contract_class_hash: felt252, calldata: Array<felt252>) -> ContractAdd | |
) | ||
.unwrap(); | ||
address | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.