├── .DS_Store
├── .env_bsc
├── .gitignore
├── .idea
├── goweb3manager.iml
├── misc.xml
├── modules.xml
├── vcs.xml
└── workspace.xml
├── .vscode
└── launch.json
├── README.md
├── build.bat
├── contracts
├── IERC20
│ └── IERC20.go
├── IPancakeFactory
│ └── IPancakeFactory.go
├── IPancakePair
│ └── IPancakePair.go
├── IPancakeRouter01
│ └── IPancakeRouter01.go
├── IPancakeRouter02
│ └── IPancakeRouter02.go
├── IWETH
│ └── IWETH.go
├── PancakeLibrary
│ └── PancakeLibrary.go
├── PancakeRouter
│ └── PancakeRouter.go
├── PancakeTestnetContract.sol
├── SafeMath
│ └── SafeMath.go
├── TransferHelper
│ └── TransferHelper.go
└── build
│ ├── IERC20.abi
│ ├── IERC20.bin
│ ├── IPancakeFactory.abi
│ ├── IPancakeFactory.bin
│ ├── IPancakePair.abi
│ ├── IPancakePair.bin
│ ├── IPancakeRouter01.abi
│ ├── IPancakeRouter01.bin
│ ├── IPancakeRouter02.abi
│ ├── IPancakeRouter02.bin
│ ├── IWETH.abi
│ ├── IWETH.bin
│ ├── PancakeLibrary.abi
│ ├── PancakeLibrary.bin
│ ├── PancakeRouter.abi
│ ├── PancakeRouter.bin
│ ├── SafeMath.abi
│ ├── SafeMath.bin
│ ├── Store.abi
│ ├── Store.bin
│ ├── TransferHelper.abi
│ └── TransferHelper.bin
├── database
└── conn.go
├── examples
├── cancelTx copy.go
├── cancelTx.go
└── sendTokens.go
├── generateGolangFromAbi.py
├── genericutils
└── utils.go
├── go.mod
├── go.sum
├── main.bak
├── main.go
├── wallets
├── 2022_04_04_21_00_06.json
└── 2022_04_04_21_00_11.json
└── web3helper
├── errors.go
├── networks.go
├── service.go
└── web3helperiface
└── interface.go
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LucaWilliams4831/web3golanghelper-1/c09ef97b5047683178f490994b8803cdd38922c8/.DS_Store
--------------------------------------------------------------------------------
/.env_bsc:
--------------------------------------------------------------------------------
1 | RPC_URL="https://rpc.ankr.com/bsc_testnet_chapel/8bb975b26860eb14a52028cf0094617967e250459efe5360f1029369b445e6c0"
2 | WS_URL="wss://rpc.ankr.com/bsc_testnet_chapel/ws/8bb975b26860eb14a52028cf0094617967e250459efe5360f1029369b445e6c0"
3 | WETH_ADDRESS="0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"
4 | FACTORY_ADDRESS="0x6725F303b657a9451d8BA641348b6761A6CC7a17"
5 | TOKEN_ADDRESS="0x5f2128b35e28dcfB3Be0580B85e7DaF14e489D1D"
6 | BUY_AMOUNT="0.1"
7 | PK="a19b9884fb0bfabb9a6db7beab3e4a436ad5d7b36289cf36dc3403e39ecdfd73"
8 | ROUTER_ADDRESS="0xD99D1c33F9fC3444f8101754aBC46c52416550D1"
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .env
2 |
--------------------------------------------------------------------------------
/.idea/goweb3manager.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
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 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | 1649469290557
78 |
79 |
80 | 1649469290557
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 | true
92 |
93 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense para saber los atributos posibles.
3 | // Mantenga el puntero para ver las descripciones de los existentes atributos.
4 | // Para más información, visite: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "Launch Package",
9 | "type": "go",
10 | "request": "launch",
11 | "mode": "auto",
12 | "program": "${fileDirname}"
13 | }
14 | ]
15 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # goweb3manager
2 |
3 | This project was created to facilitate the use of web3 using golang, initially created for my own projects, but I decided to make it public because I had a hard time finding the documentation, I have learned a lot from the free resources of the community, I feel the duty to return all this
--------------------------------------------------------------------------------
/build.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | C:\Users\Paulino\go\pkg\mod\github.com\ethereum\go-ethereum@v1.10.4\build\bin\abigen.exe --bin=C:\Users\Paulino\go\src\github.com\nikola43\web3manager\contracts\build\IERC20.bin --abi=C:\Users\Paulino\go\src\g
3 | ithub.com\nikola43\web3manager\contracts\build\IERC20.abi --pkg=pancake --out=IERC20.go
4 |
5 | C:\Users\Paulino\go\pkg\mod\github.com\ethereum\go-ethereum@v1.10.4\build\bin\abigen.exe --bin=C:\Users\Paulino\go\src\github.com\nikola43\web3manager\contracts\build\IPancakeFactory.bin --abi=C:\Users\Paulino\go\src\g
6 | ithub.com\nikola43\web3manager\contracts\build\IPancakeFactory.abi --pkg=pancake --out=IPancakeFactory.go
7 |
8 | C:\Users\Paulino\go\pkg\mod\github.com\ethereum\go-ethereum@v1.10.4\build\bin\abigen.exe --bin=C:\Users\Paulino\go\src\github.com\nikola43\web3manager\contracts\build\IPancakePair.bin --abi=C:\Users\Paulino\go\src\g
9 | ithub.com\nikola43\web3manager\contracts\build\IPancakePair.abi --pkg=pancake --out=IPancakePair.go
10 |
11 | C:\Users\Paulino\go\pkg\mod\github.com\ethereum\go-ethereum@v1.10.4\build\bin\abigen.exe --bin=C:\Users\Paulino\go\src\github.com\nikola43\web3manager\contracts\build\IPancakeRouter01.bin --abi=C:\Users\Paulino\go\src\g
12 | ithub.com\nikola43\web3manager\contracts\build\IPancakeRouter01.abi --pkg=pancake --out=IPancakeRouter01.go
13 |
14 | C:\Users\Paulino\go\pkg\mod\github.com\ethereum\go-ethereum@v1.10.4\build\bin\abigen.exe --bin=C:\Users\Paulino\go\src\github.com\nikola43\web3manager\contracts\build\IPancakeRouter02.bin --abi=C:\Users\Paulino\go\src\g
15 | ithub.com\nikola43\web3manager\contracts\build\IPancakeRouter02.abi --pkg=pancake --out=IPancakeRouter02.go
16 |
17 | C:\Users\Paulino\go\pkg\mod\github.com\ethereum\go-ethereum@v1.10.4\build\bin\abigen.exe --bin=C:\Users\Paulino\go\src\github.com\nikola43\web3manager\contracts\build\IWETH.bin --abi=C:\Users\Paulino\go\src\g
18 | ithub.com\nikola43\web3manager\contracts\build\IWETH.abi --pkg=pancake --out=IWETH.go
19 |
20 | C:\Users\Paulino\go\pkg\mod\github.com\ethereum\go-ethereum@v1.10.4\build\bin\abigen.exe --bin=C:\Users\Paulino\go\src\github.com\nikola43\web3manager\contracts\build\PancakeLibrary.bin --abi=C:\Users\Paulino\go\src\g
21 | ithub.com\nikola43\web3manager\contracts\build\PancakeLibrary.abi --pkg=pancake --out=PancakeLibrary.go
22 |
23 | C:\Users\Paulino\go\pkg\mod\github.com\ethereum\go-ethereum@v1.10.4\build\bin\abigen.exe --bin=C:\Users\Paulino\go\src\github.com\nikola43\web3manager\contracts\build\PancakeRouter.bin --abi=C:\Users\Paulino\go\src\g
24 | ithub.com\nikola43\web3manager\contracts\build\PancakeRouter.abi --pkg=pancake --out=PancakeRouter.go
25 |
26 | C:\Users\Paulino\go\pkg\mod\github.com\ethereum\go-ethereum@v1.10.4\build\bin\abigen.exe --bin=C:\Users\Paulino\go\src\github.com\nikola43\web3manager\contracts\build\SafeMath.bin --abi=C:\Users\Paulino\go\src\g
27 | ithub.com\nikola43\web3manager\contracts\build\SafeMath.abi --pkg=pancake --out=SafeMath.go
28 |
29 | C:\Users\Paulino\go\pkg\mod\github.com\ethereum\go-ethereum@v1.10.4\build\bin\abigen.exe --bin=C:\Users\Paulino\go\src\github.com\nikola43\web3manager\contracts\build\TransferHelper.bin --abi=C:\Users\Paulino\go\src\g
30 | ithub.com\nikola43\web3manager\contracts\build\TransferHelper.abi --pkg=pancake --out=TransferHelper.go
31 |
--------------------------------------------------------------------------------
/contracts/IERC20/IERC20.go:
--------------------------------------------------------------------------------
1 | // Code generated - DO NOT EDIT.
2 | // This file is a generated binding and any manual changes will be lost.
3 |
4 | package IERC20
5 |
6 | import (
7 | "math/big"
8 | "strings"
9 |
10 | ethereum "github.com/ethereum/go-ethereum"
11 | "github.com/ethereum/go-ethereum/accounts/abi"
12 | "github.com/ethereum/go-ethereum/accounts/abi/bind"
13 | "github.com/ethereum/go-ethereum/common"
14 | "github.com/ethereum/go-ethereum/core/types"
15 | "github.com/ethereum/go-ethereum/event"
16 | )
17 |
18 | // Reference imports to suppress errors if they are not otherwise used.
19 | var (
20 | _ = big.NewInt
21 | _ = strings.NewReader
22 | _ = ethereum.NotFound
23 | _ = bind.Bind
24 | _ = common.Big1
25 | _ = types.BloomLookup
26 | _ = event.NewSubscription
27 | )
28 |
29 | // PancakeABI is the input ABI used to generate the binding from.
30 | const PancakeABI = "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
31 |
32 | // Pancake is an auto generated Go binding around an Ethereum contract.
33 | type Pancake struct {
34 | PancakeCaller // Read-only binding to the contract
35 | PancakeTransactor // Write-only binding to the contract
36 | PancakeFilterer // Log filterer for contract events
37 | }
38 |
39 | // PancakeCaller is an auto generated read-only Go binding around an Ethereum contract.
40 | type PancakeCaller struct {
41 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
42 | }
43 |
44 | // PancakeTransactor is an auto generated write-only Go binding around an Ethereum contract.
45 | type PancakeTransactor struct {
46 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
47 | }
48 |
49 | // PancakeFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
50 | type PancakeFilterer struct {
51 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
52 | }
53 |
54 | // PancakeSession is an auto generated Go binding around an Ethereum contract,
55 | // with pre-set call and transact options.
56 | type PancakeSession struct {
57 | Contract *Pancake // Generic contract binding to set the session for
58 | CallOpts bind.CallOpts // Call options to use throughout this session
59 | TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
60 | }
61 |
62 | // PancakeCallerSession is an auto generated read-only Go binding around an Ethereum contract,
63 | // with pre-set call options.
64 | type PancakeCallerSession struct {
65 | Contract *PancakeCaller // Generic contract caller binding to set the session for
66 | CallOpts bind.CallOpts // Call options to use throughout this session
67 | }
68 |
69 | // PancakeTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
70 | // with pre-set transact options.
71 | type PancakeTransactorSession struct {
72 | Contract *PancakeTransactor // Generic contract transactor binding to set the session for
73 | TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
74 | }
75 |
76 | // PancakeRaw is an auto generated low-level Go binding around an Ethereum contract.
77 | type PancakeRaw struct {
78 | Contract *Pancake // Generic contract binding to access the raw methods on
79 | }
80 |
81 | // PancakeCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
82 | type PancakeCallerRaw struct {
83 | Contract *PancakeCaller // Generic read-only contract binding to access the raw methods on
84 | }
85 |
86 | // PancakeTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
87 | type PancakeTransactorRaw struct {
88 | Contract *PancakeTransactor // Generic write-only contract binding to access the raw methods on
89 | }
90 |
91 | // NewPancake creates a new instance of Pancake, bound to a specific deployed contract.
92 | func NewPancake(address common.Address, backend bind.ContractBackend) (*Pancake, error) {
93 | contract, err := bindPancake(address, backend, backend, backend)
94 | if err != nil {
95 | return nil, err
96 | }
97 | return &Pancake{PancakeCaller: PancakeCaller{contract: contract}, PancakeTransactor: PancakeTransactor{contract: contract}, PancakeFilterer: PancakeFilterer{contract: contract}}, nil
98 | }
99 |
100 | // NewPancakeCaller creates a new read-only instance of Pancake, bound to a specific deployed contract.
101 | func NewPancakeCaller(address common.Address, caller bind.ContractCaller) (*PancakeCaller, error) {
102 | contract, err := bindPancake(address, caller, nil, nil)
103 | if err != nil {
104 | return nil, err
105 | }
106 | return &PancakeCaller{contract: contract}, nil
107 | }
108 |
109 | // NewPancakeTransactor creates a new write-only instance of Pancake, bound to a specific deployed contract.
110 | func NewPancakeTransactor(address common.Address, transactor bind.ContractTransactor) (*PancakeTransactor, error) {
111 | contract, err := bindPancake(address, nil, transactor, nil)
112 | if err != nil {
113 | return nil, err
114 | }
115 | return &PancakeTransactor{contract: contract}, nil
116 | }
117 |
118 | // NewPancakeFilterer creates a new log filterer instance of Pancake, bound to a specific deployed contract.
119 | func NewPancakeFilterer(address common.Address, filterer bind.ContractFilterer) (*PancakeFilterer, error) {
120 | contract, err := bindPancake(address, nil, nil, filterer)
121 | if err != nil {
122 | return nil, err
123 | }
124 | return &PancakeFilterer{contract: contract}, nil
125 | }
126 |
127 | // bindPancake binds a generic wrapper to an already deployed contract.
128 | func bindPancake(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
129 | parsed, err := abi.JSON(strings.NewReader(PancakeABI))
130 | if err != nil {
131 | return nil, err
132 | }
133 | return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
134 | }
135 |
136 | // Call invokes the (constant) contract method with params as input values and
137 | // sets the output to result. The result type might be a single field for simple
138 | // returns, a slice of interfaces for anonymous returns and a struct for named
139 | // returns.
140 | func (_Pancake *PancakeRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
141 | return _Pancake.Contract.PancakeCaller.contract.Call(opts, result, method, params...)
142 | }
143 |
144 | // Transfer initiates a plain transaction to move funds to the contract, calling
145 | // its default method if one is available.
146 | func (_Pancake *PancakeRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
147 | return _Pancake.Contract.PancakeTransactor.contract.Transfer(opts)
148 | }
149 |
150 | // Transact invokes the (paid) contract method with params as input values.
151 | func (_Pancake *PancakeRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
152 | return _Pancake.Contract.PancakeTransactor.contract.Transact(opts, method, params...)
153 | }
154 |
155 | // Call invokes the (constant) contract method with params as input values and
156 | // sets the output to result. The result type might be a single field for simple
157 | // returns, a slice of interfaces for anonymous returns and a struct for named
158 | // returns.
159 | func (_Pancake *PancakeCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
160 | return _Pancake.Contract.contract.Call(opts, result, method, params...)
161 | }
162 |
163 | // Transfer initiates a plain transaction to move funds to the contract, calling
164 | // its default method if one is available.
165 | func (_Pancake *PancakeTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
166 | return _Pancake.Contract.contract.Transfer(opts)
167 | }
168 |
169 | // Transact invokes the (paid) contract method with params as input values.
170 | func (_Pancake *PancakeTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
171 | return _Pancake.Contract.contract.Transact(opts, method, params...)
172 | }
173 |
174 | // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e.
175 | //
176 | // Solidity: function allowance(address owner, address spender) view returns(uint256)
177 | func (_Pancake *PancakeCaller) Allowance(opts *bind.CallOpts, owner common.Address, spender common.Address) (*big.Int, error) {
178 | var out []interface{}
179 | err := _Pancake.contract.Call(opts, &out, "allowance", owner, spender)
180 |
181 | if err != nil {
182 | return *new(*big.Int), err
183 | }
184 |
185 | out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
186 |
187 | return out0, err
188 |
189 | }
190 |
191 | // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e.
192 | //
193 | // Solidity: function allowance(address owner, address spender) view returns(uint256)
194 | func (_Pancake *PancakeSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) {
195 | return _Pancake.Contract.Allowance(&_Pancake.CallOpts, owner, spender)
196 | }
197 |
198 | // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e.
199 | //
200 | // Solidity: function allowance(address owner, address spender) view returns(uint256)
201 | func (_Pancake *PancakeCallerSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) {
202 | return _Pancake.Contract.Allowance(&_Pancake.CallOpts, owner, spender)
203 | }
204 |
205 | // BalanceOf is a free data retrieval call binding the contract method 0x70a08231.
206 | //
207 | // Solidity: function balanceOf(address owner) view returns(uint256)
208 | func (_Pancake *PancakeCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) {
209 | var out []interface{}
210 | err := _Pancake.contract.Call(opts, &out, "balanceOf", owner)
211 |
212 | if err != nil {
213 | return *new(*big.Int), err
214 | }
215 |
216 | out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
217 |
218 | return out0, err
219 |
220 | }
221 |
222 | // BalanceOf is a free data retrieval call binding the contract method 0x70a08231.
223 | //
224 | // Solidity: function balanceOf(address owner) view returns(uint256)
225 | func (_Pancake *PancakeSession) BalanceOf(owner common.Address) (*big.Int, error) {
226 | return _Pancake.Contract.BalanceOf(&_Pancake.CallOpts, owner)
227 | }
228 |
229 | // BalanceOf is a free data retrieval call binding the contract method 0x70a08231.
230 | //
231 | // Solidity: function balanceOf(address owner) view returns(uint256)
232 | func (_Pancake *PancakeCallerSession) BalanceOf(owner common.Address) (*big.Int, error) {
233 | return _Pancake.Contract.BalanceOf(&_Pancake.CallOpts, owner)
234 | }
235 |
236 | // Decimals is a free data retrieval call binding the contract method 0x313ce567.
237 | //
238 | // Solidity: function decimals() view returns(uint8)
239 | func (_Pancake *PancakeCaller) Decimals(opts *bind.CallOpts) (uint8, error) {
240 | var out []interface{}
241 | err := _Pancake.contract.Call(opts, &out, "decimals")
242 |
243 | if err != nil {
244 | return *new(uint8), err
245 | }
246 |
247 | out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8)
248 |
249 | return out0, err
250 |
251 | }
252 |
253 | // Decimals is a free data retrieval call binding the contract method 0x313ce567.
254 | //
255 | // Solidity: function decimals() view returns(uint8)
256 | func (_Pancake *PancakeSession) Decimals() (uint8, error) {
257 | return _Pancake.Contract.Decimals(&_Pancake.CallOpts)
258 | }
259 |
260 | // Decimals is a free data retrieval call binding the contract method 0x313ce567.
261 | //
262 | // Solidity: function decimals() view returns(uint8)
263 | func (_Pancake *PancakeCallerSession) Decimals() (uint8, error) {
264 | return _Pancake.Contract.Decimals(&_Pancake.CallOpts)
265 | }
266 |
267 | // Name is a free data retrieval call binding the contract method 0x06fdde03.
268 | //
269 | // Solidity: function name() view returns(string)
270 | func (_Pancake *PancakeCaller) Name(opts *bind.CallOpts) (string, error) {
271 | var out []interface{}
272 | err := _Pancake.contract.Call(opts, &out, "name")
273 |
274 | if err != nil {
275 | return *new(string), err
276 | }
277 |
278 | out0 := *abi.ConvertType(out[0], new(string)).(*string)
279 |
280 | return out0, err
281 |
282 | }
283 |
284 | // Name is a free data retrieval call binding the contract method 0x06fdde03.
285 | //
286 | // Solidity: function name() view returns(string)
287 | func (_Pancake *PancakeSession) Name() (string, error) {
288 | return _Pancake.Contract.Name(&_Pancake.CallOpts)
289 | }
290 |
291 | // Name is a free data retrieval call binding the contract method 0x06fdde03.
292 | //
293 | // Solidity: function name() view returns(string)
294 | func (_Pancake *PancakeCallerSession) Name() (string, error) {
295 | return _Pancake.Contract.Name(&_Pancake.CallOpts)
296 | }
297 |
298 | // Symbol is a free data retrieval call binding the contract method 0x95d89b41.
299 | //
300 | // Solidity: function symbol() view returns(string)
301 | func (_Pancake *PancakeCaller) Symbol(opts *bind.CallOpts) (string, error) {
302 | var out []interface{}
303 | err := _Pancake.contract.Call(opts, &out, "symbol")
304 |
305 | if err != nil {
306 | return *new(string), err
307 | }
308 |
309 | out0 := *abi.ConvertType(out[0], new(string)).(*string)
310 |
311 | return out0, err
312 |
313 | }
314 |
315 | // Symbol is a free data retrieval call binding the contract method 0x95d89b41.
316 | //
317 | // Solidity: function symbol() view returns(string)
318 | func (_Pancake *PancakeSession) Symbol() (string, error) {
319 | return _Pancake.Contract.Symbol(&_Pancake.CallOpts)
320 | }
321 |
322 | // Symbol is a free data retrieval call binding the contract method 0x95d89b41.
323 | //
324 | // Solidity: function symbol() view returns(string)
325 | func (_Pancake *PancakeCallerSession) Symbol() (string, error) {
326 | return _Pancake.Contract.Symbol(&_Pancake.CallOpts)
327 | }
328 |
329 | // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd.
330 | //
331 | // Solidity: function totalSupply() view returns(uint256)
332 | func (_Pancake *PancakeCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) {
333 | var out []interface{}
334 | err := _Pancake.contract.Call(opts, &out, "totalSupply")
335 |
336 | if err != nil {
337 | return *new(*big.Int), err
338 | }
339 |
340 | out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
341 |
342 | return out0, err
343 |
344 | }
345 |
346 | // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd.
347 | //
348 | // Solidity: function totalSupply() view returns(uint256)
349 | func (_Pancake *PancakeSession) TotalSupply() (*big.Int, error) {
350 | return _Pancake.Contract.TotalSupply(&_Pancake.CallOpts)
351 | }
352 |
353 | // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd.
354 | //
355 | // Solidity: function totalSupply() view returns(uint256)
356 | func (_Pancake *PancakeCallerSession) TotalSupply() (*big.Int, error) {
357 | return _Pancake.Contract.TotalSupply(&_Pancake.CallOpts)
358 | }
359 |
360 | // Approve is a paid mutator transaction binding the contract method 0x095ea7b3.
361 | //
362 | // Solidity: function approve(address spender, uint256 value) returns(bool)
363 | func (_Pancake *PancakeTransactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) {
364 | return _Pancake.contract.Transact(opts, "approve", spender, value)
365 | }
366 |
367 | // Approve is a paid mutator transaction binding the contract method 0x095ea7b3.
368 | //
369 | // Solidity: function approve(address spender, uint256 value) returns(bool)
370 | func (_Pancake *PancakeSession) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) {
371 | return _Pancake.Contract.Approve(&_Pancake.TransactOpts, spender, value)
372 | }
373 |
374 | // Approve is a paid mutator transaction binding the contract method 0x095ea7b3.
375 | //
376 | // Solidity: function approve(address spender, uint256 value) returns(bool)
377 | func (_Pancake *PancakeTransactorSession) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) {
378 | return _Pancake.Contract.Approve(&_Pancake.TransactOpts, spender, value)
379 | }
380 |
381 | // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.
382 | //
383 | // Solidity: function transfer(address to, uint256 value) returns(bool)
384 | func (_Pancake *PancakeTransactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {
385 | return _Pancake.contract.Transact(opts, "transfer", to, value)
386 | }
387 |
388 | // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.
389 | //
390 | // Solidity: function transfer(address to, uint256 value) returns(bool)
391 | func (_Pancake *PancakeSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {
392 | return _Pancake.Contract.Transfer(&_Pancake.TransactOpts, to, value)
393 | }
394 |
395 | // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.
396 | //
397 | // Solidity: function transfer(address to, uint256 value) returns(bool)
398 | func (_Pancake *PancakeTransactorSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {
399 | return _Pancake.Contract.Transfer(&_Pancake.TransactOpts, to, value)
400 | }
401 |
402 | // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd.
403 | //
404 | // Solidity: function transferFrom(address from, address to, uint256 value) returns(bool)
405 | func (_Pancake *PancakeTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) {
406 | return _Pancake.contract.Transact(opts, "transferFrom", from, to, value)
407 | }
408 |
409 | // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd.
410 | //
411 | // Solidity: function transferFrom(address from, address to, uint256 value) returns(bool)
412 | func (_Pancake *PancakeSession) TransferFrom(from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) {
413 | return _Pancake.Contract.TransferFrom(&_Pancake.TransactOpts, from, to, value)
414 | }
415 |
416 | // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd.
417 | //
418 | // Solidity: function transferFrom(address from, address to, uint256 value) returns(bool)
419 | func (_Pancake *PancakeTransactorSession) TransferFrom(from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) {
420 | return _Pancake.Contract.TransferFrom(&_Pancake.TransactOpts, from, to, value)
421 | }
422 |
423 | // PancakeApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the Pancake contract.
424 | type PancakeApprovalIterator struct {
425 | Event *PancakeApproval // Event containing the contract specifics and raw log
426 |
427 | contract *bind.BoundContract // Generic contract to use for unpacking event data
428 | event string // Event name to use for unpacking event data
429 |
430 | logs chan types.Log // Log channel receiving the found contract events
431 | sub ethereum.Subscription // Subscription for errors, completion and termination
432 | done bool // Whether the subscription completed delivering logs
433 | fail error // Occurred error to stop iteration
434 | }
435 |
436 | // Next advances the iterator to the subsequent event, returning whether there
437 | // are any more events found. In case of a retrieval or parsing error, false is
438 | // returned and Error() can be queried for the exact failure.
439 | func (it *PancakeApprovalIterator) Next() bool {
440 | // If the iterator failed, stop iterating
441 | if it.fail != nil {
442 | return false
443 | }
444 | // If the iterator completed, deliver directly whatever's available
445 | if it.done {
446 | select {
447 | case log := <-it.logs:
448 | it.Event = new(PancakeApproval)
449 | if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
450 | it.fail = err
451 | return false
452 | }
453 | it.Event.Raw = log
454 | return true
455 |
456 | default:
457 | return false
458 | }
459 | }
460 | // Iterator still in progress, wait for either a data or an error event
461 | select {
462 | case log := <-it.logs:
463 | it.Event = new(PancakeApproval)
464 | if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
465 | it.fail = err
466 | return false
467 | }
468 | it.Event.Raw = log
469 | return true
470 |
471 | case err := <-it.sub.Err():
472 | it.done = true
473 | it.fail = err
474 | return it.Next()
475 | }
476 | }
477 |
478 | // Error returns any retrieval or parsing error occurred during filtering.
479 | func (it *PancakeApprovalIterator) Error() error {
480 | return it.fail
481 | }
482 |
483 | // Close terminates the iteration process, releasing any pending underlying
484 | // resources.
485 | func (it *PancakeApprovalIterator) Close() error {
486 | it.sub.Unsubscribe()
487 | return nil
488 | }
489 |
490 | // PancakeApproval represents a Approval event raised by the Pancake contract.
491 | type PancakeApproval struct {
492 | Owner common.Address
493 | Spender common.Address
494 | Value *big.Int
495 | Raw types.Log // Blockchain specific contextual infos
496 | }
497 |
498 | // FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925.
499 | //
500 | // Solidity: event Approval(address indexed owner, address indexed spender, uint256 value)
501 | func (_Pancake *PancakeFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*PancakeApprovalIterator, error) {
502 |
503 | var ownerRule []interface{}
504 | for _, ownerItem := range owner {
505 | ownerRule = append(ownerRule, ownerItem)
506 | }
507 | var spenderRule []interface{}
508 | for _, spenderItem := range spender {
509 | spenderRule = append(spenderRule, spenderItem)
510 | }
511 |
512 | logs, sub, err := _Pancake.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule)
513 | if err != nil {
514 | return nil, err
515 | }
516 | return &PancakeApprovalIterator{contract: _Pancake.contract, event: "Approval", logs: logs, sub: sub}, nil
517 | }
518 |
519 | // WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925.
520 | //
521 | // Solidity: event Approval(address indexed owner, address indexed spender, uint256 value)
522 | func (_Pancake *PancakeFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *PancakeApproval, owner []common.Address, spender []common.Address) (event.Subscription, error) {
523 |
524 | var ownerRule []interface{}
525 | for _, ownerItem := range owner {
526 | ownerRule = append(ownerRule, ownerItem)
527 | }
528 | var spenderRule []interface{}
529 | for _, spenderItem := range spender {
530 | spenderRule = append(spenderRule, spenderItem)
531 | }
532 |
533 | logs, sub, err := _Pancake.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule)
534 | if err != nil {
535 | return nil, err
536 | }
537 | return event.NewSubscription(func(quit <-chan struct{}) error {
538 | defer sub.Unsubscribe()
539 | for {
540 | select {
541 | case log := <-logs:
542 | // New log arrived, parse the event and forward to the user
543 | event := new(PancakeApproval)
544 | if err := _Pancake.contract.UnpackLog(event, "Approval", log); err != nil {
545 | return err
546 | }
547 | event.Raw = log
548 |
549 | select {
550 | case sink <- event:
551 | case err := <-sub.Err():
552 | return err
553 | case <-quit:
554 | return nil
555 | }
556 | case err := <-sub.Err():
557 | return err
558 | case <-quit:
559 | return nil
560 | }
561 | }
562 | }), nil
563 | }
564 |
565 | // ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925.
566 | //
567 | // Solidity: event Approval(address indexed owner, address indexed spender, uint256 value)
568 | func (_Pancake *PancakeFilterer) ParseApproval(log types.Log) (*PancakeApproval, error) {
569 | event := new(PancakeApproval)
570 | if err := _Pancake.contract.UnpackLog(event, "Approval", log); err != nil {
571 | return nil, err
572 | }
573 | event.Raw = log
574 | return event, nil
575 | }
576 |
577 | // PancakeTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the Pancake contract.
578 | type PancakeTransferIterator struct {
579 | Event *PancakeTransfer // Event containing the contract specifics and raw log
580 |
581 | contract *bind.BoundContract // Generic contract to use for unpacking event data
582 | event string // Event name to use for unpacking event data
583 |
584 | logs chan types.Log // Log channel receiving the found contract events
585 | sub ethereum.Subscription // Subscription for errors, completion and termination
586 | done bool // Whether the subscription completed delivering logs
587 | fail error // Occurred error to stop iteration
588 | }
589 |
590 | // Next advances the iterator to the subsequent event, returning whether there
591 | // are any more events found. In case of a retrieval or parsing error, false is
592 | // returned and Error() can be queried for the exact failure.
593 | func (it *PancakeTransferIterator) Next() bool {
594 | // If the iterator failed, stop iterating
595 | if it.fail != nil {
596 | return false
597 | }
598 | // If the iterator completed, deliver directly whatever's available
599 | if it.done {
600 | select {
601 | case log := <-it.logs:
602 | it.Event = new(PancakeTransfer)
603 | if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
604 | it.fail = err
605 | return false
606 | }
607 | it.Event.Raw = log
608 | return true
609 |
610 | default:
611 | return false
612 | }
613 | }
614 | // Iterator still in progress, wait for either a data or an error event
615 | select {
616 | case log := <-it.logs:
617 | it.Event = new(PancakeTransfer)
618 | if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
619 | it.fail = err
620 | return false
621 | }
622 | it.Event.Raw = log
623 | return true
624 |
625 | case err := <-it.sub.Err():
626 | it.done = true
627 | it.fail = err
628 | return it.Next()
629 | }
630 | }
631 |
632 | // Error returns any retrieval or parsing error occurred during filtering.
633 | func (it *PancakeTransferIterator) Error() error {
634 | return it.fail
635 | }
636 |
637 | // Close terminates the iteration process, releasing any pending underlying
638 | // resources.
639 | func (it *PancakeTransferIterator) Close() error {
640 | it.sub.Unsubscribe()
641 | return nil
642 | }
643 |
644 | // PancakeTransfer represents a Transfer event raised by the Pancake contract.
645 | type PancakeTransfer struct {
646 | From common.Address
647 | To common.Address
648 | Value *big.Int
649 | Raw types.Log // Blockchain specific contextual infos
650 | }
651 |
652 | // FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef.
653 | //
654 | // Solidity: event Transfer(address indexed from, address indexed to, uint256 value)
655 | func (_Pancake *PancakeFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*PancakeTransferIterator, error) {
656 |
657 | var fromRule []interface{}
658 | for _, fromItem := range from {
659 | fromRule = append(fromRule, fromItem)
660 | }
661 | var toRule []interface{}
662 | for _, toItem := range to {
663 | toRule = append(toRule, toItem)
664 | }
665 |
666 | logs, sub, err := _Pancake.contract.FilterLogs(opts, "Transfer", fromRule, toRule)
667 | if err != nil {
668 | return nil, err
669 | }
670 | return &PancakeTransferIterator{contract: _Pancake.contract, event: "Transfer", logs: logs, sub: sub}, nil
671 | }
672 |
673 | // WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef.
674 | //
675 | // Solidity: event Transfer(address indexed from, address indexed to, uint256 value)
676 | func (_Pancake *PancakeFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *PancakeTransfer, from []common.Address, to []common.Address) (event.Subscription, error) {
677 |
678 | var fromRule []interface{}
679 | for _, fromItem := range from {
680 | fromRule = append(fromRule, fromItem)
681 | }
682 | var toRule []interface{}
683 | for _, toItem := range to {
684 | toRule = append(toRule, toItem)
685 | }
686 |
687 | logs, sub, err := _Pancake.contract.WatchLogs(opts, "Transfer", fromRule, toRule)
688 | if err != nil {
689 | return nil, err
690 | }
691 | return event.NewSubscription(func(quit <-chan struct{}) error {
692 | defer sub.Unsubscribe()
693 | for {
694 | select {
695 | case log := <-logs:
696 | // New log arrived, parse the event and forward to the user
697 | event := new(PancakeTransfer)
698 | if err := _Pancake.contract.UnpackLog(event, "Transfer", log); err != nil {
699 | return err
700 | }
701 | event.Raw = log
702 |
703 | select {
704 | case sink <- event:
705 | case err := <-sub.Err():
706 | return err
707 | case <-quit:
708 | return nil
709 | }
710 | case err := <-sub.Err():
711 | return err
712 | case <-quit:
713 | return nil
714 | }
715 | }
716 | }), nil
717 | }
718 |
719 | // ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef.
720 | //
721 | // Solidity: event Transfer(address indexed from, address indexed to, uint256 value)
722 | func (_Pancake *PancakeFilterer) ParseTransfer(log types.Log) (*PancakeTransfer, error) {
723 | event := new(PancakeTransfer)
724 | if err := _Pancake.contract.UnpackLog(event, "Transfer", log); err != nil {
725 | return nil, err
726 | }
727 | event.Raw = log
728 | return event, nil
729 | }
730 |
--------------------------------------------------------------------------------
/contracts/IPancakeFactory/IPancakeFactory.go:
--------------------------------------------------------------------------------
1 | // Code generated - DO NOT EDIT.
2 | // This file is a generated binding and any manual changes will be lost.
3 |
4 | package IPancakeFactory
5 |
6 | import (
7 | "math/big"
8 | "strings"
9 |
10 | ethereum "github.com/ethereum/go-ethereum"
11 | "github.com/ethereum/go-ethereum/accounts/abi"
12 | "github.com/ethereum/go-ethereum/accounts/abi/bind"
13 | "github.com/ethereum/go-ethereum/common"
14 | "github.com/ethereum/go-ethereum/core/types"
15 | "github.com/ethereum/go-ethereum/event"
16 | )
17 |
18 | // Reference imports to suppress errors if they are not otherwise used.
19 | var (
20 | _ = big.NewInt
21 | _ = strings.NewReader
22 | _ = ethereum.NotFound
23 | _ = bind.Bind
24 | _ = common.Big1
25 | _ = types.BloomLookup
26 | _ = event.NewSubscription
27 | )
28 |
29 | // PancakeABI is the input ABI used to generate the binding from.
30 | const PancakeABI = "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token0\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token1\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"pair\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"PairCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"allPairs\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"pair\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"allPairsLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"}],\"name\":\"createPair\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"pair\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeTo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeToSetter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"}],\"name\":\"getPair\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"pair\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"setFeeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"setFeeToSetter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
31 |
32 | // Pancake is an auto generated Go binding around an Ethereum contract.
33 | type Pancake struct {
34 | PancakeCaller // Read-only binding to the contract
35 | PancakeTransactor // Write-only binding to the contract
36 | PancakeFilterer // Log filterer for contract events
37 | }
38 |
39 | // PancakeCaller is an auto generated read-only Go binding around an Ethereum contract.
40 | type PancakeCaller struct {
41 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
42 | }
43 |
44 | // PancakeTransactor is an auto generated write-only Go binding around an Ethereum contract.
45 | type PancakeTransactor struct {
46 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
47 | }
48 |
49 | // PancakeFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
50 | type PancakeFilterer struct {
51 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
52 | }
53 |
54 | // PancakeSession is an auto generated Go binding around an Ethereum contract,
55 | // with pre-set call and transact options.
56 | type PancakeSession struct {
57 | Contract *Pancake // Generic contract binding to set the session for
58 | CallOpts bind.CallOpts // Call options to use throughout this session
59 | TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
60 | }
61 |
62 | // PancakeCallerSession is an auto generated read-only Go binding around an Ethereum contract,
63 | // with pre-set call options.
64 | type PancakeCallerSession struct {
65 | Contract *PancakeCaller // Generic contract caller binding to set the session for
66 | CallOpts bind.CallOpts // Call options to use throughout this session
67 | }
68 |
69 | // PancakeTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
70 | // with pre-set transact options.
71 | type PancakeTransactorSession struct {
72 | Contract *PancakeTransactor // Generic contract transactor binding to set the session for
73 | TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
74 | }
75 |
76 | // PancakeRaw is an auto generated low-level Go binding around an Ethereum contract.
77 | type PancakeRaw struct {
78 | Contract *Pancake // Generic contract binding to access the raw methods on
79 | }
80 |
81 | // PancakeCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
82 | type PancakeCallerRaw struct {
83 | Contract *PancakeCaller // Generic read-only contract binding to access the raw methods on
84 | }
85 |
86 | // PancakeTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
87 | type PancakeTransactorRaw struct {
88 | Contract *PancakeTransactor // Generic write-only contract binding to access the raw methods on
89 | }
90 |
91 | // NewPancake creates a new instance of Pancake, bound to a specific deployed contract.
92 | func NewPancake(address common.Address, backend bind.ContractBackend) (*Pancake, error) {
93 | contract, err := bindPancake(address, backend, backend, backend)
94 | if err != nil {
95 | return nil, err
96 | }
97 | return &Pancake{PancakeCaller: PancakeCaller{contract: contract}, PancakeTransactor: PancakeTransactor{contract: contract}, PancakeFilterer: PancakeFilterer{contract: contract}}, nil
98 | }
99 |
100 | // NewPancakeCaller creates a new read-only instance of Pancake, bound to a specific deployed contract.
101 | func NewPancakeCaller(address common.Address, caller bind.ContractCaller) (*PancakeCaller, error) {
102 | contract, err := bindPancake(address, caller, nil, nil)
103 | if err != nil {
104 | return nil, err
105 | }
106 | return &PancakeCaller{contract: contract}, nil
107 | }
108 |
109 | // NewPancakeTransactor creates a new write-only instance of Pancake, bound to a specific deployed contract.
110 | func NewPancakeTransactor(address common.Address, transactor bind.ContractTransactor) (*PancakeTransactor, error) {
111 | contract, err := bindPancake(address, nil, transactor, nil)
112 | if err != nil {
113 | return nil, err
114 | }
115 | return &PancakeTransactor{contract: contract}, nil
116 | }
117 |
118 | // NewPancakeFilterer creates a new log filterer instance of Pancake, bound to a specific deployed contract.
119 | func NewPancakeFilterer(address common.Address, filterer bind.ContractFilterer) (*PancakeFilterer, error) {
120 | contract, err := bindPancake(address, nil, nil, filterer)
121 | if err != nil {
122 | return nil, err
123 | }
124 | return &PancakeFilterer{contract: contract}, nil
125 | }
126 |
127 | // bindPancake binds a generic wrapper to an already deployed contract.
128 | func bindPancake(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
129 | parsed, err := abi.JSON(strings.NewReader(PancakeABI))
130 | if err != nil {
131 | return nil, err
132 | }
133 | return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
134 | }
135 |
136 | // Call invokes the (constant) contract method with params as input values and
137 | // sets the output to result. The result type might be a single field for simple
138 | // returns, a slice of interfaces for anonymous returns and a struct for named
139 | // returns.
140 | func (_Pancake *PancakeRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
141 | return _Pancake.Contract.PancakeCaller.contract.Call(opts, result, method, params...)
142 | }
143 |
144 | // Transfer initiates a plain transaction to move funds to the contract, calling
145 | // its default method if one is available.
146 | func (_Pancake *PancakeRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
147 | return _Pancake.Contract.PancakeTransactor.contract.Transfer(opts)
148 | }
149 |
150 | // Transact invokes the (paid) contract method with params as input values.
151 | func (_Pancake *PancakeRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
152 | return _Pancake.Contract.PancakeTransactor.contract.Transact(opts, method, params...)
153 | }
154 |
155 | // Call invokes the (constant) contract method with params as input values and
156 | // sets the output to result. The result type might be a single field for simple
157 | // returns, a slice of interfaces for anonymous returns and a struct for named
158 | // returns.
159 | func (_Pancake *PancakeCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
160 | return _Pancake.Contract.contract.Call(opts, result, method, params...)
161 | }
162 |
163 | // Transfer initiates a plain transaction to move funds to the contract, calling
164 | // its default method if one is available.
165 | func (_Pancake *PancakeTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
166 | return _Pancake.Contract.contract.Transfer(opts)
167 | }
168 |
169 | // Transact invokes the (paid) contract method with params as input values.
170 | func (_Pancake *PancakeTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
171 | return _Pancake.Contract.contract.Transact(opts, method, params...)
172 | }
173 |
174 | // AllPairs is a free data retrieval call binding the contract method 0x1e3dd18b.
175 | //
176 | // Solidity: function allPairs(uint256 ) view returns(address pair)
177 | func (_Pancake *PancakeCaller) AllPairs(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) {
178 | var out []interface{}
179 | err := _Pancake.contract.Call(opts, &out, "allPairs", arg0)
180 |
181 | if err != nil {
182 | return *new(common.Address), err
183 | }
184 |
185 | out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
186 |
187 | return out0, err
188 |
189 | }
190 |
191 | // AllPairs is a free data retrieval call binding the contract method 0x1e3dd18b.
192 | //
193 | // Solidity: function allPairs(uint256 ) view returns(address pair)
194 | func (_Pancake *PancakeSession) AllPairs(arg0 *big.Int) (common.Address, error) {
195 | return _Pancake.Contract.AllPairs(&_Pancake.CallOpts, arg0)
196 | }
197 |
198 | // AllPairs is a free data retrieval call binding the contract method 0x1e3dd18b.
199 | //
200 | // Solidity: function allPairs(uint256 ) view returns(address pair)
201 | func (_Pancake *PancakeCallerSession) AllPairs(arg0 *big.Int) (common.Address, error) {
202 | return _Pancake.Contract.AllPairs(&_Pancake.CallOpts, arg0)
203 | }
204 |
205 | // AllPairsLength is a free data retrieval call binding the contract method 0x574f2ba3.
206 | //
207 | // Solidity: function allPairsLength() view returns(uint256)
208 | func (_Pancake *PancakeCaller) AllPairsLength(opts *bind.CallOpts) (*big.Int, error) {
209 | var out []interface{}
210 | err := _Pancake.contract.Call(opts, &out, "allPairsLength")
211 |
212 | if err != nil {
213 | return *new(*big.Int), err
214 | }
215 |
216 | out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
217 |
218 | return out0, err
219 |
220 | }
221 |
222 | // AllPairsLength is a free data retrieval call binding the contract method 0x574f2ba3.
223 | //
224 | // Solidity: function allPairsLength() view returns(uint256)
225 | func (_Pancake *PancakeSession) AllPairsLength() (*big.Int, error) {
226 | return _Pancake.Contract.AllPairsLength(&_Pancake.CallOpts)
227 | }
228 |
229 | // AllPairsLength is a free data retrieval call binding the contract method 0x574f2ba3.
230 | //
231 | // Solidity: function allPairsLength() view returns(uint256)
232 | func (_Pancake *PancakeCallerSession) AllPairsLength() (*big.Int, error) {
233 | return _Pancake.Contract.AllPairsLength(&_Pancake.CallOpts)
234 | }
235 |
236 | // FeeTo is a free data retrieval call binding the contract method 0x017e7e58.
237 | //
238 | // Solidity: function feeTo() view returns(address)
239 | func (_Pancake *PancakeCaller) FeeTo(opts *bind.CallOpts) (common.Address, error) {
240 | var out []interface{}
241 | err := _Pancake.contract.Call(opts, &out, "feeTo")
242 |
243 | if err != nil {
244 | return *new(common.Address), err
245 | }
246 |
247 | out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
248 |
249 | return out0, err
250 |
251 | }
252 |
253 | // FeeTo is a free data retrieval call binding the contract method 0x017e7e58.
254 | //
255 | // Solidity: function feeTo() view returns(address)
256 | func (_Pancake *PancakeSession) FeeTo() (common.Address, error) {
257 | return _Pancake.Contract.FeeTo(&_Pancake.CallOpts)
258 | }
259 |
260 | // FeeTo is a free data retrieval call binding the contract method 0x017e7e58.
261 | //
262 | // Solidity: function feeTo() view returns(address)
263 | func (_Pancake *PancakeCallerSession) FeeTo() (common.Address, error) {
264 | return _Pancake.Contract.FeeTo(&_Pancake.CallOpts)
265 | }
266 |
267 | // FeeToSetter is a free data retrieval call binding the contract method 0x094b7415.
268 | //
269 | // Solidity: function feeToSetter() view returns(address)
270 | func (_Pancake *PancakeCaller) FeeToSetter(opts *bind.CallOpts) (common.Address, error) {
271 | var out []interface{}
272 | err := _Pancake.contract.Call(opts, &out, "feeToSetter")
273 |
274 | if err != nil {
275 | return *new(common.Address), err
276 | }
277 |
278 | out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
279 |
280 | return out0, err
281 |
282 | }
283 |
284 | // FeeToSetter is a free data retrieval call binding the contract method 0x094b7415.
285 | //
286 | // Solidity: function feeToSetter() view returns(address)
287 | func (_Pancake *PancakeSession) FeeToSetter() (common.Address, error) {
288 | return _Pancake.Contract.FeeToSetter(&_Pancake.CallOpts)
289 | }
290 |
291 | // FeeToSetter is a free data retrieval call binding the contract method 0x094b7415.
292 | //
293 | // Solidity: function feeToSetter() view returns(address)
294 | func (_Pancake *PancakeCallerSession) FeeToSetter() (common.Address, error) {
295 | return _Pancake.Contract.FeeToSetter(&_Pancake.CallOpts)
296 | }
297 |
298 | // GetPair is a free data retrieval call binding the contract method 0xe6a43905.
299 | //
300 | // Solidity: function getPair(address tokenA, address tokenB) view returns(address pair)
301 | func (_Pancake *PancakeCaller) GetPair(opts *bind.CallOpts, tokenA common.Address, tokenB common.Address) (common.Address, error) {
302 | var out []interface{}
303 | err := _Pancake.contract.Call(opts, &out, "getPair", tokenA, tokenB)
304 |
305 | if err != nil {
306 | return *new(common.Address), err
307 | }
308 |
309 | out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
310 |
311 | return out0, err
312 |
313 | }
314 |
315 | // GetPair is a free data retrieval call binding the contract method 0xe6a43905.
316 | //
317 | // Solidity: function getPair(address tokenA, address tokenB) view returns(address pair)
318 | func (_Pancake *PancakeSession) GetPair(tokenA common.Address, tokenB common.Address) (common.Address, error) {
319 | return _Pancake.Contract.GetPair(&_Pancake.CallOpts, tokenA, tokenB)
320 | }
321 |
322 | // GetPair is a free data retrieval call binding the contract method 0xe6a43905.
323 | //
324 | // Solidity: function getPair(address tokenA, address tokenB) view returns(address pair)
325 | func (_Pancake *PancakeCallerSession) GetPair(tokenA common.Address, tokenB common.Address) (common.Address, error) {
326 | return _Pancake.Contract.GetPair(&_Pancake.CallOpts, tokenA, tokenB)
327 | }
328 |
329 | // CreatePair is a paid mutator transaction binding the contract method 0xc9c65396.
330 | //
331 | // Solidity: function createPair(address tokenA, address tokenB) returns(address pair)
332 | func (_Pancake *PancakeTransactor) CreatePair(opts *bind.TransactOpts, tokenA common.Address, tokenB common.Address) (*types.Transaction, error) {
333 | return _Pancake.contract.Transact(opts, "createPair", tokenA, tokenB)
334 | }
335 |
336 | // CreatePair is a paid mutator transaction binding the contract method 0xc9c65396.
337 | //
338 | // Solidity: function createPair(address tokenA, address tokenB) returns(address pair)
339 | func (_Pancake *PancakeSession) CreatePair(tokenA common.Address, tokenB common.Address) (*types.Transaction, error) {
340 | return _Pancake.Contract.CreatePair(&_Pancake.TransactOpts, tokenA, tokenB)
341 | }
342 |
343 | // CreatePair is a paid mutator transaction binding the contract method 0xc9c65396.
344 | //
345 | // Solidity: function createPair(address tokenA, address tokenB) returns(address pair)
346 | func (_Pancake *PancakeTransactorSession) CreatePair(tokenA common.Address, tokenB common.Address) (*types.Transaction, error) {
347 | return _Pancake.Contract.CreatePair(&_Pancake.TransactOpts, tokenA, tokenB)
348 | }
349 |
350 | // SetFeeTo is a paid mutator transaction binding the contract method 0xf46901ed.
351 | //
352 | // Solidity: function setFeeTo(address ) returns()
353 | func (_Pancake *PancakeTransactor) SetFeeTo(opts *bind.TransactOpts, arg0 common.Address) (*types.Transaction, error) {
354 | return _Pancake.contract.Transact(opts, "setFeeTo", arg0)
355 | }
356 |
357 | // SetFeeTo is a paid mutator transaction binding the contract method 0xf46901ed.
358 | //
359 | // Solidity: function setFeeTo(address ) returns()
360 | func (_Pancake *PancakeSession) SetFeeTo(arg0 common.Address) (*types.Transaction, error) {
361 | return _Pancake.Contract.SetFeeTo(&_Pancake.TransactOpts, arg0)
362 | }
363 |
364 | // SetFeeTo is a paid mutator transaction binding the contract method 0xf46901ed.
365 | //
366 | // Solidity: function setFeeTo(address ) returns()
367 | func (_Pancake *PancakeTransactorSession) SetFeeTo(arg0 common.Address) (*types.Transaction, error) {
368 | return _Pancake.Contract.SetFeeTo(&_Pancake.TransactOpts, arg0)
369 | }
370 |
371 | // SetFeeToSetter is a paid mutator transaction binding the contract method 0xa2e74af6.
372 | //
373 | // Solidity: function setFeeToSetter(address ) returns()
374 | func (_Pancake *PancakeTransactor) SetFeeToSetter(opts *bind.TransactOpts, arg0 common.Address) (*types.Transaction, error) {
375 | return _Pancake.contract.Transact(opts, "setFeeToSetter", arg0)
376 | }
377 |
378 | // SetFeeToSetter is a paid mutator transaction binding the contract method 0xa2e74af6.
379 | //
380 | // Solidity: function setFeeToSetter(address ) returns()
381 | func (_Pancake *PancakeSession) SetFeeToSetter(arg0 common.Address) (*types.Transaction, error) {
382 | return _Pancake.Contract.SetFeeToSetter(&_Pancake.TransactOpts, arg0)
383 | }
384 |
385 | // SetFeeToSetter is a paid mutator transaction binding the contract method 0xa2e74af6.
386 | //
387 | // Solidity: function setFeeToSetter(address ) returns()
388 | func (_Pancake *PancakeTransactorSession) SetFeeToSetter(arg0 common.Address) (*types.Transaction, error) {
389 | return _Pancake.Contract.SetFeeToSetter(&_Pancake.TransactOpts, arg0)
390 | }
391 |
392 | // PancakePairCreatedIterator is returned from FilterPairCreated and is used to iterate over the raw logs and unpacked data for PairCreated events raised by the Pancake contract.
393 | type PancakePairCreatedIterator struct {
394 | Event *PancakePairCreated // Event containing the contract specifics and raw log
395 |
396 | contract *bind.BoundContract // Generic contract to use for unpacking event data
397 | event string // Event name to use for unpacking event data
398 |
399 | logs chan types.Log // Log channel receiving the found contract events
400 | sub ethereum.Subscription // Subscription for errors, completion and termination
401 | done bool // Whether the subscription completed delivering logs
402 | fail error // Occurred error to stop iteration
403 | }
404 |
405 | // Next advances the iterator to the subsequent event, returning whether there
406 | // are any more events found. In case of a retrieval or parsing error, false is
407 | // returned and Error() can be queried for the exact failure.
408 | func (it *PancakePairCreatedIterator) Next() bool {
409 | // If the iterator failed, stop iterating
410 | if it.fail != nil {
411 | return false
412 | }
413 | // If the iterator completed, deliver directly whatever's available
414 | if it.done {
415 | select {
416 | case log := <-it.logs:
417 | it.Event = new(PancakePairCreated)
418 | if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
419 | it.fail = err
420 | return false
421 | }
422 | it.Event.Raw = log
423 | return true
424 |
425 | default:
426 | return false
427 | }
428 | }
429 | // Iterator still in progress, wait for either a data or an error event
430 | select {
431 | case log := <-it.logs:
432 | it.Event = new(PancakePairCreated)
433 | if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
434 | it.fail = err
435 | return false
436 | }
437 | it.Event.Raw = log
438 | return true
439 |
440 | case err := <-it.sub.Err():
441 | it.done = true
442 | it.fail = err
443 | return it.Next()
444 | }
445 | }
446 |
447 | // Error returns any retrieval or parsing error occurred during filtering.
448 | func (it *PancakePairCreatedIterator) Error() error {
449 | return it.fail
450 | }
451 |
452 | // Close terminates the iteration process, releasing any pending underlying
453 | // resources.
454 | func (it *PancakePairCreatedIterator) Close() error {
455 | it.sub.Unsubscribe()
456 | return nil
457 | }
458 |
459 | // PancakePairCreated represents a PairCreated event raised by the Pancake contract.
460 | type PancakePairCreated struct {
461 | Token0 common.Address
462 | Token1 common.Address
463 | Pair common.Address
464 | Arg3 *big.Int
465 | Raw types.Log // Blockchain specific contextual infos
466 | }
467 |
468 | // FilterPairCreated is a free log retrieval operation binding the contract event 0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9.
469 | //
470 | // Solidity: event PairCreated(address indexed token0, address indexed token1, address pair, uint256 arg3)
471 | func (_Pancake *PancakeFilterer) FilterPairCreated(opts *bind.FilterOpts, token0 []common.Address, token1 []common.Address) (*PancakePairCreatedIterator, error) {
472 |
473 | var token0Rule []interface{}
474 | for _, token0Item := range token0 {
475 | token0Rule = append(token0Rule, token0Item)
476 | }
477 | var token1Rule []interface{}
478 | for _, token1Item := range token1 {
479 | token1Rule = append(token1Rule, token1Item)
480 | }
481 |
482 | logs, sub, err := _Pancake.contract.FilterLogs(opts, "PairCreated", token0Rule, token1Rule)
483 | if err != nil {
484 | return nil, err
485 | }
486 | return &PancakePairCreatedIterator{contract: _Pancake.contract, event: "PairCreated", logs: logs, sub: sub}, nil
487 | }
488 |
489 | // WatchPairCreated is a free log subscription operation binding the contract event 0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9.
490 | //
491 | // Solidity: event PairCreated(address indexed token0, address indexed token1, address pair, uint256 arg3)
492 | func (_Pancake *PancakeFilterer) WatchPairCreated(opts *bind.WatchOpts, sink chan<- *PancakePairCreated, token0 []common.Address, token1 []common.Address) (event.Subscription, error) {
493 |
494 | var token0Rule []interface{}
495 | for _, token0Item := range token0 {
496 | token0Rule = append(token0Rule, token0Item)
497 | }
498 | var token1Rule []interface{}
499 | for _, token1Item := range token1 {
500 | token1Rule = append(token1Rule, token1Item)
501 | }
502 |
503 | logs, sub, err := _Pancake.contract.WatchLogs(opts, "PairCreated", token0Rule, token1Rule)
504 | if err != nil {
505 | return nil, err
506 | }
507 | return event.NewSubscription(func(quit <-chan struct{}) error {
508 | defer sub.Unsubscribe()
509 | for {
510 | select {
511 | case log := <-logs:
512 | // New log arrived, parse the event and forward to the user
513 | event := new(PancakePairCreated)
514 | if err := _Pancake.contract.UnpackLog(event, "PairCreated", log); err != nil {
515 | return err
516 | }
517 | event.Raw = log
518 |
519 | select {
520 | case sink <- event:
521 | case err := <-sub.Err():
522 | return err
523 | case <-quit:
524 | return nil
525 | }
526 | case err := <-sub.Err():
527 | return err
528 | case <-quit:
529 | return nil
530 | }
531 | }
532 | }), nil
533 | }
534 |
535 | // ParsePairCreated is a log parse operation binding the contract event 0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9.
536 | //
537 | // Solidity: event PairCreated(address indexed token0, address indexed token1, address pair, uint256 arg3)
538 | func (_Pancake *PancakeFilterer) ParsePairCreated(log types.Log) (*PancakePairCreated, error) {
539 | event := new(PancakePairCreated)
540 | if err := _Pancake.contract.UnpackLog(event, "PairCreated", log); err != nil {
541 | return nil, err
542 | }
543 | event.Raw = log
544 | return event, nil
545 | }
546 |
--------------------------------------------------------------------------------
/contracts/IWETH/IWETH.go:
--------------------------------------------------------------------------------
1 | // Code generated - DO NOT EDIT.
2 | // This file is a generated binding and any manual changes will be lost.
3 |
4 | package IWETH
5 |
6 | import (
7 | "math/big"
8 | "strings"
9 |
10 | ethereum "github.com/ethereum/go-ethereum"
11 | "github.com/ethereum/go-ethereum/accounts/abi"
12 | "github.com/ethereum/go-ethereum/accounts/abi/bind"
13 | "github.com/ethereum/go-ethereum/common"
14 | "github.com/ethereum/go-ethereum/core/types"
15 | "github.com/ethereum/go-ethereum/event"
16 | )
17 |
18 | // Reference imports to suppress errors if they are not otherwise used.
19 | var (
20 | _ = big.NewInt
21 | _ = strings.NewReader
22 | _ = ethereum.NotFound
23 | _ = bind.Bind
24 | _ = common.Big1
25 | _ = types.BloomLookup
26 | _ = event.NewSubscription
27 | )
28 |
29 | // PancakeABI is the input ABI used to generate the binding from.
30 | const PancakeABI = "[{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
31 |
32 | // Pancake is an auto generated Go binding around an Ethereum contract.
33 | type Pancake struct {
34 | PancakeCaller // Read-only binding to the contract
35 | PancakeTransactor // Write-only binding to the contract
36 | PancakeFilterer // Log filterer for contract events
37 | }
38 |
39 | // PancakeCaller is an auto generated read-only Go binding around an Ethereum contract.
40 | type PancakeCaller struct {
41 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
42 | }
43 |
44 | // PancakeTransactor is an auto generated write-only Go binding around an Ethereum contract.
45 | type PancakeTransactor struct {
46 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
47 | }
48 |
49 | // PancakeFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
50 | type PancakeFilterer struct {
51 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
52 | }
53 |
54 | // PancakeSession is an auto generated Go binding around an Ethereum contract,
55 | // with pre-set call and transact options.
56 | type PancakeSession struct {
57 | Contract *Pancake // Generic contract binding to set the session for
58 | CallOpts bind.CallOpts // Call options to use throughout this session
59 | TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
60 | }
61 |
62 | // PancakeCallerSession is an auto generated read-only Go binding around an Ethereum contract,
63 | // with pre-set call options.
64 | type PancakeCallerSession struct {
65 | Contract *PancakeCaller // Generic contract caller binding to set the session for
66 | CallOpts bind.CallOpts // Call options to use throughout this session
67 | }
68 |
69 | // PancakeTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
70 | // with pre-set transact options.
71 | type PancakeTransactorSession struct {
72 | Contract *PancakeTransactor // Generic contract transactor binding to set the session for
73 | TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
74 | }
75 |
76 | // PancakeRaw is an auto generated low-level Go binding around an Ethereum contract.
77 | type PancakeRaw struct {
78 | Contract *Pancake // Generic contract binding to access the raw methods on
79 | }
80 |
81 | // PancakeCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
82 | type PancakeCallerRaw struct {
83 | Contract *PancakeCaller // Generic read-only contract binding to access the raw methods on
84 | }
85 |
86 | // PancakeTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
87 | type PancakeTransactorRaw struct {
88 | Contract *PancakeTransactor // Generic write-only contract binding to access the raw methods on
89 | }
90 |
91 | // NewPancake creates a new instance of Pancake, bound to a specific deployed contract.
92 | func NewPancake(address common.Address, backend bind.ContractBackend) (*Pancake, error) {
93 | contract, err := bindPancake(address, backend, backend, backend)
94 | if err != nil {
95 | return nil, err
96 | }
97 | return &Pancake{PancakeCaller: PancakeCaller{contract: contract}, PancakeTransactor: PancakeTransactor{contract: contract}, PancakeFilterer: PancakeFilterer{contract: contract}}, nil
98 | }
99 |
100 | // NewPancakeCaller creates a new read-only instance of Pancake, bound to a specific deployed contract.
101 | func NewPancakeCaller(address common.Address, caller bind.ContractCaller) (*PancakeCaller, error) {
102 | contract, err := bindPancake(address, caller, nil, nil)
103 | if err != nil {
104 | return nil, err
105 | }
106 | return &PancakeCaller{contract: contract}, nil
107 | }
108 |
109 | // NewPancakeTransactor creates a new write-only instance of Pancake, bound to a specific deployed contract.
110 | func NewPancakeTransactor(address common.Address, transactor bind.ContractTransactor) (*PancakeTransactor, error) {
111 | contract, err := bindPancake(address, nil, transactor, nil)
112 | if err != nil {
113 | return nil, err
114 | }
115 | return &PancakeTransactor{contract: contract}, nil
116 | }
117 |
118 | // NewPancakeFilterer creates a new log filterer instance of Pancake, bound to a specific deployed contract.
119 | func NewPancakeFilterer(address common.Address, filterer bind.ContractFilterer) (*PancakeFilterer, error) {
120 | contract, err := bindPancake(address, nil, nil, filterer)
121 | if err != nil {
122 | return nil, err
123 | }
124 | return &PancakeFilterer{contract: contract}, nil
125 | }
126 |
127 | // bindPancake binds a generic wrapper to an already deployed contract.
128 | func bindPancake(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
129 | parsed, err := abi.JSON(strings.NewReader(PancakeABI))
130 | if err != nil {
131 | return nil, err
132 | }
133 | return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
134 | }
135 |
136 | // Call invokes the (constant) contract method with params as input values and
137 | // sets the output to result. The result type might be a single field for simple
138 | // returns, a slice of interfaces for anonymous returns and a struct for named
139 | // returns.
140 | func (_Pancake *PancakeRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
141 | return _Pancake.Contract.PancakeCaller.contract.Call(opts, result, method, params...)
142 | }
143 |
144 | // Transfer initiates a plain transaction to move funds to the contract, calling
145 | // its default method if one is available.
146 | func (_Pancake *PancakeRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
147 | return _Pancake.Contract.PancakeTransactor.contract.Transfer(opts)
148 | }
149 |
150 | // Transact invokes the (paid) contract method with params as input values.
151 | func (_Pancake *PancakeRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
152 | return _Pancake.Contract.PancakeTransactor.contract.Transact(opts, method, params...)
153 | }
154 |
155 | // Call invokes the (constant) contract method with params as input values and
156 | // sets the output to result. The result type might be a single field for simple
157 | // returns, a slice of interfaces for anonymous returns and a struct for named
158 | // returns.
159 | func (_Pancake *PancakeCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
160 | return _Pancake.Contract.contract.Call(opts, result, method, params...)
161 | }
162 |
163 | // Transfer initiates a plain transaction to move funds to the contract, calling
164 | // its default method if one is available.
165 | func (_Pancake *PancakeTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
166 | return _Pancake.Contract.contract.Transfer(opts)
167 | }
168 |
169 | // Transact invokes the (paid) contract method with params as input values.
170 | func (_Pancake *PancakeTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
171 | return _Pancake.Contract.contract.Transact(opts, method, params...)
172 | }
173 |
174 | // Deposit is a paid mutator transaction binding the contract method 0xd0e30db0.
175 | //
176 | // Solidity: function deposit() payable returns()
177 | func (_Pancake *PancakeTransactor) Deposit(opts *bind.TransactOpts) (*types.Transaction, error) {
178 | return _Pancake.contract.Transact(opts, "deposit")
179 | }
180 |
181 | // Deposit is a paid mutator transaction binding the contract method 0xd0e30db0.
182 | //
183 | // Solidity: function deposit() payable returns()
184 | func (_Pancake *PancakeSession) Deposit() (*types.Transaction, error) {
185 | return _Pancake.Contract.Deposit(&_Pancake.TransactOpts)
186 | }
187 |
188 | // Deposit is a paid mutator transaction binding the contract method 0xd0e30db0.
189 | //
190 | // Solidity: function deposit() payable returns()
191 | func (_Pancake *PancakeTransactorSession) Deposit() (*types.Transaction, error) {
192 | return _Pancake.Contract.Deposit(&_Pancake.TransactOpts)
193 | }
194 |
195 | // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.
196 | //
197 | // Solidity: function transfer(address to, uint256 value) returns(bool)
198 | func (_Pancake *PancakeTransactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) {
199 | return _Pancake.contract.Transact(opts, "transfer", to, value)
200 | }
201 |
202 | // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.
203 | //
204 | // Solidity: function transfer(address to, uint256 value) returns(bool)
205 | func (_Pancake *PancakeSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {
206 | return _Pancake.Contract.Transfer(&_Pancake.TransactOpts, to, value)
207 | }
208 |
209 | // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.
210 | //
211 | // Solidity: function transfer(address to, uint256 value) returns(bool)
212 | func (_Pancake *PancakeTransactorSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) {
213 | return _Pancake.Contract.Transfer(&_Pancake.TransactOpts, to, value)
214 | }
215 |
216 | // Withdraw is a paid mutator transaction binding the contract method 0x2e1a7d4d.
217 | //
218 | // Solidity: function withdraw(uint256 ) returns()
219 | func (_Pancake *PancakeTransactor) Withdraw(opts *bind.TransactOpts, arg0 *big.Int) (*types.Transaction, error) {
220 | return _Pancake.contract.Transact(opts, "withdraw", arg0)
221 | }
222 |
223 | // Withdraw is a paid mutator transaction binding the contract method 0x2e1a7d4d.
224 | //
225 | // Solidity: function withdraw(uint256 ) returns()
226 | func (_Pancake *PancakeSession) Withdraw(arg0 *big.Int) (*types.Transaction, error) {
227 | return _Pancake.Contract.Withdraw(&_Pancake.TransactOpts, arg0)
228 | }
229 |
230 | // Withdraw is a paid mutator transaction binding the contract method 0x2e1a7d4d.
231 | //
232 | // Solidity: function withdraw(uint256 ) returns()
233 | func (_Pancake *PancakeTransactorSession) Withdraw(arg0 *big.Int) (*types.Transaction, error) {
234 | return _Pancake.Contract.Withdraw(&_Pancake.TransactOpts, arg0)
235 | }
236 |
--------------------------------------------------------------------------------
/contracts/PancakeLibrary/PancakeLibrary.go:
--------------------------------------------------------------------------------
1 | // Code generated - DO NOT EDIT.
2 | // This file is a generated binding and any manual changes will be lost.
3 |
4 | package PancakeLibrary
5 |
6 | import (
7 | "math/big"
8 | "strings"
9 |
10 | ethereum "github.com/ethereum/go-ethereum"
11 | "github.com/ethereum/go-ethereum/accounts/abi"
12 | "github.com/ethereum/go-ethereum/accounts/abi/bind"
13 | "github.com/ethereum/go-ethereum/common"
14 | "github.com/ethereum/go-ethereum/core/types"
15 | "github.com/ethereum/go-ethereum/event"
16 | )
17 |
18 | // Reference imports to suppress errors if they are not otherwise used.
19 | var (
20 | _ = big.NewInt
21 | _ = strings.NewReader
22 | _ = ethereum.NotFound
23 | _ = bind.Bind
24 | _ = common.Big1
25 | _ = types.BloomLookup
26 | _ = event.NewSubscription
27 | )
28 |
29 | // PancakeABI is the input ABI used to generate the binding from.
30 | const PancakeABI = "[]"
31 |
32 | // PancakeBin is the compiled bytecode used for deploying new contracts.
33 | var PancakeBin = "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122008bc7663da489c19b74ba9c2d925868ad5d7b819eda4b4dd7957d878f3bd195e64736f6c63430006060033"
34 |
35 | // DeployPancake deploys a new Ethereum contract, binding an instance of Pancake to it.
36 | func DeployPancake(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Pancake, error) {
37 | parsed, err := abi.JSON(strings.NewReader(PancakeABI))
38 | if err != nil {
39 | return common.Address{}, nil, nil, err
40 | }
41 |
42 | address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(PancakeBin), backend)
43 | if err != nil {
44 | return common.Address{}, nil, nil, err
45 | }
46 | return address, tx, &Pancake{PancakeCaller: PancakeCaller{contract: contract}, PancakeTransactor: PancakeTransactor{contract: contract}, PancakeFilterer: PancakeFilterer{contract: contract}}, nil
47 | }
48 |
49 | // Pancake is an auto generated Go binding around an Ethereum contract.
50 | type Pancake struct {
51 | PancakeCaller // Read-only binding to the contract
52 | PancakeTransactor // Write-only binding to the contract
53 | PancakeFilterer // Log filterer for contract events
54 | }
55 |
56 | // PancakeCaller is an auto generated read-only Go binding around an Ethereum contract.
57 | type PancakeCaller struct {
58 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
59 | }
60 |
61 | // PancakeTransactor is an auto generated write-only Go binding around an Ethereum contract.
62 | type PancakeTransactor struct {
63 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
64 | }
65 |
66 | // PancakeFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
67 | type PancakeFilterer struct {
68 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
69 | }
70 |
71 | // PancakeSession is an auto generated Go binding around an Ethereum contract,
72 | // with pre-set call and transact options.
73 | type PancakeSession struct {
74 | Contract *Pancake // Generic contract binding to set the session for
75 | CallOpts bind.CallOpts // Call options to use throughout this session
76 | TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
77 | }
78 |
79 | // PancakeCallerSession is an auto generated read-only Go binding around an Ethereum contract,
80 | // with pre-set call options.
81 | type PancakeCallerSession struct {
82 | Contract *PancakeCaller // Generic contract caller binding to set the session for
83 | CallOpts bind.CallOpts // Call options to use throughout this session
84 | }
85 |
86 | // PancakeTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
87 | // with pre-set transact options.
88 | type PancakeTransactorSession struct {
89 | Contract *PancakeTransactor // Generic contract transactor binding to set the session for
90 | TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
91 | }
92 |
93 | // PancakeRaw is an auto generated low-level Go binding around an Ethereum contract.
94 | type PancakeRaw struct {
95 | Contract *Pancake // Generic contract binding to access the raw methods on
96 | }
97 |
98 | // PancakeCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
99 | type PancakeCallerRaw struct {
100 | Contract *PancakeCaller // Generic read-only contract binding to access the raw methods on
101 | }
102 |
103 | // PancakeTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
104 | type PancakeTransactorRaw struct {
105 | Contract *PancakeTransactor // Generic write-only contract binding to access the raw methods on
106 | }
107 |
108 | // NewPancake creates a new instance of Pancake, bound to a specific deployed contract.
109 | func NewPancake(address common.Address, backend bind.ContractBackend) (*Pancake, error) {
110 | contract, err := bindPancake(address, backend, backend, backend)
111 | if err != nil {
112 | return nil, err
113 | }
114 | return &Pancake{PancakeCaller: PancakeCaller{contract: contract}, PancakeTransactor: PancakeTransactor{contract: contract}, PancakeFilterer: PancakeFilterer{contract: contract}}, nil
115 | }
116 |
117 | // NewPancakeCaller creates a new read-only instance of Pancake, bound to a specific deployed contract.
118 | func NewPancakeCaller(address common.Address, caller bind.ContractCaller) (*PancakeCaller, error) {
119 | contract, err := bindPancake(address, caller, nil, nil)
120 | if err != nil {
121 | return nil, err
122 | }
123 | return &PancakeCaller{contract: contract}, nil
124 | }
125 |
126 | // NewPancakeTransactor creates a new write-only instance of Pancake, bound to a specific deployed contract.
127 | func NewPancakeTransactor(address common.Address, transactor bind.ContractTransactor) (*PancakeTransactor, error) {
128 | contract, err := bindPancake(address, nil, transactor, nil)
129 | if err != nil {
130 | return nil, err
131 | }
132 | return &PancakeTransactor{contract: contract}, nil
133 | }
134 |
135 | // NewPancakeFilterer creates a new log filterer instance of Pancake, bound to a specific deployed contract.
136 | func NewPancakeFilterer(address common.Address, filterer bind.ContractFilterer) (*PancakeFilterer, error) {
137 | contract, err := bindPancake(address, nil, nil, filterer)
138 | if err != nil {
139 | return nil, err
140 | }
141 | return &PancakeFilterer{contract: contract}, nil
142 | }
143 |
144 | // bindPancake binds a generic wrapper to an already deployed contract.
145 | func bindPancake(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
146 | parsed, err := abi.JSON(strings.NewReader(PancakeABI))
147 | if err != nil {
148 | return nil, err
149 | }
150 | return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
151 | }
152 |
153 | // Call invokes the (constant) contract method with params as input values and
154 | // sets the output to result. The result type might be a single field for simple
155 | // returns, a slice of interfaces for anonymous returns and a struct for named
156 | // returns.
157 | func (_Pancake *PancakeRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
158 | return _Pancake.Contract.PancakeCaller.contract.Call(opts, result, method, params...)
159 | }
160 |
161 | // Transfer initiates a plain transaction to move funds to the contract, calling
162 | // its default method if one is available.
163 | func (_Pancake *PancakeRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
164 | return _Pancake.Contract.PancakeTransactor.contract.Transfer(opts)
165 | }
166 |
167 | // Transact invokes the (paid) contract method with params as input values.
168 | func (_Pancake *PancakeRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
169 | return _Pancake.Contract.PancakeTransactor.contract.Transact(opts, method, params...)
170 | }
171 |
172 | // Call invokes the (constant) contract method with params as input values and
173 | // sets the output to result. The result type might be a single field for simple
174 | // returns, a slice of interfaces for anonymous returns and a struct for named
175 | // returns.
176 | func (_Pancake *PancakeCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
177 | return _Pancake.Contract.contract.Call(opts, result, method, params...)
178 | }
179 |
180 | // Transfer initiates a plain transaction to move funds to the contract, calling
181 | // its default method if one is available.
182 | func (_Pancake *PancakeTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
183 | return _Pancake.Contract.contract.Transfer(opts)
184 | }
185 |
186 | // Transact invokes the (paid) contract method with params as input values.
187 | func (_Pancake *PancakeTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
188 | return _Pancake.Contract.contract.Transact(opts, method, params...)
189 | }
190 |
--------------------------------------------------------------------------------
/contracts/SafeMath/SafeMath.go:
--------------------------------------------------------------------------------
1 | // Code generated - DO NOT EDIT.
2 | // This file is a generated binding and any manual changes will be lost.
3 |
4 | package SafeMath
5 |
6 | import (
7 | "math/big"
8 | "strings"
9 |
10 | ethereum "github.com/ethereum/go-ethereum"
11 | "github.com/ethereum/go-ethereum/accounts/abi"
12 | "github.com/ethereum/go-ethereum/accounts/abi/bind"
13 | "github.com/ethereum/go-ethereum/common"
14 | "github.com/ethereum/go-ethereum/core/types"
15 | "github.com/ethereum/go-ethereum/event"
16 | )
17 |
18 | // Reference imports to suppress errors if they are not otherwise used.
19 | var (
20 | _ = big.NewInt
21 | _ = strings.NewReader
22 | _ = ethereum.NotFound
23 | _ = bind.Bind
24 | _ = common.Big1
25 | _ = types.BloomLookup
26 | _ = event.NewSubscription
27 | )
28 |
29 | // PancakeABI is the input ABI used to generate the binding from.
30 | const PancakeABI = "[]"
31 |
32 | // PancakeBin is the compiled bytecode used for deploying new contracts.
33 | var PancakeBin = "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220c613136ab0ebd42c52ca8ea8e96603936852d6acc2d11fd6442af5ce68c1acee64736f6c63430006060033"
34 |
35 | // DeployPancake deploys a new Ethereum contract, binding an instance of Pancake to it.
36 | func DeployPancake(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Pancake, error) {
37 | parsed, err := abi.JSON(strings.NewReader(PancakeABI))
38 | if err != nil {
39 | return common.Address{}, nil, nil, err
40 | }
41 |
42 | address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(PancakeBin), backend)
43 | if err != nil {
44 | return common.Address{}, nil, nil, err
45 | }
46 | return address, tx, &Pancake{PancakeCaller: PancakeCaller{contract: contract}, PancakeTransactor: PancakeTransactor{contract: contract}, PancakeFilterer: PancakeFilterer{contract: contract}}, nil
47 | }
48 |
49 | // Pancake is an auto generated Go binding around an Ethereum contract.
50 | type Pancake struct {
51 | PancakeCaller // Read-only binding to the contract
52 | PancakeTransactor // Write-only binding to the contract
53 | PancakeFilterer // Log filterer for contract events
54 | }
55 |
56 | // PancakeCaller is an auto generated read-only Go binding around an Ethereum contract.
57 | type PancakeCaller struct {
58 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
59 | }
60 |
61 | // PancakeTransactor is an auto generated write-only Go binding around an Ethereum contract.
62 | type PancakeTransactor struct {
63 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
64 | }
65 |
66 | // PancakeFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
67 | type PancakeFilterer struct {
68 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
69 | }
70 |
71 | // PancakeSession is an auto generated Go binding around an Ethereum contract,
72 | // with pre-set call and transact options.
73 | type PancakeSession struct {
74 | Contract *Pancake // Generic contract binding to set the session for
75 | CallOpts bind.CallOpts // Call options to use throughout this session
76 | TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
77 | }
78 |
79 | // PancakeCallerSession is an auto generated read-only Go binding around an Ethereum contract,
80 | // with pre-set call options.
81 | type PancakeCallerSession struct {
82 | Contract *PancakeCaller // Generic contract caller binding to set the session for
83 | CallOpts bind.CallOpts // Call options to use throughout this session
84 | }
85 |
86 | // PancakeTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
87 | // with pre-set transact options.
88 | type PancakeTransactorSession struct {
89 | Contract *PancakeTransactor // Generic contract transactor binding to set the session for
90 | TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
91 | }
92 |
93 | // PancakeRaw is an auto generated low-level Go binding around an Ethereum contract.
94 | type PancakeRaw struct {
95 | Contract *Pancake // Generic contract binding to access the raw methods on
96 | }
97 |
98 | // PancakeCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
99 | type PancakeCallerRaw struct {
100 | Contract *PancakeCaller // Generic read-only contract binding to access the raw methods on
101 | }
102 |
103 | // PancakeTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
104 | type PancakeTransactorRaw struct {
105 | Contract *PancakeTransactor // Generic write-only contract binding to access the raw methods on
106 | }
107 |
108 | // NewPancake creates a new instance of Pancake, bound to a specific deployed contract.
109 | func NewPancake(address common.Address, backend bind.ContractBackend) (*Pancake, error) {
110 | contract, err := bindPancake(address, backend, backend, backend)
111 | if err != nil {
112 | return nil, err
113 | }
114 | return &Pancake{PancakeCaller: PancakeCaller{contract: contract}, PancakeTransactor: PancakeTransactor{contract: contract}, PancakeFilterer: PancakeFilterer{contract: contract}}, nil
115 | }
116 |
117 | // NewPancakeCaller creates a new read-only instance of Pancake, bound to a specific deployed contract.
118 | func NewPancakeCaller(address common.Address, caller bind.ContractCaller) (*PancakeCaller, error) {
119 | contract, err := bindPancake(address, caller, nil, nil)
120 | if err != nil {
121 | return nil, err
122 | }
123 | return &PancakeCaller{contract: contract}, nil
124 | }
125 |
126 | // NewPancakeTransactor creates a new write-only instance of Pancake, bound to a specific deployed contract.
127 | func NewPancakeTransactor(address common.Address, transactor bind.ContractTransactor) (*PancakeTransactor, error) {
128 | contract, err := bindPancake(address, nil, transactor, nil)
129 | if err != nil {
130 | return nil, err
131 | }
132 | return &PancakeTransactor{contract: contract}, nil
133 | }
134 |
135 | // NewPancakeFilterer creates a new log filterer instance of Pancake, bound to a specific deployed contract.
136 | func NewPancakeFilterer(address common.Address, filterer bind.ContractFilterer) (*PancakeFilterer, error) {
137 | contract, err := bindPancake(address, nil, nil, filterer)
138 | if err != nil {
139 | return nil, err
140 | }
141 | return &PancakeFilterer{contract: contract}, nil
142 | }
143 |
144 | // bindPancake binds a generic wrapper to an already deployed contract.
145 | func bindPancake(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
146 | parsed, err := abi.JSON(strings.NewReader(PancakeABI))
147 | if err != nil {
148 | return nil, err
149 | }
150 | return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
151 | }
152 |
153 | // Call invokes the (constant) contract method with params as input values and
154 | // sets the output to result. The result type might be a single field for simple
155 | // returns, a slice of interfaces for anonymous returns and a struct for named
156 | // returns.
157 | func (_Pancake *PancakeRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
158 | return _Pancake.Contract.PancakeCaller.contract.Call(opts, result, method, params...)
159 | }
160 |
161 | // Transfer initiates a plain transaction to move funds to the contract, calling
162 | // its default method if one is available.
163 | func (_Pancake *PancakeRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
164 | return _Pancake.Contract.PancakeTransactor.contract.Transfer(opts)
165 | }
166 |
167 | // Transact invokes the (paid) contract method with params as input values.
168 | func (_Pancake *PancakeRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
169 | return _Pancake.Contract.PancakeTransactor.contract.Transact(opts, method, params...)
170 | }
171 |
172 | // Call invokes the (constant) contract method with params as input values and
173 | // sets the output to result. The result type might be a single field for simple
174 | // returns, a slice of interfaces for anonymous returns and a struct for named
175 | // returns.
176 | func (_Pancake *PancakeCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
177 | return _Pancake.Contract.contract.Call(opts, result, method, params...)
178 | }
179 |
180 | // Transfer initiates a plain transaction to move funds to the contract, calling
181 | // its default method if one is available.
182 | func (_Pancake *PancakeTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
183 | return _Pancake.Contract.contract.Transfer(opts)
184 | }
185 |
186 | // Transact invokes the (paid) contract method with params as input values.
187 | func (_Pancake *PancakeTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
188 | return _Pancake.Contract.contract.Transact(opts, method, params...)
189 | }
190 |
--------------------------------------------------------------------------------
/contracts/TransferHelper/TransferHelper.go:
--------------------------------------------------------------------------------
1 | // Code generated - DO NOT EDIT.
2 | // This file is a generated binding and any manual changes will be lost.
3 |
4 | package TransferHelper
5 |
6 | import (
7 | "math/big"
8 | "strings"
9 |
10 | ethereum "github.com/ethereum/go-ethereum"
11 | "github.com/ethereum/go-ethereum/accounts/abi"
12 | "github.com/ethereum/go-ethereum/accounts/abi/bind"
13 | "github.com/ethereum/go-ethereum/common"
14 | "github.com/ethereum/go-ethereum/core/types"
15 | "github.com/ethereum/go-ethereum/event"
16 | )
17 |
18 | // Reference imports to suppress errors if they are not otherwise used.
19 | var (
20 | _ = big.NewInt
21 | _ = strings.NewReader
22 | _ = ethereum.NotFound
23 | _ = bind.Bind
24 | _ = common.Big1
25 | _ = types.BloomLookup
26 | _ = event.NewSubscription
27 | )
28 |
29 | // PancakeABI is the input ABI used to generate the binding from.
30 | const PancakeABI = "[]"
31 |
32 | // PancakeBin is the compiled bytecode used for deploying new contracts.
33 | var PancakeBin = "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212207f85ac0eaed49fca814d4d4094339934f89277f3c42bbc0227af69c7e7058b6f64736f6c63430006060033"
34 |
35 | // DeployPancake deploys a new Ethereum contract, binding an instance of Pancake to it.
36 | func DeployPancake(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Pancake, error) {
37 | parsed, err := abi.JSON(strings.NewReader(PancakeABI))
38 | if err != nil {
39 | return common.Address{}, nil, nil, err
40 | }
41 |
42 | address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(PancakeBin), backend)
43 | if err != nil {
44 | return common.Address{}, nil, nil, err
45 | }
46 | return address, tx, &Pancake{PancakeCaller: PancakeCaller{contract: contract}, PancakeTransactor: PancakeTransactor{contract: contract}, PancakeFilterer: PancakeFilterer{contract: contract}}, nil
47 | }
48 |
49 | // Pancake is an auto generated Go binding around an Ethereum contract.
50 | type Pancake struct {
51 | PancakeCaller // Read-only binding to the contract
52 | PancakeTransactor // Write-only binding to the contract
53 | PancakeFilterer // Log filterer for contract events
54 | }
55 |
56 | // PancakeCaller is an auto generated read-only Go binding around an Ethereum contract.
57 | type PancakeCaller struct {
58 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
59 | }
60 |
61 | // PancakeTransactor is an auto generated write-only Go binding around an Ethereum contract.
62 | type PancakeTransactor struct {
63 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
64 | }
65 |
66 | // PancakeFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
67 | type PancakeFilterer struct {
68 | contract *bind.BoundContract // Generic contract wrapper for the low level calls
69 | }
70 |
71 | // PancakeSession is an auto generated Go binding around an Ethereum contract,
72 | // with pre-set call and transact options.
73 | type PancakeSession struct {
74 | Contract *Pancake // Generic contract binding to set the session for
75 | CallOpts bind.CallOpts // Call options to use throughout this session
76 | TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
77 | }
78 |
79 | // PancakeCallerSession is an auto generated read-only Go binding around an Ethereum contract,
80 | // with pre-set call options.
81 | type PancakeCallerSession struct {
82 | Contract *PancakeCaller // Generic contract caller binding to set the session for
83 | CallOpts bind.CallOpts // Call options to use throughout this session
84 | }
85 |
86 | // PancakeTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
87 | // with pre-set transact options.
88 | type PancakeTransactorSession struct {
89 | Contract *PancakeTransactor // Generic contract transactor binding to set the session for
90 | TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
91 | }
92 |
93 | // PancakeRaw is an auto generated low-level Go binding around an Ethereum contract.
94 | type PancakeRaw struct {
95 | Contract *Pancake // Generic contract binding to access the raw methods on
96 | }
97 |
98 | // PancakeCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
99 | type PancakeCallerRaw struct {
100 | Contract *PancakeCaller // Generic read-only contract binding to access the raw methods on
101 | }
102 |
103 | // PancakeTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
104 | type PancakeTransactorRaw struct {
105 | Contract *PancakeTransactor // Generic write-only contract binding to access the raw methods on
106 | }
107 |
108 | // NewPancake creates a new instance of Pancake, bound to a specific deployed contract.
109 | func NewPancake(address common.Address, backend bind.ContractBackend) (*Pancake, error) {
110 | contract, err := bindPancake(address, backend, backend, backend)
111 | if err != nil {
112 | return nil, err
113 | }
114 | return &Pancake{PancakeCaller: PancakeCaller{contract: contract}, PancakeTransactor: PancakeTransactor{contract: contract}, PancakeFilterer: PancakeFilterer{contract: contract}}, nil
115 | }
116 |
117 | // NewPancakeCaller creates a new read-only instance of Pancake, bound to a specific deployed contract.
118 | func NewPancakeCaller(address common.Address, caller bind.ContractCaller) (*PancakeCaller, error) {
119 | contract, err := bindPancake(address, caller, nil, nil)
120 | if err != nil {
121 | return nil, err
122 | }
123 | return &PancakeCaller{contract: contract}, nil
124 | }
125 |
126 | // NewPancakeTransactor creates a new write-only instance of Pancake, bound to a specific deployed contract.
127 | func NewPancakeTransactor(address common.Address, transactor bind.ContractTransactor) (*PancakeTransactor, error) {
128 | contract, err := bindPancake(address, nil, transactor, nil)
129 | if err != nil {
130 | return nil, err
131 | }
132 | return &PancakeTransactor{contract: contract}, nil
133 | }
134 |
135 | // NewPancakeFilterer creates a new log filterer instance of Pancake, bound to a specific deployed contract.
136 | func NewPancakeFilterer(address common.Address, filterer bind.ContractFilterer) (*PancakeFilterer, error) {
137 | contract, err := bindPancake(address, nil, nil, filterer)
138 | if err != nil {
139 | return nil, err
140 | }
141 | return &PancakeFilterer{contract: contract}, nil
142 | }
143 |
144 | // bindPancake binds a generic wrapper to an already deployed contract.
145 | func bindPancake(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
146 | parsed, err := abi.JSON(strings.NewReader(PancakeABI))
147 | if err != nil {
148 | return nil, err
149 | }
150 | return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
151 | }
152 |
153 | // Call invokes the (constant) contract method with params as input values and
154 | // sets the output to result. The result type might be a single field for simple
155 | // returns, a slice of interfaces for anonymous returns and a struct for named
156 | // returns.
157 | func (_Pancake *PancakeRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
158 | return _Pancake.Contract.PancakeCaller.contract.Call(opts, result, method, params...)
159 | }
160 |
161 | // Transfer initiates a plain transaction to move funds to the contract, calling
162 | // its default method if one is available.
163 | func (_Pancake *PancakeRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
164 | return _Pancake.Contract.PancakeTransactor.contract.Transfer(opts)
165 | }
166 |
167 | // Transact invokes the (paid) contract method with params as input values.
168 | func (_Pancake *PancakeRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
169 | return _Pancake.Contract.PancakeTransactor.contract.Transact(opts, method, params...)
170 | }
171 |
172 | // Call invokes the (constant) contract method with params as input values and
173 | // sets the output to result. The result type might be a single field for simple
174 | // returns, a slice of interfaces for anonymous returns and a struct for named
175 | // returns.
176 | func (_Pancake *PancakeCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
177 | return _Pancake.Contract.contract.Call(opts, result, method, params...)
178 | }
179 |
180 | // Transfer initiates a plain transaction to move funds to the contract, calling
181 | // its default method if one is available.
182 | func (_Pancake *PancakeTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
183 | return _Pancake.Contract.contract.Transfer(opts)
184 | }
185 |
186 | // Transact invokes the (paid) contract method with params as input values.
187 | func (_Pancake *PancakeTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
188 | return _Pancake.Contract.contract.Transact(opts, method, params...)
189 | }
190 |
--------------------------------------------------------------------------------
/contracts/build/IERC20.abi:
--------------------------------------------------------------------------------
1 | [{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
--------------------------------------------------------------------------------
/contracts/build/IERC20.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LucaWilliams4831/web3golanghelper-1/c09ef97b5047683178f490994b8803cdd38922c8/contracts/build/IERC20.bin
--------------------------------------------------------------------------------
/contracts/build/IPancakeFactory.abi:
--------------------------------------------------------------------------------
1 | [{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token0","type":"address"},{"indexed":true,"internalType":"address","name":"token1","type":"address"},{"indexed":false,"internalType":"address","name":"pair","type":"address"},{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"PairCreated","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allPairs","outputs":[{"internalType":"address","name":"pair","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allPairsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"}],"name":"createPair","outputs":[{"internalType":"address","name":"pair","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeTo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeToSetter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"}],"name":"getPair","outputs":[{"internalType":"address","name":"pair","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"setFeeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"setFeeToSetter","outputs":[],"stateMutability":"nonpayable","type":"function"}]
--------------------------------------------------------------------------------
/contracts/build/IPancakeFactory.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LucaWilliams4831/web3golanghelper-1/c09ef97b5047683178f490994b8803cdd38922c8/contracts/build/IPancakeFactory.bin
--------------------------------------------------------------------------------
/contracts/build/IPancakePair.abi:
--------------------------------------------------------------------------------
1 | [{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount0Out","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1Out","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint112","name":"reserve0","type":"uint112"},{"indexed":false,"internalType":"uint112","name":"reserve1","type":"uint112"}],"name":"Sync","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINIMUM_LIQUIDITY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReserves","outputs":[{"internalType":"uint112","name":"reserve0","type":"uint112"},{"internalType":"uint112","name":"reserve1","type":"uint112"},{"internalType":"uint32","name":"blockTimestampLast","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"kLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"price0CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price1CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"skim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount0Out","type":"uint256"},{"internalType":"uint256","name":"amount1Out","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"sync","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
--------------------------------------------------------------------------------
/contracts/build/IPancakePair.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LucaWilliams4831/web3golanghelper-1/c09ef97b5047683178f490994b8803cdd38922c8/contracts/build/IPancakePair.bin
--------------------------------------------------------------------------------
/contracts/build/IPancakeRouter01.abi:
--------------------------------------------------------------------------------
1 | [{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"amountADesired","type":"uint256"},{"internalType":"uint256","name":"amountBDesired","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountTokenDesired","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"addLiquidityETH","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"reserveIn","type":"uint256"},{"internalType":"uint256","name":"reserveOut","type":"uint256"}],"name":"getAmountIn","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"reserveIn","type":"uint256"},{"internalType":"uint256","name":"reserveOut","type":"uint256"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsIn","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsOut","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"reserveA","type":"uint256"},{"internalType":"uint256","name":"reserveB","type":"uint256"}],"name":"quote","outputs":[{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"removeLiquidity","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"removeLiquidityETH","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"approveMax","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"removeLiquidityETHWithPermit","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"approveMax","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"removeLiquidityWithPermit","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapETHForExactTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactETHForTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForETH","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapTokensForExactETH","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapTokensForExactTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"}]
--------------------------------------------------------------------------------
/contracts/build/IPancakeRouter01.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LucaWilliams4831/web3golanghelper-1/c09ef97b5047683178f490994b8803cdd38922c8/contracts/build/IPancakeRouter01.bin
--------------------------------------------------------------------------------
/contracts/build/IPancakeRouter02.abi:
--------------------------------------------------------------------------------
1 | [{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"amountADesired","type":"uint256"},{"internalType":"uint256","name":"amountBDesired","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountTokenDesired","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"addLiquidityETH","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"reserveIn","type":"uint256"},{"internalType":"uint256","name":"reserveOut","type":"uint256"}],"name":"getAmountIn","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"reserveIn","type":"uint256"},{"internalType":"uint256","name":"reserveOut","type":"uint256"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsIn","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsOut","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"reserveA","type":"uint256"},{"internalType":"uint256","name":"reserveB","type":"uint256"}],"name":"quote","outputs":[{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"removeLiquidity","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"removeLiquidityETH","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"removeLiquidityETHSupportingFeeOnTransferTokens","outputs":[{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"approveMax","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"removeLiquidityETHWithPermit","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"approveMax","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"removeLiquidityETHWithPermitSupportingFeeOnTransferTokens","outputs":[{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"approveMax","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"removeLiquidityWithPermit","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapETHForExactTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactETHForTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactETHForTokensSupportingFeeOnTransferTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForETH","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForETHSupportingFeeOnTransferTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForTokensSupportingFeeOnTransferTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapTokensForExactETH","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapTokensForExactTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"}]
--------------------------------------------------------------------------------
/contracts/build/IPancakeRouter02.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LucaWilliams4831/web3golanghelper-1/c09ef97b5047683178f490994b8803cdd38922c8/contracts/build/IPancakeRouter02.bin
--------------------------------------------------------------------------------
/contracts/build/IWETH.abi:
--------------------------------------------------------------------------------
1 | [{"inputs":[],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
--------------------------------------------------------------------------------
/contracts/build/IWETH.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LucaWilliams4831/web3golanghelper-1/c09ef97b5047683178f490994b8803cdd38922c8/contracts/build/IWETH.bin
--------------------------------------------------------------------------------
/contracts/build/PancakeLibrary.abi:
--------------------------------------------------------------------------------
1 | []
--------------------------------------------------------------------------------
/contracts/build/PancakeLibrary.bin:
--------------------------------------------------------------------------------
1 | 60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122008bc7663da489c19b74ba9c2d925868ad5d7b819eda4b4dd7957d878f3bd195e64736f6c63430006060033
--------------------------------------------------------------------------------
/contracts/build/PancakeRouter.abi:
--------------------------------------------------------------------------------
1 | [{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"amountADesired","type":"uint256"},{"internalType":"uint256","name":"amountBDesired","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountTokenDesired","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"addLiquidityETH","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"reserveIn","type":"uint256"},{"internalType":"uint256","name":"reserveOut","type":"uint256"}],"name":"getAmountIn","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"reserveIn","type":"uint256"},{"internalType":"uint256","name":"reserveOut","type":"uint256"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsIn","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsOut","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"reserveA","type":"uint256"},{"internalType":"uint256","name":"reserveB","type":"uint256"}],"name":"quote","outputs":[{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"removeLiquidity","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"removeLiquidityETH","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"removeLiquidityETHSupportingFeeOnTransferTokens","outputs":[{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"approveMax","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"removeLiquidityETHWithPermit","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"approveMax","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"removeLiquidityETHWithPermitSupportingFeeOnTransferTokens","outputs":[{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"approveMax","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"removeLiquidityWithPermit","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapETHForExactTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactETHForTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactETHForTokensSupportingFeeOnTransferTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForETH","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForETHSupportingFeeOnTransferTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForTokensSupportingFeeOnTransferTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapTokensForExactETH","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapTokensForExactTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
--------------------------------------------------------------------------------
/contracts/build/SafeMath.abi:
--------------------------------------------------------------------------------
1 | []
--------------------------------------------------------------------------------
/contracts/build/SafeMath.bin:
--------------------------------------------------------------------------------
1 | 60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220c613136ab0ebd42c52ca8ea8e96603936852d6acc2d11fd6442af5ce68c1acee64736f6c63430006060033
--------------------------------------------------------------------------------
/contracts/build/Store.abi:
--------------------------------------------------------------------------------
1 | [{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"items","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"key","type":"bytes32"},{"name":"value","type":"bytes32"}],"name":"setItem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_version","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"key","type":"bytes32"},{"indexed":false,"name":"value","type":"bytes32"}],"name":"ItemSet","type":"event"}]
--------------------------------------------------------------------------------
/contracts/build/Store.bin:
--------------------------------------------------------------------------------
1 | 608060405234801561001057600080fd5b506040516103d53803806103d5833981018060405281019080805182019291905050508060009080519060200190610049929190610050565b50506100f5565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061009157805160ff19168380011785556100bf565b828001600101855582156100bf579182015b828111156100be5782518255916020019190600101906100a3565b5b5090506100cc91906100d0565b5090565b6100f291905b808211156100ee5760008160009055506001016100d6565b5090565b90565b6102d1806101046000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806348f343f31461005c57806354fd4d50146100a9578063f56256c714610139575b600080fd5b34801561006857600080fd5b5061008b6004803603810190808035600019169060200190929190505050610178565b60405180826000191660001916815260200191505060405180910390f35b3480156100b557600080fd5b506100be610190565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100fe5780820151818401526020810190506100e3565b50505050905090810190601f16801561012b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561014557600080fd5b506101766004803603810190808035600019169060200190929190803560001916906020019092919050505061022e565b005b60016020528060005260406000206000915090505481565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102265780601f106101fb57610100808354040283529160200191610226565b820191906000526020600020905b81548152906001019060200180831161020957829003601f168201915b505050505081565b8060016000846000191660001916815260200190815260200160002081600019169055507fe79e73da417710ae99aa2088575580a60415d359acfad9cdd3382d59c80281d4828260405180836000191660001916815260200182600019166000191681526020019250505060405180910390a150505600a165627a7a723058209681faa367f6d342b27e4226a92c7a146b7c3d6d4a145a65fcebd62da34920400029
--------------------------------------------------------------------------------
/contracts/build/TransferHelper.abi:
--------------------------------------------------------------------------------
1 | []
--------------------------------------------------------------------------------
/contracts/build/TransferHelper.bin:
--------------------------------------------------------------------------------
1 | 60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212207f85ac0eaed49fca814d4d4094339934f89277f3c42bbc0227af69c7e7058b6f64736f6c63430006060033
--------------------------------------------------------------------------------
/database/conn.go:
--------------------------------------------------------------------------------
1 | package database
2 |
3 | import (
4 | "database/sql"
5 | "encoding/json"
6 | "fmt"
7 | "log"
8 | "net/http"
9 | "time"
10 | "strconv"
11 | _ "github.com/lib/pq"
12 | )
13 |
14 | const (
15 | host = "localhost"
16 | port = 5432
17 | user = "postgres"
18 | password = "postgres"
19 | dbname = "bot_data"
20 | )
21 |
22 | type Bot struct {
23 | ID int `json:"id"`
24 | PrivKey string `json:"privkey"`
25 | Title string `json:"title"`
26 | NetworkID string `json:"network_id"`
27 | Volume float64 `json:"volume"`
28 | Fees float32 `json:"fees"`
29 | RandomAction int `json:"random_action"`
30 | TxNum int `json:"tx_num"`
31 | MaxGas float32 `json:"max_gas"`
32 | TimeMin int `json:"time_min"`
33 | TimeMax int `json:"time_max"`
34 | CreateTime string `json:"create_time"`
35 | DeleteDateTime sql.NullString `json:"delete_time"`
36 | }
37 |
38 | func Connect() {
39 | db, err := createDBConnection()
40 | if err != nil {
41 | log.Fatal(err)
42 | }
43 |
44 | createTable(db)
45 |
46 | bot1 := Bot{
47 | PrivKey: "mock priv key 1",
48 | Title: "bot 1",
49 | NetworkID: "network id 1",
50 | Volume: 0.0,
51 | Fees: 0.0,
52 | RandomAction: 0,
53 | TxNum: 0,
54 | MaxGas: 0.0,
55 | TimeMin: 1,
56 | TimeMax: 10,
57 | CreateTime: getCurrentTime(),
58 | }
59 |
60 | bot2 := Bot{
61 | PrivKey: "mock priv key 2",
62 | Title: "bot 2",
63 | NetworkID: "network id 2",
64 | Volume: 0.0,
65 | Fees: 0.0,
66 | RandomAction: 0,
67 | TxNum: 0,
68 | MaxGas: 0.0,
69 | TimeMin: 1,
70 | TimeMax: 20,
71 | CreateTime: getCurrentTime(),
72 | }
73 |
74 | insertBot(db, bot1)
75 | insertBot(db, bot2)
76 |
77 |
78 |
79 | }
80 |
81 | func handleRequest(w http.ResponseWriter, r *http.Request) {
82 | switch r.Method {
83 | case http.MethodGet:
84 | queryData(w)
85 | case http.MethodPost:
86 | insertData(w, r)
87 | case http.MethodPut:
88 | updateData(w, r)
89 | case http.MethodDelete:
90 | deleteData(w, r)
91 | default:
92 | w.WriteHeader(http.StatusMethodNotAllowed)
93 | fmt.Fprint(w, "405 Method Not Allowed")
94 | }
95 | }
96 |
97 | func createDBConnection() (*sql.DB, error) {
98 | print("db connected")
99 | connStr := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable", host, port, user, password, dbname)
100 | return sql.Open("postgres", connStr)
101 | }
102 |
103 | func createTable(db *sql.DB) {
104 |
105 | createTableQuery := `CREATE TABLE IF NOT EXISTS bots_info (
106 | id SERIAL PRIMARY KEY,
107 | privkey TEXT NOT NULL,
108 | title TEXT NOT NULL,
109 | network_id TEXT NOT NULL,
110 | volumn DOUBLE PRECISION DEFAULT 0,
111 | fees REAL DEFAULT 0,
112 | random_action INTEGER DEFAULT 0,
113 | tx_num INTEGER DEFAULT 0,
114 | max_gas REAL DEFAULT 0,
115 | time_min INTEGER NOT NULL,
116 | time_max INTEGER NOT NULL,
117 | create_time TIMESTAMP NOT NULL,
118 | delete_time TIMESTAMP
119 | );`
120 | print(createTableQuery)
121 | _, err := db.Exec(createTableQuery)
122 | if err != nil {
123 | log.Fatal(err)
124 | }
125 |
126 | }
127 | func insertData(w http.ResponseWriter, r *http.Request) {
128 | db, err := createDBConnection()
129 | if err != nil {
130 | w.WriteHeader(http.StatusInternalServerError)
131 | fmt.Fprint(w, "500 Internal Server Error")
132 | log.Fatal(err)
133 | return
134 | }
135 | defer db.Close()
136 |
137 | var bot Bot
138 | err = json.NewDecoder(r.Body).Decode(&bot)
139 | if err != nil {
140 | w.WriteHeader(http.StatusBadRequest)
141 | fmt.Fprint(w, "400 Bad Request")
142 | return
143 | }
144 |
145 | bot.CreateTime = getCurrentTime()
146 |
147 | success := insertBot(db, bot)
148 | if !success {
149 | w.WriteHeader(http.StatusInternalServerError)
150 | fmt.Fprint(w, "500 Internal Server Error")
151 | return
152 | }
153 |
154 | w.WriteHeader(http.StatusCreated)
155 | fmt.Fprint(w, "201 Created")
156 | }
157 |
158 | func insertBot(db *sql.DB, bot Bot) bool {
159 | insertDataQuery := `INSERT INTO bots_info (privkey, title, network_id, volumn, fees, random_action, tx_num, max_gas, time_min, time_max, create_time) VALUES
160 | ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);`
161 | print(insertDataQuery)
162 | _, err := db.Exec(insertDataQuery, bot.PrivKey, bot.Title, bot.NetworkID, bot.Volume, bot.Fees, bot.RandomAction, bot.TxNum, bot.MaxGas, bot.TimeMin, bot.TimeMax, bot.CreateTime)
163 | if err != nil {
164 | log.Println(err)
165 | return false
166 | }
167 |
168 | return true
169 | }
170 |
171 | func updateData(w http.ResponseWriter, r *http.Request) {
172 | db, err := createDBConnection()
173 | if err != nil {
174 | w.WriteHeader(http.StatusInternalServerError)
175 | fmt.Fprint(w, "500 Internal Server Error")
176 | log.Fatal(err)
177 | return
178 | }
179 | defer db.Close()
180 |
181 | var bot Bot
182 | err = json.NewDecoder(r.Body).Decode(&bot)
183 | if err != nil {
184 | w.WriteHeader(http.StatusBadRequest)
185 | fmt.Fprint(w, "400 Bad Request")
186 | return
187 | }
188 |
189 | success := updateBot(db, bot.ID, bot.Title)
190 | if !success {
191 | w.WriteHeader(http.StatusInternalServerError)
192 | fmt.Fprint(w, "500 Internal Server Error")
193 | return
194 | }
195 |
196 | w.WriteHeader(http.StatusOK)
197 | fmt.Fprint(w, "200 OK")
198 | }
199 |
200 | func updateBot(db *sql.DB, id int, newTitle string) bool {
201 | updateDataQuery := `UPDATE bots_info SET title = $1 WHERE id = $2;`
202 |
203 | _, err := db.Exec(updateDataQuery, newTitle, id)
204 | if err != nil {
205 | log.Println(err)
206 | return false
207 | }
208 |
209 | return true
210 | }
211 |
212 | func queryData(w http.ResponseWriter) {
213 | db, err := createDBConnection()
214 | if err != nil {
215 | w.WriteHeader(http.StatusInternalServerError)
216 | fmt.Fprint(w, "500 Internal Server Error")
217 | log.Fatal(err)
218 | return
219 | }
220 | defer db.Close()
221 |
222 | bots := queryBots(db)
223 |
224 | response, err := json.Marshal(bots)
225 | if err != nil {
226 | w.WriteHeader(http.StatusInternalServerError)
227 | fmt.Fprint(w, "500 Internal Server Error")
228 | return
229 | }
230 |
231 | w.Header().Set("Content-Type", "application/json")
232 | w.WriteHeader(http.StatusOK)
233 | w.Write(response)
234 | }
235 |
236 | func queryBots(db *sql.DB) []Bot {
237 | queryDataQuery := `SELECT * FROM bots_info ORDER BY create_time DESC;`
238 | print(queryDataQuery)
239 | rows, err := db.Query(queryDataQuery)
240 | if err != nil {
241 | log.Fatal(err)
242 | }
243 | defer rows.Close()
244 |
245 | bots := []Bot{}
246 | for rows.Next() {
247 | var bot Bot
248 | err := rows.Scan(&bot.ID, &bot.PrivKey, &bot.Title, &bot.NetworkID, &bot.Volume, &bot.Fees, &bot.RandomAction, &bot.TxNum, &bot.MaxGas, &bot.TimeMin, &bot.TimeMax, &bot.CreateTime, &bot.DeleteDateTime)
249 | if err != nil {
250 | log.Fatal(err)
251 | }
252 | bots = append(bots, bot)
253 | }
254 | err = rows.Err()
255 | if err != nil {
256 | log.Fatal(err)
257 | }
258 |
259 | return bots
260 | }
261 |
262 | func deleteData(w http.ResponseWriter, r *http.Request) {
263 | db, err := createDBConnection()
264 | if err != nil {
265 | w.WriteHeader(http.StatusInternalServerError)
266 | fmt.Fprint(w, "500 Internal Server Error")
267 | log.Fatal(err)
268 | return
269 | }
270 | defer db.Close()
271 | print("hello")
272 |
273 | if err := r.ParseForm(); err != nil {
274 | w.WriteHeader(http.StatusBadRequest)
275 | fmt.Fprint(w, "400 Bad Request")
276 | }
277 |
278 | id, err := strconv.Atoi(r.FormValue("ID"))
279 | if err != nil {
280 | fmt.Println("Param Error: ", err)
281 | return
282 | }
283 | success := deleteBot(db, id)
284 | if !success {
285 | w.WriteHeader(http.StatusInternalServerError)
286 | fmt.Fprint(w, "500 Internal Server Error")
287 | return
288 | }
289 |
290 | w.WriteHeader(http.StatusOK)
291 | fmt.Fprint(w, "200 OK")
292 | }
293 |
294 | func deleteBot(db *sql.DB, id int) bool {
295 | deleteDataQuery := `DELETE FROM bots_info WHERE id = $1;`
296 |
297 | _, err := db.Exec(deleteDataQuery, id)
298 | if err != nil {
299 | log.Println(err)
300 | return false
301 | }
302 |
303 | return true
304 | }
305 |
306 | func getCurrentTime() string {
307 | currentTime := time.Now().Format("2006-01-02 15:04:05")
308 | return currentTime
309 | }
310 |
--------------------------------------------------------------------------------
/examples/cancelTx copy.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "context"
5 | "crypto/ecdsa"
6 | "fmt"
7 | "log"
8 | "math/big"
9 |
10 | "github.com/ethereum/go-ethereum/common"
11 | "github.com/ethereum/go-ethereum/common/hexutil"
12 | "github.com/ethereum/go-ethereum/core/types"
13 | "github.com/ethereum/go-ethereum/crypto"
14 | "github.com/ethereum/go-ethereum/ethclient"
15 | "golang.org/x/crypto/sha3"
16 | )
17 |
18 | func main4() {
19 |
20 | rpcUrl := "https://rpc2.sepolia.org"
21 | pk := "00a2bb2d32a9aa43994686051b4d9368a64ebc1df7f18ae85e7d043b486443b8"
22 | client, err := ethclient.Dial(rpcUrl)
23 | if err != nil {
24 | log.Fatal(err)
25 | }
26 |
27 | privateKey, err := crypto.HexToECDSA(pk)
28 | if err != nil {
29 | log.Fatal(err)
30 | }
31 |
32 | publicKey := privateKey.Public()
33 | publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey)
34 | if !ok {
35 | log.Fatal("cannot assert type: publicKey is not of type *ecdsa.PublicKey")
36 | }
37 |
38 | fromAddress := crypto.PubkeyToAddress(*publicKeyECDSA)
39 | nonce, err := client.PendingNonceAt(context.Background(), fromAddress)
40 | if err != nil {
41 | log.Fatal(err)
42 | }
43 |
44 | value := big.NewInt(0) // in wei (0 eth)
45 | gasPrice, err := client.SuggestGasPrice(context.Background())
46 | if err != nil {
47 | log.Fatal(err)
48 | }
49 |
50 | toAddress := common.HexToAddress("0x4592d8f8d7b001e72cb26a73e4fa1806a51ac79d")
51 | tokenAddress := common.HexToAddress("0xF0D7F526c0A706745D9BBDbD66a1A36e0F40DA0f")
52 |
53 | transferFnSignature := []byte("transfer(address,uint256)")
54 | hash := sha3.NewLegacyKeccak256()
55 | hash.Write(transferFnSignature)
56 | methodID := hash.Sum(nil)[:4]
57 | fmt.Println(hexutil.Encode(methodID)) // 0xa9059cbb
58 |
59 | paddedAddress := common.LeftPadBytes(toAddress.Bytes(), 32)
60 | fmt.Println(hexutil.Encode(paddedAddress)) // 0x0000000000000000000000004592d8f8d7b001e72cb26a73e4fa1806a51ac79d
61 |
62 | amount := new(big.Int)
63 | amount.SetString("1000000000000000000000", 10) // sets the value to 1000 tokens, in the token denomination
64 |
65 | paddedAmount := common.LeftPadBytes(amount.Bytes(), 32)
66 | fmt.Println(hexutil.Encode(paddedAmount)) // 0x00000000000000000000000000000000000000000000003635c9adc5dea00000
67 |
68 | var data []byte
69 | data = append(data, methodID...)
70 | data = append(data, paddedAddress...)
71 | data = append(data, paddedAmount...)
72 |
73 | /*
74 | gasLimit, err := client.EstimateGas(context.Background(), ethereum.CallMsg{
75 | To: &tokenAddress,
76 | Data: data,
77 | })
78 | if err != nil {
79 | log.Fatal(err)
80 | }
81 | fmt.Println(gasLimit) // 23256
82 | */
83 |
84 | tx := types.NewTransaction(nonce, tokenAddress, value, 100000, gasPrice, data)
85 |
86 | chainID, err := client.NetworkID(context.Background())
87 | if err != nil {
88 | log.Fatal(err)
89 | }
90 |
91 | signedTx, err := types.SignTx(tx, types.NewEIP155Signer(chainID), privateKey)
92 | if err != nil {
93 | log.Fatal(err)
94 | }
95 |
96 | err = client.SendTransaction(context.Background(), signedTx)
97 | if err != nil {
98 | log.Fatal(err)
99 | }
100 |
101 | fmt.Printf("tx sent: %s", signedTx.Hash().Hex()) // tx sent: 0xa56316b637a94c4cc0331c73ef26389d6c097506d581073f927275e7a6ece0bc
102 | }
103 |
--------------------------------------------------------------------------------
/examples/cancelTx.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "math/big"
7 |
8 | "github.com/nikola43/web3golanghelper/web3helper"
9 | )
10 |
11 | func main() {
12 |
13 | wsUrl := "wss://eth-goerli.nodereal.io/ws/v1/703500179cfc4348b90bebc0b3fba854"
14 |
15 | rpcUrl := "https://rpc2.sepolia.org"
16 | pk := "00a2bb2d32a9aa43994686051b4d9368a64ebc1df7f18ae85e7d043b486443b8"
17 |
18 | web3Helper := web3helper.NewWeb3GolangHelper(rpcUrl, wsUrl)
19 | web3Helper.AddAccount(pk)
20 |
21 | chainID, err := web3Helper.HttpClient().ChainID(context.Background())
22 | if err != nil {
23 | fmt.Println(err)
24 | }
25 | //
26 |
27 | tx, nonce, err := web3Helper.SendEth("0xf0d7f526c0a706745d9bbdbd66a1a36e0f40da0f", 1, pk)
28 | if err != nil {
29 | fmt.Println(err)
30 | panic(err)
31 | }
32 | fmt.Println(tx)
33 |
34 | tx, err = web3Helper.CancelTx("0xf0d7f526c0a706745d9bbdbd66a1a36e0f40da0f", big.NewInt(int64(nonce)), 10, pk)
35 | if err != nil {
36 | fmt.Println(err)
37 | panic(err)
38 | }
39 |
40 | fmt.Println("tx", tx)
41 |
42 | fmt.Println("Chain Id: " + chainID.String())
43 | }
44 |
--------------------------------------------------------------------------------
/examples/sendTokens.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "math/big"
7 |
8 | "github.com/nikola43/web3golanghelper/web3helper"
9 | )
10 |
11 | func main2() {
12 |
13 | rpcUrl := "https://eth-goerli.nodereal.io/v1/703500179cfc4348b90bebc0b3fba854"
14 | wsUrl := "wss://eth-goerli.nodereal.io/ws/v1/703500179cfc4348b90bebc0b3fba854"
15 | pk := "cfedfad8629f43cfffda1bc9a4c97e1aa4461615f8331b0760272f9303b2838e"
16 | web3Helper := web3helper.NewWeb3GolangHelper(rpcUrl, wsUrl)
17 |
18 | chainID, err := web3Helper.HttpClient().ChainID(context.Background())
19 | if err != nil {
20 | fmt.Println(err)
21 | }
22 | //
23 |
24 | tx, nonce, err := web3Helper.SendTokens("0xc43aF0698bd618097e5DD933a04F4e4a5A806834", "0x6AD058b6af6BEEF79a20174D9f651f3534Fe2F60", big.NewInt(1000000000000000000), pk)
25 | if err != nil {
26 | fmt.Println(err)
27 | panic(err)
28 | }
29 |
30 | fmt.Println("tx", tx)
31 | fmt.Println("nonce", nonce)
32 |
33 | fmt.Println("Chain Id: " + chainID.String())
34 | }
35 |
--------------------------------------------------------------------------------
/generateGolangFromAbi.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | # generate bins and abis from contract
4 | cmd = "solc0.6.6 --overwrite " + "--abi " + "contracts/PancakeMainnetContract.sol " + " -o contracts/build"
5 | run_result = os.system(cmd)
6 | if run_result != 0:
7 | print("Error generating abi")
8 | os.abort()
9 |
10 | cmd = "solc0.6.6 --overwrite " + "--bin " + "contracts/PancakeMainnetContract.sol " + " -o contracts/build"
11 | run_result = os.system(cmd)
12 | if run_result != 0:
13 | print("Error generating bin")
14 | os.abort()
15 |
16 | # List all files in a directory using os.listdir
17 | basepath = 'contracts/build/'
18 | for entry in os.listdir(basepath):
19 | if os.path.isfile(os.path.join(basepath, entry)):
20 | split_name = entry.split(".")
21 | filename = split_name[0]
22 | file_extension = split_name[1]
23 |
24 | # for run only once
25 | if file_extension == 'abi':
26 | # [abigen --bin=contracts/build/IPancakeRouter01.bin --abi=contracts/build/IPancakeRouter01.abi --pkg=IPancakeRouter01 --out=contracts/IPancakeRouter01.go]
27 | cmd = "abigen " + "--bin=contracts/build/" + filename + ".bin " + "--abi=contracts/build/" + filename + ".abi " + "--pkg=" + filename + " --out=contracts/" + filename + ".go"
28 | run_result = os.system(cmd)
29 |
30 | if run_result != 0:
31 | print("Error generating golang source code from " + filename)
32 | os.abort()
33 |
34 | os.mkdir("contracts/" + filename)
35 | os.rename("contracts/" + filename + ".go", "contracts/" + filename + "/" + filename + ".go")
36 |
37 |
--------------------------------------------------------------------------------
/genericutils/utils.go:
--------------------------------------------------------------------------------
1 | package genericutils
2 |
3 | import (
4 | "fmt"
5 | "log"
6 | "os/exec"
7 | "runtime"
8 | )
9 |
10 | func OpenBrowser(url string) {
11 | var err error
12 |
13 | switch runtime.GOOS {
14 | case "linux":
15 | err = exec.Command("xdg-open", url).Start()
16 | case "windows":
17 | err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
18 | case "darwin":
19 | err = exec.Command("open", url).Start()
20 | default:
21 | err = fmt.Errorf("unsupported platform")
22 | }
23 | if err != nil {
24 | log.Fatal(err)
25 | }
26 | }
27 |
28 | /*
29 | // openBrowser tries to open the URL in a browser,
30 | // and returns whether it succeed in doing so.
31 | func OpenBrowser(url string) bool {
32 | var args []string
33 | switch runtime.GOOS {
34 | case "darwin":
35 | args = []string{"open"}
36 | case "windows":
37 | args = []string{"cmd", "/c", "start"}
38 | default:
39 | args = []string{"xdg-open"}
40 | }
41 | cmd := exec.Command(args[0], append(args[1:], url)...)
42 | return cmd.Start() == nil
43 | }
44 | */
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/nikola43/web3golanghelper
2 |
3 | go 1.18
4 |
5 | require (
6 | github.com/ethereum/go-ethereum v1.10.19
7 | github.com/fatih/color v1.13.0
8 | github.com/lib/pq v1.10.9
9 | github.com/shopspring/decimal v1.3.1
10 | golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
11 | )
12 |
13 | require (
14 | github.com/stretchr/testify v1.7.1 // indirect
15 | github.com/yusufpapurcu/wmi v1.2.2 // indirect
16 | rsc.io/qr v0.2.0 // indirect
17 | )
18 |
19 | require (
20 | github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
21 | github.com/deckarep/golang-set v1.8.0 // indirect
22 | github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
23 | github.com/go-ole/go-ole v1.2.6 // indirect
24 | github.com/go-stack/stack v1.8.1 // indirect
25 | github.com/google/uuid v1.3.0 // indirect
26 | github.com/gorilla/websocket v1.5.0 // indirect
27 | github.com/hokaccha/go-prettyjson v0.0.0-20211117102719-0474bc63780f
28 | github.com/joho/godotenv v1.4.0
29 | github.com/mattn/go-colorable v0.1.12 // indirect
30 | github.com/mattn/go-isatty v0.0.14 // indirect
31 | github.com/mdp/qrterminal v1.0.1
32 | github.com/rjeczalik/notify v0.9.2 // indirect
33 | github.com/shirou/gopsutil v3.21.11+incompatible // indirect
34 | github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
35 | github.com/tklauser/go-sysconf v0.3.10 // indirect
36 | github.com/tklauser/numcpus v0.5.0 // indirect
37 | golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c // indirect
38 | gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
39 | )
40 |
--------------------------------------------------------------------------------
/go.sum:
--------------------------------------------------------------------------------
1 | github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o=
2 | github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k=
3 | github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU=
4 | github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
5 | github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk=
6 | github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
7 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
8 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
9 | github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4=
10 | github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo=
11 | github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=
12 | github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
13 | github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc=
14 | github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
15 | github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw=
16 | github.com/ethereum/go-ethereum v1.10.19 h1:EOR5JbL4MD5yeOqv8W2iC1s4NximrTjqFccUz8lyBRA=
17 | github.com/ethereum/go-ethereum v1.10.19/go.mod h1:IJBNMtzKcNHPtllYihy6BL2IgK1u+32JriaTbdt4v+w=
18 | github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
19 | github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
20 | github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c=
21 | github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI=
22 | github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
23 | github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
24 | github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw=
25 | github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4=
26 | github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog=
27 | github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
28 | github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
29 | github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
30 | github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
31 | github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
32 | github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE=
33 | github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs=
34 | github.com/hokaccha/go-prettyjson v0.0.0-20211117102719-0474bc63780f h1:7LYC+Yfkj3CTRcShK0KOL/w6iTiKyqqBA9a41Wnggw8=
35 | github.com/hokaccha/go-prettyjson v0.0.0-20211117102719-0474bc63780f/go.mod h1:pFlLw2CfqZiIBOx6BuCeRLCrfxBJipTY0nIOF/VbGcI=
36 | github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao=
37 | github.com/holiman/uint256 v1.2.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM=
38 | github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ=
39 | github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus=
40 | github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
41 | github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
42 | github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
43 | github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
44 | github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
45 | github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
46 | github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
47 | github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
48 | github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
49 | github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
50 | github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
51 | github.com/mdp/qrterminal v1.0.1 h1:07+fzVDlPuBlXS8tB0ktTAyf+Lp1j2+2zK3fBOL5b7c=
52 | github.com/mdp/qrterminal v1.0.1/go.mod h1:Z33WhxQe9B6CdW37HaVqcRKzP+kByF3q/qLxOGe12xQ=
53 | github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag=
54 | github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A=
55 | github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
56 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
57 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
58 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
59 | github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA=
60 | github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8=
61 | github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM=
62 | github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
63 | github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
64 | github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
65 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
66 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
67 | github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
68 | github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
69 | github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 h1:Gb2Tyox57NRNuZ2d3rmvB3pcmbu7O1RS3m8WRx7ilrg=
70 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
71 | github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
72 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
73 | github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY=
74 | github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw=
75 | github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk=
76 | github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ=
77 | github.com/tklauser/numcpus v0.5.0 h1:ooe7gN0fg6myJ0EKoTAf5hebTZrH52px3New/D9iJ+A=
78 | github.com/tklauser/numcpus v0.5.0/go.mod h1:OGzpTxpcIMNGYQdit2BYL1pvk/dSOaJWjKoflh+RQjo=
79 | github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef h1:wHSqTBrZW24CsNJDfeh9Ex6Pm0Rcpc7qrgKBiL44vF4=
80 | github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=
81 | github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
82 | golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM=
83 | golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
84 | golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
85 | golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
86 | golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
87 | golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
88 | golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
89 | golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
90 | golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
91 | golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
92 | golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
93 | golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c h1:aFV+BgZ4svzjfabn8ERpuB4JI4N6/rdy1iusx77G3oU=
94 | golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
95 | golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
96 | golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE=
97 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
98 | gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU=
99 | gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c=
100 | gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0=
101 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
102 | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
103 | rsc.io/qr v0.2.0 h1:6vBLea5/NRMVTz8V66gipeLycZMl/+UlFmk8DvqQ6WY=
104 | rsc.io/qr v0.2.0/go.mod h1:IF+uZjkb9fqyeF/4tlBoynqmQxUoPfWEKh921coOuXs=
105 |
--------------------------------------------------------------------------------
/main.bak:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "context"
5 | "fmt"
6 |
7 | "github.com/nikola43/web3golanghelper/web3helper"
8 | )
9 |
10 | func main() {
11 |
12 | rpcUrl := "https://speedy-nodes-nyc.moralis.io/84a2745d907034e6d388f8d6/bsc/testnet"
13 | web3HttpClient := web3helper.NewHttpWeb3Client(rpcUrl)
14 |
15 | chainID, err := web3HttpClient.NetworkID(context.Background())
16 | if err != nil {
17 | fmt.Println(err)
18 | }
19 |
20 | fmt.Println("Chain Id: " + chainID.String())
21 | }
22 |
--------------------------------------------------------------------------------
/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "context"
5 | "crypto/ecdsa"
6 | "database/sql"
7 | "fmt"
8 | "log"
9 | "math/big"
10 | "os"
11 | "os/exec"
12 | "runtime"
13 | "strconv"
14 | "time"
15 |
16 | "github.com/ethereum/go-ethereum/crypto"
17 |
18 | "github.com/ethereum/go-ethereum/common"
19 | "github.com/joho/godotenv"
20 |
21 | pancakeFactory "github.com/nikola43/web3golanghelper/contracts/IPancakeFactory"
22 | pancakePair "github.com/nikola43/web3golanghelper/contracts/IPancakePair"
23 | database "github.com/nikola43/web3golanghelper/database"
24 | "github.com/nikola43/web3golanghelper/web3helper"
25 | )
26 |
27 | type Reserve struct {
28 | Reserve0 *big.Int
29 | Reserve1 *big.Int
30 | BlockTimestampLast uint32
31 | }
32 | type Bot struct {
33 | ID int `json:"id"`
34 | PrivKey string `json:"privkey"`
35 | Title string `json:"title"`
36 | NetworkID string `json:"network_id"`
37 | Volume float64 `json:"volume"`
38 | Fees float32 `json:"fees"`
39 | RandomAction int `json:"random_action"`
40 | TxNum int `json:"tx_num"`
41 | MaxGas float32 `json:"max_gas"`
42 | TimeMin int `json:"time_min"`
43 | TimeMax int `json:"time_max"`
44 | CreateTime string `json:"create_time"`
45 | DeleteDateTime sql.NullString `json:"delete_time"`
46 | }
47 |
48 | func main() {
49 | // database.Connect()
50 | database.Connect()
51 | // if err != nil {
52 | // log.Fatal(err)
53 | // }
54 |
55 | // defer db.Close()
56 | // database.createTable(db)
57 |
58 | // read .env variables
59 | RPC_URL, WS_URL, WETH_ADDRESS, FACTORY_ADDRESS, TOKEN_ADDRESS, PK, BUY_AMOUNT, ROUTER_ADDRESS, GAS_MULTIPLIER := readEnvVariables()
60 |
61 | web3GolangHelper := initWeb3(RPC_URL, WS_URL)
62 | fromAddress := GeneratePublicAddressFromPrivateKey(PK)
63 |
64 | // convert buy amount to float
65 |
66 | // infinite loop
67 | for {
68 | // get pair address
69 | lpPairAddress := getPair(web3GolangHelper, WETH_ADDRESS, FACTORY_ADDRESS, TOKEN_ADDRESS)
70 | fmt.Println("LP Pair Address: " + lpPairAddress)
71 |
72 | if lpPairAddress != "0x0000000000000000000000000000000000000000" {
73 | reserves := getReserves(web3GolangHelper, lpPairAddress)
74 |
75 | fmt.Println("Reserve0: " + reserves.Reserve0.String())
76 | fmt.Println("Reserve1: " + reserves.Reserve1.String())
77 |
78 | // check if reserves is greater than 0
79 | if reserves.Reserve0.Cmp(big.NewInt(0)) > 0 && reserves.Reserve1.Cmp(big.NewInt(0)) > 0 {
80 | buyAmount, err := strconv.ParseFloat(BUY_AMOUNT, 32)
81 | if err != nil {
82 | fmt.Println(err)
83 | }
84 | fmt.Println(web3GolangHelper.GetEthBalance(fromAddress))
85 | web3GolangHelper.Buy(ROUTER_ADDRESS, WETH_ADDRESS, PK, fromAddress, TOKEN_ADDRESS, buyAmount, GAS_MULTIPLIER)
86 | // time.Sleep(10 * time.Millisecond)
87 | // web3GolangHelper.Sell(ROUTER_ADDRESS, WETH_ADDRESS, PK, fromAddress, TOKEN_ADDRESS, buyAmount, GAS_MULTIPLIER)
88 | // web3GolangHelper.Sell(ROUTER_ADDRESS, WETH_ADDRESS, PK, fromAddress, TOKEN_ADDRESS, big.NewInt(100), GAS_MULTIPLIER)
89 | os.Exit(0)
90 | }
91 | }
92 | // sleep 1 second
93 | time.Sleep(1 * time.Millisecond)
94 | }
95 | }
96 |
97 | func OpenBrowser(url string) {
98 | var err error
99 |
100 | switch runtime.GOOS {
101 | case "linux":
102 | err = exec.Command("xdg-open", url).Start()
103 | case "windows":
104 | err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
105 | case "darwin":
106 | err = exec.Command("open", url).Start()
107 | default:
108 | err = fmt.Errorf("unsupported platform")
109 | }
110 | if err != nil {
111 | log.Fatal(err)
112 | }
113 | }
114 |
115 | // function for read .env variables
116 | func readEnvVariables() (string, string, string, string, string, string, string, string, string) {
117 | // load .env file
118 | err := godotenv.Load()
119 | if err != nil {
120 | log.Fatal("Error loading .env file")
121 | }
122 |
123 | RPC_URL := os.Getenv("RPC_URL")
124 | WS_URL := os.Getenv("WS_URL")
125 | WETH_ADDRESS := os.Getenv("WETH_ADDRESS")
126 | FACTORY_ADDRESS := os.Getenv("FACTORY_ADDRESS")
127 | TOKEN_ADDRESS := os.Getenv("TOKEN_ADDRESS")
128 | PK := os.Getenv("PK")
129 | BUY_AMOUNT := os.Getenv("BUY_AMOUNT")
130 | ROUTER_ADDRESS := os.Getenv("ROUTER_ADDRESS")
131 | GAS_MULTIPLIER := os.Getenv("GAS_MULTIPLIER")
132 |
133 | return RPC_URL, WS_URL, WETH_ADDRESS, FACTORY_ADDRESS, TOKEN_ADDRESS, PK, BUY_AMOUNT, ROUTER_ADDRESS, GAS_MULTIPLIER
134 | }
135 |
136 | func initWeb3(rpcUrl, wsUrl string) *web3helper.Web3GolangHelper {
137 | web3GolangHelper := web3helper.NewWeb3GolangHelper(rpcUrl, wsUrl)
138 |
139 | chainID, err := web3GolangHelper.HttpClient().NetworkID(context.Background())
140 | if err != nil {
141 | fmt.Println(err)
142 | }
143 | fmt.Println("Chain Id: " + chainID.String())
144 | return web3GolangHelper
145 | }
146 |
147 | func getReserves(web3GolangHelper *web3helper.Web3GolangHelper, pairAddress string) Reserve {
148 |
149 | pairInstance, instanceErr := pancakePair.NewPancake(common.HexToAddress(pairAddress), web3GolangHelper.HttpClient())
150 | if instanceErr != nil {
151 | fmt.Println(instanceErr)
152 | }
153 |
154 | reserves, getReservesErr := pairInstance.GetReserves(nil)
155 | if getReservesErr != nil {
156 | fmt.Println(getReservesErr)
157 | }
158 |
159 | return reserves
160 | }
161 |
162 | func getPair(web3GolangHelper *web3helper.Web3GolangHelper, wethAddress, factoryAddress, tokenAddress string) string {
163 |
164 | factoryInstance, instanceErr := pancakeFactory.NewPancake(common.HexToAddress(factoryAddress), web3GolangHelper.HttpClient())
165 | if instanceErr != nil {
166 | fmt.Println(instanceErr)
167 | }
168 |
169 | lpPairAddress, getPairErr := factoryInstance.GetPair(nil, common.HexToAddress(wethAddress), common.HexToAddress(tokenAddress))
170 | if getPairErr != nil {
171 | fmt.Println(getPairErr)
172 | }
173 |
174 | return lpPairAddress.Hex()
175 |
176 | }
177 |
178 | func GeneratePublicAddressFromPrivateKey(plainPrivateKey string) common.Address {
179 | privateKey, err := crypto.HexToECDSA(plainPrivateKey)
180 | if err != nil {
181 | log.Fatal(err)
182 | }
183 |
184 | publicKey := privateKey.Public()
185 | publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey)
186 | if !ok {
187 | log.Fatal("error casting public key to ECDSA")
188 | }
189 |
190 | fromAddress := crypto.PubkeyToAddress(*publicKeyECDSA)
191 | return fromAddress
192 | }
193 |
--------------------------------------------------------------------------------
/wallets/2022_04_04_21_00_06.json:
--------------------------------------------------------------------------------
1 | {
2 | "PublicKey": "0xa5C2a2A9BD18a0568284620a2aFBf062678E5331",
3 | "PrivateKey": "8acc0b23375808589040f7c2921063bee6b5e1e75db491ffdccda7150a98175c"
4 | }
--------------------------------------------------------------------------------
/wallets/2022_04_04_21_00_11.json:
--------------------------------------------------------------------------------
1 | {
2 | "PublicKey": "0xC804BB308ac4Fa4311971B878A9699E6F33DcBe6",
3 | "PrivateKey": "9b5d98f147929d8db42def463afda98cc849bd9829e78985dc9f15bbcc272736"
4 | }
--------------------------------------------------------------------------------
/web3helper/errors.go:
--------------------------------------------------------------------------------
1 |
2 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
3 |
4 | package web3helper
5 |
6 | import (
7 |
8 | )
9 |
10 | const (
11 | // GenerateContractEventSubscription etc etc.
12 | GenerateContractEventSubscription = "GenerateContractEventSubscription"
13 |
14 | // SuggestGasPriceException etc etc.
15 | SuggestGasPriceException = "SuggestGasPriceException"
16 | )
--------------------------------------------------------------------------------
/web3helper/networks.go:
--------------------------------------------------------------------------------
1 | package web3helper
2 |
3 | type EVMNetwork struct {
4 | HttpUrl string
5 | WebsocketUrl string
6 | ChainID uint64
7 | }
8 |
9 | var AvalancheMainnet = &EVMNetwork{
10 | HttpUrl: "https://speedy-nodes-nyc.moralis.io/84a2745d907034e6d388f8d6/avalanche/mainnet",
11 | WebsocketUrl: "wss://speedy-nodes-nyc.moralis.io/84a2745d907034e6d388f8d6/avalanche/mainnet/ws",
12 | ChainID: 43114,
13 | }
14 |
15 | var AvalancheFujiTesnet = &EVMNetwork{
16 | HttpUrl: "https://speedy-nodes-nyc.moralis.io/84a2745d907034e6d388f8d6/avalanche/testnet",
17 | WebsocketUrl: "wss://speedy-nodes-nyc.moralis.io/84a2745d907034e6d388f8d6/avalanche/testnet/ws",
18 | ChainID: 43113,
19 | }
20 |
21 | var BinanceSmartChainMainnet = &EVMNetwork{
22 | HttpUrl: "https://speedy-nodes-nyc.moralis.io/84a2745d907034e6d388f8d6/bsc/mainnet",
23 | WebsocketUrl: "wss://speedy-nodes-nyc.moralis.io/84a2745d907034e6d388f8d6/bsc/mainnet/ws",
24 | ChainID: 56,
25 | }
26 |
27 | var BinanceSmartChainTestnet = &EVMNetwork{
28 | HttpUrl: "https://speedy-nodes-nyc.moralis.io/84a2745d907034e6d388f8d6/bsc/testnet",
29 | WebsocketUrl: "wss://speedy-nodes-nyc.moralis.io/84a2745d907034e6d388f8d6/bsc/testnet/ws",
30 | ChainID: 97,
31 | }
32 |
--------------------------------------------------------------------------------
/web3helper/web3helperiface/interface.go:
--------------------------------------------------------------------------------
1 | package web3helper
2 |
3 | /*
4 | package web3helper
5 |
6 | import "math/big"
7 |
8 | type Web3ManagerInterface interface {
9 | AddHttpClient(httpClient *ethclient.Client) *Web3Manager
10 | SuggestGasPrice() *big.Int
11 | AddWsClient(wsClient *ethclient.Client) *Web3Manager
12 | GetEthBalance(address string) *big.Int
13 | IsAddressContract(address string) bool
14 | }
15 | */
16 |
--------------------------------------------------------------------------------