Skip to content

Commit

Permalink
Add madara hacks to sharingan (kkrt-labs#599)
Browse files Browse the repository at this point in the history
Time spent on this PR: 0.1

## Pull request type

Please check the type of change your PR introduces:

- [ ] Bugfix
- [x] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] Documentation content changes
- [ ] Other (please describe):

## What is the current behavior?

Some code is run only when STARKNET_NETWORK=madara. We need to run it
when network is
sharingan as well

## What is the new behavior?

Works on sharingan

## Other information

First Kakarot deployment ✅ on sharingan!
Address:
0x3fc7138043e914a2061c128fd4a868a15361f1ef8bdeaade0e282995389dcf

Just deployed also an ERC20, address is
0x9bC9f3e18Ca7B721aE08D0c43Cc67D05ffc73f11
  • Loading branch information
ClementWalter authored Jun 21, 2023
1 parent 50db72c commit 2133aaf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scripts/deploy_kakarot.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# %% Main
async def main():
# %% Declarations
if NETWORK["name"] == "madara":
if NETWORK["name"] in ["madara", "sharingan"]:
await deploy_starknet_account(amount=100)
account = await get_starknet_account()
logger.info(f"ℹ️ Using account {hex(account.address)} as deployer")
Expand Down
7 changes: 5 additions & 2 deletions scripts/utils/starknet.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ async def fund_address(address: Union[int, str], amount: float):
address, int_to_uint256(amount)
)
# TODO: remove when madara has a regular default account
if NETWORK["name"] == "madara" and account.address == 1:
if NETWORK["name"] in ["madara", "sharingan"] and account.address == 1:
transaction = Invoke(
calldata=[
prepared.to_addr,
Expand Down Expand Up @@ -312,6 +312,7 @@ async def deploy_starknet_account(private_key=None, amount=1) -> Account:
logger.warning("⚠️ Transaction REJECTED")

logger.info(f"✅ Account deployed at address {hex(res.account.address)}")

NETWORK["account_address"] = hex(res.account.address)
NETWORK["private_key"] = hex(key_pair.private_key)
return res.account
Expand Down Expand Up @@ -445,7 +446,9 @@ async def wait_for_transaction(*args, **kwargs):
status not in [TransactionStatus.ACCEPTED_ON_L2, TransactionStatus.REJECTED]
and elapsed < max_wait
):
logger.info(f"ℹ️ Current status: {status}")
if elapsed > 0:
# don't log at the first iteration
logger.info(f"ℹ️ Current status: {status}")
logger.info(f"ℹ️ Sleeping for {check_interval}s")
time.sleep(check_interval)
response = requests.post(
Expand Down

0 comments on commit 2133aaf

Please sign in to comment.