node: governor updates for Aptos (#1740)
* node: governor updates for Aptos * Tweak governor limits for aptos
This commit is contained in:
parent
da8a972b92
commit
7d53c1814f
|
@ -124,12 +124,18 @@ func (gov *ChainGovernor) queryCoinGecko() error {
|
|||
for coinGeckoId, data := range result {
|
||||
cge, exists := gov.tokensByCoinGeckoId[coinGeckoId]
|
||||
if exists {
|
||||
price, ok := data.(map[string]interface{})["usd"].(float64)
|
||||
// If a price is not set in CoinGecko, they return an empty entry. Treat that as a zero price.
|
||||
price := float64(0)
|
||||
m := data.(map[string]interface{})
|
||||
if len(m) != 0 {
|
||||
var ok bool
|
||||
price, ok = m["usd"].(float64)
|
||||
if !ok {
|
||||
gov.logger.Error("cgov: failed to parse coin gecko response, reverting to configured price for this token", zap.String("coinGeckoId", coinGeckoId))
|
||||
// By continuing, we leave this one in the local map so the price will get reverted below.
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
for _, te := range cge {
|
||||
te.coinGeckoPrice = big.NewFloat(price)
|
||||
|
|
|
@ -27,7 +27,7 @@ func chainList() []chainConfigEntry {
|
|||
chainConfigEntry{emitterChainID: vaa.ChainIDNear, dailyLimit: 5_000_000, bigTransactionSize: 500_000},
|
||||
chainConfigEntry{emitterChainID: vaa.ChainIDTerra2, dailyLimit: 500_000, bigTransactionSize: 50_000},
|
||||
chainConfigEntry{emitterChainID: vaa.ChainIDMoonbeam, dailyLimit: 200_000, bigTransactionSize: 20_000},
|
||||
chainConfigEntry{emitterChainID: vaa.ChainIDAptos, dailyLimit: 200_000, bigTransactionSize: 20_000},
|
||||
chainConfigEntry{emitterChainID: vaa.ChainIDAptos, dailyLimit: 1_000_000, bigTransactionSize: 100_000},
|
||||
chainConfigEntry{emitterChainID: vaa.ChainIDXpla, dailyLimit: 200_000, bigTransactionSize: 20_000},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,5 +134,6 @@ func tokenList() []tokenConfigEntry {
|
|||
tokenConfigEntry{chain: 15, addr: "67499b7b8f58eaeb3cd81aea1d1ce9f7f722fd7750ceb2bed13e255073c25e2a", symbol: "SWEAT", coinGeckoId: "sweatcoin", decimals: 8, price: 0.04160976}, // *** manually added
|
||||
tokenConfigEntry{chain: 16, addr: "000000000000000000000000acc15dc74880c9944775448304b263d191c6077f", symbol: "GLMR", coinGeckoId: "moonbeam", decimals: 8, price: 0.460609}, // *** manually added
|
||||
tokenConfigEntry{chain: 18, addr: "01fa6c6fbc36d8c245b0a852a43eb5d644e8b4c477b27bfab9537c10945939da", symbol: "LUNA", coinGeckoId: "terra-luna-2", decimals: 6, price: 2.6}, // Addr: uluna, Notional: 1640
|
||||
tokenConfigEntry{chain: 22, addr: "a867703f5395cb2965feb7ebff5cdf39b771fc6156085da3ae4147a00be91b38", symbol: "APTOS", coinGeckoId: "aptos", decimals: 8, price: 0.0}, // *** manually added
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,22 +14,7 @@ func TestTokenListSize(t *testing.T) {
|
|||
|
||||
/* Assuming that governed tokens will need to be updated every time
|
||||
we regenerate it */
|
||||
assert.Equal(t, 128, len(tokenConfigEntries))
|
||||
}
|
||||
|
||||
func TestTokenListFloor(t *testing.T) {
|
||||
tokenConfigEntries := tokenList()
|
||||
|
||||
/* Assume that we will never have a floor price of zero,
|
||||
otherwise this would disable the value of the notional
|
||||
value limit for the token */
|
||||
for _, tokenConfigEntry := range tokenConfigEntries {
|
||||
testLabel := vaa.ChainID(tokenConfigEntry.chain).String() + ":" + tokenConfigEntry.symbol
|
||||
t.Run(testLabel, func(t *testing.T) {
|
||||
assert.Greater(t, tokenConfigEntry.price, float64(0))
|
||||
})
|
||||
}
|
||||
|
||||
assert.Equal(t, 129, len(tokenConfigEntries))
|
||||
}
|
||||
|
||||
func TestTokenListAddressSize(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue