diff --git a/README.md b/README.md index e1d7feccd..021da0f67 100644 --- a/README.md +++ b/README.md @@ -22,17 +22,18 @@ Note that Devnet deployments are ephemeral. Once you kill your Devnet instance, | Module | Address | | ------ | --------| -| Abbot | `0x6352de997a7fde3bc733675180e843b5fe585b7ef464a2987a76fae454af78d` | -| Absorber | `0x48deaee30965a88184619f8b3b30b805727654468ae9b42b483a84831b9e5ea` | -| Allocator | `0xa7b142b8937cb31507fe598252d44a516f2bc64eb285f1807163461d6c208e` | -| Caretaker | `0xeab066a1083f32ff92e3ac9696dc847928fa0f4035bda93dacc34df1cef604` | -| Controller | `0x3297c2080d6c565055ca1c7695b9b6e458600515ebd76101ec4221bcea877ce` | -| Equalizer | `0x43d5cd32847304e168fca09feef5620aaf7c3a0e6fa1689416541be95d8d183` | -| Flash Mint | `0x2c6c7acedfbb6607ecc33cd6b2134f3dea2f16998b44219067063ae4ccb6e42` | -| Gate[ETH] | `0x20ee25588aa6225c58a55110fc5f5b983d074d4ed5b1d98788825a9d3305ac0` | -| Gate[STRK] | `0x594f653061a2181514fad04dc005f7eb8210786a45b577f416029e0ffb01cd7` | -| Pragma | `0x71415935245134eaa125de2df12772443726d5a149a4995f60208c28653a54f` | -| Purger | `0x67f57eec3ce8ba9781985cafcb774283d6450662906691b65d882e13dc59934` | -| Seer | `0x14dac867b21b5b6645cc046e0125cca8e81e8dd9d95ca5dd8e756fa053a2984` | -| Sentinel | `0x2f1778912ef186e2434dfe0957e00ed2122dd48f3aa2e8bc46173fd67bdd065` | -| Shrine | `0x4b3bfe81472b5a01dc3c1fba3456bb0979852deaca43da49d406189371d09e6` | +| Abbot | `0x55753ea07d7c53b0d512dd14aa1fb536b02efc179907905610619eecaac1e97` | +| Absorber | `0x32e5f6bfc937e239e9f1c7c2c30f0d8ce59d7d703d82bc69382b4d2b0be1e4e` | +| Allocator | `0x470ad58d601501eab46479e69c0d9367e2b429aca88a1775114e3b074b2117b` | +| Caretaker | `0x1461305951ac7fb7af835a9a19b99ae5e135ba1fb64477d4b92a871fb85a2b1` | +| Controller | `0x5c4d4b9ce7f54dc50354b99dfca29c3ba3935501e5244e048fa87b83043ddc2` | +| Equalizer | `0x54b46ed341533fe4da0116f27e201276165e3a3fd030ac391b6e9967668996d` | +| Flash Mint | `0x6f1577c508f95e633d22eaa65c5781442651336d30a95ba149a80fd85db29bc` | +| Frontend Data Provider | `0x6f7cf629552047a337324712571068b3f8f2deddcc0454533596ef5dfa192d` | +| Gate[ETH] | `0x23dbc80de342f86f2b33b27d5593c259809961d9ecbd9f69b7088babba1016f` | +| Gate[STRK] | `0x2918116ed1154cfe378eaefa5ee83914c9bed787815cdb5a82d25185737dad` | +| Pragma | `0xa163eb702f1cba67680cb67a2ad018dd6d349b76ebc9d85102a83857948304` | +| Purger | `0x1e188c4223245660e692e7f0b9834d11687cec5aa37da0889cbe2e2e2743c28` | +| Seer | `0x1ba77782ba5dea67bcf4f71c2b98849b598d030df02952bf8f62e3eb6b5b192` | +| Sentinel | `0x255e43013fd414520d27a0491c64aa03705e6f728999d0ceb44e395ac5c9c1d` | +| Shrine | `0x7d2a06078ee45540e9507a0daf01ac94f0550b675958dda88cbbc6fc8993708` | diff --git a/scripts/deploy/Scarb.toml b/scripts/deploy/Scarb.toml index 6ad20bea9..856872082 100644 --- a/scripts/deploy/Scarb.toml +++ b/scripts/deploy/Scarb.toml @@ -35,6 +35,7 @@ build-external-contracts = [ "opus::mock::erc20_mintable::erc20_mintable", "opus::mock::mock_pragma::mock_pragma", "opus::mock::mock_switchboard::mock_switchboard", + "opus::periphery::frontend_data_provider::frontend_data_provider", ] [scripts] diff --git a/scripts/deploy/deploy_sepolia_alpha-sepolia_state.json b/scripts/deploy/deploy_sepolia_alpha-sepolia_state.json index 9f9cb4a96..43d83daf6 100644 --- a/scripts/deploy/deploy_sepolia_alpha-sepolia_state.json +++ b/scripts/deploy/deploy_sepolia_alpha-sepolia_state.json @@ -2,6 +2,28 @@ "version": 1, "transactions": { "transactions": { + "590468097c3c7ae35ceca740e7d51fc2fd28ae1cca6ea6793b5b7129b2cda758": { + "name": "declare", + "output": { + "type": "DeclareResponse", + "class_hash": "0x6264182dffc615e1ceb983f944a6e58b69c50c6c152fc8d5161afdec979256c", + "transaction_hash": "0x58c295605f169ca636b3fa636c3379efe1ff3679c84941be290ae633dda1d73" + }, + "status": "Success", + "timestamp": 1713363989, + "misc": null + }, + "2629b50d1bb6cd4b0910207957e0c856a27b98f81305800d85dc66f737012858": { + "name": "deploy", + "output": { + "type": "DeployResponse", + "contract_address": "0x1461305951ac7fb7af835a9a19b99ae5e135ba1fb64477d4b92a871fb85a2b1", + "transaction_hash": "0x100df4cdda7b1585e3c0b442504d7bdecb999c60b93cdac199142177e9fd428" + }, + "status": "Success", + "timestamp": 1715090611, + "misc": null + }, "672716b767bf77c3d8d32d49bc395827201b5e39e837cc8e73d12574ec6abf3c": { "name": "declare", "output": { @@ -13,46 +35,78 @@ "timestamp": 1713355931, "misc": null }, - "130c2d3876286111a091882d78b57bafd505831537efb8fd3ce9f7f6dda165cb": { + "0b59dbfa449f0220724f6f9a439adb6a232c214889a87750fc046f4a4c8c7248": { + "name": "declare", + "output": { + "type": "DeclareResponse", + "class_hash": "0x6610d366e50e22faaec547d9422e60fef572660ce619ccf5c54d2ef547c9665", + "transaction_hash": "0x5bee1c596a801a9fcae3318fd13c3ef49724aa32ad1e7d8421b62917d54dce" + }, + "status": "Success", + "timestamp": 1713364003, + "misc": null + }, + "ff25df488156fe1f3cc18038ebc977ef6fa92e5898dade16860ecc39f50c0b43": { + "name": "deploy", + "output": { + "type": "DeployResponse", + "contract_address": "0x32e5f6bfc937e239e9f1c7c2c30f0d8ce59d7d703d82bc69382b4d2b0be1e4e", + "transaction_hash": "0x4d670dcbb3b7d7a26d4c31614de917d1fa10dd9101afdc7148c52fc05311738" + }, + "status": "Success", + "timestamp": 1715090586, + "misc": null + }, + "c241d3d17509a4149661fed49af585e1df25dc95b702c6dcc05f5d3d5a2f5b2a": { "name": "invoke", "output": { "type": "InvokeResponse", - "transaction_hash": "0x153514a06405148f02949764c95239d5ff0fd04366c62f34943d010e879f94" + "transaction_hash": "0x3dbd7a854c570c00546c89e7f262e804842f2eb524ea61a069867c73c8999d6" }, "status": "Success", - "timestamp": 1713435351, + "timestamp": 1715092126, "misc": null }, - "dd41c47640601d43f25990b718d0f0e49e032659237a9340a09f8c46dcae329a": { - "name": "declare", + "a7176d040a1e285c747e860bd7b19f182408186e434362a887d96255b1c9d7b7": { + "name": "deploy", "output": { - "type": "DeclareResponse", - "class_hash": "0x59f96128a0028d997436de056ccbaee279ceeb8308dba48704a944f07f549ef", - "transaction_hash": "0x2886f11ab4e8b83ecf5b70a3ac3356f9f80ce79ff0f0edc35c93756d056311c" + "type": "DeployResponse", + "contract_address": "0x2918116ed1154cfe378eaefa5ee83914c9bed787815cdb5a82d25185737dad", + "transaction_hash": "0x67e2c3d507cd9810fc739b11b8f939cf6b17f31014125fe61daa950d74a1c94" }, "status": "Success", - "timestamp": 1713280889, + "timestamp": 1715090630, "misc": null }, - "99c844f1f239fc6d3a56473a1af36a59a59aed012b457056578b0972288b16d7": { - "name": "declare", + "cc9cd35c3009845371bb83e6cfda8fa6bc42001012ae3ff88a856e0b2c4d8d1d": { + "name": "deploy", "output": { - "type": "DeclareResponse", - "class_hash": "0x7d17157480d3f859f63c1a4608d05b7ac198702f56d78291c5673b58961c577", - "transaction_hash": "0x7e846312c321c9190298f8d05f769b5309b92b9068d9fda3265fbeff433e05c" + "type": "DeployResponse", + "contract_address": "0x470ad58d601501eab46479e69c0d9367e2b429aca88a1775114e3b074b2117b", + "transaction_hash": "0x47628e2ea1d190269bf59a206c19dbcb0e965cc36f67a9eb559e13bad07284a" }, "status": "Success", - "timestamp": 1713355915, + "timestamp": 1715090599, "misc": null }, - "f8d08132334abb17221bd38782ab5084d5258d5166e06768916a470d6626a6ae": { + "1f454045d025e1e7bc6ed9c96e7dd14304de187441a481a1b85ba9b96166f0ae": { "name": "invoke", "output": { "type": "InvokeResponse", - "transaction_hash": "0x1485672fd5f4a79e455f7cb56ebb6dd97a1ac12dbc3372f0108ba715740b314" + "transaction_hash": "0x2798a2819c2c9adb04e3951c984b4549c564c0b930701b4b4a2134e71170a08" }, "status": "Success", - "timestamp": 1713433100, + "timestamp": 1715091708, + "misc": null + }, + "078af5ddda2a4cced6a879bbe1430a4c5a34dc7d74878c8e639e02e565fef2cd": { + "name": "invoke", + "output": { + "type": "InvokeResponse", + "transaction_hash": "0x1fa459b47e42d42403ed24c2ea6088f5cb3b14a0ada900fdbb31b44ac90dcb6" + }, + "status": "Success", + "timestamp": 1715090679, "misc": null }, "906724d17758727ccff27d143fd27b4aa200bcd94f5ad87c59d482efc3f7f980": { @@ -66,350 +120,349 @@ "timestamp": 1713364996, "misc": null }, - "433d3ee88b65037cf06fb91c3c9e8563f955741ee4fe5e537b0c2b017a1048df": { + "1f49f82c25190c04766fef1b038fdf756fa0f17ca8d66b713fea4bd6504f30e7": { "name": "invoke", "output": { "type": "InvokeResponse", - "transaction_hash": "0x4c388b93e419da08a2c8c9897700215d70fd5b590e17e67f85622fa013c81f9" + "transaction_hash": "0x557c9d2e0739f1fb0d3a32505aa6977fb4ed0c33ba2119c504596babf8182ac" }, "status": "Success", - "timestamp": 1713433087, + "timestamp": 1715092056, "misc": null }, - "2c0f6b42cc23cb96cb07ac70465b71c4d16924e8c7e2e622e0b514aec57e3f25": { - "name": "invoke", - "output": { - "type": "InvokeResponse", - "transaction_hash": "0x96508b708e25247e8c65ef9ac8bb65d1adfa92a9d6bfb395f7f8b88cda49da" - }, - "status": "Success", - "timestamp": 1713433018, - "misc": null - }, - "ab07556e3639f1e3877800dc224ff0710c7c40392f5d409e5619cc277e1870de": { + "52d1eb667c40e3b5cc63acf33e5ed8dea61c51297d94320c0a5cfa32b05d8f7f": { "name": "deploy", "output": { "type": "DeployResponse", - "contract_address": "0x6352de997a7fde3bc733675180e843b5fe585b7ef464a2987a76fae454af78d", - "transaction_hash": "0x1e0e05946a121056859de983c54a4338a389d868538711d1f25ef24e112b5b0" + "contract_address": "0x6f7cf629552047a337324712571068b3f8f2deddcc0454533596ef5dfa192d", + "transaction_hash": "0x1ac740976f47bea6e6ce4b8782fbd9a7522d765c297dbe9a7b00678aa6a84a7" }, "status": "Success", - "timestamp": 1713355921, + "timestamp": 1715092138, "misc": null }, - "d41337fc230f61eec2dd63997056d3903d4c31062dbbaee8d5a108792b36d85d": { + "6fef334cc5e893160b81fce56bc931f2009bc22b4f2ffef9567af5963823fd8a": { "name": "deploy", "output": { "type": "DeployResponse", - "contract_address": "0x2f1778912ef186e2434dfe0957e00ed2122dd48f3aa2e8bc46173fd67bdd065", - "transaction_hash": "0x67b001ac0bd56e9fe6abc7aecf9f1625d53739686c82bec65352cb2168e3ee" + "contract_address": "0xa163eb702f1cba67680cb67a2ad018dd6d349b76ebc9d85102a83857948304", + "transaction_hash": "0x6323cfb99036c2bbf0baf4749428b2c53cb37e5d40ef35eeb727fee9f2898a8" }, "status": "Success", - "timestamp": 1713355893, + "timestamp": 1715090635, "misc": null }, - "19045b7533a8feb631b724103299fe7ac3beea5cf01a0a6823de7a4fbcee6d0e": { + "f2ebdd9abfe936f2f693ef932da0959db0731985b1462c87e169a554258fe5fd": { "name": "deploy", "output": { "type": "DeployResponse", - "contract_address": "0x67f57eec3ce8ba9781985cafcb774283d6450662906691b65d882e13dc59934", - "transaction_hash": "0x4fbdf22582c27b488778cb7c5345a772362370dd0cd4be203041a365e7611f7" + "contract_address": "0x255e43013fd414520d27a0491c64aa03705e6f728999d0ceb44e395ac5c9c1d", + "transaction_hash": "0x68dfddeec80a329d55bbb9375fca528b4832fd67fb5c7e352568f418cee0bdd" }, "status": "Success", - "timestamp": 1713355952, + "timestamp": 1715090568, "misc": null }, - "76bfa9c9f3dfade656b49d2d274ea2504a55954c69a7a7cb902a76787fb5b33d": { + "9e1e2c155d0e2b0b5a9694f5f47b2197b65ae7fd4d4721559a5b47a54bbabd3a": { "name": "invoke", "output": { "type": "InvokeResponse", - "transaction_hash": "0x222c84ba34d01e164f8f4aa4494a1cefc05940d72b911394d228a8b9c2c4574" + "transaction_hash": "0x5b9d4bcd6bcb2bb6520b8bfd84231dc660deb099f2392650b90af4179a105e1" }, "status": "Success", - "timestamp": 1713433093, + "timestamp": 1715089391, "misc": null }, - "eba955446c7f9eb7da1771c25f223a9ef27bbed88d7efc08136e4f7e498e2a08": { + "2e71c5d1d8ac74ab004630e9777fb83f7a535f16693425e8bd18b0719c286c98": { "name": "declare", "output": { "type": "DeclareResponse", - "class_hash": "0xce68b83ddd51fcfb3b6eaf25e4d8eea63cc9373618d1b5a1f6909cf211d78", - "transaction_hash": "0x235ff10d619fbdb2374273437802548631f8deb6c7988362dc1951f6953213e" + "class_hash": "0x2b4e510a5aa0a547d8a266f3fc54457281769e82a4247b1bbcc1cd55d768116", + "transaction_hash": "0x61876a39196cdf4ff7e30be46024062f36b9c9c2f6727dce0bb02091f6b41af" }, "status": "Success", - "timestamp": 1713355974, + "timestamp": 1713355960, "misc": null }, - "e1ce68c49048946426271a365518255162c48e617f0109f2cd735b71807da324": { - "name": "invoke", + "5007559b15931fb0862b0bb7717746e0fc3b3a38af6cfa9539385f09fe1c5161": { + "name": "deploy", "output": { - "type": "InvokeResponse", - "transaction_hash": "0x5943f066c7dc76589c8f0221c16382b3c3badb0fea783cfd6049ca6a41c6d06" + "type": "DeployResponse", + "contract_address": "0x23dbc80de342f86f2b33b27d5593c259809961d9ecbd9f69b7088babba1016f", + "transaction_hash": "0x377828a7bd69b8b0fe8a5df5d5b8d1a6bb6547157b9732f220d911340d5cc5e" }, "status": "Success", - "timestamp": 1713434215, + "timestamp": 1715090624, "misc": null }, - "0e2b6907e29db2d30ee7e78fef850044502b6d36b903d3036c493a4d0f456434": { - "name": "deploy", + "6588f9b47bd171f17602a857c6cabb703d6cec9a213879ecdfb596ae59f71db1": { + "name": "invoke", "output": { - "type": "DeployResponse", - "contract_address": "0x20ee25588aa6225c58a55110fc5f5b983d074d4ed5b1d98788825a9d3305ac0", - "transaction_hash": "0x1c8a21c164b82016b2ed0a9d1a2f8f85817aff3da59eb02dd2c161bcc7fa007" + "type": "InvokeResponse", + "transaction_hash": "0x6215fe7f936f542ac0329c804615b83132d04f4b0c4e7dad36c0c60f3820670" }, "status": "Success", - "timestamp": 1713364009, + "timestamp": 1715091714, "misc": null }, - "19ecb2b5d40cf6b2e1b3f2a97f92bb71cf19842be0d5ef6d3a572ab0167da663": { + "99c844f1f239fc6d3a56473a1af36a59a59aed012b457056578b0972288b16d7": { "name": "declare", "output": { "type": "DeclareResponse", - "class_hash": "0x180bc88b3fcb18e158fa4708779bfa4323557fde86d0dc287bad827b600247d", - "transaction_hash": "0x2221c92fa8aec039855dee74cf2f8498247d7d8db99d4cc5a0edf4bbfbbb2b9" + "class_hash": "0x7d17157480d3f859f63c1a4608d05b7ac198702f56d78291c5673b58961c577", + "transaction_hash": "0x7e846312c321c9190298f8d05f769b5309b92b9068d9fda3265fbeff433e05c" }, "status": "Success", - "timestamp": 1713355887, + "timestamp": 1713355915, "misc": null }, - "ff98b6e386b0a1cf2f236d1139a341846690c81853bf14baa1c89650badc3e0a": { - "name": "deploy", + "189a73592c03c2eee41e593da13d971c369c2d2174c215178b21df22135f849f": { + "name": "declare", "output": { - "type": "DeployResponse", - "contract_address": "0xeab066a1083f32ff92e3ac9696dc847928fa0f4035bda93dacc34df1cef604", - "transaction_hash": "0x6ff1e0160603cf890071142171883f306646f61fca72d5ac842a014c04014be" + "type": "DeclareResponse", + "class_hash": "0x665c3040b091dec0e9d36bed35fb350ba60ff7fe70b24526988d81cfc537ab9", + "transaction_hash": "0x692b4cd0023d83dd22176306a56ebef2758c5c81f4324a89bb366c3f02d832" }, "status": "Success", - "timestamp": 1713363980, + "timestamp": 1713355946, "misc": null }, - "346ec38cf2c9afebf08d66d1cf178400bc44ead9d9fca7f93bbfaee7c2adc268": { + "6c6e200775d712203d37d84171a01792add004f9367bdd7de175efd85707cfc8": { "name": "invoke", "output": { "type": "InvokeResponse", - "transaction_hash": "0x54d3215b2d6a8694ee2858a79859d792fb003d294da0065d0b8bc2bfa9eadb3" + "transaction_hash": "0x2cbabb40ec6512be296cb58b1e760ded767f73543fe2d17fab138879bb5687e" }, "status": "Success", - "timestamp": 1713433106, + "timestamp": 1715090653, "misc": null }, - "e82d65e6dd02669ca0172faae1966dde6b65c9fe70a2d5a3c1610544da200254": { + "282e5b842143e5a332a1d67d9cb77d8f4ae61921a587a4a01e5c3836c582083c": { "name": "invoke", "output": { "type": "InvokeResponse", - "transaction_hash": "0x7457bd43ee1274641ce7de54f5eb0fc3b448c8827e32ab6bfaabeb39c3bff8" + "transaction_hash": "0x3dea09626a616d19eaf760ed23e9d790a9f26ff082e1699b20eac4bedc5cb8d" }, "status": "Success", - "timestamp": 1713433113, + "timestamp": 1715092114, "misc": null }, - "5d983dbde214e2d0bdd632a4d5bd2319277738abfe0a43201b0fdb278ea7d0bf": { + "6763e7acf8d8a77f395f3bc8431309a8952f9491e71a0b7e6dc6db4c5b49d729": { "name": "invoke", "output": { "type": "InvokeResponse", - "transaction_hash": "0x4ffc4d65fcc4464a475f8c502375531d17cb955254d19cac75925c9e0275ad7" + "transaction_hash": "0x45ada6ed2ea6ac0c47e71a927af162b3c06ef128ecedcc9244e1beaa765ae21" }, "status": "Success", - "timestamp": 1713435357, + "timestamp": 1715092132, "misc": null }, - "590468097c3c7ae35ceca740e7d51fc2fd28ae1cca6ea6793b5b7129b2cda758": { - "name": "declare", + "7687cff9743ad4f4d63a80500b752c9c88a069f58ce843e6397b6d29fd32140f": { + "name": "deploy", "output": { - "type": "DeclareResponse", - "class_hash": "0x6264182dffc615e1ceb983f944a6e58b69c50c6c152fc8d5161afdec979256c", - "transaction_hash": "0x58c295605f169ca636b3fa636c3379efe1ff3679c84941be290ae633dda1d73" + "type": "DeployResponse", + "contract_address": "0x1e188c4223245660e692e7f0b9834d11687cec5aa37da0889cbe2e2e2743c28", + "transaction_hash": "0x423b0a7471d00ef67e373740bf6cf8d90b271881993de4fc176691bd629f5cc" }, "status": "Success", - "timestamp": 1713363989, + "timestamp": 1715090592, "misc": null }, - "a1f1e61e1f9780ef2cd43951e4688ae9f449bd863d650ceb13048cfd4bf07097": { + "a81b8a81e0988da6aa36500a42b54fbe17fe9da021f6248f2678829c63f04b28": { "name": "invoke", "output": { "type": "InvokeResponse", - "transaction_hash": "0x25ed295d1ed164b346ba3d6660ccb99c95e0567e6e5d729a54c1372a678546e" + "transaction_hash": "0x3e55263f63e71a431ca1e67cfd28e3a12e2d2b91e49c48342f04d80bdd630e6" }, "status": "Success", - "timestamp": 1713365947, + "timestamp": 1715090648, "misc": null }, - "88a9396d55311a803a08e17160cbcd81990b5ea05069495687a6ace83a279b44": { + "00cd99ebfb79f461ccfd6d62bcfcce1bdbf5759875fc458adcbd50d7b035d4ad": { "name": "invoke", "output": { "type": "InvokeResponse", - "transaction_hash": "0x5a0aba2f261c52ebffa4aab6d9c6c733d5646ca051aebabf7e2edecffa9b50" + "transaction_hash": "0x1c2293194082289cdc1a4491805abe1f9593cc0c1cac28c2f24393fac7e9668" }, "status": "Success", - "timestamp": 1713365785, + "timestamp": 1715092045, "misc": null }, - "cbfda53e2f3e4cbd5591e2051e714bd28bfe02e4ed0f5314d3c939b4261d1e26": { - "name": "invoke", + "c5335df53f10ee4a3d158004384345a603443c589d18af40834cc1301b1f6867": { + "name": "declare", "output": { - "type": "InvokeResponse", - "transaction_hash": "0x3352b4d99a2817ec9c42b99f084822b28ffe4ee1e153d175649b71d97141fd9" + "type": "DeclareResponse", + "class_hash": "0x5028451c0d6c56b05ac3be603f014ac9f8a8ec0d39ed42a52d8456383e777cf", + "transaction_hash": "0x23915d0f463591096d8c0c4668f0f11ec360f0cdcdb72aa3a137fe48e4ae31d" }, "status": "Success", - "timestamp": 1713434222, + "timestamp": 1713355392, "misc": null }, - "9961b551607f9104c4db0ade2a733b0ead13b6d6c8940bdca78b9e89d899a800": { + "1eea556576b2b7764e132d113da0607dcf071820677363ab66151058a47d4be7": { "name": "invoke", "output": { "type": "InvokeResponse", - "transaction_hash": "0x8e2d3e369b9257c7fd60c4b6c687aba3bc160388e08328f36feb3a81efe3b8" + "transaction_hash": "0x426be998e810354f771b05311c301070ad44f09598a661b86ece6b78b215fe8" }, "status": "Success", - "timestamp": 1713433125, + "timestamp": 1715091660, "misc": null }, - "f936c9ad74d4104968ce9d09ed5043cb02f99d0d170f1d16936808463230d44b": { + "9b656ffc4bc3ed2ccfebb6fba7d5a16c44cf66aa988687b496bd00ccf1b6eeba": { "name": "invoke", "output": { "type": "InvokeResponse", - "transaction_hash": "0x21cc70763c84302ac61d769f17c8360a4abdf5948eec243693bf166ef3506c1" + "transaction_hash": "0x285e956fd94375ab74bc15447027900b52f84d308f62f34bc2cfae54e5f424e" }, "status": "Success", - "timestamp": 1713365779, + "timestamp": 1715092108, "misc": null }, - "9dbcd80d2c2442f297687f21712c2a5b9900eead2f337c2a5ba7e04306b2a8ba": { - "name": "deploy", + "dd41c47640601d43f25990b718d0f0e49e032659237a9340a09f8c46dcae329a": { + "name": "declare", "output": { - "type": "DeployResponse", - "contract_address": "0x4b3bfe81472b5a01dc3c1fba3456bb0979852deaca43da49d406189371d09e6", - "transaction_hash": "0x59ed06d55a1a8594f510ef6b88c7111b8824f83a5c2875825256b1b365e1fa8" + "type": "DeclareResponse", + "class_hash": "0x2ad9f2d9e74cce3fc04815168300d0ebd4a3076023a71dda0f9147304e55db7", + "transaction_hash": "0x2c4b11ed98ec65c0332241bf517fe5cc7aea5856ece5dd9a026fb697be27283" }, "status": "Success", - "timestamp": 1713355100, + "timestamp": 1715090494, "misc": null }, - "f1bc19a11ce70f15c52e7098960d7f94dd38d6c976347e652b7a54063bdcb605": { - "name": "deploy", + "2e29404ae7b8bab65cd1e7342c6cc181c71bafa766c42e3279e08a3d4e9944fe": { + "name": "invoke", "output": { - "type": "DeployResponse", - "contract_address": "0x14dac867b21b5b6645cc046e0125cca8e81e8dd9d95ca5dd8e756fa053a2984", - "transaction_hash": "0x4d6295f0eb56caa317ba85ec70c1d6a580bb2f2d754ccc61244cbd655a7ce1b" + "type": "InvokeResponse", + "transaction_hash": "0x3bcdc66f192dfff954873cdaa6278ca711afda402a1231f46ee8c2259ed378" }, "status": "Success", - "timestamp": 1713355907, + "timestamp": 1715091762, "misc": null }, - "c5335df53f10ee4a3d158004384345a603443c589d18af40834cc1301b1f6867": { - "name": "declare", + "cb6947bf5f49c95e7485b70f339ec1e5c5c4601b2aac6f3ba96fe9475a59dab0": { + "name": "invoke", "output": { - "type": "DeclareResponse", - "class_hash": "0x5028451c0d6c56b05ac3be603f014ac9f8a8ec0d39ed42a52d8456383e777cf", - "transaction_hash": "0x23915d0f463591096d8c0c4668f0f11ec360f0cdcdb72aa3a137fe48e4ae31d" + "type": "InvokeResponse", + "transaction_hash": "0x70df76bd280c07c6ea209b9faab2ef85d614ad89aabef287e5501198b114583" }, "status": "Success", - "timestamp": 1713355392, + "timestamp": 1715090667, "misc": null }, - "0b59dbfa449f0220724f6f9a439adb6a232c214889a87750fc046f4a4c8c7248": { - "name": "declare", + "82bec2e01f015da72444f510c9a37d1a93aa0dcca5e9272b47929c69823f1ffd": { + "name": "deploy", "output": { - "type": "DeclareResponse", - "class_hash": "0x6610d366e50e22faaec547d9422e60fef572660ce619ccf5c54d2ef547c9665", - "transaction_hash": "0x5bee1c596a801a9fcae3318fd13c3ef49724aa32ad1e7d8421b62917d54dce" + "type": "DeployResponse", + "contract_address": "0x7d2a06078ee45540e9507a0daf01ac94f0550b675958dda88cbbc6fc8993708", + "transaction_hash": "0x12d8ef7f5ee2dd8a9e8108e3487acd11207c3f322e9484081e6af51ebb0fa0" }, "status": "Success", - "timestamp": 1713364003, + "timestamp": 1715090551, "misc": null }, - "cc9cd35c3009845371bb83e6cfda8fa6bc42001012ae3ff88a856e0b2c4d8d1d": { + "8b805a268bad2da6e2875a767fefa5e369d61b53160cd5e5a9630f082f4ad315": { "name": "deploy", "output": { "type": "DeployResponse", - "contract_address": "0xa7b142b8937cb31507fe598252d44a516f2bc64eb285f1807163461d6c208e", - "transaction_hash": "0x7979a61a26d3337ad7ede5d0b43dce5c16b612fb7d7e3b2e24c125d6ef575d" + "contract_address": "0x55753ea07d7c53b0d512dd14aa1fb536b02efc179907905610619eecaac1e97", + "transaction_hash": "0x5736d7b69f09c114dcbcf70c8b8c67ba8733942e5a1a6118e608e005078f153" }, "status": "Success", - "timestamp": 1713355966, + "timestamp": 1715090580, "misc": null }, - "aef80ff8c4cb4020056530ddf7d38a1ca8859f0dd43431f2f2f9c082f00e5d2d": { - "name": "deploy", + "c4a592b9dcbdc84d134d0876432788a100a7a8a193eeaf365d7b30c09a2eaf0f": { + "name": "invoke", "output": { - "type": "DeployResponse", - "contract_address": "0x48deaee30965a88184619f8b3b30b805727654468ae9b42b483a84831b9e5ea", - "transaction_hash": "0x5775df2234fc500580344e9c82f51be99e144dbf58bfedaa2cb693f703fc460" + "type": "InvokeResponse", + "transaction_hash": "0x7740d7d61b391493997fba96b96619866f6122b5f3a03347c7af4102afa1a0" }, "status": "Success", - "timestamp": 1713355937, + "timestamp": 1715092067, "misc": null }, - "2e71c5d1d8ac74ab004630e9777fb83f7a535f16693425e8bd18b0719c286c98": { - "name": "declare", + "e844bec4c4f5285b779b5b085d09973ba36209bc15cd7c3dc71b767dcb1ea5f2": { + "name": "invoke", "output": { - "type": "DeclareResponse", - "class_hash": "0x2b4e510a5aa0a547d8a266f3fc54457281769e82a4247b1bbcc1cd55d768116", - "transaction_hash": "0x61876a39196cdf4ff7e30be46024062f36b9c9c2f6727dce0bb02091f6b41af" + "type": "InvokeResponse", + "transaction_hash": "0x1c73d7e4f6ae4e2cca11e8464c3548a19dc63a9cddba3431a62d347ba110250" }, "status": "Success", - "timestamp": 1713355960, + "timestamp": 1715092027, "misc": null }, - "0cb2494e20c382ccd4ac0b2b82e543aa7b709e9f419f5e2c184ffa7e899f1dbf": { + "26f08bc8f675d23aca14ea8849f600516cba4f6b7fddd962ed7a83bfbe3b1050": { "name": "invoke", "output": { "type": "InvokeResponse", - "transaction_hash": "0xdda0d22acf141e12425f32963b9ab58fc41cc84d7713e8db35ce25bf1efa4b" + "transaction_hash": "0x79c8736321baa822e7358ce779f5485e74534366438106b7dc46f9c0b50a824" }, "status": "Success", - "timestamp": 1713433119, + "timestamp": 1715090641, "misc": null }, - "eb23acb2d3c5bf75816831965ea5429da4424c2e0eef3532c388af428f693cee": { + "a076ae2bd566233cdbbf06236d0c4716e6d4e0308b6e68ed4d4d4f988ca52a8a": { "name": "invoke", "output": { "type": "InvokeResponse", - "transaction_hash": "0x2f6adfe60c6e3a51c7daa8e9799eb03c11d613610f23a56de87088e647f0f79" + "transaction_hash": "0x762b3e0ad84fe521f55b14ebfe5b7dd59f057200d9949d0b27a298147878042" }, "status": "Success", - "timestamp": 1713435170, + "timestamp": 1715091649, "misc": null }, - "c7d2c05e91fae9c17354d86d7eefa4e98852e746704749c6b134ab4ffefa3ae9": { + "a7b18bb54e2d49bf38d9ac40694d8f2f347d0681250b006aeefada325c9912e2": { "name": "deploy", "output": { "type": "DeployResponse", - "contract_address": "0x594f653061a2181514fad04dc005f7eb8210786a45b577f416029e0ffb01cd7", - "transaction_hash": "0x61f8d1805e31b1581a5650bad109a9108e7838b498718302e9830a17916f4a5" + "contract_address": "0x1ba77782ba5dea67bcf4f71c2b98849b598d030df02952bf8f62e3eb6b5b192", + "transaction_hash": "0x20a0f18c8b3bd798258e0c734ff7912276fe79ea3e26cc95c416384c2063693" }, "status": "Success", - "timestamp": 1713364016, + "timestamp": 1715090574, "misc": null }, - "a856e17b1f401cd5a8cb65374f379c47955d1800f167ded72510be87bad50f7d": { - "name": "invoke", + "a0c6d143f2f8ba10d8a5038653c8a128ad9a3a78d91cebc698d9b128ee8ac67f": { + "name": "declare", "output": { - "type": "InvokeResponse", - "transaction_hash": "0x7126ae4381ba6ecdbbac7190326f5d2c262ffd6c1c88e48ac12b47a44c10a8c" + "type": "DeclareResponse", + "class_hash": "0xcf41883647354a7b73b19ff51c4613a2f084124b75bea0f4dad33329c2ae63", + "transaction_hash": "0x7000aa72f175dd2e396443d0ef08a04e512f1a684f4d5ad5115c451c5872411" }, "status": "Success", - "timestamp": 1713435594, + "timestamp": 1715052833, "misc": null }, - "c477836e682e13d9c36f767c479a13ac66e74d800da2ec891a5befe6d2b1670a": { + "7bb15c170fb4d0d30d9e28a2b02dd417b9fef38ec6a4884f24131e2dbe121ac8": { "name": "invoke", "output": { - "type": "ErrorResponse", - "message": "Transaction has been reverted = Error in the called contract (0x017721cd89df40d33907b70b42be2a524abeea23a572cf41c79ffe2422e7814e):\nError at pc=0:4573:\nGot an exception while executing a hint: Execution failed. Failure reason: 0x4661696c656420746f20646573657269616c697a6520706172616d202331 ('Failed to deserialize param #1').\nCairo traceback (most recent call last):\nUnknown location (pc=0:67)\nUnknown location (pc=0:1835)\nUnknown location (pc=0:2478)\nUnknown location (pc=0:3255)\nUnknown location (pc=0:3795)\n\nError in the called contract (0x014dac867b21b5b6645cc046e0125cca8e81e8dd9d95ca5dd8e756fa053a2984):\nExecution failed. Failure reason: 0x4661696c656420746f20646573657269616c697a6520706172616d202331 ('Failed to deserialize param #1').\n" + "type": "InvokeResponse", + "transaction_hash": "0x1d7b73b3192d2bebf867f68e7c6250e4a99a9feac9fc961507e1b6ca402af55" }, - "status": "Fail", - "timestamp": 1713434097, + "status": "Success", + "timestamp": 1715092119, "misc": null }, - "50409426cf6b2dc0e8cd9b6b47c7328c78157ebd846b0474465e53d495f7b80b": { + "603bee0cd5681a9151465b5b041984a9e0c1d16b647a36d17afa7906aafb614f": { "name": "invoke", "output": { "type": "InvokeResponse", - "transaction_hash": "0x41028a33e564cdb6b3432eb5f6b1c0e0d3126b8d091e10963a7eee763ccc002" + "transaction_hash": "0x41dd07056b44c75c2e22fbb255fcb8bc4ba8f23525a099f17c05790c6ac0fc1" }, "status": "Success", - "timestamp": 1713434233, + "timestamp": 1715090673, + "misc": null + }, + "40eae2d86da41b16152459d9fd09b58e3800c6a1c126411a64033464cae4ec84": { + "name": "deploy", + "output": { + "type": "DeployResponse", + "contract_address": "0x5c4d4b9ce7f54dc50354b99dfca29c3ba3935501e5244e048fa87b83043ddc2", + "transaction_hash": "0x59354c2e3952f5d50f6bf7af8ba50f64f54f2b2ab2dc77a96dc8549c919134" + }, + "status": "Success", + "timestamp": 1715090617, "misc": null }, "c4c44b8f78a990847c932fa7f5349658975fe171cd6a489dddf9f25f9caf95a3": { @@ -423,58 +476,37 @@ "timestamp": 1713355901, "misc": null }, - "e9c27c40e36a647afbf691ba2a90bbdc2b2c46615aa27f276e2d6fab6310e3e8": { - "name": "deploy", - "output": { - "type": "DeployResponse", - "contract_address": "0x43d5cd32847304e168fca09feef5620aaf7c3a0e6fa1689416541be95d8d183", - "transaction_hash": "0x33815d28ed3ba8562b321bb95bba1c1da8c87f3255c90eb06f66f4c30c83c14" - }, - "status": "Success", - "timestamp": 1713363879, - "misc": null - }, - "33bf38bfae2a6495d4c4777da70d012b5023450cce05918a48cd31f4c42c4fbc": { + "b3bd661f4807613f905ae527a94a0628471145c84798b04324bf1107a867b139": { "name": "deploy", "output": { "type": "DeployResponse", - "contract_address": "0x3297c2080d6c565055ca1c7695b9b6e458600515ebd76101ec4221bcea877ce", - "transaction_hash": "0x4e41c9e6ea364d0f8d2c67e34d8bc05bce33fa394d46be2df38e701d16561e1" + "contract_address": "0x54b46ed341533fe4da0116f27e201276165e3a3fd030ac391b6e9967668996d", + "transaction_hash": "0x65aaf6b7c2f04593c2be27d05d3122c59c418676f4a7fdd2551ed5acba656aa" }, "status": "Success", - "timestamp": 1713363995, + "timestamp": 1715090605, "misc": null }, - "189a73592c03c2eee41e593da13d971c369c2d2174c215178b21df22135f849f": { + "eba955446c7f9eb7da1771c25f223a9ef27bbed88d7efc08136e4f7e498e2a08": { "name": "declare", "output": { "type": "DeclareResponse", - "class_hash": "0x665c3040b091dec0e9d36bed35fb350ba60ff7fe70b24526988d81cfc537ab9", - "transaction_hash": "0x692b4cd0023d83dd22176306a56ebef2758c5c81f4324a89bb366c3f02d832" - }, - "status": "Success", - "timestamp": 1713355946, - "misc": null - }, - "d1557f6c2f8e726c768cbbf1619cbaa4943010757b3fd2d98a097fcd3c7859ae": { - "name": "invoke", - "output": { - "type": "InvokeResponse", - "transaction_hash": "0x6408e934bcb5750582b8f038317dbcfd1b6dfb19fe6410fb66a7fefd8bc2d2c" + "class_hash": "0xce68b83ddd51fcfb3b6eaf25e4d8eea63cc9373618d1b5a1f6909cf211d78", + "transaction_hash": "0x235ff10d619fbdb2374273437802548631f8deb6c7988362dc1951f6953213e" }, "status": "Success", - "timestamp": 1713365755, + "timestamp": 1713355974, "misc": null }, - "d318b23c85f11deb4ded680ca17c859f6ef9bc99b43880ae1e51297778b2cfca": { + "aeee1e3eacf6f1d0fa0b29d348ba056f7fa4b8522a95c2e44cb2f215059fb68b": { "name": "deploy", "output": { "type": "DeployResponse", - "contract_address": "0x2c6c7acedfbb6607ecc33cd6b2134f3dea2f16998b44219067063ae4ccb6e42", - "transaction_hash": "0x4f87f6711c9174ec9855c386107d06b641e4ebb92a0bc37f5aaabc487b0c4a5" + "contract_address": "0x6f1577c508f95e633d22eaa65c5781442651336d30a95ba149a80fd85db29bc", + "transaction_hash": "0xad7497c079c3f11bce9d9bb05bd81a18913d5c5a9fb6993f62bbeda6064885" }, "status": "Success", - "timestamp": 1713355878, + "timestamp": 1715090562, "misc": null }, "ee755cc389e7beab0d6f0ec3404534cecec816b2177aa4101cfa73fe4f726373": { @@ -488,45 +520,35 @@ "timestamp": 1713363974, "misc": null }, - "6fef334cc5e893160b81fce56bc931f2009bc22b4f2ffef9567af5963823fd8a": { - "name": "deploy", - "output": { - "type": "DeployResponse", - "contract_address": "0x71415935245134eaa125de2df12772443726d5a149a4995f60208c28653a54f", - "transaction_hash": "0x74a0b99fc170f6106508ab4d7c411db034c3ab714594c9f006fe8959b58906" - }, - "status": "Success", - "timestamp": 1713365749, - "misc": null - }, - "3d1e981cd23eed7155be70df6b2afb1bfb6f247b9c9a1fdc4c699136a44e05a7": { + "360bf6065e903fd651edecd75779f4fd2f436844bccdd9a8551ad68e7544825b": { "name": "invoke", "output": { "type": "InvokeResponse", - "transaction_hash": "0x1a267e6bdad667a5b50c1e16ea2e11f79c80dcbdf8ff646532843affaac026f" + "transaction_hash": "0x766753f62458332f3e17bb87b6eb7abd9f6cf321cfdd3d7c633d66aa705ceef" }, "status": "Success", - "timestamp": 1713365767, + "timestamp": 1715091756, "misc": null }, - "8731e4d54f1055e199f93ef668c4131b9994ad2c9d5a44a87d3c99b0b6daf57c": { + "3ee681620507be463f5fc2202ae84feb8be6e03a5de86389e6725bcd9bdeff29": { "name": "invoke", "output": { "type": "InvokeResponse", - "transaction_hash": "0x1e21d502ce831a1528beb180378e28c8f4e1e49a0ca7ee30277ff835f170537" + "transaction_hash": "0x70fffc7cbb1fac23915d7851ab999d463a1b20e785a6ecf21ee65e7f18e8bd3" }, "status": "Success", - "timestamp": 1714361713, + "timestamp": 1715090660, "misc": null }, - "219aec8d3b2e9d0242998a12d367b869488750095694ad43832c6c73e1e152a4": { - "name": "invoke", + "19ecb2b5d40cf6b2e1b3f2a97f92bb71cf19842be0d5ef6d3a572ab0167da663": { + "name": "declare", "output": { - "type": "InvokeResponse", - "transaction_hash": "0x763314d0b1ee5aa2281df2826e97f5d51e3741e744abca2734d1e001240c56" + "type": "DeclareResponse", + "class_hash": "0x939fe8f3c39bbac9d01268a73ec713f872aeab64b1bd90a4117a3ece37f2c6", + "transaction_hash": "0x349d77fd7915ef8b5457008b058a484476852378c308d5cee036bda79724d84" }, "status": "Success", - "timestamp": 1714623104, + "timestamp": 1715088968, "misc": null } } diff --git a/scripts/deploy/src/constants.cairo b/scripts/deploy/src/constants.cairo index 7f96aabdf..fee9d5b3a 100644 --- a/scripts/deploy/src/constants.cairo +++ b/scripts/deploy/src/constants.cairo @@ -1,7 +1,7 @@ use starknet::{ClassHash, ContractAddress}; // Constants for deployment -pub const MAX_FEE: felt252 = 999999999999999; +pub const MAX_FEE: felt252 = 9999999999999999; pub const SALT: felt252 = 0x3; // Constants for Shrine diff --git a/scripts/deploy/src/deploy_devnet.cairo b/scripts/deploy/src/deploy_devnet.cairo index 53f8c45d6..db2dc8c23 100644 --- a/scripts/deploy/src/deploy_devnet.cairo +++ b/scripts/deploy/src/deploy_devnet.cairo @@ -1,9 +1,5 @@ use deployment::constants::{MAX_FEE, SALT}; -use deployment::constants; -use deployment::core_deployment; -use deployment::mock_deployment; -use deployment::mock_utils; -use deployment::utils; +use deployment::{constants, core_deployment, mock_deployment, mock_utils, periphery_deployment, utils}; use opus::constants::{ETH_USD_PAIR_ID, PRAGMA_DECIMALS, STRK_USD_PAIR_ID, WBTC_DECIMALS, WBTC_USD_PAIR_ID}; use opus::core::roles::{absorber_roles, sentinel_roles, seer_roles, shrine_roles}; use opus::utils::math::wad_to_fixed_point; @@ -174,6 +170,12 @@ fn main() { utils::set_yang_pair_id_for_oracle(switchboard, wbtc, WBTC_USD_PAIR_ID); utils::set_yang_pair_id_for_oracle(switchboard, strk, STRK_USD_PAIR_ID); + // Peripheral deployment + println!("Deploying periphery contracts"); + let frontend_data_provider: ContractAddress = periphery_deployment::deploy_frontend_data_provider( + admin, shrine, sentinel + ); + // Print summary table of deployed contracts println!("-------------------------------------------------\n"); println!("Deployed addresses"); @@ -184,6 +186,7 @@ fn main() { println!("Controller: {}", controller); println!("Equalizer: {}", equalizer); println!("Flash Mint: {}", flash_mint); + println!("Frontend Data Provider: {}", frontend_data_provider); println!("Gate[ETH]: {}", eth_gate); println!("Gate[STRK]: {}", strk_gate); println!("Gate[WBTC]: {}", wbtc_gate); diff --git a/scripts/deploy/src/deploy_sepolia.cairo b/scripts/deploy/src/deploy_sepolia.cairo index e334795fa..ada80d748 100644 --- a/scripts/deploy/src/deploy_sepolia.cairo +++ b/scripts/deploy/src/deploy_sepolia.cairo @@ -1,5 +1,5 @@ use deployment::constants::MAX_FEE; -use deployment::{constants, core_deployment, utils}; +use deployment::{constants, core_deployment, periphery_deployment, utils}; use opus::constants::{ETH_USD_PAIR_ID, STRK_USD_PAIR_ID}; use opus::core::roles; use sncast_std::{ @@ -13,7 +13,7 @@ fn main() { println!("Deploying core contracts"); //let shrine: ContractAddress = core_deployment::deploy_shrine(admin); - let shrine: ContractAddress = 0x4b3bfe81472b5a01dc3c1fba3456bb0979852deaca43da49d406189371d09e6.try_into().unwrap(); + let shrine: ContractAddress = core_deployment::deploy_shrine(admin); let flash_mint: ContractAddress = core_deployment::deploy_flash_mint(shrine); let sentinel: ContractAddress = core_deployment::deploy_sentinel(admin, shrine); let seer: ContractAddress = core_deployment::deploy_seer(admin, shrine, sentinel); @@ -112,6 +112,12 @@ fn main() { utils::set_yang_pair_id_for_oracle(pragma, eth, ETH_USD_PAIR_ID); utils::set_yang_pair_id_for_oracle(pragma, strk, STRK_USD_PAIR_ID); + // Peripheral deployment + println!("Deploying periphery contracts"); + let frontend_data_provider: ContractAddress = periphery_deployment::deploy_frontend_data_provider( + admin, shrine, sentinel + ); + println!("-------------------------------------------------\n"); println!("Abbot: {}", abbot); println!("Absorber: {}", absorber); @@ -120,6 +126,7 @@ fn main() { println!("Controller: {}", controller); println!("Equalizer: {}", equalizer); println!("Flash Mint: {}", flash_mint); + println!("Frontend Data Provider: {}", frontend_data_provider); println!("Gate[ETH]: {}", eth_gate); println!("Gate[STRK]: {}", strk_gate); println!("Pragma: {}", pragma); diff --git a/scripts/deploy/src/lib.cairo b/scripts/deploy/src/lib.cairo index 8346af562..50e2c3b2a 100644 --- a/scripts/deploy/src/lib.cairo +++ b/scripts/deploy/src/lib.cairo @@ -4,4 +4,5 @@ mod deploy_devnet; mod deploy_sepolia; pub mod mock_deployment; pub mod mock_utils; +pub mod periphery_deployment; pub mod utils; diff --git a/scripts/deploy/src/periphery_deployment.cairo b/scripts/deploy/src/periphery_deployment.cairo new file mode 100644 index 000000000..e8fb4ae0d --- /dev/null +++ b/scripts/deploy/src/periphery_deployment.cairo @@ -0,0 +1,29 @@ +use deployment::constants::MAX_FEE; +use sncast_std::{ + declare, DeclareResult, deploy, DeployResult, DisplayClassHash, DisplayContractAddress, invoke, InvokeResult, + ScriptCommandError +}; +use starknet::{ClassHash, ContractAddress}; + +// +// Deployment helpers +// + +pub fn deploy_frontend_data_provider( + admin: ContractAddress, shrine: ContractAddress, sentinel: ContractAddress +) -> ContractAddress { + let declare_frontend_data_provider = declare("frontend_data_provider", Option::Some(MAX_FEE), Option::None) + .expect('failed FDP declare'); + let frontend_data_provider_calldata: Array = array![admin.into(), shrine.into(), sentinel.into()]; + let deploy_frontend_data_provider = deploy( + declare_frontend_data_provider.class_hash, + frontend_data_provider_calldata, + Option::None, + true, + Option::Some(MAX_FEE), + Option::None + ) + .expect('failed FDP deploy'); + + deploy_frontend_data_provider.contract_address +} diff --git a/src/core/sentinel.cairo b/src/core/sentinel.cairo index 59ba2e660..74dd834e1 100644 --- a/src/core/sentinel.cairo +++ b/src/core/sentinel.cairo @@ -28,7 +28,7 @@ pub mod sentinel { // Helper constant to set the starting index for iterating over the // yangs in the order they were added - const LOOP_START: u64 = 1; + const LOOP_START: u32 = 1; // // Storage @@ -42,10 +42,10 @@ pub mod sentinel { // mapping between a yang address and our deployed Gate yang_to_gate: LegacyMap::, // length of the yang_addresses array - yang_addresses_count: u64, + yang_addresses_count: u32, // array of yang addresses added to the Shrine via this Sentinel // starts from index 1 - yang_addresses: LegacyMap::, + yang_addresses: LegacyMap::, // The Shrine associated with this Sentinel shrine: IShrineDispatcher, // mapping between a yang address and the cap on the yang's asset in the @@ -119,8 +119,8 @@ pub mod sentinel { } fn get_yang_addresses(self: @ContractState) -> Span { - let mut idx: u64 = LOOP_START; - let loop_end: u64 = self.yang_addresses_count.read() + LOOP_START; + let mut idx: u32 = LOOP_START; + let loop_end: u32 = self.yang_addresses_count.read() + LOOP_START; let mut addresses: Array = ArrayTrait::new(); loop { if idx == loop_end { @@ -131,11 +131,11 @@ pub mod sentinel { } } - fn get_yang_addresses_count(self: @ContractState) -> u64 { + fn get_yang_addresses_count(self: @ContractState) -> u32 { self.yang_addresses_count.read() } - fn get_yang(self: @ContractState, idx: u64) -> ContractAddress { + fn get_yang(self: @ContractState, idx: u32) -> ContractAddress { self.yang_addresses.read(idx) } @@ -190,7 +190,7 @@ pub mod sentinel { let gate = IGateDispatcher { contract_address: gate }; assert(gate.get_asset() == yang, 'SE: Asset of gate is not yang'); - let index: u64 = self.yang_addresses_count.read() + 1; + let index: u32 = self.yang_addresses_count.read() + 1; self.yang_addresses_count.write(index); self.yang_addresses.write(index, yang); self.yang_to_gate.write(yang, gate); diff --git a/src/core/shrine.cairo b/src/core/shrine.cairo index 2f5ed0dd9..a361ecf95 100644 --- a/src/core/shrine.cairo +++ b/src/core/shrine.cairo @@ -538,6 +538,46 @@ pub mod shrine { self.deposits.read((yang_id, trove_id)) } + // Returns an ordered array of the `YangBalance` struct for a trove's deposits. + // Starts from yang ID 1. + // Note that zero values are added to the return array because downstream + // computation assumes the full array of yangs. + fn get_trove_deposits(self: @ContractState, trove_id: u64) -> Span { + let mut yang_balances: Array = ArrayTrait::new(); + + let mut current_yang_id: u32 = START_YANG_IDX; + let loop_end: u32 = self.yangs_count.read() + START_YANG_IDX; + loop { + if current_yang_id == loop_end { + break yang_balances.span(); + } + + let deposited: Wad = self.deposits.read((current_yang_id, trove_id)); + yang_balances.append(YangBalance { yang_id: current_yang_id, amount: deposited }); + + current_yang_id += 1; + } + } + + // Returns an ordered array of the `YangBalance` struct for the total deposited yangs in the Shrine. + // Starts from yang ID 1. + fn get_shrine_deposits(self: @ContractState) -> Span { + let mut yang_balances: Array = ArrayTrait::new(); + + let mut current_yang_id: u32 = START_YANG_IDX; + let loop_end: u32 = self.yangs_count.read() + START_YANG_IDX; + loop { + if current_yang_id == loop_end { + break yang_balances.span(); + } + + let yang_total: Wad = self.yang_total.read(current_yang_id); + yang_balances.append(YangBalance { yang_id: current_yang_id, amount: yang_total }); + + current_yang_id += 1; + } + } + fn get_budget(self: @ContractState) -> SignedWad { self.budget.read() } @@ -1410,46 +1450,6 @@ pub mod shrine { } } - // Returns an ordered array of the `YangBalance` struct for a trove's deposits. - // Starts from yang ID 1. - // Note that zero values are added to the return array because downstream - // computation assumes the full array of yangs. - fn get_trove_deposits(self: @ContractState, trove_id: u64) -> Span { - let mut yang_balances: Array = ArrayTrait::new(); - - let mut current_yang_id: u32 = START_YANG_IDX; - let loop_end: u32 = self.yangs_count.read() + START_YANG_IDX; - loop { - if current_yang_id == loop_end { - break yang_balances.span(); - } - - let deposited: Wad = self.deposits.read((current_yang_id, trove_id)); - yang_balances.append(YangBalance { yang_id: current_yang_id, amount: deposited }); - - current_yang_id += 1; - } - } - - // Returns an ordered array of the `YangBalance` struct for the total deposited yangs in the Shrine. - // Starts from yang ID 1. - fn get_shrine_deposits(self: @ContractState) -> Span { - let mut yang_balances: Array = ArrayTrait::new(); - - let mut current_yang_id: u32 = START_YANG_IDX; - let loop_end: u32 = self.yangs_count.read() + START_YANG_IDX; - loop { - if current_yang_id == loop_end { - break yang_balances.span(); - } - - let yang_total: Wad = self.yang_total.read(current_yang_id); - yang_balances.append(YangBalance { yang_id: current_yang_id, amount: yang_total }); - - current_yang_id += 1; - } - } - // Returns a tuple of: // 1. the custom threshold (maximum LTV before liquidation) // 2. the total value of the yangs, at a given interval diff --git a/src/interfaces/ISentinel.cairo b/src/interfaces/ISentinel.cairo index e1ccef011..ae2181faa 100644 --- a/src/interfaces/ISentinel.cairo +++ b/src/interfaces/ISentinel.cairo @@ -7,8 +7,8 @@ pub trait ISentinel { fn get_gate_address(self: @TContractState, yang: ContractAddress) -> ContractAddress; fn get_gate_live(self: @TContractState, yang: ContractAddress) -> bool; fn get_yang_addresses(self: @TContractState) -> Span; - fn get_yang_addresses_count(self: @TContractState) -> u64; - fn get_yang(self: @TContractState, idx: u64) -> ContractAddress; + fn get_yang_addresses_count(self: @TContractState) -> u32; + fn get_yang(self: @TContractState, idx: u32) -> ContractAddress; fn get_yang_asset_max(self: @TContractState, yang: ContractAddress) -> u128; fn get_asset_amt_per_yang(self: @TContractState, yang: ContractAddress) -> Wad; // external diff --git a/src/interfaces/IShrine.cairo b/src/interfaces/IShrine.cairo index 665ac407c..908bdb29d 100644 --- a/src/interfaces/IShrine.cairo +++ b/src/interfaces/IShrine.cairo @@ -13,6 +13,8 @@ pub trait IShrine { fn get_protocol_owned_troves_debt(self: @TContractState) -> Wad; fn get_yangs_count(self: @TContractState) -> u32; fn get_deposit(self: @TContractState, yang: ContractAddress, trove_id: u64) -> Wad; + fn get_trove_deposits(self: @TContractState, trove_id: u64) -> Span; + fn get_shrine_deposits(self: @TContractState) -> Span; fn get_budget(self: @TContractState) -> SignedWad; fn get_yang_price(self: @TContractState, yang: ContractAddress, interval: u64) -> (Wad, Wad); fn get_yang_rate(self: @TContractState, yang: ContractAddress, rate_era: u64) -> Ray; diff --git a/src/lib.cairo b/src/lib.cairo index 447eae70b..b516ce88c 100644 --- a/src/lib.cairo +++ b/src/lib.cairo @@ -53,6 +53,14 @@ pub mod utils { pub mod exp; pub mod math; pub mod reentrancy_guard; + pub mod upgradeable; +} + +mod periphery { + pub mod frontend_data_provider; + pub mod interfaces; + pub mod roles; + pub mod types; } // mock used for local devnet deployment diff --git a/src/periphery/frontend_data_provider.cairo b/src/periphery/frontend_data_provider.cairo new file mode 100644 index 000000000..231502f0d --- /dev/null +++ b/src/periphery/frontend_data_provider.cairo @@ -0,0 +1,213 @@ +#[starknet::contract] +pub mod frontend_data_provider { + use access_control::access_control_component; + use opus::interfaces::IGate::{IGateDispatcher, IGateDispatcherTrait}; + use opus::interfaces::ISentinel::{ISentinelDispatcher, ISentinelDispatcherTrait}; + use opus::interfaces::IShrine::{IShrineDispatcher, IShrineDispatcherTrait}; + use opus::periphery::interfaces::IFrontendDataProvider; + use opus::periphery::roles::frontend_data_provider_roles; + use opus::periphery::types::{RecoveryModeInfo, ShrineAssetInfo, TroveAssetInfo, YinInfo}; + use opus::types::{Health, YangBalance}; + use opus::utils::upgradeable::{IUpgradeable, upgradeable_component}; + use starknet::{ClassHash, ContractAddress}; + use wadray::{Ray, Wad}; + + // + // Components + // + + component!(path: access_control_component, storage: access_control, event: AccessControlEvent); + + #[abi(embed_v0)] + impl AccessControlPublic = access_control_component::AccessControl; + impl AccessControlHelpers = access_control_component::AccessControlHelpers; + + component!(path: upgradeable_component, storage: upgradeable, event: UpgradeableEvent); + + impl UpgradeableHelpers = upgradeable_component::UpgradeableHelpers; + + // + // Storage + // + + #[storage] + struct Storage { + // components + #[substorage(v0)] + access_control: access_control_component::Storage, + #[substorage(v0)] + upgradeable: upgradeable_component::Storage, + sentinel: ISentinelDispatcher, + shrine: IShrineDispatcher, + } + + // + // Events + // + + #[event] + #[derive(Copy, Drop, starknet::Event, PartialEq)] + pub enum Event { + AccessControlEvent: access_control_component::Event, + UpgradeableEvent: upgradeable_component::Event, + } + + // + // Constructor + // + + #[constructor] + fn constructor( + ref self: ContractState, admin: ContractAddress, shrine: ContractAddress, sentinel: ContractAddress + ) { + self.access_control.initializer(admin, Option::Some(frontend_data_provider_roles::default_admin_role())); + self.shrine.write(IShrineDispatcher { contract_address: shrine }); + self.sentinel.write(ISentinelDispatcher { contract_address: sentinel }); + } + + // + // Upgradeable + // + + #[abi(embed_v0)] + impl IUpgradeableImpl of IUpgradeable { + fn upgrade(ref self: ContractState, new_class_hash: ClassHash) { + self.access_control.assert_has_role(frontend_data_provider_roles::UPGRADE); + self.upgradeable.upgrade(new_class_hash); + } + } + + // + // External functions + // + + #[abi(embed_v0)] + impl IFrontendDataProviderImpl of IFrontendDataProvider { + fn get_yin_info(self: @ContractState) -> YinInfo { + let shrine: IShrineDispatcher = self.shrine.read(); + + YinInfo { + spot_price: shrine.get_yin_spot_price(), + total_supply: shrine.get_total_yin(), + ceiling: shrine.get_debt_ceiling(), + } + } + + fn get_recovery_mode_info(self: @ContractState) -> RecoveryModeInfo { + let shrine: IShrineDispatcher = self.shrine.read(); + let shrine_health: Health = shrine.get_shrine_health(); + + let target_factor: Ray = shrine.get_recovery_mode_target_factor(); + let buffer_factor: Ray = shrine.get_recovery_mode_buffer_factor(); + let target_ltv: Ray = target_factor * shrine_health.threshold; + let buffer_ltv: Ray = (target_factor + buffer_factor) * shrine_health.threshold; + + RecoveryModeInfo { is_recovery_mode: shrine.is_recovery_mode(), target_ltv, buffer_ltv } + } + + // Returns an ordered array of TroveAssetInfo struct for a trove + fn get_trove_assets_info(self: @ContractState, trove_id: u64) -> Span { + let shrine: IShrineDispatcher = self.shrine.read(); + let sentinel: ISentinelDispatcher = self.sentinel.read(); + + let mut trove_yang_balances: Span = shrine.get_trove_deposits(trove_id); + let mut yang_addresses: Span = sentinel.get_yang_addresses(); + + assert(trove_yang_balances.len() == yang_addresses.len(), 'FDP: Length mismatch'); + + let mut asset_infos: Array = ArrayTrait::new(); + let current_rate_era: u64 = shrine.get_current_rate_era(); + loop { + match trove_yang_balances.pop_front() { + Option::Some(yang_balance) => { + let yang: ContractAddress = *yang_addresses.pop_front().unwrap(); + assert(sentinel.get_yang(*yang_balance.yang_id) == yang, 'FDP: Address mismatch'); + + let (shrine_asset_info, yang_price) = self + .get_shrine_asset_info_helper( + shrine, sentinel, yang, *yang_balance.amount, current_rate_era + ); + + let asset_amt: u128 = sentinel.convert_to_assets(yang, *yang_balance.amount); + let trove_asset_info = TroveAssetInfo { + shrine_asset_info, amount: asset_amt, value: *yang_balance.amount * yang_price, + }; + asset_infos.append(trove_asset_info); + }, + Option::None => { break asset_infos.span(); } + } + } + } + + // Returns an ordered array of ShrineAssetInfo struct for the Shrine + fn get_shrine_assets_info(self: @ContractState) -> Span { + let shrine: IShrineDispatcher = self.shrine.read(); + let sentinel: ISentinelDispatcher = self.sentinel.read(); + + let mut shrine_yang_balances: Span = shrine.get_shrine_deposits(); + let mut yang_addresses: Span = sentinel.get_yang_addresses(); + + assert(shrine_yang_balances.len() == yang_addresses.len(), 'FDP: Length mismatch'); + + let mut asset_infos: Array = ArrayTrait::new(); + let current_rate_era: u64 = shrine.get_current_rate_era(); + loop { + match shrine_yang_balances.pop_front() { + Option::Some(yang_balance) => { + let yang: ContractAddress = *yang_addresses.pop_front().unwrap(); + assert(sentinel.get_yang(*yang_balance.yang_id) == yang, 'FDP: Address mismatch'); + + let (shrine_asset_info, _) = self + .get_shrine_asset_info_helper( + shrine, sentinel, yang, *yang_balance.amount, current_rate_era + ); + asset_infos.append(shrine_asset_info); + }, + Option::None => { break asset_infos.span(); } + } + } + } + } + + // + // Internal functions + // + + #[generate_trait] + impl FrontendDataProviderHelpers of FrontendDataProviderHelpersTrait { + // Helper function to generate a ShrineAssetInfo struct for a yang. + // Returns a tuple of a ShrineAssetInfo struct and the yang price + fn get_shrine_asset_info_helper( + self: @ContractState, + shrine: IShrineDispatcher, + sentinel: ISentinelDispatcher, + yang: ContractAddress, + yang_amt: Wad, + current_rate_era: u64 + ) -> (ShrineAssetInfo, Wad) { + let gate = IGateDispatcher { contract_address: sentinel.get_gate_address(yang) }; + let deposited: u128 = gate.get_total_assets(); + + let (yang_price, _, _) = shrine.get_current_yang_price(yang); + let yang_value: Wad = yang_amt * yang_price; + let asset_price: Wad = yang_value / deposited.into(); + + let threshold: Ray = shrine.get_yang_threshold(yang); + let base_rate: Ray = shrine.get_yang_rate(yang, current_rate_era); + let ceiling: u128 = sentinel.get_yang_asset_max(yang); + + ( + ShrineAssetInfo { + address: yang, + price: asset_price, + threshold, + base_rate, + deposited, + ceiling, + deposited_value: yang_value + }, + yang_price + ) + } + } +} diff --git a/src/periphery/interfaces.cairo b/src/periphery/interfaces.cairo new file mode 100644 index 000000000..31f9b5b24 --- /dev/null +++ b/src/periphery/interfaces.cairo @@ -0,0 +1,12 @@ +use opus::periphery::types::{RecoveryModeInfo, ShrineAssetInfo, TroveAssetInfo, YinInfo}; +use starknet::ContractAddress; +use wadray::Wad; + +#[starknet::interface] +pub trait IFrontendDataProvider { + // getters + fn get_yin_info(self: @TContractState) -> YinInfo; + fn get_recovery_mode_info(self: @TContractState) -> RecoveryModeInfo; + fn get_trove_assets_info(self: @TContractState, trove_id: u64) -> Span; + fn get_shrine_assets_info(self: @TContractState) -> Span; +} diff --git a/src/periphery/roles.cairo b/src/periphery/roles.cairo new file mode 100644 index 000000000..814e289a7 --- /dev/null +++ b/src/periphery/roles.cairo @@ -0,0 +1,7 @@ +pub mod frontend_data_provider_roles { + pub const UPGRADE: u128 = 1; + + pub fn default_admin_role() -> u128 { + UPGRADE + } +} diff --git a/src/periphery/types.cairo b/src/periphery/types.cairo new file mode 100644 index 000000000..68cbda8bb --- /dev/null +++ b/src/periphery/types.cairo @@ -0,0 +1,36 @@ +use starknet::ContractAddress; +use wadray::{Ray, Wad}; + + +#[derive(Copy, Debug, Drop, Serde)] +pub struct YinInfo { + pub spot_price: Wad, // Spot price of yin + pub total_supply: Wad, // Total supply of yin + pub ceiling: Wad, // Maximum amount of yin allowed +} + +#[derive(Copy, Debug, Drop, Serde)] +pub struct RecoveryModeInfo { + pub is_recovery_mode: bool, + pub target_ltv: Ray, // Recovery mode is triggered once Shrine's LTV exceeds this + pub buffer_ltv: Ray, // Thresholds are scaled once Shrine's LTV exceeds this +} + +#[derive(Copy, Debug, Drop, Serde)] +pub struct TroveAssetInfo { + pub shrine_asset_info: ShrineAssetInfo, + pub amount: u128, // Amount of the yang's asset in the asset's decimals for the trove + pub value: Wad, // Value of the yang in the trove +} + +#[derive(Copy, Debug, Drop, Serde)] +pub struct ShrineAssetInfo { + pub address: ContractAddress, // Address of the yang's ERC-20 asset + pub price: Wad, // Price of the yang's asset + pub threshold: Ray, // Base threshold of the yang + pub base_rate: Ray, // Base rate of the yang + pub deposited: u128, // Amount of yang's asset in the asset's decimals deposited in Shrine + pub ceiling: u128, // Maximum amount of yang's asset in Shrine + pub deposited_value: Wad // Value of yang deposited in Shrine +} + diff --git a/src/utils/upgradeable.cairo b/src/utils/upgradeable.cairo new file mode 100644 index 000000000..36d1cec26 --- /dev/null +++ b/src/utils/upgradeable.cairo @@ -0,0 +1,41 @@ +// With reference to OpenZeppelin's cairo-contracts +// https://github.com/OpenZeppelin/cairo-contracts/blob/main/src/upgrades/upgradeable.cairo + +use starknet::ClassHash; + +#[starknet::interface] +pub trait IUpgradeable { + fn upgrade(ref self: TContractState, new_class_hash: ClassHash); +} + +#[starknet::component] +pub mod upgradeable_component { + use core::num::traits::Zero; + use starknet::syscalls::replace_class_syscall; + use starknet::{ClassHash, SyscallResultTrait}; + + #[storage] + struct Storage {} + + #[event] + #[derive(Copy, Drop, PartialEq, starknet::Event)] + pub enum Event { + Upgraded: Upgraded + } + + #[derive(Copy, Drop, PartialEq, starknet::Event)] + pub struct Upgraded { + class_hash: ClassHash + } + + #[generate_trait] + pub impl UpgradeableHelpers< + TContractState, +HasComponent + > of UpgradeableHelpersTrait { + fn upgrade(ref self: ComponentState, new_class_hash: ClassHash) { + assert(!new_class_hash.is_zero(), 'Class hash cannot be zero'); + replace_class_syscall(new_class_hash).unwrap_syscall(); + self.emit(Upgraded { class_hash: new_class_hash }); + } + } +}