-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
42 lines (35 loc) · 1.12 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
package main
import (
"bevm-erc20-factory/config"
"bevm-erc20-factory/erc20Factory"
"fmt"
"io/ioutil"
"log"
"github.com/ethereum/go-ethereum/common"
)
func main() {
// Read ABI from file
abi, err := ioutil.ReadFile("./abis/BitcoinAssetsErc20Factory.json")
if err != nil {
log.Fatalf("Failed to read contract ABI: %v", err)
}
// Instantiate the factory
factory, err := erc20Factory.NewERC20Factory(config.BEVMTestnet.RpcUrl, string(abi), config.BEVMTestnet.FactoryContractAddress)
if err != nil {
log.Fatalf("Failed to create ERC20 factory: %v", err)
}
// Replace with your own values
name := "ABCD"
symbol := "ABCD"
protocol := "brc-20"
decimals := uint8(18)
// hot wallet address, owner can change admin
owner := common.HexToAddress("0xffBFBCC6d20a0a90CBDEB1DA52BED04Bb9B37022")
admin := common.HexToAddress("0xffBFBCC6d20a0a90CBDEB1DA52BED04Bb9B37022")
// Call CreateERC20
newContractAddress, err := factory.CreateERC20(name, symbol, protocol, decimals, owner, admin)
if err != nil {
log.Fatalf("Failed to create ERC20 token: %v", err)
}
fmt.Printf("New contract address: %s\n", newContractAddress.Hex())
}