horsefacts
@horsefacts.eth
Just in time for 4th of July, here's a Uniswap v4 hook that reverts all swaps if NYSE is closed: https://github.com/horsefacts/trading-days You can see a view only version ("TradingView") on Etherscan here: https://etherscan.io/address/0x000000006016c17169c289346015b3c9d42a1218#readContract
3 replies
2 recasts
14 reactions
horsefacts
@horsefacts.eth
This is a joke with a few interesting technical details: NYSE holidays and Daylight Savings start/end timestamps are precalculated through 2123 and looked up from a "data contract" (data bytes stored as contract bytecode). Here's DST: https://etherscan.io/address/0x823b0DE957DFF208DB83918E89d9F6c357Ada121#code
1 reply
0 recast
0 reaction
horsefacts
@horsefacts.eth
The DST calendar encodes two 32-bit values for start and end block.timestamp of DST, localized to NY (8 bytes). The holiday calendar encodes the month/day of 11 potential holidays in 9 bits each (4 month, 5 day, 13 bytes/year). I precalculated these using Python "holidays"
1 reply
0 recast
0 reaction