Skip to content

Commit

Permalink
test: custom native token transfer (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-Ethernal committed Sep 17, 2024
1 parent b6274f2 commit 8eae787
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions test/basic-e2e.bats
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ setup() {
load 'helpers/common'
_common_setup

readonly enclave=${ENCLAVE:-cdk-v1}
readonly enclave=${KURTOSIS_ENCLAVE:-cdk-v1}
readonly node=${KURTOSIS_NODE:-cdk-erigon-node-001}
readonly contracts_container=${KURTOSIS_CONTRACTS:contracts-001}
readonly rpc_url=${RPC_URL:-$(kurtosis port print "$enclave" "$node" http-rpc)}
readonly private_key=${SENDER_PRIVATE_KEY:-"12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625"}
readonly receiver=${RECEIVER:-"0x85dA99c8a7C2C95964c8EfD687E95E632Fc533D6"}
readonly contracts_service_wrapper=${KURTOSIS_WRAPPER:-"kurtosis service exec "$enclave" "$contracts_container""}

readonly l1_rpc_url=${L1_ETH_RPC_URL:-"$(kurtosis port print cdk-v1 el-1-geth-lighthouse rpc)"}
}

@test "Send EOA transaction" {
Expand All @@ -27,10 +31,10 @@ setup() {
contract_addr=$(echo "$output" | tail -n 1)

# Mint ERC20 tokens
local mintFnSig="function mint(address receiver, uint256 amount)"
local mint_fn_sig="function mint(address receiver, uint256 amount)"
local amount="5"

run sendTx "$private_key" "$contract_addr" "$mintFnSig" "$receiver" "$amount"
run sendTx "$private_key" "$contract_addr" "$mint_fn_sig" "$receiver" "$amount"
assert_success
assert_output --regexp "Transaction successful \(transaction hash: 0x[a-fA-F0-9]{64}\)"

Expand All @@ -47,3 +51,25 @@ setup() {
# Check if the balance is equal to the amount
assert_equal "$receiverBalance" "$amount"
}

@test "Custom native token transfer" {
local gas_token_addr
set -x
# Retrieve the gas token address
gas_token_addr=run $contracts_service_wrapper "cat /opt/zkevm/create_rollup_parameters.json" | \
tail -n +2 | \
jq -r '.gasTokenAddress'
assert_success
assert_output --regexp "0x[a-fA-F0-9]{40}"

# Mint gas token on L1
local mint_fn_sig="function mint(address receiver, uint256 amount)"
local amount="10ether"
run sendTx "$private_key" "$gas_token_addr" "$mint_fn_sig" "$receiver" "$amount"

assert_success
assert_output --regexp "Transaction successful \(transaction hash: 0x[a-fA-F0-9]{64}\)"

# 1. Mint gas_token_addr
# 2.
}

0 comments on commit 8eae787

Please sign in to comment.