cloud_functions: Added Aptos and Xpla support
This commit is contained in:
parent
6b4de5be9d
commit
84507c0a04
|
@ -78,6 +78,7 @@ func fetchCoinGeckoCoins() map[string][]CoinGeckoCoin {
|
||||||
}
|
}
|
||||||
|
|
||||||
func chainIdToCoinGeckoPlatform(chain vaa.ChainID) string {
|
func chainIdToCoinGeckoPlatform(chain vaa.ChainID) string {
|
||||||
|
// used when symbol not found in cg's coins/list
|
||||||
switch chain {
|
switch chain {
|
||||||
case vaa.ChainIDSolana:
|
case vaa.ChainIDSolana:
|
||||||
return "solana"
|
return "solana"
|
||||||
|
@ -113,6 +114,10 @@ func chainIdToCoinGeckoPlatform(chain vaa.ChainID) string {
|
||||||
return "moonbeam"
|
return "moonbeam"
|
||||||
case vaa.ChainIDTerra2:
|
case vaa.ChainIDTerra2:
|
||||||
return "" // TODO
|
return "" // TODO
|
||||||
|
case vaa.ChainIDAptos:
|
||||||
|
return "" // TODO: not currently supported
|
||||||
|
case vaa.ChainIDXpla:
|
||||||
|
return "" // TODO: not currently supported
|
||||||
case vaa.ChainIDEthereumRopsten:
|
case vaa.ChainIDEthereumRopsten:
|
||||||
return "ethereum"
|
return "ethereum"
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ require (
|
||||||
github.com/cosmos/cosmos-sdk v0.44.5
|
github.com/cosmos/cosmos-sdk v0.44.5
|
||||||
github.com/gagliardetto/solana-go v1.0.2
|
github.com/gagliardetto/solana-go v1.0.2
|
||||||
github.com/holiman/uint256 v1.2.0
|
github.com/holiman/uint256 v1.2.0
|
||||||
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20220927161925-37ee5cf4a476
|
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20221018051913-c289bd9f57e0
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
|
replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
|
||||||
|
|
|
@ -1475,6 +1475,8 @@ github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee/go.mod h1:
|
||||||
github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
|
github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
|
||||||
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20220927161925-37ee5cf4a476 h1:bDWDrECFHiIArs5A0ugQnAG0tTWXDGV835smsqBXOz8=
|
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20220927161925-37ee5cf4a476 h1:bDWDrECFHiIArs5A0ugQnAG0tTWXDGV835smsqBXOz8=
|
||||||
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20220927161925-37ee5cf4a476/go.mod h1:Vg7Cbb370S+JihB+of1rWm9Aaxzf0GPPvKszPeSb7AE=
|
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20220927161925-37ee5cf4a476/go.mod h1:Vg7Cbb370S+JihB+of1rWm9Aaxzf0GPPvKszPeSb7AE=
|
||||||
|
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20221018051913-c289bd9f57e0 h1:MMBGWGmGZGVgPeshIyeoW5MjC2Sj4w58HB4SPJ4fxwY=
|
||||||
|
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20221018051913-c289bd9f57e0/go.mod h1:Vg7Cbb370S+JihB+of1rWm9Aaxzf0GPPvKszPeSb7AE=
|
||||||
github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees=
|
github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees=
|
||||||
github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=
|
github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=
|
||||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||||
|
|
|
@ -30,6 +30,8 @@ var tokenAddressExceptions = map[string]string{
|
||||||
"67499b7b8f58eaeb3cd81aea1d1ce9f7f722fd7750ceb2bed13e255073c25e2a": "token.sweat",
|
"67499b7b8f58eaeb3cd81aea1d1ce9f7f722fd7750ceb2bed13e255073c25e2a": "token.sweat",
|
||||||
// terra2
|
// terra2
|
||||||
"01fa6c6fbc36d8c245b0a852a43eb5d644e8b4c477b27bfab9537c10945939da": "uluna",
|
"01fa6c6fbc36d8c245b0a852a43eb5d644e8b4c477b27bfab9537c10945939da": "uluna",
|
||||||
|
// xpla
|
||||||
|
"017ce8aec5af3bb3ac0158d49771d4c8feba2e54a614fa2a1c0c95e9c4c37185": "axpla",
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns a pair of dates before and after the input time.
|
// returns a pair of dates before and after the input time.
|
||||||
|
@ -96,6 +98,18 @@ func transformHexAddressToNative(chain vaa.ChainID, address string) string {
|
||||||
}
|
}
|
||||||
// TODO for now use hex/wormhole address string, we'll need to do a contract query to get the native address
|
// TODO for now use hex/wormhole address string, we'll need to do a contract query to get the native address
|
||||||
return address
|
return address
|
||||||
|
case vaa.ChainIDAptos:
|
||||||
|
if val, ok := tokenAddressExceptions[address]; ok {
|
||||||
|
return val
|
||||||
|
}
|
||||||
|
// TODO for now use hex/wormhole address string, we'll need to do a contract query to get the native address
|
||||||
|
return address
|
||||||
|
case vaa.ChainIDXpla:
|
||||||
|
if val, ok := tokenAddressExceptions[address]; ok {
|
||||||
|
return val
|
||||||
|
}
|
||||||
|
// TODO for now use hex/wormhole address string, we'll need to do a contract query to get the native address
|
||||||
|
return address
|
||||||
default:
|
default:
|
||||||
log.Println("cannot process address for unknown chain: ", chain)
|
log.Println("cannot process address for unknown chain: ", chain)
|
||||||
return ""
|
return ""
|
||||||
|
|
|
@ -70,6 +70,8 @@ var tokenTransferEmitters = map[string]string{
|
||||||
"000000000000000000000000B1731c586ca89a23809861c6103F0b96B3F57D92": "0xB1731c586ca89a23809861c6103F0b96B3F57D92", // moonbeam
|
"000000000000000000000000B1731c586ca89a23809861c6103F0b96B3F57D92": "0xB1731c586ca89a23809861c6103F0b96B3F57D92", // moonbeam
|
||||||
"a463ad028fb79679cfc8ce1efba35ac0e77b35080a1abe9bebe83461f176b0a3": "terra153366q50k7t8nn7gec00hg66crnhkdggpgdtaxltaq6xrutkkz3s992fw9", // terra2
|
"a463ad028fb79679cfc8ce1efba35ac0e77b35080a1abe9bebe83461f176b0a3": "terra153366q50k7t8nn7gec00hg66crnhkdggpgdtaxltaq6xrutkkz3s992fw9", // terra2
|
||||||
"67e93fa6c8ac5c819990aa7340c0c16b508abb1178be9b30d024b8ac25193d45": "842126029", // algorand
|
"67e93fa6c8ac5c819990aa7340c0c16b508abb1178be9b30d024b8ac25193d45": "842126029", // algorand
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000001": "0x576410486a2da45eee6c949c995670112ddf2fbeedab20350d506328eefc9d4f", // aptos
|
||||||
|
"8f9cf727175353b17a5f574270e370776123d90fd74956ae4277962b4fdee24c": "xpla137w0wfch2dfmz7jl2ap8pcmswasj8kg06ay4dtjzw7tzkn77ufxqfw7acv", //xpla
|
||||||
|
|
||||||
// devnet
|
// devnet
|
||||||
"c69a1b1a65dd336bf1df6a77afb501fc25db7fc0938cb08595a9ef473265cb4f": "B6RHG3mfcckmrYN1UhmJzyS1XX3fZKbkeUcpJe9Sy3FE", // solana
|
"c69a1b1a65dd336bf1df6a77afb501fc25db7fc0938cb08595a9ef473265cb4f": "B6RHG3mfcckmrYN1UhmJzyS1XX3fZKbkeUcpJe9Sy3FE", // solana
|
||||||
|
|
|
@ -239,7 +239,7 @@ type (
|
||||||
// ChainIDs to compute TVL/stats for
|
// ChainIDs to compute TVL/stats for
|
||||||
// Useful to exclude chains we don't want to compute TVL for which can improve performance
|
// Useful to exclude chains we don't want to compute TVL for which can improve performance
|
||||||
// (notably PythNet is excluded, ChainID 26)
|
// (notably PythNet is excluded, ChainID 26)
|
||||||
var tvlChainIDs = []vaa.ChainID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18}
|
var tvlChainIDs = []vaa.ChainID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 22, 28}
|
||||||
|
|
||||||
func chainIdStringToType(chainId string) vaa.ChainID {
|
func chainIdStringToType(chainId string) vaa.ChainID {
|
||||||
switch chainId {
|
switch chainId {
|
||||||
|
@ -277,6 +277,10 @@ func chainIdStringToType(chainId string) vaa.ChainID {
|
||||||
return vaa.ChainIDMoonbeam
|
return vaa.ChainIDMoonbeam
|
||||||
case "18":
|
case "18":
|
||||||
return vaa.ChainIDTerra2
|
return vaa.ChainIDTerra2
|
||||||
|
case "22":
|
||||||
|
return vaa.ChainIDAptos
|
||||||
|
case "28":
|
||||||
|
return vaa.ChainIDXpla
|
||||||
case "10001":
|
case "10001":
|
||||||
return vaa.ChainIDEthereumRopsten
|
return vaa.ChainIDEthereumRopsten
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,5 +170,11 @@
|
||||||
},
|
},
|
||||||
"18": {
|
"18": {
|
||||||
"uluna": "terra-luna-2"
|
"uluna": "terra-luna-2"
|
||||||
|
},
|
||||||
|
"22": {
|
||||||
|
"a867703f5395cb2965feb7ebff5cdf39b771fc6156085da3ae4147a00be91b38": "aptos"
|
||||||
|
},
|
||||||
|
"28": {
|
||||||
|
"axpla": "xpla"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue