Skip to content

Commit

Permalink
feat: add more rate connector to velo
Browse files Browse the repository at this point in the history
  • Loading branch information
Majorfi committed Oct 19, 2023
1 parent b9ad218 commit de16a37
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 3 deletions.
4 changes: 2 additions & 2 deletions processes/prices/fetcher.aero.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var AERO_SUGAR_ORACLE_ADDRESS = common.HexToAddress(`0xB98fB4C9C99dE155cCbF5A14a
var BASE_WETH_ADDRESS = common.HexToAddress(`0x4200000000000000000000000000000000000006`)
var BASE_USDC_ADDRESS = common.HexToAddress(`0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`)

var RATE_CONNECTORS = []common.Address{
var BASE_RATE_CONNECTORS = []common.Address{
common.HexToAddress(`0xbf1aea8670d2528e08334083616dd9c5f3b087ae`),
common.HexToAddress(`0xe3b53af74a4bf62ae5511055290838050bf764df`),
common.HexToAddress(`0xf544251d25f3d243a36b07e7e7962a678f952691`),
Expand Down Expand Up @@ -82,7 +82,7 @@ func fetchPricesFromAeroSugar(chainID uint64, blockNumber *uint64, tokens []comm

for _, pair := range allSugar {
ratesConnector := []common.Address{pair.Token0, pair.Token1}
ratesConnector = append(ratesConnector, RATE_CONNECTORS...)
ratesConnector = append(ratesConnector, BASE_RATE_CONNECTORS...)
calls := []ethereum.Call{}
calls = append(calls, multicalls.GetManyRatesWithConnectors(AERO_SUGAR_ORACLE_ADDRESS.Hex(), AERO_SUGAR_ORACLE_ADDRESS, 2, ratesConnector))
calls = append(calls, multicalls.GetDecimals(pair.Token0.Hex(), pair.Token0))
Expand Down
64 changes: 63 additions & 1 deletion processes/prices/fetcher.velo.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,67 @@ var VELO_SUGAR_ORACLE_ADDRESS = common.HexToAddress(`0x395942c2049604a314d39f370
var OPT_WETH_ADDRESS = common.HexToAddress(`0x4200000000000000000000000000000000000006`)
var OPT_OP_ADDRESS = common.HexToAddress(`0x4200000000000000000000000000000000000042`)
var OPT_USDC_ADDRESS = common.HexToAddress(`0x7F5c764cBc14f9669B88837ca1490cCa17c31607`)
var OPT_RATE_CONNECTORS = []common.Address{
common.HexToAddress(`0x9560e827af36c94d2ac33a39bce1fe78631088db`),
common.HexToAddress(`0x46f21fda29f1339e0ab543763ff683d399e393ec`),
common.HexToAddress(`0x3417e54a51924c225330f8770514ad5560b9098d`),
common.HexToAddress(`0x7f5c764cbc14f9669b88837ca1490cca17c31607`),
common.HexToAddress(`0x7ae97042a4a0eb4d1eb370c34bfec71042a056b7`),
common.HexToAddress(`0x4200000000000000000000000000000000000006`),
common.HexToAddress(`0x3e29d3a9316dab217754d13b28646b76607c5f04`),
common.HexToAddress(`0x6806411765af15bddd26f8f544a34cc40cb9838b`),
common.HexToAddress(`0x1f32b1c2345538c0c6f582fcb022739c4a194ebb`),
common.HexToAddress(`0xfdb794692724153d1488ccdbe0c56c252596735f`),
common.HexToAddress(`0x340fe1d898eccaad394e2ba0fc1f93d27c7b717a`),
common.HexToAddress(`0xc40f949f8a4e094d1b49a23ea9241d289b7b2819`),
common.HexToAddress(`0xda10009cbd5d07dd0cecc66161fc93d7c9000da1`),
common.HexToAddress(`0xc5b001dc33727f8f26880b184090d3e252470d45`),
common.HexToAddress(`0xdfa46478f9e5ea86d57387849598dbfb2e964b02`),
common.HexToAddress(`0x10010078a54396f62c96df8532dc2b4847d47ed3`),
common.HexToAddress(`0x4200000000000000000000000000000000000042`),
common.HexToAddress(`0x9485aca5bbbe1667ad97c7fe7c4531a624c8b1ed`),
common.HexToAddress(`0xca0e54b636db823847b29f506bffee743f57729d`),
common.HexToAddress(`0xcb8fa9a76b8e203d8c3797bf438d8fb81ea3326a`),
common.HexToAddress(`0x2e3d870790dc77a83dd1d18184acc7439a53f475`),
common.HexToAddress(`0x73cb180bf0521828d8849bc8cf2b920918e23032`),
common.HexToAddress(`0x50c5725949a6f0c72e6c4a641f24049a917db0cb`),
common.HexToAddress(`0xb153fb3d196a8eb25522705560ac152eeec57901`),
common.HexToAddress(`0x8ae125e8653821e851f12a49f7765db9a9ce7384`),
common.HexToAddress(`0x4e720dd3ac5cfe1e1fbde4935f386bb1c66f4642`),
common.HexToAddress(`0x94b008aa00579c1307b0ef2c499ad98a8ce58e58`),
common.HexToAddress(`0x39fde572a18448f8139b7788099f0a0740f51205`),
common.HexToAddress(`0x970d50d09f3a656b43e11b0d45241a84e3a6e011`),
common.HexToAddress(`0x920cf626a271321c151d027030d5d08af699456b`),
common.HexToAddress(`0x8700daec35af8ff88c16bdf0418774cb3d7599b4`),
common.HexToAddress(`0x1db2466d9f5e10d7090e7152b68d62703a2245f0`),
common.HexToAddress(`0x1610e3c85dd44af31ed7f33a63642012dca0c5a5`),
common.HexToAddress(`0x9e5aac1ba1a2e6aed6b32689dfcf62a509ca96f3`),
common.HexToAddress(`0xbfd291da8a403daaf7e5e9dc1ec0aceacd4848b9`),
common.HexToAddress(`0xb0b195aefa3650a6908f15cdac7d92f8a5791b0b`),
common.HexToAddress(`0x9bcef72be871e61ed4fbbc7630889bee758eb81d`),
common.HexToAddress(`0x375488f097176507e39b9653b88fdc52cde736bf`),
common.HexToAddress(`0x9e1028f5f1d5ede59748ffcee5532509976840e0`),
common.HexToAddress(`0x79af5dd14e855823fa3e9ecacdf001d99647d043`),
common.HexToAddress(`0x9560e827af36c94d2ac33a39bce1fe78631088db`),
common.HexToAddress(`0x4200000000000000000000000000000000000042`),
common.HexToAddress(`0x4200000000000000000000000000000000000006`),
common.HexToAddress(`0x9bcef72be871e61ed4fbbc7630889bee758eb81d`),
common.HexToAddress(`0x2e3d870790dc77a83dd1d18184acc7439a53f475`),
common.HexToAddress(`0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9`),
common.HexToAddress(`0x1f32b1c2345538c0c6f582fcb022739c4a194ebb`),
common.HexToAddress(`0xbfd291da8a403daaf7e5e9dc1ec0aceacd4848b9`),
common.HexToAddress(`0xc3864f98f2a61a7caeb95b039d031b4e2f55e0e9`),
common.HexToAddress(`0x9485aca5bbbe1667ad97c7fe7c4531a624c8b1ed`),
common.HexToAddress(`0xda10009cbd5d07dd0cecc66161fc93d7c9000da1`),
common.HexToAddress(`0x73cb180bf0521828d8849bc8cf2b920918e23032`),
common.HexToAddress(`0x6806411765af15bddd26f8f544a34cc40cb9838b`),
common.HexToAddress(`0x6c2f7b6110a37b3b0fbdd811876be368df02e8b0`),
common.HexToAddress(`0xc5b001dc33727f8f26880b184090d3e252470d45`),
common.HexToAddress(`0x6c84a8f1c29108f47a79964b5fe888d4f4d0de40`),
common.HexToAddress(`0xc40f949f8a4e094d1b49a23ea9241d289b7b2819`),
common.HexToAddress(`0x94b008aa00579c1307b0ef2c499ad98a8ce58e58`),
common.HexToAddress(`0x7f5c764cbc14f9669b88837ca1490cca17c31607`),
}

func fetchVelo(url string) []TVeloPairData {
resp, err := http.Get(url)
Expand Down Expand Up @@ -106,7 +167,8 @@ func fetchPricesFromSugar(chainID uint64, blockNumber *uint64, tokens []common.A
allSugar, _ := sugar.All(nil, big.NewInt(1000), big.NewInt(0), common.Address{})

for _, pair := range allSugar {
ratesConnector := []common.Address{pair.Token0, pair.Token1, OPT_WETH_ADDRESS, OPT_OP_ADDRESS, OPT_USDC_ADDRESS}
ratesConnector := []common.Address{pair.Token0, pair.Token1}
ratesConnector = append(ratesConnector, OPT_RATE_CONNECTORS...)
calls := []ethereum.Call{}
calls = append(calls, multicalls.GetManyRatesWithConnectors(VELO_SUGAR_ORACLE_ADDRESS.Hex(), VELO_SUGAR_ORACLE_ADDRESS, 2, ratesConnector))
calls = append(calls, multicalls.GetDecimals(pair.Token0.Hex(), pair.Token0))
Expand Down

0 comments on commit de16a37

Please sign in to comment.