Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: update creditclock to facet #813

Merged
merged 3 commits into from
Oct 24, 2023
Merged

refactor: update creditclock to facet #813

merged 3 commits into from
Oct 24, 2023

Conversation

molecula451
Copy link
Member

@molecula451 molecula451 commented Oct 8, 2023

Resolves #772

CreditClock.t.sol

 [68668] CreditClockFacetTest::testSetRatePerBlock_Default() 
    ├─ [0] VM::prank(Admin: [0x2B5AD5c4795c026514f8317c7a215E218DcCD6cF]) 
    │   └─ ← ()
    ├─ [58400] Diamond::setRatePerBlock(0x00000000000000000000000000000000) 
    │   ├─ [53410] CreditClockFacet::setRatePerBlock(0x00000000000000000000000000000000) [delegatecall]
    │   │   ├─ emit SetRatePerBlock(rateStartBlock: 1, rateStartValue: 0x7fff8000000000000000000000000000, ratePerBlock: 0x00000000000000000000000000000000)
    │   │   └─ ← ()
    │   └─ ← ()
    └─ ← ()

Normal because this one it's being introduced as a lib in this PR

https://github.com/ubiquity/ubiquity-dollar/actions/runs/6447528063/job/17503896857?pr=813

look this call:

[58400] Diamond::setRatePerBlock(0x00000000000000000000000000000000)

