constants

package
v0.2.0-alpha-2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EthereumNetworkId = uint64(1)
	PolygonNetworkId  = uint64(137)
	FeePercentage     = int64(10000)
	MinFeeAmountInUsd = decimal.NewFromFloat(1)
	TopicId           = "0.0.1234567"

	NetworkHederaFungibleNativeToken = constants.Hbar
	NetworkHederaFungibleNativeAsset = &asset.NativeAsset{
		MinFeeAmountInUsd: &MinFeeAmountInUsd,
		ChainId:           constants.HederaNetworkId,
		Asset:             NetworkHederaFungibleNativeToken,
		FeePercentage:     FeePercentage,
	}

	NetworkHederaNFTNativeToken = "0.0.111122"

	NetworkHederaFungibleNativeTokenFungibleAssetInfo = asset.FungibleAssetInfo{
		NetworkHederaFungibleNativeToken,
		NetworkHederaFungibleNativeToken,
		constants.HederaDefaultDecimals,
	}

	NetworkHederaFungibleWrappedTokenForNetworkPolygon                  = "0.0.000033"
	NetworkHederaFungibleWrappedTokenForNetworkPolygonFungibleAssetInfo = asset.FungibleAssetInfo{
		NetworkHederaFungibleWrappedTokenForNetworkPolygon,
		NetworkHederaFungibleWrappedTokenForNetworkPolygon,
		constants.HederaDefaultDecimals,
	}

	NetworkEthereumFungibleNativeToken = "0xb083879B1e10C8476802016CB12cd2F25a896691"
	NetworkEthereumFungibleNativeAsset = &asset.NativeAsset{
		MinFeeAmountInUsd: &MinFeeAmountInUsd,
		ChainId:           EthereumNetworkId,
		Asset:             NetworkEthereumFungibleNativeToken,
		FeePercentage:     FeePercentage,
	}

	NetworkEthereumNFTWrappedTokenForNetworkHedera = "0x0000000000000000000000000000000000009999"

	NetworkEthereumFungibleNativeTokenFungibleAssetInfo = asset.FungibleAssetInfo{
		NetworkEthereumFungibleNativeToken,
		NetworkEthereumFungibleNativeToken,
		constants.EvmDefaultDecimals,
	}

	NetworkEthereumFungibleWrappedTokenForNetworkPolygon                  = "0x0000000000000000000000000000000000000133"
	NetworkEthereumFungibleWrappedTokenForNetworkPolygonFungibleAssetInfo = asset.FungibleAssetInfo{
		NetworkEthereumFungibleWrappedTokenForNetworkPolygon,
		NetworkEthereumFungibleWrappedTokenForNetworkPolygon,
		constants.EvmDefaultDecimals,
	}

	NetworkEthereumFungibleWrappedTokenForNetworkHedera                  = "0x0000000000000000000000000000000000000555"
	NetworkEthereumFungibleWrappedTokenForNetworkHederaFungibleAssetInfo = asset.FungibleAssetInfo{
		NetworkEthereumFungibleWrappedTokenForNetworkHedera,
		NetworkEthereumFungibleWrappedTokenForNetworkHedera,
		constants.EvmDefaultDecimals,
	}

	NetworkPolygonFungibleNativeToken = "0x0000000000000000000000000000000000000033"
	NetworkPolygonFungibleNativeAsset = &asset.NativeAsset{
		MinFeeAmountInUsd: &MinFeeAmountInUsd,
		ChainId:           PolygonNetworkId,
		Asset:             NetworkPolygonFungibleNativeToken,
		FeePercentage:     FeePercentage,
	}
	NetworkPolygonFungibleNativeTokenFungibleAssetInfo = asset.FungibleAssetInfo{
		NetworkPolygonFungibleNativeToken,
		NetworkPolygonFungibleNativeToken,
		constants.EvmDefaultDecimals,
	}

	NetworkPolygonFungibleWrappedTokenForNetworkHedera                  = "0x0000000000000000000000000000000000000001"
	NetworkPolygonFungibleWrappedTokenForNetworkHederaFungibleAssetInfo = asset.FungibleAssetInfo{
		NetworkPolygonFungibleWrappedTokenForNetworkHedera,
		NetworkPolygonFungibleWrappedTokenForNetworkHedera,
		constants.EvmDefaultDecimals,
	}
	NetworkPolygonFungibleWrappedTokenForNetworkEthereum                  = "0x0000000000000000000000000000000000000123"
	NetworkPolygonFungibleWrappedTokenForNetworkEthereumFungibleAssetInfo = asset.FungibleAssetInfo{
		NetworkPolygonFungibleWrappedTokenForNetworkEthereum,
		NetworkPolygonFungibleWrappedTokenForNetworkEthereum,
		constants.EvmDefaultDecimals,
	}

	Networks = map[uint64]*parser.Network{
		constants.HederaNetworkId: {
			Name:          "Hedera",
			BridgeAccount: "0.0.476139",
			PayerAccount:  "0.0.476139",
			Members:       []string{"0.0.123", "0.0.321", "0.0.231"},
			Tokens: parser.Tokens{
				Fungible: map[string]parser.Token{
					NetworkHederaFungibleNativeToken: {
						Networks: map[uint64]string{
							PolygonNetworkId:  NetworkPolygonFungibleWrappedTokenForNetworkHedera,
							EthereumNetworkId: NetworkEthereumFungibleWrappedTokenForNetworkHedera,
						},
						CoinGeckoId:       HbarCoinGeckoId,
						CoinMarketCapId:   HbarCoinMarketCapId,
						MinFeeAmountInUsd: MinFeeAmountInUsd.String(),
					},
				},
				Nft: nil,
			},
		},
		EthereumNetworkId: {
			Name: "Ethereum",
			Tokens: parser.Tokens{
				Fungible: map[string]parser.Token{
					NetworkEthereumFungibleNativeToken: {
						Networks: map[uint64]string{
							PolygonNetworkId: NetworkPolygonFungibleWrappedTokenForNetworkEthereum,
						},
						CoinGeckoId:       EthereumCoinGeckoId,
						CoinMarketCapId:   EthereumCoinMarketCapId,
						MinFeeAmountInUsd: MinFeeAmountInUsd.String(),
					},
				},
				Nft: nil,
			},
		},
		PolygonNetworkId: {
			Name: "Polygon",
			Tokens: parser.Tokens{
				Fungible: map[string]parser.Token{
					NetworkPolygonFungibleNativeToken: {
						Networks: map[uint64]string{
							constants.HederaNetworkId: NetworkHederaFungibleWrappedTokenForNetworkPolygon,
							EthereumNetworkId:         NetworkEthereumFungibleWrappedTokenForNetworkPolygon,
						},
						MinFeeAmountInUsd: MinFeeAmountInUsd.String(),
					},
				},
				Nft: nil,
			},
		},
	}

	NativeToWrapped = map[uint64]map[string]map[uint64]string{
		constants.HederaNetworkId: {
			NetworkHederaFungibleNativeToken: {
				PolygonNetworkId:  NetworkPolygonFungibleWrappedTokenForNetworkHedera,
				EthereumNetworkId: NetworkEthereumFungibleWrappedTokenForNetworkHedera,
			},
		},
		EthereumNetworkId: {
			NetworkEthereumFungibleNativeToken: {
				PolygonNetworkId: NetworkPolygonFungibleWrappedTokenForNetworkEthereum,
			},
		},
		PolygonNetworkId: {
			NetworkPolygonFungibleNativeToken: {
				constants.HederaNetworkId: NetworkHederaFungibleWrappedTokenForNetworkPolygon,
				EthereumNetworkId:         NetworkEthereumFungibleWrappedTokenForNetworkPolygon,
			},
		},
	}

	WrappedToNative = map[uint64]map[string]*asset.NativeAsset{
		constants.HederaNetworkId: {
			NetworkHederaFungibleWrappedTokenForNetworkPolygon: NetworkPolygonFungibleNativeAsset,
		},
		EthereumNetworkId: {
			NetworkEthereumFungibleWrappedTokenForNetworkPolygon: NetworkPolygonFungibleNativeAsset,
			NetworkEthereumFungibleWrappedTokenForNetworkHedera:  NetworkHederaFungibleNativeAsset,
		},
		PolygonNetworkId: {
			NetworkPolygonFungibleWrappedTokenForNetworkHedera:   NetworkHederaFungibleNativeAsset,
			NetworkPolygonFungibleWrappedTokenForNetworkEthereum: NetworkEthereumFungibleNativeAsset,
		},
	}

	FungibleNetworkAssets = map[uint64][]string{
		constants.HederaNetworkId: {NetworkHederaFungibleNativeToken, NetworkHederaFungibleWrappedTokenForNetworkPolygon},
		EthereumNetworkId:         {NetworkEthereumFungibleNativeToken, NetworkEthereumFungibleWrappedTokenForNetworkPolygon, NetworkEthereumFungibleWrappedTokenForNetworkHedera},
		PolygonNetworkId:          {NetworkPolygonFungibleNativeToken, NetworkPolygonFungibleWrappedTokenForNetworkEthereum, NetworkPolygonFungibleWrappedTokenForNetworkHedera},
	}

	FungibleNativeAssets = map[uint64]map[string]*asset.NativeAsset{
		constants.HederaNetworkId: {
			NetworkHederaFungibleNativeToken: NetworkHederaFungibleNativeAsset,
		},
		EthereumNetworkId: {
			NetworkEthereumFungibleNativeToken: NetworkEthereumFungibleNativeAsset,
		},
		PolygonNetworkId: {
			NetworkPolygonFungibleNativeToken: NetworkPolygonFungibleNativeAsset,
		},
	}

	FungibleAssetInfos = map[uint64]map[string]asset.FungibleAssetInfo{
		constants.HederaNetworkId: {
			NetworkHederaFungibleNativeToken:                   NetworkHederaFungibleNativeTokenFungibleAssetInfo,
			NetworkHederaFungibleWrappedTokenForNetworkPolygon: NetworkHederaFungibleWrappedTokenForNetworkPolygonFungibleAssetInfo,
		},
		EthereumNetworkId: {
			NetworkEthereumFungibleNativeToken:                   NetworkEthereumFungibleNativeTokenFungibleAssetInfo,
			NetworkEthereumFungibleWrappedTokenForNetworkPolygon: NetworkEthereumFungibleWrappedTokenForNetworkPolygonFungibleAssetInfo,
			NetworkEthereumFungibleWrappedTokenForNetworkHedera:  NetworkEthereumFungibleWrappedTokenForNetworkHederaFungibleAssetInfo,
		},
		PolygonNetworkId: {
			NetworkPolygonFungibleNativeToken:                    NetworkPolygonFungibleNativeTokenFungibleAssetInfo,
			NetworkPolygonFungibleWrappedTokenForNetworkHedera:   NetworkPolygonFungibleWrappedTokenForNetworkHederaFungibleAssetInfo,
			NetworkPolygonFungibleWrappedTokenForNetworkEthereum: NetworkPolygonFungibleWrappedTokenForNetworkEthereumFungibleAssetInfo,
		},
	}

	ParserBridge = parser.Bridge{
		TopicId:           TopicId,
		Networks:          Networks,
		MonitoredAccounts: make(map[string]string),
	}
)
View Source
var (
	CoinGeckoApiConfig = config.CoinGecko{
		ApiAddress: "https://api.coingecko.com/api/v3/",
	}

	SimplePriceResponse = coin_gecko.SimplePriceResponse{
		EthereumCoinGeckoId: coin_gecko.PriceResult{Usd: EthereumNativeTokenPriceInUsdFloat64},
		HbarCoinGeckoId:     coin_gecko.PriceResult{Usd: HbarNativeTokenPriceInUsdFloat64},
	}
)
View Source
var (
	CoinMarketCapApiConfig = config.CoinMarketCap{
		ApiAddress: "https://pro-api.coinmarketcap.com/v2/cryptocurrency/",
		ApiKey:     "0f56c8c8-4cde-4432-80f2-11f1623e5149",
	}

	CoinMarketCapResponse = coinMarketCapModel.CoinMarketCapResponse{
		Status: coinMarketCapModel.Status{
			ErrorCode: 0,
		},
		Data: map[string]coinMarketCapModel.TokenInfo{
			EthereumCoinMarketCapId: {
				Quote: coinMarketCapModel.Quote{
					USD: coinMarketCapModel.Usd{
						Price: EthereumNativeTokenPriceInUsdFloat64,
					},
				},
			},
			HbarCoinMarketCapId: {
				Quote: coinMarketCapModel.Quote{
					USD: coinMarketCapModel.Usd{
						Price: HbarNativeTokenPriceInUsdFloat64,
					},
				},
			},
		},
	}
)
View Source
var (
	ParsedTransactionResponse = mirrorNodeModel.TransactionsResponse{
		Transactions: []mirrorNodeModel.Transaction{
			{
				Bytes:                    nil,
				ChargedTxFee:             0,
				ConsensusTimestamp:       "1648206035.257921608",
				EntityId:                 "0.0.112",
				MaxFee:                   "200000000",
				MemoBase64:               "Y3VycmVudFJhdGUgOiAwLjIyNTksIG5leHRSYXRlIDogMC4yMjY0LCBtaWRuaWdodC1jdXJyZW50UmF0ZSA6IDAuMjIwNSBtaWRuaWdodC1uZXh0UmF0ZSA6IDAuMjIwMA==",
				Name:                     "FILEUPDATE",
				Node:                     "0.0.4",
				Nonce:                    0,
				ParentConsensusTimestamp: "",
				Result:                   "SUCCESS",
				Scheduled:                false,
				TransactionHash:          "zSMXPzZVq1czqAoNmpXjvBybW5K9RHdgGSDoBAI+nmAV/viN7tCCBp7gmbe+vuki",
				TransactionId:            "0.0.57-1648206026-390263003",
				Transfers:                make([]interface{}, 0),
				ValidDurationSeconds:     "120",
				ValidStartTimestamp:      "1648206026.390263003",
			},
		},
		Links: map[string]string{
			"next": "/api/v1/transactions?account.id=0.0.57&transactiontype=fileupdate&limit=1&timestamp=lt:1648206035.257921608",
		},
	}
	ParsedTransactionResponseCurrentRate = decimal.NewFromFloat(0.2259)
	ParsedTransactionResponseNextRate    = decimal.NewFromFloat(0.2264)
)
View Source
var (
	HbarCoinGeckoId                     = "hedera-hashgraph"
	HbarCoinMarketCapId                 = "4642"
	HbarPriceInUsd                      = decimal.NewFromFloat(0.2)
	HbarNativeTokenPriceInUsdFloat64, _ = HbarPriceInUsd.Float64()
	HbarMinAmountWithFee                = big.NewInt(5000000000)
	HbarMinAmountWithFeeInEVM, _        = big.NewInt(0).SetString("50000000000000000000", 10)

	EthereumCoinGeckoId                     = "ethereum"
	EthereumCoinMarketCapId                 = "1027"
	EthereumNativeTokenPriceInUsd           = decimal.NewFromFloat(8000.0)
	EthereumNativeTokenPriceInUsdFloat64, _ = EthereumNativeTokenPriceInUsd.Float64()
	EthereumNativeTokenMinAmountWithFee     = big.NewInt(1250000000000000)

	PolygonNativeTokenMinAmountWithFee = big.NewInt(1250000000000000)

	UsdPrices = map[uint64]map[string]decimal.Decimal{
		constants.HederaNetworkId: {
			constants.Hbar: HbarPriceInUsd,
		},
		EthereumNetworkId: {
			NetworkEthereumFungibleNativeToken: EthereumNativeTokenPriceInUsd,
		},
	}

	CoinGeckoIds = map[uint64]map[string]string{
		constants.HederaNetworkId: {
			constants.Hbar: HbarCoinGeckoId,
		},
		EthereumNetworkId: {
			NetworkEthereumFungibleNativeToken: EthereumCoinGeckoId,
		},
	}

	CoinMarketCapIds = map[uint64]map[string]string{
		constants.HederaNetworkId: {
			constants.Hbar: HbarCoinMarketCapId,
		},
		EthereumNetworkId: {
			NetworkEthereumFungibleNativeToken: EthereumCoinMarketCapId,
		},
	}

	TokenPriceInfos = map[uint64]map[string]pricing.TokenPriceInfo{
		constants.HederaNetworkId: {
			constants.Hbar: pricing.TokenPriceInfo{
				UsdPrice:         HbarPriceInUsd,
				MinAmountWithFee: HbarMinAmountWithFee,
			},
		},
		EthereumNetworkId: {
			NetworkEthereumFungibleNativeToken: pricing.TokenPriceInfo{
				UsdPrice:         EthereumNativeTokenPriceInUsd,
				MinAmountWithFee: EthereumNativeTokenMinAmountWithFee,
			},
			NetworkEthereumFungibleWrappedTokenForNetworkHedera: pricing.TokenPriceInfo{
				UsdPrice:         HbarPriceInUsd,
				MinAmountWithFee: HbarMinAmountWithFeeInEVM,
			},
		},

		PolygonNetworkId: {
			NetworkPolygonFungibleNativeToken: pricing.TokenPriceInfo{
				MinAmountWithFee: PolygonNativeTokenMinAmountWithFee,
			},
			NetworkPolygonFungibleWrappedTokenForNetworkHedera: pricing.TokenPriceInfo{
				UsdPrice:         HbarPriceInUsd,
				MinAmountWithFee: HbarMinAmountWithFeeInEVM,
			},
			NetworkPolygonFungibleWrappedTokenForNetworkEthereum: pricing.TokenPriceInfo{
				UsdPrice:         EthereumNativeTokenPriceInUsd,
				MinAmountWithFee: EthereumNativeTokenMinAmountWithFee,
			},
		},
	}

	MinAmountsForApi = map[uint64]map[string]string{
		constants.HederaNetworkId: {
			constants.Hbar: HbarMinAmountWithFee.String(),
		},
		EthereumNetworkId: {
			NetworkEthereumFungibleNativeToken:                  EthereumNativeTokenMinAmountWithFee.String(),
			NetworkEthereumFungibleWrappedTokenForNetworkHedera: HbarMinAmountWithFeeInEVM.String(),
		},
		PolygonNetworkId: {
			NetworkPolygonFungibleNativeToken:                    PolygonNativeTokenMinAmountWithFee.String(),
			NetworkPolygonFungibleWrappedTokenForNetworkEthereum: EthereumNativeTokenMinAmountWithFee.String(),
			NetworkPolygonFungibleWrappedTokenForNetworkHedera:   HbarMinAmountWithFeeInEVM.String(),
		},
	}
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL