evm/pancakeswap/router.go

22 lines
582 B
Go
Raw Normal View History

2021-11-08 18:20:31 +00:00
package pancakeswap
import (
"git.lehouerou.net/laurent/evm"
2021-11-09 05:45:18 +00:00
"git.lehouerou.net/laurent/evm/bsc"
2021-11-08 18:20:31 +00:00
"git.lehouerou.net/laurent/evm/pancakeswap/contracts"
"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
)
const (
RouterAddress = "0x10ED43C718714eb63d5aA57B78B54704E256024E"
)
2021-11-09 05:45:18 +00:00
func NewRouter(client *bsc.Client) (*evm.UniswapRouter, error) {
2021-11-08 18:20:31 +00:00
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
}