Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
feat(bindings): updates related to TaikoToken changes
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Oct 23, 2023
1 parent 57410f6 commit ed835c2
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 25 deletions.
2 changes: 1 addition & 1 deletion bindings/.githead
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2cc9863870b35939117135e6100e7f3b241d3310
8ba512b54c2102b93907d12cc108c4c3b02602f0
26 changes: 13 additions & 13 deletions bindings/gen_taiko_token.go

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions integration_test/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ if ! docker info >/dev/null 2>&1; then
fi

TESTNET_CONFIG=$DIR/nodes/docker-compose.yml
PREMINT_TOKEN_AMOUNT=92233720368547758070000000000000

TESTNET_CONFIG=$TESTNET_CONFIG \
TAIKO_MONO_DIR=$TAIKO_MONO_DIR \
PREMINT_TOKEN_AMOUNT=$PREMINT_TOKEN_AMOUNT \
$DIR/nodes/init.sh

DEPLOYMENT_JSON=$(cat $TAIKO_MONO_DIR/packages/protocol/deployments/deploy_l1.json)
Expand Down Expand Up @@ -56,7 +54,6 @@ if [ "$RUN_TESTS" == "true" ]; then
L2_SUGGESTED_FEE_RECIPIENT=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \
L1_PROVER_PRIVATE_KEY=59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d \
TREASURY=0xdf09A0afD09a63fb04ab3573922437e1e637dE8b \
PREMINT_TOKEN_AMOUNT=$PREMINT_TOKEN_AMOUNT \
JWT_SECRET=$DIR/nodes/jwt.hex \
go test -v -p=1 ./$PACKAGE -coverprofile=coverage.out -covermode=atomic -timeout=300s
else
Expand Down
3 changes: 1 addition & 2 deletions integration_test/nodes/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ cd $TAIKO_MONO_DIR/packages/protocol &&
L2_SIGNAL_SERVICE=0x1000777700000000000000000000000000000007 \
SHARED_SIGNAL_SERVICE=0x0000000000000000000000000000000000000000 \
PROPOSER=0x0000000000000000000000000000000000000000 \
TAIKO_TOKEN_PREMINT_RECIPIENTS="0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266,0x70997970C51812dc3A010C7d01b50e0d17dc79C8" \
TAIKO_TOKEN_PREMINT_AMOUNTS=$PREMINT_TOKEN_AMOUNT,$PREMINT_TOKEN_AMOUNT \
TAIKO_TOKEN_PREMINT_RECIPIENT=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \
TIER_PROVIDER=0x0 \
L2_GENESIS_HASH=$L2_GENESIS_HASH \
forge script script/DeployOnL1.s.sol:DeployOnL1 \
Expand Down
26 changes: 20 additions & 6 deletions testutils/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,32 @@ func (s *ClientTestSuite) SetupTest() {
_, err = rpc.WaitReceipt(context.Background(), rpcCli.L1, tx)
s.Nil(err)

// Transfer some tokens to provers.
balance, err := rpcCli.TaikoToken.BalanceOf(nil, crypto.PubkeyToAddress(ownerPrivKey.PublicKey))
s.Nil(err)
s.Greater(balance.Cmp(common.Big0), 0)

opts, err = bind.NewKeyedTransactorWithChainID(ownerPrivKey, rpcCli.L1ChainID)
s.Nil(err)
proverBalance := new(big.Int).Div(balance, common.Big2)
s.Greater(proverBalance.Cmp(common.Big0), 0)

tx, err = rpcCli.TaikoToken.Transfer(
opts,
crypto.PubkeyToAddress(l1ProverPrivKey.PublicKey), proverBalance,
)
s.Nil(err)
_, err = rpc.WaitReceipt(context.Background(), rpcCli.L1, tx)
s.Nil(err)

// Deposit taiko tokens for provers.
opts, err = bind.NewKeyedTransactorWithChainID(l1ProverPrivKey, rpcCli.L1ChainID)
s.Nil(err)

premintAmount, ok := new(big.Int).SetString(os.Getenv("PREMINT_TOKEN_AMOUNT"), 10)
s.True(ok)
s.True(premintAmount.Cmp(common.Big0) > 0)

_, err = rpcCli.TaikoToken.Approve(opts, common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")), premintAmount)
_, err = rpcCli.TaikoToken.Approve(opts, common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")), proverBalance)
s.Nil(err)

tx, err = rpcCli.TaikoL1.DepositTaikoToken(opts, premintAmount)
tx, err = rpcCli.TaikoL1.DepositTaikoToken(opts, proverBalance)
s.Nil(err)
_, err = rpc.WaitReceipt(context.Background(), rpcCli.L1, tx)
s.Nil(err)
Expand Down

0 comments on commit ed835c2

Please sign in to comment.