{
      "hash": "0x656fbfc79610ba67fc5c885429f11031146993cd46214d2e3113533b521c30b0",
      "transactionType": "CREATE",
      "contractName": "CreditClockFacet",
      "contractAddress": "0x7f7A6fA77E3De3e90be433834f23E24214bbe3C8",
      "function": null,
      "arguments": null,
      "transaction": {
        "type": "0x02",
        "from": "0xa18e35a6e821aadc80afd132ffa72879f999f2fc",
        "gas": "0x33f84d",
        "value": "0x0",
        "data": "0x608060405234801561001057600080fd5b50612f34806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80635776409414610051578063bf55cd6914610066578063d0ebdbe714610079578063d50095841461008c575b600080fd5b61006461005f366004612dd5565b6100bd565b005b610064610074366004612dee565b6100ca565b610064610087366004612e30565b61014c565b6100946101c6565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100c6816101d5565b5050565b6100d56000336103dc565b610140576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4d616e616765723a2043616c6c6572206973206e6f742061646d696e0000000060448201526064015b60405180910390fd5b61014981610408565b50565b6101576000336103dc565b6101bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4d616e616765723a2043616c6c6572206973206e6f742061646d696e000000006044820152606401610137565b610149816104be565b60006101d061050d565b905090565b6000806101e0610533565b9050826000036101f257439250610282565b43831015610282576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f437265646974436c6f636b3a20626c6f636b206e756d626572206d757374206e60448201527f6f7420626520696e2074686520706173742e00000000000000000000000000006064820152608401610137565b600281015460038201546103d5916103a5916103759161034e9161030e916102e7917fffffffffffffffffffffffffffffffff00000000000000000000000000000000608091821b16917001000000000000000000000000000000009004901b610561565b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000016610b4c565b6103268660010154896103219190612e66565b610e01565b7fffffffffffffffffffffffffffffffff000000000000000000000000000000001690610e6f565b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000016611296565b600384015460801b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000016906128a1565b600283015460801b7fffffffffffffffffffffffffffffffff000000000000000000000000000000001690610e6f565b9392505050565b60006103ff826103ea612cc8565b60008681526020919091526040902090612cf6565b90505b92915050565b6000610412610533565b905061041d436101d5565b4360018301819055608091821c70010000000000000000000000000000000085841c81029190911760028501819055604080519384527fffffffffffffffffffffffffffffffff0000000000000000000000000000000082861b811660208601529290910490931b16918101919091527f2a888d68449437a913e711ed7752edf8edbeff71a954fc42d427c87cca1817199060600160405180910390a15050565b806104c7610533565b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6000610517610533565b5473ffffffffffffffffffffffffffffffffffffffff16919050565b60008061040260017f376b565b24ab91d9304d6e315a895f041c5ac57fe7d11efd078145adc56d43dd612e66565b6000617fff60f084811c8216919084901c8116908290036105f05780617fff036105e6577fffffffffffffffffffffffffffffffff00000000000000000000000000000000808516908616036105bb578492505050610402565b507f7fff80000000000000000000000000000000000000000000000000000000000091506104029050565b8492505050610402565b80617fff03610603578392505050610402565b6f80000000000000000000000000000000608086901c90811015906dffffffffffffffffffffffffffff1660008490036106405760019350610652565b6e010000000000000000000000000000175b6f80000000000000000000000000000000608087901c90811015906dffffffffffffffffffffffffffff16600085900361068f57600194506106a1565b6e010000000000000000000000000000175b82600003610708577fffffffffffffffffffffffffffffffff0000000000000000000000000000000088167f8000000000000000000000000000000000000000000000000000000000000000146106f857876106fb565b60005b9650505050505050610402565b8060000361075f577fffffffffffffffffffffffffffffffff0000000000000000000000000000000089167f8000000000000000000000000000000000000000000000000000000000000000146106f857886106fb565b848603821515851515036108eb5760708113156107855789975050505050505050610402565b60008113156107975790811c906107e4565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff908112156107ce5788975050505050505050610402565b60008112156107e4578060000384901c93508596505b928101926e020000000000000000000000000000841061080a576001968701969390931c925b86617fff0361086e578461083e577f7fff000000000000000000000000000000000000000000000000000000000000610860565b7fffff0000000000000000000000000000000000000000000000000000000000005b975050505050505050610402565b6e01000000000000000000000000000084101561088e57600096506108a2565b6dffffffffffffffffffffffffffff841693505b83607088901b866108b45760006108c6565b6f800000000000000000000000000000005b6fffffffffffffffffffffffffffffffff16171760801b975050505050505050610402565b600081131561090657600184901b935060018703965061091d565b600081121561091d57600182901b91506001860396505b607081131561092f57600191506109b8565b600181131561094c576001810360018303901c60010191506109b8565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9081121561097d57600193506109b8565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8112156109b8576001816000030360018503901c60010193505b8184106109c95781840393506109d2565b83820393508294505b836000036109eb57506000965061040295505050505050565b60006109f685612d25565b905080607103610a2257600185901c6dffffffffffffffffffffffffffff169450600188019750610a9d565b6070811015610a8957607081900380891115610a58578086901b6dffffffffffffffffffffffffffff1695508089039850610a83565b6000987fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019590951b945b50610a9d565b6dffffffffffffffffffffffffffff851694505b87617fff03610b025785610ad1577f7fff000000000000000000000000000000000000000000000000000000000000610af3565b7fffff0000000000000000000000000000000000000000000000000000000000005b98505050505050505050610402565b84607089901b87610b14576000610b26565b6f800000000000000000000000000000005b6fffffffffffffffffffffffffffffffff16171760801b98505050505050505050610402565b60006f80000000000000000000000000000000608083901c1115610b9157507f7fff800000000000000000000000000000000000000000000000000000000000919050565b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000082167f3fff00000000000000000000000000000000000000000000000000000000000003610be257506000919050565b617fff60f083901c811690819003610bfb575090919050565b6dffffffffffffffffffffffffffff608084901c166000829003610c225760019150610c34565b6e010000000000000000000000000000175b80600003610c6557507fffff0000000000000000000000000000000000000000000000000000000000009392505050565b600061406f81613fff8510610ca85750600f9290921b91600091507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0018401610cf2565b600192506e0100000000000000000000000000008410610cd55784613ffe039050600f84901b9350610cf2565b6000610ce085612d25565b607f8190039590951b9461406d039150505b836f8000000000000000000000000000000003610d34578215610d13576001015b6000610d1e82612d25565b60700390508082901b9150808303925050610dab565b600083610d42576000610d45565b60015b60ff1690505b6e010000000000000000000000000000821015610da95793800260ff81901c607f81019190911c947fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff939093019260019290921b9082180190610d4b565b505b806dffffffffffffffffffffffffffff16607083901b84610dcd576000610ddf565b6f800000000000000000000000000000005b6fffffffffffffffffffffffffffffffff16171760801b979650505050505050565b600081600003610e1357506000919050565b816000610e1f82612d25565b90506070811015610e38578060700382901b9150610e4b565b6070811115610e4b576070810382901c91505b613fff0160701b6dffffffffffffffffffffffffffff919091161760801b92915050565b6000617fff60f084811c8216919084901c811690829003610fc45780617fff03610f42577fffffffffffffffffffffffffffffffff0000000000000000000000000000000080851690861603610eec575050507f800000000000000000000000000000000000000000000000000000000000000081168218610402565b7fffffffffffffffffffffffffffffffff00000000000000000000000000000000858518167f8000000000000000000000000000000000000000000000000000000000000000036105bb57505050818117610402565b7f7fffffffffffffffffffffffffffffff000000000000000000000000000000008416600003610f9757507f7fff80000000000000000000000000000000000000000000000000000000000091506104029050565b5050507f800000000000000000000000000000000000000000000000000000000000000081168218610402565b80617fff0361104f577f7fffffffffffffffffffffffffffffff00000000000000000000000000000000851660000361102257507f7fff80000000000000000000000000000000000000000000000000000000000091506104029050565b5050507f800000000000000000000000000000000000000000000000000000000000000082168118610402565b6dffffffffffffffffffffffffffff608086901c1660008390036110765760019250611088565b6e010000000000000000000000000000175b6dffffffffffffffffffffffffffff608086901c1660008390036110af57600192506110c1565b6e010000000000000000000000000000175b80820291508160000361112b577f8000000000000000000000000000000000000000000000000000000000000000878718166110fe576000611120565b7f80000000000000000000000000000000000000000000000000000000000000005b945050505050610402565b9282019260007c0200000000000000000000000000000000000000000000000000000000831015611190577c01000000000000000000000000000000000000000000000000000000008310156111895761118483612d25565b611193565b60e0611193565b60e15b905061407081860110156111ae576000945060009250611252565b6140e081860110156111f1576140708510156111d357846140700383901c92506111e8565b6140708511156111e857614070850383901b92505b60009450611252565b61c0dd818601111561120b57617fff945060009250611252565b6070811115611222576070810383901c9250611235565b6070811015611235578060700383901b92505b6dffffffffffffffffffffffffffff831692506140df8186010394505b82607086901b888a186f8000000000000000000000000000000060801b1660801c6fffffffffffffffffffffffffffffffff16171760801b95505050505050610402565b60006f80000000000000000000000000000000608083901c90811190617fff60f085901c8116916dffffffffffffffffffffffffffff1690821480156112db57508015155b1561130a57507f7fff800000000000000000000000000000000000000000000000000000000000949350505050565b61400d82111561134b578261133f577f7fff000000000000000000000000000000000000000000000000000000000000611342565b60005b95945050505050565b613f7f82101561137f57507f3fff000000000000000000000000000000000000000000000000000000000000949350505050565b8160000361139057600191506113a2565b6e010000000000000000000000000000175b613fef8211156113d5577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc01182011b6113e7565b613fef8210156113e757613fef8290031c5b828015611405575071406e0000000000000000000000000000000081115b1561141557506000949350505050565b821580156114345750713fffffffffffffffffffffffffffffffffff81115b1561146357507f7fff000000000000000000000000000000000000000000000000000000000000949350505050565b6fffffffffffffffffffffffffffffffff81169060801c83801561148657508115155b15611492579019906001015b6f80000000000000000000000000000000828116156114c25770016a09e667f3bcc908b2fb1366ea957d3e0260801c5b6f400000000000000000000000000000008316156114f1577001306fe0a31b7152de8d5a46305c85edec0260801c5b6f20000000000000000000000000000000831615611520577001172b83c7d517adcdf7c8c50eb14a791f0260801c5b6f1000000000000000000000000000000083161561154f5770010b5586cf9890f6298b92b71842a983630260801c5b6f0800000000000000000000000000000083161561157e577001059b0d31585743ae7c548eb68ca417fd0260801c5b6f040000000000000000000000000000008316156115ad57700102c9a3e778060ee6f7caca4f7a29bde80260801c5b6f020000000000000000000000000000008316156115dc5770010163da9fb33356d84a66ae336dcdfa3f0260801c5b6f0100000000000000000000000000000083161561160b57700100b1afa5abcbed6129ab13ec11dc95430260801c5b6e8000000000000000000000000000008316156116395770010058c86da1c09ea1ff19d294cf2f679b0260801c5b6e400000000000000000000000000000831615611667577001002c605e2e8cec506d21bfc89a23a00f0260801c5b6e20000000000000000000000000000083161561169557700100162f3904051fa128bca9c55c31e5df0260801c5b6e1000000000000000000000000000008316156116c3577001000b175effdc76ba38e31671ca9397250260801c5b6e0800000000000000000000000000008316156116f157700100058ba01fb9f96d6cacd4b180917c3d0260801c5b6e04000000000000000000000000000083161561171f5770010002c5cc37da9491d0985c348c68e7b30260801c5b6e02000000000000000000000000000083161561174d577001000162e525ee054754457d59952920260260801c5b6e01000000000000000000000000000083161561177b5770010000b17255775c040618bf4a4ade83fc0260801c5b6d80000000000000000000000000008316156117a8577001000058b91b5bc9ae2eed81e9b7d4cfab0260801c5b6d40000000000000000000000000008316156117d557700100002c5c89d5ec6ca4d7c8acc017b7c90260801c5b6d20000000000000000000000000008316156118025770010000162e43f4f831060e02d839a9d16d0260801c5b6d100000000000000000000000000083161561182f57700100000b1721bcfc99d9f890ea069117630260801c5b6d080000000000000000000000000083161561185c5770010000058b90cf1e6d97f9ca14dbcc16280260801c5b6d0400000000000000000000000000831615611889577001000002c5c863b73f016468f6bac5ca2b0260801c5b6d02000000000000000000000000008316156118b657700100000162e430e5a18f6119e3c02282a50260801c5b6d01000000000000000000000000008316156118e3577001000000b1721835514b86e6d96efd1bfe0260801c5b6c8000000000000000000000000083161561190f57700100000058b90c0b48c6be5df846c5b2ef0260801c5b6c4000000000000000000000000083161561193b5770010000002c5c8601cc6b9e94213c72737a0260801c5b6c20000000000000000000000000831615611967577001000000162e42fff037df38aa2b219f060260801c5b6c100000000000000000000000008316156119935770010000000b17217fba9c739aa5819f44f90260801c5b6c080000000000000000000000008316156119bf577001000000058b90bfcdee5acd3c1cedc8230260801c5b6c040000000000000000000000008316156119eb57700100000002c5c85fe31f35a6a30da1be500260801c5b6c02000000000000000000000000831615611a175770010000000162e42ff0999ce3541b9fffcf0260801c5b6c01000000000000000000000000831615611a4357700100000000b17217f80f4ef5aadda455540260801c5b6b800000000000000000000000831615611a6e5770010000000058b90bfbf8479bd5a81b51ad0260801c5b6b400000000000000000000000831615611a99577001000000002c5c85fdf84bd62ae30a74cc0260801c5b6b200000000000000000000000831615611ac457700100000000162e42fefb2fed257559bdaa0260801c5b6b100000000000000000000000831615611aef577001000000000b17217f7d5a7716bba4a9ae0260801c5b6b080000000000000000000000831615611b1a57700100000000058b90bfbe9ddbac5e109cce0260801c5b6b040000000000000000000000831615611b455770010000000002c5c85fdf4b15de6f17eb0d0260801c5b6b020000000000000000000000831615611b70577001000000000162e42fefa494f1478fde050260801c5b6b010000000000000000000000831615611b9b5770010000000000b17217f7d20cf927c8e94c0260801c5b6a8000000000000000000000831615611bc5577001000000000058b90bfbe8f71cb4e4b33d0260801c5b6a4000000000000000000000831615611bef57700100000000002c5c85fdf477b662b269450260801c5b6a2000000000000000000000831615611c195770010000000000162e42fefa3ae53369388c0260801c5b6a1000000000000000000000831615611c4357700100000000000b17217f7d1d351a389d400260801c5b6a0800000000000000000000831615611c6d5770010000000000058b90bfbe8e8b2d3d4ede0260801c5b6a0400000000000000000000831615611c97577001000000000002c5c85fdf4741bea6e77e0260801c5b6a0200000000000000000000831615611cc157700100000000000162e42fefa39fe95583c20260801c5b6a0100000000000000000000831615611ceb577001000000000000b17217f7d1cfb72b45e10260801c5b6980000000000000000000831615611d1457700100000000000058b90bfbe8e7cc35c3f00260801c5b6940000000000000000000831615611d3d5770010000000000002c5c85fdf473e242ea380260801c5b6920000000000000000000831615611d66577001000000000000162e42fefa39f02b772c0260801c5b6910000000000000000000831615611d8f5770010000000000000b17217f7d1cf7d83c1a0260801c5b6908000000000000000000831615611db8577001000000000000058b90bfbe8e7bdcbe2e0260801c5b6904000000000000000000831615611de157700100000000000002c5c85fdf473dea871f0260801c5b6902000000000000000000831615611e0a5770010000000000000162e42fefa39ef44d910260801c5b6901000000000000000000831615611e3357700100000000000000b17217f7d1cf79e9490260801c5b68800000000000000000831615611e5b5770010000000000000058b90bfbe8e7bce5440260801c5b68400000000000000000831615611e83577001000000000000002c5c85fdf473de6eca0260801c5b68200000000000000000831615611eab57700100000000000000162e42fefa39ef366f0260801c5b68100000000000000000831615611ed3577001000000000000000b17217f7d1cf79afa0260801c5b68080000000000000000831615611efb57700100000000000000058b90bfbe8e7bcd6d0260801c5b68040000000000000000831615611f235770010000000000000002c5c85fdf473de6b20260801c5b68020000000000000000831615611f4b577001000000000000000162e42fefa39ef3580260801c5b68010000000000000000831615611f735770010000000000000000b17217f7d1cf79ab0260801c5b678000000000000000831615611f9a577001000000000000000058b90bfbe8e7bcd50260801c5b674000000000000000831615611fc157700100000000000000002c5c85fdf473de6a0260801c5b672000000000000000831615611fe85770010000000000000000162e42fefa39ef340260801c5b67100000000000000083161561200f57700100000000000000000b17217f7d1cf7990260801c5b6708000000000000008316156120365770010000000000000000058b90bfbe8e7bcc0260801c5b67040000000000000083161561205d577001000000000000000002c5c85fdf473de50260801c5b67020000000000000083161561208457700100000000000000000162e42fefa39ef20260801c5b6701000000000000008316156120ab577001000000000000000000b17217f7d1cf780260801c5b66800000000000008316156120d157700100000000000000000058b90bfbe8e7bb0260801c5b66400000000000008316156120f75770010000000000000000002c5c85fdf473dd0260801c5b662000000000000083161561211d577001000000000000000000162e42fefa39ee0260801c5b66100000000000008316156121435770010000000000000000000b17217f7d1cf60260801c5b6608000000000000831615612169577001000000000000000000058b90bfbe8e7a0260801c5b660400000000000083161561218f57700100000000000000000002c5c85fdf473c0260801c5b66020000000000008316156121b55770010000000000000000000162e42fefa39d0260801c5b66010000000000008316156121db57700100000000000000000000b17217f7d1ce0260801c5b658000000000008316156122005770010000000000000000000058b90bfbe8e60260801c5b65400000000000831615612225577001000000000000000000002c5c85fdf4720260801c5b6520000000000083161561224a57700100000000000000000000162e42fefa380260801c5b6510000000000083161561226f577001000000000000000000000b17217f7d1b0260801c5b6508000000000083161561229457700100000000000000000000058b90bfbe8d0260801c5b650400000000008316156122b95770010000000000000000000002c5c85fdf460260801c5b650200000000008316156122de577001000000000000000000000162e42fefa20260801c5b650100000000008316156123035770010000000000000000000000b17217f7d00260801c5b648000000000831615612327577001000000000000000000000058b90bfbe70260801c5b64400000000083161561234b57700100000000000000000000002c5c85fdf30260801c5b64200000000083161561236f5770010000000000000000000000162e42fef90260801c5b64100000000083161561239357700100000000000000000000000b17217f7c0260801c5b6408000000008316156123b75770010000000000000000000000058b90bfbd0260801c5b6404000000008316156123db577001000000000000000000000002c5c85fde0260801c5b6402000000008316156123ff57700100000000000000000000000162e42fee0260801c5b640100000000831615612423577001000000000000000000000000b17217f60260801c5b638000000083161561244657700100000000000000000000000058b90bfa0260801c5b63400000008316156124695770010000000000000000000000002c5c85fc0260801c5b632000000083161561248c577001000000000000000000000000162e42fd0260801c5b63100000008316156124af5770010000000000000000000000000b17217e0260801c5b63080000008316156124d2577001000000000000000000000000058b90be0260801c5b63040000008316156124f557700100000000000000000000000002c5c85e0260801c5b63020000008316156125185770010000000000000000000000000162e42e0260801c5b630100000083161561253b57700100000000000000000000000000b172160260801c5b6280000083161561255d5770010000000000000000000000000058b90a0260801c5b6240000083161561257f577001000000000000000000000000002c5c840260801c5b622000008316156125a157700100000000000000000000000000162e410260801c5b621000008316156125c3577001000000000000000000000000000b17200260801c5b620800008316156125e557700100000000000000000000000000058b8f0260801c5b620400008316156126075770010000000000000000000000000002c5c70260801c5b62020000831615612629577001000000000000000000000000000162e30260801c5b6201000083161561264b5770010000000000000000000000000000b1710260801c5b61800083161561266c577001000000000000000000000000000058b80260801c5b61400083161561268d57700100000000000000000000000000002c5b0260801c5b6120008316156126ae5770010000000000000000000000000000162d0260801c5b6110008316156126cf57700100000000000000000000000000000b160260801c5b6108008316156126f05770010000000000000000000000000000058a0260801c5b610400831615612711577001000000000000000000000000000002c40260801c5b610200831615612732577001000000000000000000000000000001610260801c5b610100831615612753577001000000000000000000000000000000b00260801c5b6080831615612773577001000000000000000000000000000000570260801c5b60408316156127935770010000000000000000000000000000002b0260801c5b60208316156127b3577001000000000000000000000000000000150260801c5b60108316156127d35770010000000000000000000000000000000a0260801c5b60088316156127f3577001000000000000000000000000000000040260801c5b6004831615612813577001000000000000000000000000000000010260801c5b8461283b57600f81901c6dffffffffffffffffffffffffffff169050613fff8201915061288e565b613ffe821161286757600f81901c6dffffffffffffffffffffffffffff16905081613fff03915061288e565b6000917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc011011c5b60709190911b1760801b95945050505050565b6000617fff60f084811c8216919084901c8116908290036128f05780617fff03610f9757507f7fff80000000000000000000000000000000000000000000000000000000000091506104029050565b80617fff03612977577dffffffffffffffffffffffffffff0000000000000000000000000000000084161561294a57507f7fff80000000000000000000000000000000000000000000000000000000000091506104029050565b5050508082187f800000000000000000000000000000000000000000000000000000000000000016610402565b7f7fffffffffffffffffffffffffffffff000000000000000000000000000000008416600003612a45577f7fffffffffffffffffffffffffffffff0000000000000000000000000000000085166000036129f657507f7fff80000000000000000000000000000000000000000000000000000000000091506104029050565b5050508082187f8000000000000000000000000000000000000000000000000000000000000000167f7fff00000000000000000000000000000000000000000000000000000000000017610402565b6dffffffffffffffffffffffffffff608085901c166000829003612a6c5760019150612a7e565b6e010000000000000000000000000000175b6dffffffffffffffffffffffffffff608087901c166000849003612ae6578015612ae1576000612aad82612d25565b6001955060e2039384017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8e01939190911b90505b612afb565b6e0100000000000000000000000000001760721b5b818181612b0a57612b0a612ea0565b04905080600003612b45577f8000000000000000000000000000000000000000000000000000000000000000878718166110fe576000611120565b6d1000000000000000000000000000811015612b6357612b63612ecf565b60006e080000000000000000000000000000821015612bc3576e040000000000000000000000000000821015612bb8576e020000000000000000000000000000821015612bb1576070612bbb565b6071612bbb565b60725b60ff16612bcc565b612bcc82612d25565b905083614071018186011115612bea57617fff945060009150612c84565b83818601613ffc011015612c05576000945060009150612c84565b83818601613f8c011015612c52578385613ffc011115612c30578385613ffc010382901b9150612c49565b8385613ffc011015612c4957613ffc8585030382901c91505b60009450612c84565b6070811115612c65576070810382901c91505b6dffffffffffffffffffffffffffff8216915083818601613f8d010394505b81607086901b888a186f8000000000000000000000000000000060801b1660801c6fffffffffffffffffffffffffffffffff16171760801b95505050505050610402565b60008061040260017f7a9158dd65ad6382295fd9a8aad0a64b5d99867a77a0a1b2bc38a4f50be8bd77612e66565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260018301602052604081205415156103ff565b6000808211612d3357600080fd5b60007001000000000000000000000000000000008310612d5557608092831c92015b680100000000000000008310612d6d57604092831c92015b6401000000008310612d8157602092831c92015b620100008310612d9357601092831c92015b6101008310612da457600892831c92015b60108310612db457600492831c92015b60048310612dc457600292831c92015b600283106104025760010192915050565b600060208284031215612de757600080fd5b5035919050565b600060208284031215612e0057600080fd5b81357fffffffffffffffffffffffffffffffff00000000000000000000000000000000811681146103d557600080fd5b600060208284031215612e4257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146103d557600080fd5b81810381811115610402577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fdfea264697066735822122075dd099a37225043bf375e7a0a8df96d9335165b74e9267821771a6a685572d564736f6c63430008130033",
        "nonce": "0x10",
        "accessList": []
      },
      "additionalContracts": [],
      "isFixedGasLimit": false
    },

