21 lines
544 B
Go
21 lines
544 B
Go
|
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
|
||
|
}
|