Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Hooks = figure.Hooks{ "tokenmanager.NetworkType": figure.BaseHooks["int32"], "chains.SwapContractVersion": func(value interface{}) (reflect.Value, error) { supported := []string{ string(SwapContractVersionTraderJoe), string(SwapContractVersionQuickSwap), string(SwapContractVersionPancakeSwap), string(SwapContractVersionUniswapV3), } result, err := cast.ToStringE(value) if err != nil { return reflect.Value{}, errors.Wrap(err, "failed to parse string") } if !slices.Contains(supported, result) { return reflect.Value{}, fmt.Errorf("supported values are: %v", supported) } return reflect.ValueOf(SwapContractVersion(result)), nil }, "chains.Kind": func(value interface{}) (reflect.Value, error) { supported := []string{ string(KindTestnet), string(KindMainnet), } result, err := cast.ToStringE(value) if err != nil { return reflect.Value{}, errors.Wrap(err, "failed to parse string") } if !slices.Contains(supported, result) { return reflect.Value{}, fmt.Errorf("supported values are: %v", supported) } return reflect.ValueOf(Kind(result)), nil }, "chains.TokensInfo": func(value interface{}) (reflect.Value, error) { cfgMap, err := cast.ToStringMapE(value) if err != nil { return reflect.Value{}, errors.Wrap(err, "failed to parse map[string]interface{}") } var cfg TokensInfo err = figure. Out(&cfg). With(figure.BaseHooks, tokenHooks). From(cfgMap). Please() if err != nil { return reflect.Value{}, errors.Wrap(err, "failed to figure out chain tokens") } return reflect.ValueOf(cfg), nil }, } )
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain struct { ID int64 `fig:"id,required"` Name string `fig:"name,required"` RPCUrl *url.URL `fig:"rpc_url,required"` // use this for actual rpc calls RPCUrlClient *url.URL `fig:"rpc_url_client,required"` // use this url for rendering responses etc NativeSymbol string `fig:"native_symbol,required"` ExplorerURL string `fig:"explorer_url,required"` Type tokenmanager.NetworkType `fig:"type,required"` Kind Kind `fig:"kind,required"` IconURL string `fig:"icon_url,required"` SwapContractAddr common.Address `fig:"swap_contract_address,required"` SwapContractVersion SwapContractVersion `fig:"swap_contract_version,required"` MultiBalanceGetterContractAddr common.Address `fig:"balance_multigetter_addr,required"` TokensInfo TokensInfo `fig:"tokens_info"` BalanceProvider EthMultiAmounter `fig:"-"` }
type Config ¶
type Config struct {
Chains []Chain `fig:"list,required"`
}
func (Config) FindByName ¶
type EthMultiAmounter ¶
type SwapContractVersion ¶
type SwapContractVersion string
const ( SwapContractVersionTraderJoe SwapContractVersion = "TraderJoe" SwapContractVersionQuickSwap SwapContractVersion = "QuickSwap" SwapContractVersionPancakeSwap SwapContractVersion = "PancakeSwap" SwapContractVersionUniswapV3 SwapContractVersion = "UniswapV3" )
type TokensInfo ¶
Click to show internal directories.
Click to hide internal directories.