Skip to content

Commit

Permalink
Update e2e test code
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcl committed Feb 14, 2024
1 parent e315cf6 commit 05044cc
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
22 changes: 21 additions & 1 deletion integration-tests/contracts/contract_deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/upkeep_perform_counter_restrictive_wrapper"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/upkeep_transcoder"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/fee_manager"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/fee_manager_no_native"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/reward_manager"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/verifier"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/verifier_proxy"
Expand Down Expand Up @@ -153,6 +154,7 @@ type ContractDeployer interface {
DeployMercuryVerifierContract(verifierProxyAddr common.Address) (MercuryVerifier, error)
DeployMercuryVerifierProxyContract(accessControllerAddr common.Address) (MercuryVerifierProxy, error)
DeployMercuryFeeManager(linkAddress common.Address, nativeAddress common.Address, proxyAddress common.Address, rewardManagerAddress common.Address) (MercuryFeeManager, error)
DeployMercuryFeeManagerNoNative(linkAddress common.Address, nativeAddress common.Address, proxyAddress common.Address, rewardManagerAddress common.Address) (MercuryFeeManager, error)
DeployMercuryRewardManager(linkAddress common.Address) (MercuryRewardManager, error)
DeployLogEmitterContract() (LogEmitter, error)
DeployMultiCallContract() (common.Address, error)
Expand Down Expand Up @@ -1669,7 +1671,7 @@ func (e *EthereumContractDeployer) DeployMercuryVerifierProxyContract(accessCont
}

func (e *EthereumContractDeployer) DeployMercuryFeeManager(linkAddress common.Address, nativeAddress common.Address, proxyAddress common.Address, rewardManagerAddress common.Address) (MercuryFeeManager, error) {
address, _, instance, err := e.client.DeployContract("Mercury Fee Manager", func(
address, _, instance, err := e.client.DeployContract("Mercury FeeManager", func(
auth *bind.TransactOpts,
backend bind.ContractBackend,
) (common.Address, *types.Transaction, interface{}, error) {
Expand All @@ -1686,6 +1688,24 @@ func (e *EthereumContractDeployer) DeployMercuryFeeManager(linkAddress common.Ad
}, err
}

func (e *EthereumContractDeployer) DeployMercuryFeeManagerNoNative(linkAddress common.Address, nativeAddress common.Address, proxyAddress common.Address, rewardManagerAddress common.Address) (MercuryFeeManager, error) {
address, _, instance, err := e.client.DeployContract("Mercury FeeManagerNoNative", func(
auth *bind.TransactOpts,
backend bind.ContractBackend,
) (common.Address, *types.Transaction, interface{}, error) {
return fee_manager_no_native.DeployFeeManagerNoNative(auth, backend, linkAddress, nativeAddress, proxyAddress, rewardManagerAddress)
})
if err != nil {
return nil, err
}
return &EthereumMercuryFeeManagerNoNative{
client: e.client,
instance: instance.(*fee_manager_no_native.FeeManagerNoNative),
address: *address,
l: e.l,
}, err
}

func (e *EthereumContractDeployer) DeployMercuryRewardManager(linkAddress common.Address) (MercuryRewardManager, error) {
address, _, instance, err := e.client.DeployContract("Mercury Reward Manager", func(
auth *bind.TransactOpts,
Expand Down
20 changes: 19 additions & 1 deletion integration-tests/contracts/contract_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrf_coordinator_v2"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrf_load_test_with_metrics"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/fee_manager"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/fee_manager_no_native"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/reward_manager"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/verifier"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/verifier_proxy"
Expand Down Expand Up @@ -310,7 +311,7 @@ func (e *EthereumContractLoader) LoadMercuryVerifierProxy(addr common.Address) (
}

func (e *EthereumContractLoader) LoadMercuryFeeManager(addr common.Address) (MercuryFeeManager, error) {
instance, err := e.client.LoadContract("Mercury Fee Manager", addr, func(
instance, err := e.client.LoadContract("Mercury FeeManager", addr, func(
address common.Address,
backend bind.ContractBackend,
) (interface{}, error) {
Expand All @@ -326,6 +327,23 @@ func (e *EthereumContractLoader) LoadMercuryFeeManager(addr common.Address) (Mer
}, err
}

func (e *EthereumContractLoader) LoadMercuryFeeManagerNoNative(addr common.Address) (MercuryFeeManager, error) {
instance, err := e.client.LoadContract("Mercury FeeManagerNoNative", addr, func(
address common.Address,
backend bind.ContractBackend,
) (interface{}, error) {
return fee_manager_no_native.NewFeeManagerNoNative(address, backend)
})
if err != nil {
return nil, err
}
return &EthereumMercuryFeeManagerNoNative{
client: e.client,
instance: instance.(*fee_manager_no_native.FeeManagerNoNative),
address: addr,
}, err
}

func (e *EthereumContractLoader) LoadMercuryRewardManager(addr common.Address) (MercuryRewardManager, error) {
instance, err := e.client.LoadContract("Mercury Reward Manager", addr, func(
address common.Address,
Expand Down
25 changes: 25 additions & 0 deletions integration-tests/contracts/ethereum_contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/oracle_wrapper"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/test_api_consumer_wrapper"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/fee_manager"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/fee_manager_no_native"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/reward_manager"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/verifier"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/llo-feeds/generated/verifier_proxy"
Expand Down Expand Up @@ -2421,6 +2422,30 @@ func (e *EthereumMercuryFeeManager) UpdateSubscriberDiscount(subscriber common.A
return tx, e.client.ProcessTransaction(tx)
}

type EthereumMercuryFeeManagerNoNative struct {
address common.Address
client blockchain.EVMClient
instance *fee_manager_no_native.FeeManagerNoNative
l zerolog.Logger
}

func (e *EthereumMercuryFeeManagerNoNative) Address() common.Address {
return e.address
}

func (e *EthereumMercuryFeeManagerNoNative) UpdateSubscriberDiscount(subscriber common.Address, feedId [32]byte, token common.Address, discount uint64) (*types.Transaction, error) {
opts, err := e.client.TransactionOpts(e.client.GetDefaultWallet())
if err != nil {
return nil, err
}
tx, err := e.instance.UpdateSubscriberDiscount(opts, subscriber, feedId, token, discount)
e.l.Info().Err(err).Msg("Called EthereumMercuryFeeManagerNoNative.UpdateSubscriberDiscount()")
if err != nil {
return nil, err
}
return tx, e.client.ProcessTransaction(tx)
}

type EthereumMercuryRewardManager struct {
address common.Address
client blockchain.EVMClient
Expand Down

0 comments on commit 05044cc

Please sign in to comment.