Earlier quoted context omitted.
Strange emphasis on 'now'. From wiki, "Mechanic's liens in their modern form were first conceived by Thomas Jefferson, to encourage construction in the new capital city of Washington. They were established by the Maryland General Assembly, of which the city of Washington was then a part.[1] However, it is not likely that Jefferson single-handedly dreamed up the idea. At the time Jefferson promoted the law, a lien-lik…
It's not strange at all because "now" does not assert "in the past few years" or something. It's just in contrast to when the technique was first developed. Like, do you think there was a long-standing issue with people not paying their bills because the liens weren't enshrined in law, and a bunch of clever legislators got the brilliant idea to introduce it? No! It's been happening since before laws were written down…
The collapse of the IRON stable coin
501–502 of 502 posts
Re: The collapse of the IRON stable coin
#502Earlier quoted context omitted.
You might be confused. The "price > 0" refers to the price of TITAN. TITAN isn't backed by USDC at all. IRON is (ideally) backed by 75% USDC and 25% TITAN.
Oh you're right I am confused. I actually don't even understand the point of the price check in the first place. Why does the USDC portion of IRON tokens need to be locked in the smart contract based on TITAN price anyways?
It doesn't need to be. It's basically a bug in the code. They didn't consider TITAN price being 0 to be possible, so they didn't write their code in a way to handle it correctly.
A random guess for why they had the price > 0 check. They might have had code like this:
// Returns (usdc_to_withdraw, titan_to_withdraw)
def GetWithdrawalAmounts(iron_to_withdraw):
usdc_price = 1 // guaranteed: USDC price in USD (aka USD/USDC)
titan_price = GetTitanPrice() // TITAN price in USD (aka USD/TITAN)
iron_price = GetIronPrice() // IRON price in USD (aka USD/IRON)
usdc_to_withdraw = iron_to_withdraw * iron_price * 0.75 / usdc_price
assert titan_price > 0
titan_to_withdraw = iron_to_withdraw * iron_price * 0.25 / titan_price
return (usdc_to_withdraw, titan_to_withdraw)
If you look at it like that, it's pretty obvious why they have the assertion that titan_price > 0. Without that assertion there's a divide by 0.If you want to handle the ability to withdraw USDC even if the TITAN price is 0, you have to make the code more complicated. Likely not just this function, but the system as a whole, because it'll mess up all the accounting.