Address Contract Partially Verified
Address
0x7df2d51e69aA58B69C3dF18D75b8e9ACc3C1B04E
Balance
0 ETH
Nonce
1
Code Size
9417 bytes
Creator
0x45852f76...Ca08 at tx 0x9fd73cac...679d3b
Indexed Transactions
0
Contract Bytecode
9417 bytes
0x608060405234801561001057600080fd5b506004361061025e5760003560e01c8063554f94db11610146578063a314fd6e116100c3578063d6e882dc11610087578063d6e882dc14610536578063dd2d2a121461055f578063f238ffd214610582578063f752fdc3146105a5578063fdb04bbf146105c8578063fe4f5890146105d05761025e565b8063a314fd6e146104f0578063bbaf0133146104f8578063c28a6d3d1461051e578063c8f33c9114610526578063cab6a5501461052e5761025e565b8063718af6901161010a578063718af6901461048f57806394f3f81d14610497578063961d45c4146104bd5780639a8226b0146104c5578063a0871637146104cd5761025e565b8063554f94db1461042757806361d027b31461042f5780636614f0101461045357806369dec2761461047f5780636a146024146104875761025e565b806335b28153116101df57806346f3e81c116101a357806346f3e81c146103ac5780634a24ddc6146103c95780634d230551146103ec5780634e4112ce146103f457806354f363a3146103fc578063552033c41461041f5761025e565b806335b281531461032e5780633b0662d5146103565780633c8bb3e61461035e5780633ef5e4451461038157806343943b6b146103a45761025e565b80631c1f908c116102265780631c1f908c146102e85780632009e568146102f057806320c06d59146102f857806324ba5884146103005780633425677e146103265761025e565b8063056640b7146102635780631021344714610298578063126e325c146102b5578063165c4a16146102bd5780631b25c355146102e0575b600080fd5b6102866004803603604081101561027957600080fd5b50803590602001356105f3565b60408051918252519081900360200190f35b610286600480360360208110156102ae57600080fd5b503561061a565b610286610630565b610286600480360360408110156102d357600080fd5b5080359060200135610636565b61028661069b565b6102866106a1565b6102866106a7565b6102866106ad565b6102866004803603602081101561031657600080fd5b50356001600160a01b03166106b3565b6102866106c5565b6103546004803603602081101561034457600080fd5b50356001600160a01b031661075c565b005b6102866107fc565b6102866004803603604081101561037457600080fd5b5080359060200135610802565b6102866004803603604081101561039757600080fd5b5080359060200135610817565b61028661086f565b610286600480360360208110156103c257600080fd5b5035610875565b610354600480360360408110156103df57600080fd5b508035906020013561088c565b610286610a24565b610286610a2a565b6102866004803603604081101561041257600080fd5b5080359060200135610b51565b610286610ba2565b610286610bb1565b610437610bb7565b604080516001600160a01b039092168252519081900360200190f35b6103546004803603604081101561046957600080fd5b50803590602001356001600160a01b0316610bc6565b610286610e70565b610286610e76565b610286610e82565b610354600480360360208110156104ad57600080fd5b50356001600160a01b0316610f7b565b61043761101a565b610437611029565b610286600480360360408110156104e357600080fd5b5080359060200135611038565b610286611050565b6103546004803603602081101561050e57600080fd5b50356001600160a01b0316611180565b61043761158f565b61028661159e565b6102866115a4565b6102866004803603606081101561054c57600080fd5b50803590602081013590604001356115aa565b6102866004803603604081101561057557600080fd5b5080359060200135611668565b6102866004803603604081101561059857600080fd5b5080359060200135611681565b610286600480360360408110156105bb57600080fd5b5080359060200135611781565b610286611796565b610354600480360360408110156105e657600080fd5b508035906020013561179b565b6000676765c793fa10079d601b1b61060b8484610636565b8161061257fe5b049392505050565b600061062a82633b9aca00610636565b92915050565b600a5481565b60008115806106515750508082028282828161064e57fe5b04145b61062a576040805162461bcd60e51b815260206004820152601660248201527575696e742d75696e742d6d756c2d6f766572666c6f7760501b604482015290519081900360640190fd5b60095481565b60015481565b60035481565b600c5481565b60006020819052908152604090205481565b600554604080516375ad331760e11b81523060048201528151600093849384936001600160a01b039092169263eb5a662e926024808201939291829003018186803b15801561071357600080fd5b505afa158015610727573d6000803e3d6000fd5b505050506040513d604081101561073d57600080fd5b50805160209091015190925090506107558282611668565b9250505090565b336000908152602081905260409020546001146107aa5760405162461bcd60e51b815260040180806020018281038252603681526020018061245e6036913960400191505060405180910390fd5b6001600160a01b0381166000818152602081815260409182902060019055815192835290517f599a298163e1678bb1c676052a8930bf0b8a1261ed6e01b8a2391e55f70001029281900390910190a150565b600b5481565b6000670de0b6b3a764000061060b8484610636565b8082038281111561062a576040805162461bcd60e51b815260206004820152601760248201527f75696e742d75696e742d7375622d756e646572666c6f77000000000000000000604482015290519081900360640190fd5b60045481565b600061062a82676765c793fa10079d601b1b610636565b336000908152602081905260409020546001146108da5760405162461bcd60e51b815260040180806020018281038252603681526020018061245e6036913960400191505060405180910390fd5b60105460408051630fe4f58960e41b8152716465627441756374696f6e42696453697a6560701b60048201526024810185905290516001600160a01b039092169163fe4f58909160448082019260009290919082900301818387803b15801561094257600080fd5b505af1158015610956573d6000803e3d6000fd5b505060105460408051630fe4f58960e41b81527f696e697469616c4465627441756374696f6e4d696e746564546f6b656e73000060048201526024810186905290516001600160a01b03909216935063fe4f5890925060448082019260009290919082900301818387803b1580156109cd57600080fd5b505af11580156109e1573d6000803e3d6000fd5b5050604080518581526020810185905281517f6ac99a129f7b6fba42fb46dbc014553b74eb1f5cb470559895cf43ff8856bd159450908190039091019150a15050565b60085481565b6000806000600e60009054906101000a90046001600160a01b03166001600160a01b0316634fd0ada86040518163ffffffff1660e01b8152600401604080518083038186803b158015610a7c57600080fd5b505afa158015610a90573d6000803e3d6000fd5b505050506040513d6040811015610aa657600080fd5b5080516020909101519092509050610ac081831515611d59565b610afb5760405162461bcd60e51b815260040180806020018281038252602f8152602001806121d8602f913960400191505060405180910390fd5b6000610b05611d5d565b915050610b39610b31610b29610b2384670de0b6b3a7640000610636565b86611dc4565b600954610636565b6103e8611dc4565b9350600854841015610b4b5760085493505b50505090565b8181018281101561062a576040805162461bcd60e51b815260206004820152601660248201527575696e742d75696e742d6164642d6f766572666c6f7760501b604482015290519081900360640190fd5b676765c793fa10079d601b1b81565b60065481565b6005546001600160a01b031681565b33600090815260208190526040902054600114610c145760405162461bcd60e51b815260040180806020018281038252603681526020018061245e6036913960400191505060405180910390fd5b6001600160a01b038116610c595760405162461bcd60e51b815260040180806020018281038252602b8152602001806121ad602b913960400191505060405180910390fd5b81701c1c9bdd1bd8dbdb151bdad95b93dc98db607a1b1415610c9557600e80546001600160a01b0319166001600160a01b038316179055610e29565b816d1cde5cdd195b50dbda5b93dc98db60921b1415610cce57600f80546001600160a01b0319166001600160a01b038316179055610e29565b816f6163636f756e74696e67456e67696e6560801b1415610d0957601080546001600160a01b0319166001600160a01b038316179055610e29565b8167747265617375727960c01b1415610df25760006001600160a01b0316816001600160a01b031663a7e944556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d6057600080fd5b505afa158015610d74573d6000803e3d6000fd5b505050506040513d6020811015610d8a57600080fd5b50516001600160a01b03161415610dd25760405162461bcd60e51b81526004018080602001828103825260378152602001806120936037913960400191505060405180910390fd5b600580546001600160a01b0319166001600160a01b038316179055610e29565b60405162461bcd60e51b815260040180806020018281038252603b815260200180612106603b913960400191505060405180910390fd5b604080518381526001600160a01b038316602082015281517fd91f38cf03346b5dc15fb60f9076f866295231ad3c3841a1051f8443f25170d1929181900390910190a15050565b60025481565b670de0b6b3a764000081565b6000806000600e60009054906101000a90046001600160a01b03166001600160a01b0316634fd0ada86040518163ffffffff1660e01b8152600401604080518083038186803b158015610ed457600080fd5b505afa158015610ee8573d6000803e3d6000fd5b505050506040513d6040811015610efe57600080fd5b5080516020909101519092509050610f1881831515611d59565b610f535760405162461bcd60e51b815260040180806020018281038252602f8152602001806121d8602f913960400191505060405180910390fd5b6000610f5d611d5d565b915050610b39610f7582670de0b6b3a7640000610636565b84611dc4565b33600090815260208190526040902054600114610fc95760405162461bcd60e51b815260040180806020018281038252603681526020018061245e6036913960400191505060405180910390fd5b6001600160a01b03811660008181526020818152604080832092909255815192835290517f8834a87e641e9716be4f34527af5d23e11624f1ddeefede6ad75a9acfc31b9039281900390910190a150565b6010546001600160a01b031681565b600e546001600160a01b031681565b60008161060b84676765c793fa10079d601b1b610636565b6000806000600f60009054906101000a90046001600160a01b03166001600160a01b0316634fd0ada86040518163ffffffff1660e01b8152600401604080518083038186803b1580156110a257600080fd5b505afa1580156110b6573d6000803e3d6000fd5b505050506040513d60408110156110cc57600080fd5b50805160209091015190925090506110e682151582611d59565b6111215760405162461bcd60e51b815260040180806020018281038252602f8152602001806121d8602f913960400191505060405180910390fd5b600061112b611d5d565b915050611157610f7561114683670de0b6b3a7640000610636565b676765c793fa10079d601b1b610636565b9350676765c793fa10079d601b1b841015610b4b57676765c793fa10079d601b1b935050505090565b61119f60065461119242600754610817565b1015600754600014611e23565b6111da5760405162461bcd60e51b815260040180806020018281038252602b815260200180612207602b913960400191505060405180910390fd5b60006111ea600754600654611681565b42600755600e54604080516309fa15b560e31b8152815193945060009384936001600160a01b031692634fd0ada89260048082019391829003018186803b15801561123457600080fd5b505afa158015611248573d6000803e3d6000fd5b505050506040513d604081101561125e57600080fd5b508051602090910151600f54604080516309fa15b560e31b8152815194965092945060009384936001600160a01b0390931692634fd0ada8926004808301939192829003018186803b1580156112b357600080fd5b505afa1580156112c7573d6000803e3d6000fd5b505050506040513d60408110156112dd57600080fd5b50805160209091015190925090506112f58382611d59565b6113305760405162461bcd60e51b815260040180806020018281038252603081526020018061217d6030913960400191505060405180910390fd5b6113406000851160008411611d59565b61137b5760405162461bcd60e51b815260040180806020018281038252602d815260200180612357602d913960400191505060405180910390fd5b6000611385611d5d565b600a55600d54600b549192506113a5916113a0908490610636565b610b51565b600d55600a546000906113c090670de0b6b3a7640000610636565b905060006113ce8288611dc4565b90506113df610b3182600954610636565b90506008548110156113f057506008545b600061141061140a84676765c793fa10079d601b1b610636565b87611dc4565b9050676765c793fa10079d601b1b8110156114335750676765c793fa10079d601b1b5b60105460408051630fe4f58960e41b8152716465627441756374696f6e42696453697a6560701b60048201526024810184905290516001600160a01b039092169163fe4f58909160448082019260009290919082900301818387803b15801561149b57600080fd5b505af11580156114af573d6000803e3d6000fd5b505060105460408051630fe4f58960e41b81527f696e697469616c4465627441756374696f6e4d696e746564546f6b656e73000060048201526024810187905290516001600160a01b03909216935063fe4f5890925060448082019260009290919082900301818387803b15801561152657600080fd5b505af115801561153a573d6000803e3d6000fd5b5050604080518481526020810186905281517f6ac99a129f7b6fba42fb46dbc014553b74eb1f5cb470559895cf43ff8856bd159450908190039091019150a16115838a8a611e27565b50505050505050505050565b600f546001600160a01b031681565b60075481565b600d5481565b600083801561164a576001841680156115c5578592506115c9565b8392505b50600283046002850494505b84156116445785860286878204146115ec57600080fd5b818101818110156115fc57600080fd5b859004965050600185161561163957858302838782041415871515161561162257600080fd5b8181018181101561163257600080fd5b8590049350505b6002850494506115d5565b50611660565b83801561165a576000925061165e565b8392505b505b509392505050565b600081831115611678578161167a565b825b9392505050565b60008060015460001480156116965750600254155b90506116a54285101582611e23565b156116b457600091505061062a565b600084156116cb576116c64286610817565b6116cd565b835b90506116e0848210600154600014611e23565b156116f05760009250505061062a565b60006116fc8286610817565b90506000611727600254676765c793fa10079d601b1b61171a6106c5565b8161172157fe5b04611668565b905060035482111561173e57935061062a92505050565b600154821561176b5761176861176260045485676765c793fa10079d601b1b6115aa565b826105f3565b90505b818111156117765750805b979650505050505050565b60008161060b84670de0b6b3a7640000610636565b603281565b336000908152602081905260409020546001146117e95760405162461bcd60e51b815260040180806020018281038252603681526020018061245e6036913960400191505060405180910390fd5b817f6d696e50726f746f636f6c546f6b656e416d6f756e744f666665726564000000141561185a57600081116118505760405162461bcd60e51b815260040180806020018281038252603381526020018061242b6033913960400191505060405180910390fd5b6008819055611d1a565b817370726f746f636f6c546f6b656e5072656d69756d60601b14156118c3576103e881106118b95760405162461bcd60e51b815260040180806020018281038252603c815260200180612232603c913960400191505060405180910390fd5b6009819055611d1a565b817518985cd9555c19185d1950d85b1b195c94995dd85c9960521b141561192f576002548111156119255760405162461bcd60e51b815260040180806020018281038252603c8152602001806120ca603c913960400191505060405180910390fd5b6001819055611d1a565b81741b585e155c19185d1950d85b1b195c94995dd85c99605a1b141561199a576001548110156119905760405162461bcd60e51b81526004018080602001828103825260348152602001806123f76034913960400191505060405180910390fd5b6002819055611d1a565b817f7065725365636f6e6443616c6c6572526577617264496e6372656173650000001415611a1657676765c793fa10079d601b1b811015611a0c5760405162461bcd60e51b81526004018080602001828103825260398152602001806123846039913960400191505060405180910390fd5b6004819055611d1a565b81756d6178526577617264496e63726561736544656c617960501b1415611a805760008111611a765760405162461bcd60e51b815260040180806020018281038252603c815260200180612141603c913960400191505060405180910390fd5b6003819055611d1a565b816a75706461746544656c617960a81b1415611adf5760008111611ad55760405162461bcd60e51b81526004018080602001828103825260338152602001806123246033913960400191505060405180910390fd5b6006819055611d1a565b816d62696454617267657456616c756560901b1415611b42576064811015611b385760405162461bcd60e51b815260040180806020018281038252603a81526020018061226e603a913960400191505060405180910390fd5b600a819055611d1a565b816d6c61737455706461746554696d6560901b1415611ba357428111611b995760405162461bcd60e51b815260040180806020018281038252603a8152602001806123bd603a913960400191505060405180910390fd5b6007819055611d1a565b817f62696456616c75654c617374496e666c6174696f6e55706461746554696d65001415611c2257611bdd600d5482101542831115611d59565b611c185760405162461bcd60e51b81526004018080602001828103825260438152602001806122e16043913960600191505060405180910390fd5b600d819055611d1a565b817562696456616c7565496e666c6174696f6e44656c617960501b1415611cac577f1999999999999999999999999999999999999999999999999999999999999999811115611ca25760405162461bcd60e51b81526004018080602001828103825260398152602001806122a86039913960400191505060405180910390fd5b600b819055611d1a565b817f62696456616c7565546172676574496e666c6174696f6e0000000000000000001415610df2576032811115611d145760405162461bcd60e51b815260040180806020018281038252603a815260200180612059603a913960400191505060405180910390fd5b600c8190555b604080518381526020810183905281517fac7c5c1afaef770ec56ac6268cd3f2fbb1035858ead2601d6553157c33036c3a929181900390910190a15050565b1690565b6000806000600b54611d7142600d54610817565b81611d7857fe5b04905080611d8e575050600a5460009150611dc0565b600a5460005b82811015611db957611daf826113a060648204600c54610636565b9150600101611d94565b5090925090505b9091565b6000808211611e0a576040805162461bcd60e51b815260206004820152600d60248201526c6469766964652d6e756c6c2d7960981b604482015290519081900360640190fd5b818381611e1357fe5b0490508281111561062a57600080fd5b1790565b6005546001600160a01b0383811691161415611e4257612054565b600554611e5a906001600160a01b0316158215611e23565b15611e6457612054565b60006001600160a01b03831615611e7b5782611e7d565b335b6005546040805163a7e9445560e01b815290519293506001600160a01b039091169163201add9b918491849163a7e94455916004808301926020929190829003018186803b158015611ece57600080fd5b505afa158015611ee2573d6000803e3d6000fd5b505050506040513d6020811015611ef857600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820186905251606480830192600092919082900301818387803b158015611f5057600080fd5b505af1925050508015611f61575060015b612052573d808015611f8f576040519150601f19603f3d011682016040523d82523d6000602084013e611f94565b606091505b507ff7bf1f7447ce563690edb2abe40636178ff64fc766b07bf3e171b16102794a548183856040518080602001846001600160a01b03166001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019080838360005b83811015612014578181015183820152602001611ffc565b50505050905090810190601f1680156120415780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a1505b505b505056fe4465627441756374696f6e496e697469616c506172616d657465725365747465722f696e76616c69642d7461726765742d696e666c6174696f6e4465627441756374696f6e496e697469616c506172616d657465725365747465722f74726561737572792d636f696e2d6e6f742d7365744465627441756374696f6e496e697469616c506172616d657465725365747465722f696e76616c69642d626173652d63616c6c65722d7265776172644465627441756374696f6e496e697469616c506172616d657465725365747465722f6d6f646966792d756e7265636f676e697a65642d706172616d4465627441756374696f6e496e697469616c506172616d657465725365747465722f696e76616c69642d6d61782d696e6372656173652d64656c61794465627441756374696f6e496e697469616c506172616d657465725365747465722f696e76616c69642d7072696365734465627441756374696f6e496e697469616c506172616d657465725365747465722f6e756c6c2d616464724465627441756374696f6e496e697469616c506172616d657465725365747465722f696e76616c69642d70726963654465627441756374696f6e496e697469616c506172616d657465725365747465722f776169742d6d6f72654465627441756374696f6e496e697469616c506172616d657465725365747465722f696e76616c69642d70726f742d746f6b656e2d7072656d69756d4465627441756374696f6e496e697469616c506172616d657465725365747465722f696e76616c69642d6269642d7461726765742d76616c75654465627441756374696f6e496e697469616c506172616d657465725365747465722f696e76616c69642d696e666c6174696f6e2d64656c61794465627441756374696f6e496e697469616c506172616d657465725365747465722f696e76616c69642d6269642d696e666c6174696f6e2d7570646174652d74696d654465627441756374696f6e496e697469616c506172616d657465725365747465722f6e756c6c2d7570646174652d64656c61794465627441756374696f6e496e697469616c506172616d657465725365747465722f6e756c6c2d7072696365734465627441756374696f6e496e697469616c506172616d657465725365747465722f696e76616c69642d7265776172642d696e6372656173654465627441756374696f6e496e697469616c506172616d657465725365747465722f696e76616c69642d6c6173742d7570646174652d74696d654465627441756374696f6e496e697469616c506172616d657465725365747465722f696e76616c69642d6d61782d7265776172644465627441756374696f6e496e697469616c506172616d657465725365747465722f6e756c6c2d6d696e2d70726f742d616d74496e6372656173696e6754726561737572795265696d62757273656d656e742f6163636f756e742d6e6f742d617574686f72697a6564a2646970667358221220dbd277f3551cbd7e9fc00406afaa6a5771bedf5208ef1c07440eee7747f7b7f564736f6c63430006070033
Verified Source Code Partial Match
Compiler: v0.6.7+commit.b8d736ae
EVM: istanbul
Optimization: Yes (200 runs)
DebtAuctionInitialParameterSetter.sol 534 lines
pragma solidity 0.6.7;
contract GebMath {
uint256 public constant RAY = 10 ** 27;
uint256 public constant WAD = 10 ** 18;
function ray(uint x) public pure returns (uint z) {
z = multiply(x, 10 ** 9);
}
function rad(uint x) public pure returns (uint z) {
z = multiply(x, 10 ** 27);
}
function minimum(uint x, uint y) public pure returns (uint z) {
z = (x <= y) ? x : y;
}
function addition(uint x, uint y) public pure returns (uint z) {
z = x + y;
require(z >= x, "uint-uint-add-overflow");
}
function subtract(uint x, uint y) public pure returns (uint z) {
z = x - y;
require(z <= x, "uint-uint-sub-underflow");
}
function multiply(uint x, uint y) public pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, "uint-uint-mul-overflow");
}
function rmultiply(uint x, uint y) public pure returns (uint z) {
z = multiply(x, y) / RAY;
}
function rdivide(uint x, uint y) public pure returns (uint z) {
z = multiply(x, RAY) / y;
}
function wdivide(uint x, uint y) public pure returns (uint z) {
z = multiply(x, WAD) / y;
}
function wmultiply(uint x, uint y) public pure returns (uint z) {
z = multiply(x, y) / WAD;
}
function rpower(uint x, uint n, uint base) public pure returns (uint z) {
assembly {
switch x case 0 {switch n case 0 {z := base} default {z := 0}}
default {
switch mod(n, 2) case 0 { z := base } default { z := x }
let half := div(base, 2) // for rounding.
for { n := div(n, 2) } n { n := div(n,2) } {
let xx := mul(x, x)
if iszero(eq(div(xx, x), x)) { revert(0,0) }
let xxRound := add(xx, half)
if lt(xxRound, xx) { revert(0,0) }
x := div(xxRound, base)
if mod(n,2) {
let zx := mul(z, x)
if and(iszero(iszero(x)), iszero(eq(div(zx, x), z))) { revert(0,0) }
let zxRound := add(zx, half)
if lt(zxRound, zx) { revert(0,0) }
z := div(zxRound, base)
}
}
}
}
}
}
abstract contract StabilityFeeTreasuryLike {
function getAllowance(address) virtual external view returns (uint, uint);
function systemCoin() virtual external view returns (address);
function pullFunds(address, address, uint) virtual external;
}
contract IncreasingTreasuryReimbursement is GebMath {
// --- Auth ---
mapping (address => uint) public authorizedAccounts;
/**
* @notice Add auth to an account
* @param account Account to add auth to
*/
function addAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 1;
emit AddAuthorization(account);
}
/**
* @notice Remove auth from an account
* @param account Account to remove auth from
*/
function removeAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 0;
emit RemoveAuthorization(account);
}
/**
* @notice Checks whether msg.sender can call an authed function
**/
modifier isAuthorized {
require(authorizedAccounts[msg.sender] == 1, "IncreasingTreasuryReimbursement/account-not-authorized");
_;
}
// --- Variables ---
// Starting reward for the fee receiver/keeper
uint256 public baseUpdateCallerReward; // [wad]
// Max possible reward for the fee receiver/keeper
uint256 public maxUpdateCallerReward; // [wad]
// Max delay taken into consideration when calculating the adjusted reward
uint256 public maxRewardIncreaseDelay; // [seconds]
// Rate applied to baseUpdateCallerReward every extra second passed beyond a certain point (e.g next time when a specific function needs to be called)
uint256 public perSecondCallerRewardIncrease; // [ray]
// SF treasury
StabilityFeeTreasuryLike public treasury;
// --- Events ---
event AddAuthorization(address account);
event RemoveAuthorization(address account);
event ModifyParameters(
bytes32 parameter,
address addr
);
event ModifyParameters(
bytes32 parameter,
uint256 val
);
event FailRewardCaller(bytes revertReason, address feeReceiver, uint256 amount);
constructor(
address treasury_,
uint256 baseUpdateCallerReward_,
uint256 maxUpdateCallerReward_,
uint256 perSecondCallerRewardIncrease_
) public {
if (address(treasury_) != address(0)) {
require(StabilityFeeTreasuryLike(treasury_).systemCoin() != address(0), "IncreasingTreasuryReimbursement/treasury-coin-not-set");
}
require(maxUpdateCallerReward_ >= baseUpdateCallerReward_, "IncreasingTreasuryReimbursement/invalid-max-caller-reward");
require(perSecondCallerRewardIncrease_ >= RAY, "IncreasingTreasuryReimbursement/invalid-per-second-reward-increase");
authorizedAccounts[msg.sender] = 1;
treasury = StabilityFeeTreasuryLike(treasury_);
baseUpdateCallerReward = baseUpdateCallerReward_;
maxUpdateCallerReward = maxUpdateCallerReward_;
perSecondCallerRewardIncrease = perSecondCallerRewardIncrease_;
maxRewardIncreaseDelay = uint(-1);
emit AddAuthorization(msg.sender);
emit ModifyParameters("treasury", treasury_);
emit ModifyParameters("baseUpdateCallerReward", baseUpdateCallerReward);
emit ModifyParameters("maxUpdateCallerReward", maxUpdateCallerReward);
emit ModifyParameters("perSecondCallerRewardIncrease", perSecondCallerRewardIncrease);
}
// --- Boolean Logic ---
function either(bool x, bool y) internal pure returns (bool z) {
assembly{ z := or(x, y)}
}
// --- Treasury ---
/**
* @notice This returns the stability fee treasury allowance for this contract by taking the minimum between the per block and the total allowances
**/
function treasuryAllowance() public view returns (uint256) {
(uint total, uint perBlock) = treasury.getAllowance(address(this));
return minimum(total, perBlock);
}
/*
* @notice Get the SF reward that can be sent to a function caller right now
* @param timeOfLastUpdate The last time when the function that the treasury pays for has been updated
* @param defaultDelayBetweenCalls Enforced delay between calls to the function for which the treasury reimburses callers
*/
function getCallerReward(uint256 timeOfLastUpdate, uint256 defaultDelayBetweenCalls) public view returns (uint256) {
// If the rewards are null or if the time of the last update is in the future or present, return 0
bool nullRewards = (baseUpdateCallerReward == 0 && maxUpdateCallerReward == 0);
if (either(timeOfLastUpdate >= now, nullRewards)) return 0;
// If the time elapsed is smaller than defaultDelayBetweenCalls or if the base reward is zero, return 0
uint256 timeElapsed = (timeOfLastUpdate == 0) ? defaultDelayBetweenCalls : subtract(now, timeOfLastUpdate);
if (either(timeElapsed < defaultDelayBetweenCalls, baseUpdateCallerReward == 0)) {
return 0;
}
// If too much time elapsed, return the max reward
uint256 adjustedTime = subtract(timeElapsed, defaultDelayBetweenCalls);
uint256 maxPossibleReward = minimum(maxUpdateCallerReward, treasuryAllowance() / RAY);
if (adjustedTime > maxRewardIncreaseDelay) {
return maxPossibleReward;
}
// Calculate the reward
uint256 calculatedReward = baseUpdateCallerReward;
if (adjustedTime > 0) {
calculatedReward = rmultiply(rpower(perSecondCallerRewardIncrease, adjustedTime, RAY), calculatedReward);
}
// If the reward is higher than max, set it to max
if (calculatedReward > maxPossibleReward) {
calculatedReward = maxPossibleReward;
}
return calculatedReward;
}
/**
* @notice Send a stability fee reward to an address
* @param proposedFeeReceiver The SF receiver
* @param reward The system coin amount to send
**/
function rewardCaller(address proposedFeeReceiver, uint256 reward) internal {
// If the receiver is the treasury itself or if the treasury is null or if the reward is zero, return
if (address(treasury) == proposedFeeReceiver) return;
if (either(address(treasury) == address(0), reward == 0)) return;
// Determine the actual receiver and send funds
address finalFeeReceiver = (proposedFeeReceiver == address(0)) ? msg.sender : proposedFeeReceiver;
try treasury.pullFunds(finalFeeReceiver, treasury.systemCoin(), reward) {}
catch(bytes memory revertReason) {
emit FailRewardCaller(revertReason, finalFeeReceiver, reward);
}
}
}
abstract contract OracleLike {
function getResultWithValidity() virtual external view returns (uint256, bool);
}
abstract contract AccountingEngineLike {
function modifyParameters(bytes32, uint256) virtual external;
}
contract DebtAuctionInitialParameterSetter is IncreasingTreasuryReimbursement {
// --- Variables ---
// Delay between updates after which the reward starts to increase
uint256 public updateDelay;
// Last timestamp when the median was updated
uint256 public lastUpdateTime; // [unix timestamp]
// Min amount of protocol tokens that should be offered in the auction
uint256 public minProtocolTokenAmountOffered; // [wad]
// Premium subtracted from the new amount of protocol tokens to be offered
uint256 public protocolTokenPremium; // [thousand]
// Value of the initial debt bid
uint256 public bidTargetValue; // [wad]
// Delay between two consecutive updates
uint256 public bidValueInflationDelay;
// The target inflation applied to bidTargetValue
uint256 public bidValueTargetInflation;
// The last time when inflation was applied to the bid target value
uint256 public bidValueLastInflationUpdateTime; // [unix timestamp]
// The protocol token oracle
OracleLike public protocolTokenOrcl;
// The system coin oracle
OracleLike public systemCoinOrcl;
// The accounting engine contract
AccountingEngineLike public accountingEngine;
// Max inflation per period
uint256 public constant MAX_INFLATION = 50;
// --- Events ---
event SetDebtAuctionInitialParameters(uint256 debtAuctionBidSize, uint256 initialDebtAuctionMintedTokens);
constructor(
address protocolTokenOrcl_,
address systemCoinOrcl_,
address accountingEngine_,
address treasury_,
uint256 updateDelay_,
uint256 baseUpdateCallerReward_,
uint256 maxUpdateCallerReward_,
uint256 perSecondCallerRewardIncrease_,
uint256 minProtocolTokenAmountOffered_,
uint256 protocolTokenPremium_,
uint256 bidTargetValue_
) public IncreasingTreasuryReimbursement(treasury_, baseUpdateCallerReward_, maxUpdateCallerReward_, perSecondCallerRewardIncrease_) {
require(minProtocolTokenAmountOffered_ > 0, "DebtAuctionInitialParameterSetter/null-min-prot-amt");
require(protocolTokenPremium_ < THOUSAND, "DebtAuctionInitialParameterSetter/invalid-prot-token-premium");
require(both(both(protocolTokenOrcl_ != address(0), systemCoinOrcl_ != address(0)), accountingEngine_ != address(0)), "DebtAuctionInitialParameterSetter/invalid-contract-address");
require(updateDelay_ > 0, "DebtAuctionInitialParameterSetter/null-update-delay");
require(bidTargetValue_ >= HUNDRED, "DebtAuctionInitialParameterSetter/invalid-bid-target-value");
protocolTokenOrcl = OracleLike(protocolTokenOrcl_);
systemCoinOrcl = OracleLike(systemCoinOrcl_);
accountingEngine = AccountingEngineLike(accountingEngine_);
minProtocolTokenAmountOffered = minProtocolTokenAmountOffered_;
protocolTokenPremium = protocolTokenPremium_;
updateDelay = updateDelay_;
bidTargetValue = bidTargetValue_;
bidValueTargetInflation = 0;
bidValueInflationDelay = uint(-1) / 10;
bidValueLastInflationUpdateTime = now;
emit ModifyParameters(bytes32("protocolTokenOrcl"), protocolTokenOrcl_);
emit ModifyParameters(bytes32("systemCoinOrcl"), systemCoinOrcl_);
emit ModifyParameters(bytes32("accountingEngine"), accountingEngine_);
emit ModifyParameters(bytes32("bidTargetValue"), bidTargetValue);
emit ModifyParameters(bytes32("minProtocolTokenAmountOffered"), minProtocolTokenAmountOffered);
emit ModifyParameters(bytes32("protocolTokenPremium"), protocolTokenPremium);
emit ModifyParameters(bytes32("updateDelay"), updateDelay);
}
// --- Boolean Logic ---
function both(bool x, bool y) internal pure returns (bool z) {
assembly{ z := and(x, y)}
}
// --- Math ---
uint internal constant HUNDRED = 100;
uint internal constant THOUSAND = 10 ** 3;
function divide(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(y > 0, "divide-null-y");
z = x / y;
require(z <= x);
}
function rpower(uint256 x, uint256 n) internal pure returns (uint256 z) {
z = n % 2 != 0 ? x : RAY;
for (n /= 2; n != 0; n /= 2) {
x = rmultiply(x, x);
if (n % 2 != 0) {
z = rmultiply(z, x);
}
}
}
// --- Administration ---
/*
* @notice Modify the address of a contract integrated with this setter
* @param parameter Name of the contract to set a new address for
* @param addr The new address
*/
function modifyParameters(bytes32 parameter, address addr) external isAuthorized {
require(addr != address(0), "DebtAuctionInitialParameterSetter/null-addr");
if (parameter == "protocolTokenOrcl") protocolTokenOrcl = OracleLike(addr);
else if (parameter == "systemCoinOrcl") systemCoinOrcl = OracleLike(addr);
else if (parameter == "accountingEngine") accountingEngine = AccountingEngineLike(addr);
else if (parameter == "treasury") {
require(StabilityFeeTreasuryLike(addr).systemCoin() != address(0), "DebtAuctionInitialParameterSetter/treasury-coin-not-set");
treasury = StabilityFeeTreasuryLike(addr);
}
else revert("DebtAuctionInitialParameterSetter/modify-unrecognized-param");
emit ModifyParameters(parameter, addr);
}
/*
* @notice Modify a uint256 parameter
* @param parameter Name of the parameter
* @param addr The new parameter value
*/
function modifyParameters(bytes32 parameter, uint256 val) external isAuthorized {
if (parameter == "minProtocolTokenAmountOffered") {
require(val > 0, "DebtAuctionInitialParameterSetter/null-min-prot-amt");
minProtocolTokenAmountOffered = val;
}
else if (parameter == "protocolTokenPremium") {
require(val < THOUSAND, "DebtAuctionInitialParameterSetter/invalid-prot-token-premium");
protocolTokenPremium = val;
}
else if (parameter == "baseUpdateCallerReward") {
require(val <= maxUpdateCallerReward, "DebtAuctionInitialParameterSetter/invalid-base-caller-reward");
baseUpdateCallerReward = val;
}
else if (parameter == "maxUpdateCallerReward") {
require(val >= baseUpdateCallerReward, "DebtAuctionInitialParameterSetter/invalid-max-reward");
maxUpdateCallerReward = val;
}
else if (parameter == "perSecondCallerRewardIncrease") {
require(val >= RAY, "DebtAuctionInitialParameterSetter/invalid-reward-increase");
perSecondCallerRewardIncrease = val;
}
else if (parameter == "maxRewardIncreaseDelay") {
require(val > 0, "DebtAuctionInitialParameterSetter/invalid-max-increase-delay");
maxRewardIncreaseDelay = val;
}
else if (parameter == "updateDelay") {
require(val > 0, "DebtAuctionInitialParameterSetter/null-update-delay");
updateDelay = val;
}
else if (parameter == "bidTargetValue") {
require(val >= HUNDRED, "DebtAuctionInitialParameterSetter/invalid-bid-target-value");
bidTargetValue = val;
}
else if (parameter == "lastUpdateTime") {
require(val > now, "DebtAuctionInitialParameterSetter/invalid-last-update-time");
lastUpdateTime = val;
}
else if (parameter == "bidValueLastInflationUpdateTime") {
require(both(val >= bidValueLastInflationUpdateTime, val <= now), "DebtAuctionInitialParameterSetter/invalid-bid-inflation-update-time");
bidValueLastInflationUpdateTime = val;
}
else if (parameter == "bidValueInflationDelay") {
require(val <= uint(-1) / 10, "DebtAuctionInitialParameterSetter/invalid-inflation-delay");
bidValueInflationDelay = val;
}
else if (parameter == "bidValueTargetInflation") {
require(val <= MAX_INFLATION, "DebtAuctionInitialParameterSetter/invalid-target-inflation");
bidValueTargetInflation = val;
}
else revert("DebtAuctionInitialParameterSetter/modify-unrecognized-param");
emit ModifyParameters(parameter, val);
}
// --- Setter ---
/*
* @notify View function that returns the new, initial debt auction bid
* @returns debtAuctionBidSize The new, initial debt auction bid
*/
function getNewDebtBid() external view returns (uint256 debtAuctionBidSize) {
// Get token price
(uint256 systemCoinPrice, bool validSysCoinPrice) = systemCoinOrcl.getResultWithValidity();
require(both(systemCoinPrice > 0, validSysCoinPrice), "DebtAuctionInitialParameterSetter/invalid-price");
// Compute the bid size
(, uint256 latestTargetValue) = getNewBidTargetValue();
debtAuctionBidSize = divide(multiply(multiply(latestTargetValue, WAD), RAY), systemCoinPrice);
if (debtAuctionBidSize < RAY) {
debtAuctionBidSize = RAY;
}
}
/*
* @notify View function that returns the initial amount of protocol tokens which should be offered in a debt auction
* @returns debtAuctionMintedTokens The initial amount of protocol tokens that should be offered in a debt auction
*/
function getRawProtocolTokenAmount() external view returns (uint256 debtAuctionMintedTokens) {
// Get token price
(uint256 protocolTknPrice, bool validProtocolPrice) = protocolTokenOrcl.getResultWithValidity();
require(both(validProtocolPrice, protocolTknPrice > 0), "DebtAuctionInitialParameterSetter/invalid-price");
// Compute the amont of protocol tokens without the premium
(, uint256 latestTargetValue) = getNewBidTargetValue();
debtAuctionMintedTokens = divide(multiply(latestTargetValue, WAD), protocolTknPrice);
// Take into account the minimum amount of protocol tokens to offer
if (debtAuctionMintedTokens < minProtocolTokenAmountOffered) {
debtAuctionMintedTokens = minProtocolTokenAmountOffered;
}
}
/*
* @notify View function that returns the initial amount of protocol tokens with a premium added on top
* @returns debtAuctionMintedTokens The initial amount of protocol tokens with a premium added on top
*/
function getPremiumAdjustedProtocolTokenAmount() external view returns (uint256 debtAuctionMintedTokens) {
// Get token price
(uint256 protocolTknPrice, bool validProtocolPrice) = protocolTokenOrcl.getResultWithValidity();
require(both(validProtocolPrice, protocolTknPrice > 0), "DebtAuctionInitialParameterSetter/invalid-price");
// Compute the amont of protocol tokens without the premium and apply it
(, uint256 latestTargetValue) = getNewBidTargetValue();
debtAuctionMintedTokens = divide(
multiply(divide(multiply(latestTargetValue, WAD), protocolTknPrice), protocolTokenPremium), THOUSAND
);
// Take into account the minimum amount of protocol tokens to offer
if (debtAuctionMintedTokens < minProtocolTokenAmountOffered) {
debtAuctionMintedTokens = minProtocolTokenAmountOffered;
}
}
/*
* @notify Set the new debtAuctionBidSize and initialDebtAuctionMintedTokens inside the AccountingEngine
* @param feeReceiver The address that will receive the reward for setting new params
*/
function setDebtAuctionInitialParameters(address feeReceiver) external {
// Check delay between calls
require(either(subtract(now, lastUpdateTime) >= updateDelay, lastUpdateTime == 0), "DebtAuctionInitialParameterSetter/wait-more");
// Get the caller's reward
uint256 callerReward = getCallerReward(lastUpdateTime, updateDelay);
// Store the timestamp of the update
lastUpdateTime = now;
// Get token prices
(uint256 protocolTknPrice, bool validProtocolPrice) = protocolTokenOrcl.getResultWithValidity();
(uint256 systemCoinPrice, bool validSysCoinPrice) = systemCoinOrcl.getResultWithValidity();
require(both(validProtocolPrice, validSysCoinPrice), "DebtAuctionInitialParameterSetter/invalid-prices");
require(both(protocolTknPrice > 0, systemCoinPrice > 0), "DebtAuctionInitialParameterSetter/null-prices");
// Compute the scaled bid target value
uint256 updateSlots;
(updateSlots, bidTargetValue) = getNewBidTargetValue();
bidValueLastInflationUpdateTime = addition(bidValueLastInflationUpdateTime, multiply(updateSlots, bidValueInflationDelay));
uint256 scaledBidTargetValue = multiply(bidTargetValue, WAD);
// Compute the amont of protocol tokens without the premium
uint256 initialDebtAuctionMintedTokens = divide(scaledBidTargetValue, protocolTknPrice);
// Apply the premium
initialDebtAuctionMintedTokens = divide(multiply(initialDebtAuctionMintedTokens, protocolTokenPremium), THOUSAND);
// Take into account the minimum amount of protocol tokens to offer
if (initialDebtAuctionMintedTokens < minProtocolTokenAmountOffered) {
initialDebtAuctionMintedTokens = minProtocolTokenAmountOffered;
}
// Compute the debtAuctionBidSize as a RAD taking into account the minimum amount to bid
uint256 debtAuctionBidSize = divide(multiply(scaledBidTargetValue, RAY), systemCoinPrice);
if (debtAuctionBidSize < RAY) {
debtAuctionBidSize = RAY;
}
// Set the debt bid and the associated protocol token amount in the accounting engine
accountingEngine.modifyParameters("debtAuctionBidSize", debtAuctionBidSize);
accountingEngine.modifyParameters("initialDebtAuctionMintedTokens", initialDebtAuctionMintedTokens);
// Emit an event
emit SetDebtAuctionInitialParameters(debtAuctionBidSize, initialDebtAuctionMintedTokens);
// Pay the caller for updating the rate
rewardCaller(feeReceiver, callerReward);
}
/*
* @notice Manually set initial debt auction parameters
* @param debtAuctionBidSize The initial debt auction bid size
* @param initialDebtAuctionMintedTokens The initial amount of protocol tokens to mint in exchange for debtAuctionBidSize system coins
*/
function manualSetDebtAuctionParameters(uint256 debtAuctionBidSize, uint256 initialDebtAuctionMintedTokens)
external isAuthorized {
accountingEngine.modifyParameters("debtAuctionBidSize", debtAuctionBidSize);
accountingEngine.modifyParameters("initialDebtAuctionMintedTokens", initialDebtAuctionMintedTokens);
emit SetDebtAuctionInitialParameters(debtAuctionBidSize, initialDebtAuctionMintedTokens);
}
// --- Internal Logic ---
/*
* @notice Return the latest bidTargetValue
*/
function getNewBidTargetValue() internal view returns (uint256, uint256) {
uint256 updateSlots = subtract(now, bidValueLastInflationUpdateTime) / bidValueInflationDelay;
if (updateSlots == 0) return (0, bidTargetValue);
uint256 targetValue = bidTargetValue;
for (uint i = 0; i < updateSlots; i++) {
targetValue = addition(targetValue, multiply(targetValue / HUNDRED, bidValueTargetInflation));
}
return (
updateSlots,
targetValue
);
}
}
Read Contract
MAX_INFLATION 0xfdb04bbf → uint256
RAY 0x552033c4 → uint256
WAD 0x6a146024 → uint256
accountingEngine 0x961d45c4 → address
addition 0x54f363a3 → uint256
authorizedAccounts 0x24ba5884 → uint256
baseUpdateCallerReward 0x1c1f908c → uint256
bidTargetValue 0x126e325c → uint256
bidValueInflationDelay 0x3b0662d5 → uint256
bidValueLastInflationUpdateTime 0xcab6a550 → uint256
bidValueTargetInflation 0x20c06d59 → uint256
getCallerReward 0xf238ffd2 → uint256
getNewDebtBid 0xa314fd6e → uint256
getPremiumAdjustedProtocolTokenAmount 0x4e4112ce → uint256
getRawProtocolTokenAmount 0x718af690 → uint256
lastUpdateTime 0xc8f33c91 → uint256
maxRewardIncreaseDelay 0x2009e568 → uint256
maxUpdateCallerReward 0x69dec276 → uint256
minProtocolTokenAmountOffered 0x4d230551 → uint256
minimum 0xdd2d2a12 → uint256
multiply 0x165c4a16 → uint256
perSecondCallerRewardIncrease 0x43943b6b → uint256
protocolTokenOrcl 0x9a8226b0 → address
protocolTokenPremium 0x1b25c355 → uint256
rad 0x46f3e81c → uint256
ray 0x10213447 → uint256
rdivide 0xa0871637 → uint256
rmultiply 0x056640b7 → uint256
rpower 0xd6e882dc → uint256
subtract 0x3ef5e445 → uint256
systemCoinOrcl 0xc28a6d3d → address
treasury 0x61d027b3 → address
treasuryAllowance 0x3425677e → uint256
updateDelay 0x554f94db → uint256
wdivide 0xf752fdc3 → uint256
wmultiply 0x3c8bb3e6 → uint256
Write Contract 6 functions
These functions modify contract state and require a wallet transaction to execute.
addAuthorization 0x35b28153
address account
manualSetDebtAuctionParameters 0x4a24ddc6
uint256 debtAuctionBidSize
uint256 initialDebtAuctionMintedTokens
modifyParameters 0x6614f010
bytes32 parameter
address addr
modifyParameters 0xfe4f5890
bytes32 parameter
uint256 val
removeAuthorization 0x94f3f81d
address account
setDebtAuctionInitialParameters 0xbbaf0133
address feeReceiver
Recent Transactions
No transactions found for this address