evm/beefy/vaultv6.go

32 lines
696 B
Go
Raw Normal View History

2021-11-12 11:05:57 +00:00
package beefy
import (
"git.lehouerou.net/laurent/evm"
"git.lehouerou.net/laurent/evm/beefy/contracts"
"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
)
type VaultV6 struct {
evm.Token
client evm.Client
contract *contracts.VaultV6
}
func NewVaultV6(client evm.Client, address common.Address) (*VaultV6, error) {
contract, err := contracts.NewVaultV6(address, client)
if err != nil {
return nil, errors.Wrap(err, "init vault contract")
}
token, err := client.TokenService().TokenByAddress(address)
if err != nil {
return nil, errors.Wrap(err, "init token contract")
}
return &VaultV6{
client: client,
contract: contract,
Token: token,
}, nil
}