-
Notifications
You must be signed in to change notification settings - Fork 0
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
6 changed files
with
41 additions
and
21 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
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,14 @@ | ||
#[dojo::interface] | ||
trait IERC721System { | ||
fn owner_of(ref world: IWorldDispatcher, token_id: u256) -> bool; | ||
} | ||
|
||
#[dojo::contract] | ||
mod erc721_system { | ||
#[abi(embed_v0)] | ||
impl ERC721Impl of super::IERC721System<ContractState> { | ||
fn owner_of(ref world: IWorldDispatcher, token_id: u256) -> bool { | ||
true | ||
} | ||
} | ||
} |
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,15 +1,22 @@ | ||
use dojo::world::Resource::Contract; | ||
use dojo::world::{IWorldDispatcher, IWorldDispatcherTrait}; | ||
|
||
use starknet::{ContractAddress, contract_address_const}; | ||
|
||
const MAINNET_CHAIN_ID: felt252 = 0x534e5f4d41494e; | ||
|
||
fn get_adventurer_address(chain_id: felt252) -> ContractAddress { | ||
fn get_adventurer_address(world: IWorldDispatcher, chain_id: felt252) -> ContractAddress { | ||
if chain_id == MAINNET_CHAIN_ID { | ||
ADVENTURER_ADDRESS_MAINNET() | ||
} else { | ||
panic_with_felt252('Chain not supported') | ||
let (_, erc721_system_address) = match world.resource(selector_from_tag!("jokers_of_neon-erc721_system")) { | ||
Contract((class_hash, contract_address)) => Option::Some((class_hash, contract_address)), | ||
_ => Option::None | ||
}.unwrap(); | ||
erc721_system_address | ||
} | ||
} | ||
|
||
fn ADVENTURER_ADDRESS_MAINNET() -> ContractAddress { | ||
contract_address_const::<0x018108b32cea514a78ef1b0e4a0753e855cdf620bc0565202c02456f618c4dc4>() | ||
} | ||
} |