Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
kariy committed Dec 4, 2023
1 parent 7787e3c commit 810afd7
Show file tree
Hide file tree
Showing 40 changed files with 762 additions and 1,278 deletions.
20 changes: 16 additions & 4 deletions crates/dojo-world/src/migration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ pub trait Deployable: Declarable + Sync {
calldata: vec![],
entry_point_selector: get_selector_from_name("base").unwrap(),
},
BlockId::Tag(BlockTag::Latest),
BlockId::Tag(BlockTag::Pending),
)
.await
.map_err(MigrationError::Provider)?;
Expand Down Expand Up @@ -246,6 +246,8 @@ pub trait Deployable: Declarable + Sync {
FieldElement::ZERO,
);

println!("ohayo");

match account
.provider()
.get_class_hash_at(BlockId::Tag(BlockTag::Pending), contract_address)
Expand All @@ -254,12 +256,22 @@ pub trait Deployable: Declarable + Sync {
Err(ProviderError::StarknetError(StarknetErrorWithMessage {
code: MaybeUnknownErrorCode::Known(StarknetError::ContractNotFound),
..
})) => {}
})) => {
println!("deploying contract so deploy")
}

Ok(_) => return Err(MigrationError::ContractAlreadyDeployed(contract_address)),
Err(e) => return Err(MigrationError::Provider(e)),
Ok(res) => {
println!("hmmm {res:#x}");
return Err(MigrationError::ContractAlreadyDeployed(contract_address));
}
Err(e) => {
println!("error {e}");
return Err(MigrationError::Provider(e));
}
}

println!("ohayo 12");

let mut txn = account.execute(vec![Call {
calldata,
// devnet UDC address
Expand Down
2 changes: 1 addition & 1 deletion crates/dojo-world/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ where
P: Provider + Send,
{
const DEFAULT_TIMEOUT: Duration = Duration::from_secs(300);
const DEFAULT_INTERVAL: Duration = Duration::from_millis(2500);
const DEFAULT_INTERVAL: Duration = Duration::from_millis(250);

pub fn new(tx: FieldElement, provider: &'a P) -> Self {
Self {
Expand Down
1 change: 1 addition & 0 deletions crates/katana/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ assert_matches.workspace = true
hex = "0.4.3"

[features]
default = [ "starknet-messaging" ]
messaging = [ "ethers", "sha3" ]
starknet-messaging = [ ]
10 changes: 5 additions & 5 deletions crates/katana/core/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ impl Account {
fn deploy(&self, state: &dyn StateWriter) -> Result<()> {
let address: ContractAddress = self.address.into();
// set the class hash at the account address
state.set_class_hash_of_contract(address, self.class_hash.into())?;
state.set_class_hash_of_contract(address, self.class_hash)?;
// set the public key in the account contract
state.set_storage(
address,
get_storage_var_address("Account_public_key", &[]).unwrap(),
self.public_key.into(),
self.public_key,
)?;
// initialze account nonce
state.set_nonce(address, 1u128.into())?;
Expand All @@ -79,8 +79,8 @@ impl Account {
fn fund(&self, state: &dyn StateWriter) -> Result<()> {
state.set_storage(
*FEE_TOKEN_ADDRESS,
get_storage_var_address("ERC20_balances", &[self.address.into()]).unwrap(),
self.balance.into(),
get_storage_var_address("ERC20_balances", &[self.address]).unwrap(),
self.balance,
)?;
Ok(())
}
Expand Down Expand Up @@ -114,7 +114,7 @@ impl DevAccountGenerator {
total,
seed: [0u8; 32],
balance: FieldElement::ZERO,
class_hash: (*OZ_V0_ACCOUNT_CONTRACT_CLASS_HASH).into(),
class_hash: (*OZ_V0_ACCOUNT_CONTRACT_CLASS_HASH),
contract_class: Arc::new((*OZ_V0_ACCOUNT_CONTRACT).clone()),
}
}
Expand Down
Loading

0 comments on commit 810afd7

Please sign in to comment.