Skip to content

Commit

Permalink
chore: run pre-commit run --all-files
Browse files Browse the repository at this point in the history
  • Loading branch information
gosuto-inzasheru committed Apr 2, 2024
1 parent 47f4a40 commit d0796f1
Show file tree
Hide file tree
Showing 58 changed files with 407 additions and 400 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ Use more exceptions

# 0.4.1
Support Sepolia
TODO:
move constant maps to jsons so they fresh versions can be pulled from main without a version upgrade
TODO:
move constant maps to jsons so they fresh versions can be pulled from main without a version upgrade
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ init:
pip install -r bal_addresses/requirements.txt
pip install -r bal_addresses/requirements-dev.txt
ci:
pytest
pytest
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This repo is setup to make it easy to find up to date addresses at balancer.
## Outputs - structured data
The [outputs](./outputs) directory has a number of different address books that you can use in code or with your eyeballs.

### [chain].json Files
### [chain].json Files
Have keys of deployment/contract as well as some other extra stuff all with / notation. It includes multisigs and signers known to the maxis as well as other addresses we have touched sorted by protocol.

### addressbook.json
Expand All @@ -27,7 +27,7 @@ Then you can do this with the flatbook:
'0xfADa0f4547AB2de89D1304A668C39B3E09Aa7c76'
>>> a.flatbook["multisigs/lm"]
'0xc38c5f97B34E175FFd35407fc91a937300E33860'
>>>
>>>
```

This with the reversebook:
Expand Down Expand Up @@ -79,10 +79,10 @@ There is also search and lookup commands
'0xBA12222222228d8Ba445958a75a0704d566BF2C8'
>>> a.reversebook[a.latest_contract("ComposableStablePoolFactory")]
'20230320-composable-stable-pool-v4/ComposableStablePoolFactory'
>>>
>>>
```
Most of the other functions are used by a github action which regenerates files read in by those 2 functions on a weekly basis. You can explore them if you would like.
Most of the other functions are used by a github action which regenerates files read in by those 2 functions on a weekly basis. You can explore them if you would like.

## Using deployments:
`.deployments` attribute is an object that is lazy loaded on first access.
Expand Down
2 changes: 1 addition & 1 deletion bal_addresses/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.idea/
venv/
__pycache__/
__pycache__/
8 changes: 7 additions & 1 deletion bal_addresses/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
from .addresses import AddrBook, GITHUB_DEPLOYMENTS_RAW, GITHUB_DEPLOYMENTS_NICE, GITHUB_RAW_OUTPUTS, GITHUB_RAW_EXTRAS
from .addresses import (
AddrBook,
GITHUB_DEPLOYMENTS_RAW,
GITHUB_DEPLOYMENTS_NICE,
GITHUB_RAW_OUTPUTS,
GITHUB_RAW_EXTRAS,
)
from .permissions import BalPermissions
from .errors import MultipleMatchesError, NoResultError
4 changes: 2 additions & 2 deletions bal_addresses/errors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

class MultipleMatchesError(Exception):
pass


class NoResultError(Exception):
pass
pass
38 changes: 23 additions & 15 deletions bal_addresses/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
class BalPermissions:
def __init__(self, chain):
self.chain = chain
self.active_permissions_by_action_id = requests.get(f"{GITHUB_RAW_OUTPUTS}/permissions/active/{chain}.json").json()
self.action_ids_by_contract_by_deployment = requests.get(f"{GITHUB_DEPLOYMENTS_RAW}/action-ids/{chain}/action-ids.json").json()
self.active_permissions_by_action_id = requests.get(
f"{GITHUB_RAW_OUTPUTS}/permissions/active/{chain}.json"
).json()
self.action_ids_by_contract_by_deployment = requests.get(
f"{GITHUB_DEPLOYMENTS_RAW}/action-ids/{chain}/action-ids.json"
).json()

# Define
self.paths_by_action_id = defaultdict(set)
Expand All @@ -23,7 +27,9 @@ def __init__(self, chain):
for contract, contract_data in contracts.items():
for fx, action_id in contract_data["actionIds"].items():
path = f"{deployment}/{contract}/{fx}"
assert path not in self.action_id_by_path.values(), f"{path} shows up twice?"
assert (
path not in self.action_id_by_path.values()
), f"{path} shows up twice?"
self.action_id_by_path[path] = action_id
self.deployments_by_fx[fx].add(deployment)
self.contracts_by_fx[fx].add(contract)
Expand All @@ -35,30 +41,35 @@ def search_path(self, substr) -> list[str]:
results = [path for path in search if path in self.action_id_by_path]
return results

