Skip to content

usdai: switch monitoring to pyusd backing and peg checks#199

Open
ctmotox2 wants to merge 3 commits intoyearn:mainfrom
ctmotox2:usdai-monitoring-update
Open

usdai: switch monitoring to pyusd backing and peg checks#199
ctmotox2 wants to merge 3 commits intoyearn:mainfrom
ctmotox2:usdai-monitoring-update

Conversation

@ctmotox2
Copy link
Copy Markdown
Contributor

@ctmotox2 ctmotox2 commented Apr 2, 2026

No description provided.

@ctmotox2 ctmotox2 marked this pull request as ready for review April 6, 2026 12:32

usdai_supply_fmt = usdai_supply_raw / (10**usdai_decimals)
pyusd_assets_fmt = pyusd_assets_raw / (10**pyusd_decimals)
backing_ratio = (pyusd_assets_fmt / usdai_supply_fmt) if usdai_supply_fmt > 0 else 0
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about the USDai backed by loans? It is not like that always pyUSD > USDai supply because of the loans. Am I missing out smth here?

USDAI_PYUSD_WARN_DEVIATION = Config.get_env_float("USDAI_PYUSD_WARN_DEVIATION", 0.003) # 0.30%
USDAI_PYUSD_CRITICAL_DEVIATION = Config.get_env_float("USDAI_PYUSD_CRITICAL_DEVIATION", 0.01) # 1.00%
PYUSD_USD_WARN_DEVIATION = Config.get_env_float("PYUSD_USD_WARN_DEVIATION", 0.003) # 0.30%
PYUSD_USD_CRITICAL_DEVIATION = Config.get_env_float("PYUSD_USD_CRITICAL_DEVIATION", 0.0075) # 0.75%
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that basically means the backing is 0.25?

pyusd_key = f"{Chain.ARBITRUM.network_name}:{PYUSD_TOKEN_ADDR.lower()}"
pyusd_price = None
try:
prices = fetch_prices([pyusd_key])
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this price is fetched?

from utils.config import Config
from utils.logging import get_logger
from utils.web3_wrapper import ChainManager

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is overall great but can we make it generic to any ERC20 instead of only for usdai?
maybe make this large_mints.py in a different folder and generic such that it can work with say iUSD, USDC etc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants