github.com/ethersphere/bee/v2@v2.2.0/pkg/settlement/swap/priceoracle/mock/priceoracle.go (about) 1 // Copyright 2021 The Swarm Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package mock 6 7 import ( 8 "context" 9 "math/big" 10 11 "github.com/ethereum/go-ethereum/common" 12 ) 13 14 type Service struct { 15 rate *big.Int 16 deduct *big.Int 17 } 18 19 func New(rate, deduct *big.Int) Service { 20 return Service{ 21 rate: rate, 22 deduct: deduct, 23 } 24 } 25 26 func (s Service) Start() { 27 } 28 29 func (s Service) GetPrice(ctx context.Context) (*big.Int, *big.Int, error) { 30 return s.rate, s.deduct, nil 31 } 32 33 func (s Service) CurrentRates() (exchangeRate, deduction *big.Int, err error) { 34 return s.rate, s.deduct, nil 35 } 36 37 func (s Service) Close() error { 38 return nil 39 } 40 41 func DiscoverPriceOracleAddress(chainID int64) (priceOracleAddress common.Address, found bool) { 42 return common.Address{}, false 43 } 44 45 func (s *Service) SetValues(rate, deduct *big.Int) { 46 s.rate = rate 47 s.deduct = deduct 48 }