def search_many_paths_by_unique_deployment(self, deployment_substr, fx_substr) -> list[dict[str, str]]:
def search_many_paths_by_unique_deployment(
self, deployment_substr, fx_substr
) -> list[dict[str, str]]:
a = AddrBook(self.chain)
results = []
deployment = a.search_unique_deployment(deployment_substr)
deployment_fxs = self.search_path(deployment.deployment)
search = [s for s in deployment_fxs if fx_substr in s]
for r in search:
result = Munch.fromDict({
"path": r,
"action_id": self.action_id_by_path[r]
})
result = Munch.fromDict({"path": r, "action_id": self.action_id_by_path[r]})
results.append(result)
return Munch.fromDict(results)

def search_unique_path_by_unique_deployment(self, deployment_substr, fx_substr) -> dict[str, str]:
results = self.search_many_paths_by_unique_deployment(deployment_substr, fx_substr)
def search_unique_path_by_unique_deployment(
self, deployment_substr, fx_substr
) -> dict[str, str]:
results = self.search_many_paths_by_unique_deployment(
deployment_substr, fx_substr
)
if len(results) > 1:
raise MultipleMatchesError(f"{fx_substr} Multiple matches found: {results}")
if len(results) < 1:
raise NoResultError(f"{fx_substr}")
return results[0]

def needs_authorizer(self, contract, deployment) -> bool:
return self.action_ids_by_contract_by_deployment[deployment][contract]["useAdaptor"]
return self.action_ids_by_contract_by_deployment[deployment][contract][
"useAdaptor"
]

def allowed_addresses(self, action_id) -> list[str]:
try:
Expand All @@ -72,8 +83,5 @@ def allowed_caller_names(self, action_id) -> list[str]:
addresslist = self.active_permissions_by_action_id[action_id]
except KeyError:
raise NoResultError(f"{action_id} has no authorized callers")
names = [a.flatbook.get(item, 'undef') for item in addresslist]
names = [a.flatbook.get(item, "undef") for item in addresslist]
return names



4 changes: 3 additions & 1 deletion config/core_pools_blacklist.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"mainnet": { "0xxxx": "BLACKLIST-ME" },
"mainnet": {
"0xxxx": "BLACKLIST-ME"
},
"polygon": {},
"zkevm": {},
"arbitrum": {},
Expand Down
118 changes: 59 additions & 59 deletions extras/arbitrum.json
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
{
"zero": {
"zero": "0x0000000000000000000000000000000000000000"
},
"tokens": {
"BADGER": "0xBfa641051Ba0a0Ad1b0AcF549a89536A0D76472E",
"WBTC": "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f",
"USDC": "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8",
"CRV": "0x11cdb42b0eb46d95f990bedd4695a6e3fa034978",
"SUSHI": "0xd4d42f0b6def4ce0383636770ef773390d85c61a",
"renBTC": "0xdbf31df14b66535af65aac99c32e9ea844e14501",
"WETH": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
"USDT": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"LDO": "0x13Ad51ed4F1B7e9Dc168d8a00cB3f4dDD85EfA60"
},
"across": {
"spoke_pool": "0xB88690461dDbaB6f04Dfad7df66B7725942FEb9C"
},
"chainlink": {
"keeper_registry": "0x75c0530885F385721fddA23C539AF3701d6183D4",
"keeper_registrar": "0x4F3AF332A30973106Fe146Af0B4220bBBeA748eC"
},
"sushi": {
"router": "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506"
},
"swapr": {
"router": "0x530476d5583724A89c8841eB6Da76E7Af4C0F17E"
},
"arbitrum": {
"node": "0x00000000000000000000000000000000000000C8",
"gateway_router": "0x5288c571Fd7aD117beA99bF60FE0846C4E84F933"
},
"maxiKeepers": {
"gaugeRewardsInjectors": {
"arb_rewards_injector": "0xF23d8342881eDECcED51EA694AC21C2B68440929",
"fox_rewards_injector": "0xc085bD4cEd17015eAe366a6d1Cd095a2F6fD0B6D"
},
"one_inch": {
"settlement": "0xad3b67bca8935cb510c8d18bd45f0b94f54a968f"
},
"mimic": {
"smartvault": "0x94Dd9C6152a2A0BBcB52d3297b723A6F01D5F9f7",
"claimer": "0xdF818E63341767d5F5A9827088f1892e9C604A2D",
"bptSwapper": "0x6030331C9225Ee5ae3F3D08FBD19e8bF053dF498",
"oneinchSwapper": "0xd712A863766dE7e7cA13289A97997E01832A6571",
"paraswapSwapper": "0x95676AaEcD59B19C5B79008F86d3A291628b0947"
}
},
"maxiVestingContracts": {
"factory": "0x7BBAc709a9535464690A435ca7361256496f13Ce",
"Tritium": "0x2b03b15E4A26D858DD594649988255eCEb832787",
"shak": "0x3e7EC248fd5BE044C0efcE9fAA778AC374350efc",
"Xeonus": "0xCE49aeFDDdDBa966cd69e6A4670f4F795F577264",
"zekraken": "0x5C8260f4eB66eC847018BBC5f68694864eF094Fe",
"Zen Dragon": "0x2466f62D52005AaB7A8F637CC3152361D4CC210c",
"Mike B": "0x81DE849AdB5883d089cdFd66bB399b4Af74a16bb",
"Danko": "0x2304488F0eddF15227C21b021739448B51E791C0",
"Dubstard": "0x01B894622C7aa890d758C8a0E8156480F0Fa5f6C",
"gosuto": "0xd411b886e96291b089273a5835D2BE4406700352"
}
"zero": {
"zero": "0x0000000000000000000000000000000000000000"
},
"tokens": {
"BADGER": "0xBfa641051Ba0a0Ad1b0AcF549a89536A0D76472E",
"WBTC": "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f",
"USDC": "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8",
"CRV": "0x11cdb42b0eb46d95f990bedd4695a6e3fa034978",
"SUSHI": "0xd4d42f0b6def4ce0383636770ef773390d85c61a",
"renBTC": "0xdbf31df14b66535af65aac99c32e9ea844e14501",
"WETH": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
"USDT": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"LDO": "0x13Ad51ed4F1B7e9Dc168d8a00cB3f4dDD85EfA60"
},
"across": {
"spoke_pool": "0xB88690461dDbaB6f04Dfad7df66B7725942FEb9C"
},
"chainlink": {
"keeper_registry": "0x75c0530885F385721fddA23C539AF3701d6183D4",
"keeper_registrar": "0x4F3AF332A30973106Fe146Af0B4220bBBeA748eC"
},
"sushi": {
"router": "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506"
},
"swapr": {
"router": "0x530476d5583724A89c8841eB6Da76E7Af4C0F17E"
},
"arbitrum": {
"node": "0x00000000000000000000000000000000000000C8",
"gateway_router": "0x5288c571Fd7aD117beA99bF60FE0846C4E84F933"
},
"maxiKeepers": {
"gaugeRewardsInjectors": {
"arb_rewards_injector": "0xF23d8342881eDECcED51EA694AC21C2B68440929",
"fox_rewards_injector": "0xc085bD4cEd17015eAe366a6d1Cd095a2F6fD0B6D"
},
"one_inch": {
"settlement": "0xad3b67bca8935cb510c8d18bd45f0b94f54a968f"
},
"mimic": {
"smartvault": "0x94Dd9C6152a2A0BBcB52d3297b723A6F01D5F9f7",
"claimer": "0xdF818E63341767d5F5A9827088f1892e9C604A2D",
"bptSwapper": "0x6030331C9225Ee5ae3F3D08FBD19e8bF053dF498",
"oneinchSwapper": "0xd712A863766dE7e7cA13289A97997E01832A6571",
"paraswapSwapper": "0x95676AaEcD59B19C5B79008F86d3A291628b0947"
}
},
"maxiVestingContracts": {
"factory": "0x7BBAc709a9535464690A435ca7361256496f13Ce",
"Tritium": "0x2b03b15E4A26D858DD594649988255eCEb832787",
"shak": "0x3e7EC248fd5BE044C0efcE9fAA778AC374350efc",
"Xeonus": "0xCE49aeFDDdDBa966cd69e6A4670f4F795F577264",
"zekraken": "0x5C8260f4eB66eC847018BBC5f68694864eF094Fe",
"Zen Dragon": "0x2466f62D52005AaB7A8F637CC3152361D4CC210c",
"Mike B": "0x81DE849AdB5883d089cdFd66bB399b4Af74a16bb",
"Danko": "0x2304488F0eddF15227C21b021739448B51E791C0",
"Dubstard": "0x01B894622C7aa890d758C8a0E8156480F0Fa5f6C",
"gosuto": "0xd411b886e96291b089273a5835D2BE4406700352"
}
}
7 changes: 3 additions & 4 deletions extras/avalanche.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"ankr": "0x10087761Ebd0Da939d2123A0B18D69F11f5Ea67f"
}
},
"mimic": {
"smartVaultV2": "0x9e5D6427D2cdaDC68870197b099C2Df535Ec3c97"
"mimic": {
"smartVaultV2": "0x9e5D6427D2cdaDC68870197b099C2Df535Ec3c97"
}

}
}
10 changes: 4 additions & 6 deletions extras/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
"maxiKeepers": {
"gasStation": "0x34a265e1EBCb31586293eb2D2f94c6ff2f920340",
"gaugeRewardsInjectors": {
"usdc": "0xA6E7840Fc8193cFeBDdf177fa410038E5DD08f7A",
"gold": "0x79D0F97D4D8c1Dd30b1Ea09746dB8847036AD92d"
"usdc": "0xA6E7840Fc8193cFeBDdf177fa410038E5DD08f7A",
"gold": "0x79D0F97D4D8c1Dd30b1Ea09746dB8847036AD92d"
}
},
"mimic": {
"smartVaultV2": "0x9e5D6427D2cdaDC68870197b099C2Df535Ec3c97"
"mimic": {
"smartVaultV2": "0x9e5D6427D2cdaDC68870197b099C2Df535Ec3c97"
}

}

