wip
This commit is contained in:
parent
22b69e5bf5
commit
0da2e12fa2
@ -12,11 +12,11 @@ import (
|
||||
|
||||
type WBNB struct {
|
||||
evm.Token
|
||||
client evm.Client
|
||||
client *Client
|
||||
contract *contracts.WBnb
|
||||
}
|
||||
|
||||
func NewWBNB(client evm.Client) (*WBNB, error) {
|
||||
func NewWBNB(client *Client) (*WBNB, error) {
|
||||
address, err := client.TokenService().TokenAddressBySymbol("WBNB")
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "getting wbnb address")
|
||||
|
@ -4,6 +4,8 @@ import (
|
||||
"context"
|
||||
"math/big"
|
||||
|
||||
"git.lehouerou.net/laurent/evm/bsc"
|
||||
|
||||
"git.lehouerou.net/laurent/evm"
|
||||
"git.lehouerou.net/laurent/evm/pancakeswap/contracts"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||
@ -16,13 +18,13 @@ import (
|
||||
const MasterChefAddress = "0x73feaa1eE314F8c655E354234017bE2193C9E24E"
|
||||
|
||||
type MasterChef struct {
|
||||
client evm.Client
|
||||
client *bsc.Client
|
||||
contract *contracts.MasterChef
|
||||
|
||||
cake evm.Token
|
||||
}
|
||||
|
||||
func NewMasterChef(client evm.Client) (*MasterChef, error) {
|
||||
func NewMasterChef(client *bsc.Client) (*MasterChef, error) {
|
||||
c, err := contracts.NewMasterChef(common.HexToAddress(MasterChefAddress), client)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "init contract")
|
||||
|
@ -4,6 +4,8 @@ import (
|
||||
"context"
|
||||
"math/big"
|
||||
|
||||
"git.lehouerou.net/laurent/evm/bsc"
|
||||
|
||||
"git.lehouerou.net/laurent/evm"
|
||||
"git.lehouerou.net/laurent/evm/pancakeswap/contracts"
|
||||
|
||||
@ -19,12 +21,12 @@ const (
|
||||
)
|
||||
|
||||
type NftMarket struct {
|
||||
client evm.Client
|
||||
client *bsc.Client
|
||||
contract *contracts.NftMarket
|
||||
wbnb evm.Token
|
||||
}
|
||||
|
||||
func NewNftMarket(client evm.Client) (*NftMarket, error) {
|
||||
func NewNftMarket(client *bsc.Client) (*NftMarket, error) {
|
||||
contract, err := contracts.NewNftMarket(common.HexToAddress(MarketAddress), client)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "init contract")
|
||||
|
@ -2,6 +2,7 @@ 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"
|
||||
@ -11,7 +12,7 @@ const (
|
||||
RouterAddress = "0x10ED43C718714eb63d5aA57B78B54704E256024E"
|
||||
)
|
||||
|
||||
func NewRouter(client evm.Client) (*evm.UniswapRouter, error) {
|
||||
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")
|
||||
|
@ -3,6 +3,7 @@ package polycat
|
||||
import (
|
||||
"git.lehouerou.net/laurent/evm"
|
||||
"git.lehouerou.net/laurent/evm/polycat/contracts"
|
||||
"git.lehouerou.net/laurent/evm/polygon"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/pkg/errors"
|
||||
@ -14,7 +15,7 @@ type CatPair struct {
|
||||
paircontract *contracts.CatPair
|
||||
}
|
||||
|
||||
func NewCatPair(client evm.Client, address common.Address) (*CatPair, error) {
|
||||
func NewCatPair(client *polygon.Client, address common.Address) (*CatPair, error) {
|
||||
t, err := client.TokenService().TokenByAddress(address)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "init contract")
|
||||
|
@ -3,13 +3,14 @@ package polycat
|
||||
import (
|
||||
"git.lehouerou.net/laurent/evm"
|
||||
"git.lehouerou.net/laurent/evm/polycat/contracts"
|
||||
"git.lehouerou.net/laurent/evm/polygon"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const CatRouterAddress = "0x94930a328162957FF1dd48900aF67B5439336cBD"
|
||||
|
||||
func NewCatRouterService(c evm.Client) (*evm.UniswapRouter, error) {
|
||||
func NewCatRouterService(c *polygon.Client) (*evm.UniswapRouter, error) {
|
||||
contract, err := contracts.NewCatRouter(common.HexToAddress(CatRouterAddress), c)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "init contract")
|
||||
|
@ -4,6 +4,8 @@ import (
|
||||
"context"
|
||||
"math/big"
|
||||
|
||||
"git.lehouerou.net/laurent/evm/polygon"
|
||||
|
||||
"git.lehouerou.net/laurent/evm"
|
||||
"git.lehouerou.net/laurent/evm/polycat/contracts"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
@ -18,11 +20,11 @@ const (
|
||||
)
|
||||
|
||||
type MasterchefService struct {
|
||||
client evm.Client
|
||||
client *polygon.Client
|
||||
contract *contracts.Masterchef
|
||||
}
|
||||
|
||||
func NewMasterchefService(c evm.Client) (*MasterchefService, error) {
|
||||
func NewMasterchefService(c *polygon.Client) (*MasterchefService, error) {
|
||||
contract, err := contracts.NewMasterchef(common.HexToAddress(MasterchefAddress), c)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "init contract")
|
||||
|
@ -4,6 +4,8 @@ import (
|
||||
"context"
|
||||
"math/big"
|
||||
|
||||
"git.lehouerou.net/laurent/evm/polygon"
|
||||
|
||||
"git.lehouerou.net/laurent/evm"
|
||||
"git.lehouerou.net/laurent/evm/polycat/contracts"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||
@ -18,11 +20,11 @@ const (
|
||||
)
|
||||
|
||||
type Masterchefv2Service struct {
|
||||
client evm.Client
|
||||
client *polygon.Client
|
||||
contract *contracts.MasterChefv2
|
||||
}
|
||||
|
||||
func NewMasterchefv2Service(c evm.Client) (*Masterchefv2Service, error) {
|
||||
func NewMasterchefv2Service(c *polygon.Client) (*Masterchefv2Service, error) {
|
||||
contract, err := contracts.NewMasterChefv2(common.HexToAddress(Masterchefv2Address), c)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "init contract")
|
||||
|
@ -4,6 +4,8 @@ import (
|
||||
"context"
|
||||
"math/big"
|
||||
|
||||
"git.lehouerou.net/laurent/evm/polygon"
|
||||
|
||||
"git.lehouerou.net/laurent/evm"
|
||||
"git.lehouerou.net/laurent/evm/polycat/contracts"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||
@ -16,11 +18,11 @@ import (
|
||||
const RewardLockerAddress = "0xE0e44d4E7e61f2f4f990f5F4e2408D2187315C94"
|
||||
|
||||
type RewardLockerService struct {
|
||||
client evm.Client
|
||||
client *polygon.Client
|
||||
contract *contracts.RewardLocker
|
||||
}
|
||||
|
||||
func NewRewardLockerService(c evm.Client) (*RewardLockerService, error) {
|
||||
func NewRewardLockerService(c *polygon.Client) (*RewardLockerService, error) {
|
||||
contract, err := contracts.NewRewardLocker(common.HexToAddress(RewardLockerAddress), c)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "init contract")
|
||||
|
@ -4,6 +4,8 @@ import (
|
||||
"context"
|
||||
"math/big"
|
||||
|
||||
"git.lehouerou.net/laurent/evm/polygon"
|
||||
|
||||
"git.lehouerou.net/laurent/evm"
|
||||
"git.lehouerou.net/laurent/evm/polycat/contracts"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
@ -13,11 +15,11 @@ import (
|
||||
)
|
||||
|
||||
type TankChefService struct {
|
||||
client evm.Client
|
||||
client *polygon.Client
|
||||
contract *contracts.TankChef
|
||||
}
|
||||
|
||||
func NewTankChefService(c evm.Client, address string) (*TankChefService, error) {
|
||||
func NewTankChefService(c *polygon.Client, address string) (*TankChefService, error) {
|
||||
contract, err := contracts.NewTankChef(common.HexToAddress(address), c)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "init contract")
|
||||
|
Loading…
Reference in New Issue
Block a user