diff --git a/bsc/wbnb.go b/bsc/wbnb.go index 2a5e4fc..0d0ab4c 100644 --- a/bsc/wbnb.go +++ b/bsc/wbnb.go @@ -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") diff --git a/pancakeswap/masterchef.go b/pancakeswap/masterchef.go index 08a76df..7ec01d1 100644 --- a/pancakeswap/masterchef.go +++ b/pancakeswap/masterchef.go @@ -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") diff --git a/pancakeswap/nftmarket.go b/pancakeswap/nftmarket.go index 8833953..ed4f332 100644 --- a/pancakeswap/nftmarket.go +++ b/pancakeswap/nftmarket.go @@ -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") diff --git a/pancakeswap/router.go b/pancakeswap/router.go index 1fbd320..0fcaf8c 100644 --- a/pancakeswap/router.go +++ b/pancakeswap/router.go @@ -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") diff --git a/polycat/catpair.go b/polycat/catpair.go index 0e88778..39a09f1 100644 --- a/polycat/catpair.go +++ b/polycat/catpair.go @@ -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") diff --git a/polycat/catrouter.go b/polycat/catrouter.go index feb4ed8..bddfd1b 100644 --- a/polycat/catrouter.go +++ b/polycat/catrouter.go @@ -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") diff --git a/polycat/masterchef.go b/polycat/masterchef.go index cfc18e8..ceb17d1 100644 --- a/polycat/masterchef.go +++ b/polycat/masterchef.go @@ -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") diff --git a/polycat/masterchefv2.go b/polycat/masterchefv2.go index bcadb45..ef8f45f 100644 --- a/polycat/masterchefv2.go +++ b/polycat/masterchefv2.go @@ -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") diff --git a/polycat/rewardlocker.go b/polycat/rewardlocker.go index 79e2b4d..ab64651 100644 --- a/polycat/rewardlocker.go +++ b/polycat/rewardlocker.go @@ -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") diff --git a/polycat/tankchef.go b/polycat/tankchef.go index 241c74e..09ac1b8 100644 --- a/polycat/tankchef.go +++ b/polycat/tankchef.go @@ -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")