Query editor
WITH candidates(project, chain, rpc, comptroller, market, cf_pct) AS (VALUES('hundred_finance','optimism','https://optimism-rpc.publicnode.com','0x0f390559f258eb8591c8e31cf0905e97cf36ace2','0x9a9c7c065efcd4a8ffbf3d97882bbcaed4eb2910',0.85),('hundred_finance','optimism','https://optimism-rpc.publicnode.com','0x0f390559f258eb8591c8e31cf0905e97cf36ace2','0x89db3b59381bc06fe9bf74532afd777e5f78ef02',0.75),('hundred_finance','optimism','https://optimism-rpc.publicnode.com','0x0f390559f258eb8591c8e31cf0905e97cf36ace2','0x42b458056f887fd665ed6f160a59afe932e1f559',0.85),('hundred_finance','optimism','https://optimism-rpc.publicnode.com','0x0f390559f258eb8591c8e31cf0905e97cf36ace2','0x103f2ca2148b863942397dbc50a425cc4f4e9a27',0.85),('hundred_finance','optimism','https://optimism-rpc.publicnode.com','0x0f390559f258eb8591c8e31cf0905e97cf36ace2','0x607312a5c671d0c511998171e634de32156e69d0',0.85),('hundred_finance','optimism','https://optimism-rpc.publicnode.com','0x0f390559f258eb8591c8e31cf0905e97cf36ace2','0x243e33aa7f6787154a8e59d3c27a66db3f8818ee',0.75),('hundred_finance','optimism','https://optimism-rpc.publicnode.com','0x0f390559f258eb8591c8e31cf0905e97cf36ace2','0xe4e43864ea18d5e5211352a4b810383460ab7fcc',0.75),('hundred_finance','optimism','https://optimism-rpc.publicnode.com','0x0f390559f258eb8591c8e31cf0905e97cf36ace2','0xbb93c7f378b9b531216f9ad7b5748be189a55807',0.85),('hundred_finance','optimism','https://optimism-rpc.publicnode.com','0x0f390559f258eb8591c8e31cf0905e97cf36ace2','0xfcd8570ad81e6c77b8d252bebeba62ed980bd64d',0.85),('hundred_finance','optimism','https://optimism-rpc.publicnode.com','0x0f390559f258eb8591c8e31cf0905e97cf36ace2','0x8e15a22853a0a60a0fbb0d875055a8e66cff0235',0.85),('hundred_finance','optimism','https://optimism-rpc.publicnode.com','0x0f390559f258eb8591c8e31cf0905e97cf36ace2','0x090a00a2de0ea83def700b5e216f87a5d4f394fe',0.75),('hundred_finance','optimism','https://optimism-rpc.publicnode.com','0x0f390559f258eb8591c8e31cf0905e97cf36ace2','0xe8f12f5492ec28609d2932519456b7436d6c93bd',0.75),('unfederalreserve_v1','ethereum','https://ethereum-rpc.publicnode.com','0x3105d328c66d8d55092358cf595d54608178e9b5','0x01a4e9f06616fb5a90405ae8f2cc9a797b9c60e0',0.40),('unfederalreserve_v1','ethereum','https://ethereum-rpc.publicnode.com','0x3105d328c66d8d55092358cf595d54608178e9b5','0x38591fbac616925947a10001aa053eb3f4766c63',0.10),('unfederalreserve_v1','ethereum','https://ethereum-rpc.publicnode.com','0x3105d328c66d8d55092358cf595d54608178e9b5','0x031002d15b0d0cd7c9129d6f644446368deae391',0.80),('unfederalreserve_v1','ethereum','https://ethereum-rpc.publicnode.com','0x3105d328c66d8d55092358cf595d54608178e9b5','0xd837eca6c91c67d98461a411ba2f00bda9960a9d',0.80),('unfederalreserve_v1','ethereum','https://ethereum-rpc.publicnode.com','0x3105d328c66d8d55092358cf595d54608178e9b5','0x5d446fc8dbd10ebacfe9a427ab5402586af98cd4',0.80),('unfederalreserve_v1','ethereum','https://ethereum-rpc.publicnode.com','0x3105d328c66d8d55092358cf595d54608178e9b5','0x9e29ce9cd25f4141df6bb85b27ef6933a16a5824',0.80),('unfederalreserve_v1','ethereum','https://ethereum-rpc.publicnode.com','0x3105d328c66d8d55092358cf595d54608178e9b5','0x6e2aa5bb90ac37d9006685afc651ef067e1c7b44',0.90),('unfederalreserve_v1','ethereum','https://ethereum-rpc.publicnode.com','0x3105d328c66d8d55092358cf595d54608178e9b5','0x2dba05b51ef5a7de3e7c3327201ca2f8a25c2414',0.90),('unfederalreserve_v1','ethereum','https://ethereum-rpc.publicnode.com','0x3105d328c66d8d55092358cf595d54608178e9b5','0x6b576972de33bebde3a703bff52a091e79f8c87a',0.90),('unfederalreserve_v1','ethereum','https://ethereum-rpc.publicnode.com','0x3105d328c66d8d55092358cf595d54608178e9b5','0xe4cc5a22b39ffb0a56d67f94f9300db20d786a5f',0.78),('unfederalreserve_v1','ethereum','https://ethereum-rpc.publicnode.com','0x3105d328c66d8d55092358cf595d54608178e9b5','0xfacece87e14b50eafc85c44c01702f5f485ca460',0.80)),sel AS (SELECTconcat('0x', lower(substr(to_hex(keccak(to_utf8('mintGuardianPaused(address)'))),1,8))) AS mint_paused_sel,concat('0x', lower(substr(to_hex(keccak(to_utf8('borrowGuardianPaused(address)'))),1,8))) AS borrow_paused_sel,concat('0x', lower(substr(to_hex(keccak(to_utf8('mintAllowed(address,address,uint256)'))),1,8))) AS mint_allowed_sel,concat('0x', lower(substr(to_hex(keccak(to_utf8('borrowAllowed(address,address,uint256)'))),1,8))) AS borrow_allowed_sel),raw AS (SELECT c.*,json_extract_scalar(json_parse(http_post(rpc, concat('{"jsonrpc":"2.0","id":1,"method":"eth_call","params":[{"to":"', comptroller, '","data":"', (SELECT mint_paused_sel FROM sel), lpad(substr(market,3),64,'0'), '"},"latest"]}'), ARRAY['Content-Type: application/json'])), '$.result') AS mint_paused_hex,json_extract_scalar(json_parse(http_post(rpc, concat('{"jsonrpc":"2.0","id":1,"method":"eth_call","params":[{"to":"', comptroller, '","data":"', (SELECT borrow_paused_sel FROM sel), lpad(substr(market,3),64,'0'), '"},"latest"]}'), ARRAY['Content-Type: application/json'])), '$.result') AS borrow_paused_hex,json_extract_scalar(json_parse(http_post(rpc, concat('{"jsonrpc":"2.0","id":1,"method":"eth_call","params":[{"from":"', market, '","to":"', comptroller, '","data":"', (SELECT mint_allowed_sel FROM sel), lpad(substr(market,3),64,'0'), lpad(substr('0x0000000000000000000000000000000000000001',3),64,'0'), lpad('1',64,'0'), '"},"latest"]}'), ARRAY['Content-Type: application/json'])), '$.result') AS mint_allowed_hex,json_extract_scalar(json_parse(http_post(rpc, concat('{"jsonrpc":"2.0","id":1,"method":"eth_call","params":[{"from":"', market, '","to":"', comptroller, '","data":"', (SELECT borrow_allowed_sel FROM sel), lpad(substr(market,3),64,'0'), lpad(substr('0x0000000000000000000000000000000000000001',3),64,'0'), lpad('1',64,'0'), '"},"latest"]}'), ARRAY['Content-Type: application/json'])), '$.result') AS borrow_allowed_hexFROM candidates c),decoded AS (SELECT *,try(bytearray_to_uint256(from_hex(substr(mint_paused_hex,3,64)))) AS mint_paused,try(bytearray_to_uint256(from_hex(substr(borrow_paused_hex,3,64)))) AS borrow_paused,try(bytearray_to_uint256(from_hex(substr(mint_allowed_hex,3,64)))) AS mint_allowed_error_code,try(bytearray_to_uint256(from_hex(substr(borrow_allowed_hex,3,64)))) AS borrow_allowed_error_codeFROM raw)SELECT project, chain, market, cf_pct, mint_paused, borrow_paused, mint_allowed_error_code, borrow_allowed_error_code,CASEWHEN mint_paused = UINT256 '1' OR borrow_paused = UINT256 '1' THEN 'EXCLUDE_PAUSED'WHEN mint_allowed_error_code IS NOT NULL AND mint_allowed_error_code <> UINT256 '0' THEN 'EXCLUDE_MINT_BLOCKED'ELSE 'KEEP_GATE_OPEN'END AS gate_decision,CASEWHEN mint_paused = UINT256 '1' THEN 'supply/mint paused'WHEN borrow_paused = UINT256 '1' THEN 'borrow paused'WHEN mint_allowed_error_code IS NOT NULL AND mint_allowed_error_code <> UINT256 '0' THEN concat('mintAllowed error=', CAST(mint_allowed_error_code AS varchar))ELSE 'supply not paused; borrow not paused'