22 lines
582 B
Go
22 lines
582 B
Go
package pancakeswap
|
|
|
|
import (
|
|
"git.lehouerou.net/laurent/evm"
|
|
"git.lehouerou.net/laurent/evm/bsc"
|
|
"git.lehouerou.net/laurent/evm/pancakeswap/contracts"
|
|
"github.com/ethereum/go-ethereum/common"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
const (
|
|
RouterAddress = "0x10ED43C718714eb63d5aA57B78B54704E256024E"
|
|
)
|
|
|
|
func NewRouter(client *bsc.Client) (*evm.UniswapRouter, error) {
|
|
contract, err := contracts.NewRouter(common.HexToAddress(RouterAddress), client)
|
|
if err != nil {
|
|
return nil, errors.Wrap(err, "init contract")
|
|
}
|
|
return evm.NewUniswapRouter("pancakeswap", client, contract), nil
|
|
}
|