evm/pancakeswap/router.go

21 lines
544 B
Go
Raw Normal View History

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