@ubiquibot
Copy link

ubiquibot bot commented Oct 8, 2023

Copy link
Member

@rndquu rndquu left a comment

Choose a reason for hiding this comment

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

We should keep this test because it (at least) sheds some light on the original idea of why we need the CreditClock facet and how to use it. Pls refactor accordingly.

@molecula451
Copy link
Member Author

molecula451 commented Oct 9, 2023

We should keep this test because it (at least) sheds some light on the original idea of why we need the CreditClock facet and how to use it. Pls refactor accordingly.

we can't have this test, please note it takes state vars originally from the CreditClock, this is more like a test redesign that's why i open #812 to rather take time to design a "similar" test but not the same, plus look how the test it invokes 3 times for loops almost doing the same, the test is originally bad designed (to my point), you still think we need it for this issue?

@rndquu
Copy link
Member

rndquu commented Oct 9, 2023

we can't have this test, please note it takes state vars originally from the CreditClock

Then we should add new view methods to the CreditClockFacet contract which return state variables from the LibCreditClock storage struct

I want to preserve as much context as possible. The whole "credit clock" feature consists of 2 purely described google documents + the original issue description. So it is pretty hard to keep the whole picture of how the CreditClock should work exactly. And this PR removes even more context from the original implementation. That is why it is better to keep everything untouched and refactor test/implementation later.

@molecula451
Copy link
Member Author

we can't have this test, please note it takes state vars originally from the CreditClock

Then we should add new view methods to the CreditClockFacet contract which return state variables from the LibCreditClock storage struct

I want to preserve as much context as possible. The whole "credit clock" feature consists of 2 purely described google documents + the original issue description. So it is pretty hard to keep the whole picture of how the CreditClock should work exactly. And this PR removes even more context from the original implementation. That is why it is better to keep everything untouched and refactor test/implementation later.

possible approach could be

inside the library

function checkStructData() internal pure (CreditClockData memory) {
  CreditClockData storage data = creditClockStorage();
  return data;

this result in foundry test

[PASS] testCheckagain() (gas: 19244)
Traces:
  [19244] CreditClockFacetTest::testCheckagain() 
    ├─ [14037] Diamond::checkData() [staticcall]
    │   ├─ [9050] CreditClockFacet::checkData() [delegatecall]
    │   │   └─ ← ()
    │   └─ ← ()
    └─ ← ()

where as () are the state var inside the struct, will retest a bit

@molecula451 molecula451 marked this pull request as draft October 20, 2023 10:56
@rndquu
Copy link
Member

rndquu commented Oct 24, 2023

@molecula451

Update: We're putting Credit and CreditNft tokens "on hold" which means those tokens won't be a part of the production deploy or production UI. Instead we're going to use a "frax minter" contract as a peg maintaining mechanism (I haven't investigated in depth how it works yet).

It means that the CreditClock contract is also "on hold" so I guess it is simpler to remove this test in order to proceed further with the current PR.

@molecula451 molecula451 marked this pull request as ready for review October 24, 2023 12:30
@molecula451
Copy link
Member Author

that was what originally told you. We always have the reference in any case + the implementation it's working outstanding

My QA:

The Contract inside the Diamond

diamondfacet

The contract inside the DiamondLoupe::FacetAddresses deployed

diamondfac

This doesn't need further changes

@rndquu rndquu merged commit 8e774ee into ubiquity:development Oct 24, 2023
35 of 36 checks passed
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.

Move CreditClock to diamond facets
2 participants