-
Notifications
You must be signed in to change notification settings - Fork 67
/
main.go
47 lines (40 loc) · 1.18 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"context"
"math/big"
"github.com/0xPolygonHermez/zkevm-bridge-service/utils"
"github.com/0xPolygonHermez/zkevm-node/log"
"github.com/ethereum/go-ethereum/common"
)
const (
l1BridgeAddr = "0x0165878A594ca255338adfa4d48449f69242Eb8F"
l1AccHexAddress = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
l1AccHexPrivateKey = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
l1NetworkURL = "http://localhost:8545"
funds = 90000000000000000 // nolint
destNetwork uint32 = 1
)
var tokenAddr = common.Address{}
func main() {
ctx := context.Background()
client, err := utils.NewClient(ctx, l1NetworkURL)
if err != nil {
log.Fatal("Error: ", err)
}
auth, err := client.GetSigner(ctx, l1AccHexPrivateKey)
if err != nil {
log.Fatal("Error: ", err)
}
amount := big.NewInt(funds)
emptyAddr := common.Address{}
if tokenAddr == emptyAddr {
auth.Value = amount
}
destAddr := common.HexToAddress(l1AccHexAddress)
log.Info("Sending bridge tx...")
err = client.SendBridgeAsset(ctx, tokenAddr, amount, destNetwork, &destAddr, []byte{}, common.HexToAddress(l1BridgeAddr), auth)
if err != nil {
log.Fatal("Error: ", err)
}
log.Info("Success!")
}