2 changes: 1 addition & 1 deletion extras/func_desc_by_name.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"add_gauge(address,int128)": "Add a gauge to veBAL, allowing it to be voted on to receive BAL emissions.",
"mint(address,uint256)": "Mint BAL tokens up to the current max supply as defined by the [emissions schedule.](https://docs.balancer.fi/concepts/governance/bal-token.html#supply-inflation-schedule)",
"addZKSyncGauge(address)": "Adds a gauge to veBAL so it can be voted on to receive BAL emissions.",
"addGnosisGauge(address)":"Adds a gauge to veBAL so it can be voted on to receive BAL emissions.",
"addGnosisGauge(address)": "Adds a gauge to veBAL so it can be voted on to receive BAL emissions.",
"add_reward(address,address)": "Enables a reward token for direct incentives on a gauge.",
"renameProtocolId(uint256,string)": "Rename a protocolId in the linear pool protocol registry.",
"registerProtocolId(uint256,string)": "Registers a protocol in the linear pool protocol registry."
Expand Down
2 changes: 1 addition & 1 deletion extras/gauges.json
Original file line number Diff line number Diff line change
Expand Up @@ -477,4 +477,4 @@
"50WETH-50GOLD-gauge-e2f2": "0xe2f2aed19fa245aff66342c2b849be6f411fb28f",
" 50tBTC-50USD-gauge-ef97": "0xef97b54f69060f4d5304f79734d01c2da12114d8"
}
}
}
30 changes: 15 additions & 15 deletions extras/gnosis.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"zero": {
"zero": "0x0000000000000000000000000000000000000000"
},
"tokens": {},
"mimic": {
"smartvault": "0x94Dd9C6152a2A0BBcB52d3297b723A6F01D5F9f7",
"claimer": "0xdF818E63341767d5F5A9827088f1892e9C604A2D",
"bptSwapper": "0x6030331C9225Ee5ae3F3D08FBD19e8bF053dF498",
"oneinchSwapper": "0xd712A863766dE7e7cA13289A97997E01832A6571",
"paraswapSwapper": "0x95676AaEcD59B19C5B79008F86d3A291628b0947"
},
"maxiKeepers": {
"gaugeRewardsInjectors": {
"usdc_rewards_injector": "0x87c921be1fd8ee7E5eda4394aDB849DB72847aE9"
}
"zero": {
"zero": "0x0000000000000000000000000000000000000000"
},
"tokens": {},
"mimic": {
"smartvault": "0x94Dd9C6152a2A0BBcB52d3297b723A6F01D5F9f7",
"claimer": "0xdF818E63341767d5F5A9827088f1892e9C604A2D",
"bptSwapper": "0x6030331C9225Ee5ae3F3D08FBD19e8bF053dF498",
"oneinchSwapper": "0xd712A863766dE7e7cA13289A97997E01832A6571",
"paraswapSwapper": "0x95676AaEcD59B19C5B79008F86d3A291628b0947"
},
"maxiKeepers": {
"gaugeRewardsInjectors": {
"usdc_rewards_injector": "0x87c921be1fd8ee7E5eda4394aDB849DB72847aE9"
}
}
}
6 changes: 4 additions & 2 deletions extras/goerli.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"zero": {"zero": "0x0000000000000000000000000000000000000000"},
"tokens": {}
"zero": {
"zero": "0x0000000000000000000000000000000000000000"
},
"tokens": {}
}
Loading

0 comments on commit d0796f1

Please sign in to comment.