Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x29985c0adDa5fF2d5f716E428E43A460987D90A5
Balance 0 ETH
Nonce 1
Code Size 12916 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

12916 bytes
0x608060405234801561000f575f80fd5b5060043610610319575f3560e01c8063851b16f5116101af578063c1df984f116100fe578063e3f5aeb91161009e578063f45346dc11610079578063f45346dc14610705578063f65baefa14610718578063f71aa5c61461072d578063f76339dc14610754575f80fd5b8063e3f5aeb9146106d0578063e74b981b146106df578063efb65e89146106f2575f80fd5b8063ca628c78116100d9578063ca628c7814610664578063d0254a2c1461068b578063d1f810a5146106aa578063d547741f146106bd575f80fd5b8063c1df984f1461061c578063c6e6f5921461063e578063ca3f42a314610651575f80fd5b8063942dc57311610169578063aa2f892d11610144578063aa2f892d146105da578063b8f82b26146105ed578063bed6236514610600578063bfefcd7b14610614575f80fd5b8063942dc573146105b6578063a11bac74146105c9578063a217fddf146105d3575f80fd5b8063851b16f51461053057806385a942431461053857806387153eb1146105405780638d158c2a1461055f5780638fed9c441461059a57806391d14854146105a3575f80fd5b8063355274ea1161026b5780634a34a55d11610225578063679aefce11610200578063679aefce146104f0578063761e8cb9146104f85780637ec77ae414610501578063844f31bf14610509575f80fd5b80634a34a55d1461049f5780635069fb57146104c15780635fcbd285146104c9575f80fd5b8063355274ea1461042957806336568abe146104325780633b50c4d1146104455780634494fdc014610470578063469048401461047957806347786d371461048c575f80fd5b8063177aaeef116102d6578063252ca2b5116102b1578063252ca2b5146103e757806326582137146103fa5780632f2ff15d14610403578063327d5f1914610416575f80fd5b8063177aaeef146103a85780631c17b946146103bd578063248a9ca3146103c5575f80fd5b806301e1d1141461031d57806301ffc9a71461033857806307a2d13a1461035b5780630d4d15131461036e5780630ede8a6f146103815780630ef575ed146103a0575b5f80fd5b61032561075d565b6040519081526020015b60405180910390f35b61034b610346366004612e52565b6108ed565b604051901515815260200161032f565b610325610369366004612e79565b610923565b61032561037c366004612ea4565b6109d7565b61032561038f366004612e79565b60056020525f908152604090205481565b610325610d6f565b6103bb6103b6366004612ee3565b610de7565b005b610325610fd8565b6103256103d3366004612e79565b5f9081526020819052604090206001015490565b6103bb6103f5366004612f0b565b6110b5565b610325600b5481565b6103bb610411366004612f42565b61112c565b6103bb610424366004612f65565b611156565b61032560095481565b6103bb610440366004612f42565b6112ea565b610458610453366004612e79565b611322565b6040516001600160a01b03909116815260200161032f565b610325600d5481565b600e54610458906001600160a01b031681565b6103bb61049a366004612e79565b61134a565b61034b6104ad366004612ee3565b60066020525f908152604090205460ff1681565b6103bb6113a3565b6104587f000000000000000000000000a762588624acf7001162aedb6eca6447d60c8de481565b61032561162e565b610325600a5481565b6103bb611659565b6104587f000000000000000000000000425dbc2db879a9d88f259d15cac45786ffe48c9c81565b6103bb611823565b6103256118f1565b61032561054e366004612e79565b60046020525f908152604090205481565b61058561056d366004612ee3565b60036020525f90815260409020805460019091015482565b6040805192835260208301919091520161032f565b610325600c5481565b61034b6105b1366004612f42565b611938565b6103bb6105c4366004612f65565b611960565b610325620f424081565b6103255f81565b6103bb6105e8366004612e79565b611a48565b6103256105fb366004612f65565b611bf1565b6103255f8051602061324883398151915281565b610325611cec565b61034b61062a366004612ee3565b60026020525f908152604090205460ff1681565b61032561064c366004612e79565b611d7a565b6103bb61065f366004612ee3565b611e17565b6104587f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b610325610699366004612ee3565b60076020525f908152604090205481565b6103256106b8366004612f65565b611fb7565b6103bb6106cb366004612f42565b612158565b610325670de0b6b3a764000081565b6103bb6106ed366004612ee3565b61217c565b6103bb610700366004612f65565b612224565b610325610713366004612ea4565b6124b6565b610720612821565b60405161032f9190612f8f565b6103257fddc6431fb8cc9968b6149c68294b1486c85021422e96da6ec1d538f61bc6e7d081565b61032560085481565b6001545f9081305b828210156108d8575f6001838154811061078157610781612fdb565b5f9182526020822001546040516370a0823160e01b81526001600160a01b038581166004830152909116925082919082906370a0823190602401602060405180830381865afa1580156107d6573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107fa9190612fef565b905080156108c2576040516341976e0960e01b81526001600160a01b0384811660048301525f917f000000000000000000000000425dbc2db879a9d88f259d15cac45786ffe48c9c909116906341976e0990602401602060405180830381865afa15801561086a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061088e9190612fef565b90505f6108a58284670de0b6b3a764000084612881565b90506108b185826128c4565b90506108bd818a61301a565b985050505b50505081806108d09061302d565b925050610765565b600a546108e5908561301a565b935050505090565b5f6001600160e01b03198216637965db0b60e01b148061091d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f807f000000000000000000000000a762588624acf7001162aedb6eca6447d60c8de46001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610981573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109a59190612fef565b905080156109ce576109c96109b8610fd8565b6109c0611cec565b8591905f612881565b6109d0565b825b9392505050565b6001600160a01b0383165f9081526006602052604081205460ff1615610a105760405163035edea360e41b815260040160405180910390fd5b825f03610a3057604051639811e0c760e01b815260040160405180910390fd5b600954837f000000000000000000000000a762588624acf7001162aedb6eca6447d60c8de46001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a90573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ab49190612fef565b610abe919061301a565b1115610add576040516305a2e88560e21b815260040160405180910390fd5b610ae78484611fb7565b9050805f03610b0957604051631f2a200560e01b815260040160405180910390fd5b610b158433308461298d565b6001600160a01b0384165f908152600760205260408120548015610b4457610b418582620f4240612a97565b91505b815f03610bcb576040516340c10f1960e01b81526001600160a01b037f000000000000000000000000a762588624acf7001162aedb6eca6447d60c8de416906340c10f1990610b999087908990600401613045565b5f604051808303815f87803b158015610bb0575f80fd5b505af1158015610bc2573d5f803e3d5ffd5b50505050610d1a565b610bd5828661305e565b6040516340c10f1960e01b81529095506001600160a01b037f000000000000000000000000a762588624acf7001162aedb6eca6447d60c8de416906340c10f1990610c269087908990600401613045565b5f604051808303815f87803b158015610c3d575f80fd5b505af1158015610c4f573d5f803e3d5ffd5b5050600e546040516340c10f1960e01b81526001600160a01b037f000000000000000000000000a762588624acf7001162aedb6eca6447d60c8de4811694506340c10f199350610ca59216908690600401613045565b5f604051808303815f87803b158015610cbc575f80fd5b505af1158015610cce573d5f803e3d5ffd5b5050600e546040517f55bb3cade9d43b798a4fe5ffdd05024b2d7870df53920673bfc7e68047cd0ab19350610d1192506001600160a01b03909116908590613045565b60405180910390a15b60408051848152602081018790526001600160a01b03808916929087169133917f5fe47ed6d4225326d3303476197d782ded5a4e9c14f479dc9ec4992af4e85d5991015b60405180910390a450509392505050565b335f908152600360209081526040808320815180830190925280548083526001909101549282019290925260085490919081108015610db15750602082015115155b15610de2575f81815260046020908152604080832054600583529083205491850151610ddf93909290612881565b92505b505090565b5f80516020613248833981519152610dfe81612b56565b6001600160a01b0382165f9081526002602052604090205460ff16610e3657604051636448d6e960e11b815260040160405180910390fd5b5f6001805480602002602001604051908101604052809291908181526020018280548015610e8b57602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311610e6d575b505083519394505f925050505b81811015610f8c57846001600160a01b0316838281518110610ebc57610ebc612fdb565b60200260200101516001600160a01b031603610f7a576001610ede818461305e565b81548110610eee57610eee612fdb565b5f91825260209091200154600180546001600160a01b039092169183908110610f1957610f19612fdb565b905f5260205f20015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055506001805480610f5557610f55613071565b5f8281526020902081015f1990810180546001600160a01b0319169055019055610f8c565b80610f848161302d565b915050610e98565b6001600160a01b0385165f81815260026020526040808220805460ff19169055517f3b8004e49c63694b9ff7a9ca59adcb1bd76fd5f862a40e51e18edb5a54c136549190a25050505050565b6040516341976e0960e01b81526001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48811660048301525f9182917f000000000000000000000000425dbc2db879a9d88f259d15cac45786ffe48c9c16906341976e0990602401602060405180830381865afa158015611060573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110849190612fef565b600b549091505f906110a09083670de0b6b3a764000084612881565b9050806110ab61075d565b610ddf919061305e565b5f805160206132488339815191526110cc81612b56565b6001600160a01b0383165f81815260066020908152604091829020805460ff191686151590811790915591519182527f61aef471b728d4736f9a33247c01f625010034871921f090899ed871abf6952291015b60405180910390a2505050565b5f8281526020819052604090206001015461114681612b56565b6111508383612b63565b50505050565b7fddc6431fb8cc9968b6149c68294b1486c85021422e96da6ec1d538f61bc6e7d061118081612b56565b6001600160a01b0383165f9081526002602052604090205460ff166111b857604051636448d6e960e11b815260040160405180910390fd5b6111c48333308561298d565b6040516341976e0960e01b81526001600160a01b0384811660048301525f917f000000000000000000000000425dbc2db879a9d88f259d15cac45786ffe48c9c909116906341976e0990602401602060405180830381865afa15801561122c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112509190612fef565b90505f6112678483670de0b6b3a764000084612881565b905061127385826128c4565b9050600a54811115611288575f600a5561129f565b80600a5f828254611299919061305e565b90915550505b60408051858152602081018390526001600160a01b038716917f488e335f22a2c4de0fd0265eb68df7062d7026745393fe3268195ea3565af648910160405180910390a25050505050565b6001600160a01b03811633146113135760405163334bd91960e11b815260040160405180910390fd5b61131d8282612bf2565b505050565b60018181548110611331575f80fd5b5f918252602090912001546001600160a01b0316905081565b5f8051602061324883398151915261136181612b56565b60095460408051918252602082018490527fdbbbb176683582b710ef3349793b8d62658724a9d9b54deccf193c4b0aa90c4c910160405180910390a150600955565b5f805160206132488339815191526113ba81612b56565b6040516341976e0960e01b81526001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48811660048301525f917f000000000000000000000000425dbc2db879a9d88f259d15cac45786ffe48c9c909116906341976e0990602401602060405180830381865afa158015611442573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114669190612fef565b90505f61147161162e565b600d549091505f6114858284866001612881565b6040516370a0823160e01b81523060048201529091505f906001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4816906370a0823190602401602060405180830381865afa1580156114ec573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115109190612fef565b905061153c7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48826128c4565b905081600b5461154c919061301a565b81101561156c57604051631e9acf1760e31b815260040160405180910390fd5b81600b5f82825461157d919061301a565b9250508190555082600c5f828254611595919061301a565b90915550505f600d8190556008805482526004602090815260408084208890558254845260058252928390208890559054825190815290810185905290810183905260608101859052608081018690527fc4ba859343295c59f02b0147d3c88883fcf89b2665cbfa5f099362e62acbcb909060a00160405180910390a160088054905f6116218361302d565b9190505550505050505050565b5f611654670de0b6b3a7640000611643611cec565b5f61164c610fd8565b929190612881565b905090565b335f9081526003602052604081206001810154815460085492939192811080156116865750600184015415155b156116bd575f81815260046020908152604080832054600590925282205460018701546116b69390929190612881565b91506116d6565b60405163228c835960e01b815260040160405180910390fd5b604051632770a7eb60e21b81526001600160a01b037f000000000000000000000000a762588624acf7001162aedb6eca6447d60c8de41690639dc29fac906117249030908790600401613045565b5f604051808303815f87803b15801561173b575f80fd5b505af115801561174d573d5f803e3d5ffd5b505050505f846001018190555081600b5f82825461176b919061305e565b9250508190555082600c5f828254611783919061305e565b909155505081156117e8575f6117b97f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4884612c5b565b90506117e67f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb483383612cf2565b505b60405182815233907f9887148cd9a4ee7cd8c2e99ede63c41161da88f30be82a89c4a4e37835b288a29060200160405180910390a250505050565b61182b6118f1565b5f0361184a576040516304b2698360e01b815260040160405180910390fd5b335f90815260036020526040812060018101805490839055600d80549293919283929061187890849061305e565b909155506118a990507f000000000000000000000000a762588624acf7001162aedb6eca6447d60c8de43383612cf2565b60085460405133917fea840f4599505b22d43b474559b1c58da5318bc1787f5dd35b24ed797a905cba916118e591858252602082015260400190565b60405180910390a25050565b335f908152600360209081526040808320815180830190925280548083526001909101549282019290925260085490911461192c575f611932565b80602001515b91505090565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b5f8051602061324883398151915261197781612b56565b600e546001600160a01b03166119a057604051630ef97d8160e11b815260040160405180910390fd5b6001600160a01b0383165f9081526002602052604090205460ff166119d857604051636448d6e960e11b815260040160405180910390fd5b620f42408211156119fc57604051630adad23360e31b815260040160405180910390fd5b6001600160a01b0383165f8181526007602052604090819020849055517fcfb4ca721b9a64dcc3626a15f4a4e53a6b1edd2a79e24527ac117aa8d9f1e4dd9061111f9085815260200190565b805f03611a6857604051639811e0c760e01b815260040160405180910390fd5b6040516370a0823160e01b81523360048201527f000000000000000000000000a762588624acf7001162aedb6eca6447d60c8de46001600160a01b0316906370a0823190602401602060405180830381865afa158015611aca573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611aee9190612fef565b811115611b0e57604051631e9acf1760e31b815260040160405180910390fd5b611b3a7f000000000000000000000000a762588624acf7001162aedb6eca6447d60c8de433308461298d565b335f908152600360205260409020600181015415801590611b5d57506008548154105b15611b6a57611b6a611659565b600854815403611b925781816001015f828254611b87919061301a565b90915550611b9f9050565b6008548155600181018290555b81600d5f828254611bb0919061301a565b909155505060085460405133917f58fe322fc5911ed072ec92f570e517b9793e350eb1ff7be0019fd9f3fade87bc916118e591868252602082015260400190565b6001600160a01b0382165f9081526002602052604081205460ff16611c2957604051636448d6e960e11b815260040160405180910390fd5b6040516341976e0960e01b81526001600160a01b0384811660048301525f917f000000000000000000000000425dbc2db879a9d88f259d15cac45786ffe48c9c909116906341976e0990602401602060405180830381865afa158015611c91573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611cb59190612fef565b90505f611ccc8483670de0b6b3a764000084612881565b9050611cd885826128c4565b9050611ce381611d7a565b95945050505050565b5f600c547f000000000000000000000000a762588624acf7001162aedb6eca6447d60c8de46001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d4c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611d709190612fef565b611654919061305e565b5f807f000000000000000000000000a762588624acf7001162aedb6eca6447d60c8de46001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611dd8573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611dfc9190612fef565b905080156109ce576109c9611e0f611cec565b6109c0610fd8565b5f80516020613248833981519152611e2e81612b56565b6001600160a01b0382161580611e5b57506001600160a01b0382165f9081526002602052604090205460ff165b15611e7957604051636448d6e960e11b815260040160405180910390fd5b60405163addd509960e01b81526001600160a01b0383811660048301525f917f000000000000000000000000425dbc2db879a9d88f259d15cac45786ffe48c9c9091169063addd509990602401602060405180830381865afa158015611ee1573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f059190613085565b6001600160a01b031603611f2c57604051639589a27d60e01b815260040160405180910390fd5b6001600160a01b0382165f81815260026020526040808220805460ff19166001908117909155805480820182559083527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60180546001600160a01b03191684179055517f182944d312eea819dbfe93cae76a416df9ad6ea6df2bd30e5f2f8a202a9d13419190a25050565b6001600160a01b0382165f9081526002602052604081205460ff16611fef57604051636448d6e960e11b815260040160405180910390fd5b6040516341976e0960e01b81526001600160a01b0384811660048301525f917f000000000000000000000000425dbc2db879a9d88f259d15cac45786ffe48c9c909116906341976e0990602401602060405180830381865afa158015612057573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061207b9190612fef565b90505f61209384670de0b6b3a7640000846001612881565b90505f7f000000000000000000000000a762588624acf7001162aedb6eca6447d60c8de46001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120f2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121169190612fef565b90506121228683612c5b565b9150801561214c57612147612135610fd8565b61213d611cec565b8491906001612881565b61214e565b815b9695505050505050565b5f8281526020819052604090206001015461217281612b56565b6111508383612bf2565b5f8051602061324883398151915261219381612b56565b6001600160a01b0382166121ba5760405163d92e233d60e01b815260040160405180910390fd5b600e54604080516001600160a01b03928316815291841660208301527fd9d6b85b6d670cd443496fc6d03390f739bbff47f96a8e33fb0cdd52ad26f5c2910160405180910390a150600e80546001600160a01b0319166001600160a01b0392909216919091179055565b7fddc6431fb8cc9968b6149c68294b1486c85021422e96da6ec1d538f61bc6e7d061224e81612b56565b6001600160a01b0383165f9081526002602052604090205460ff1661228657604051636448d6e960e11b815260040160405180910390fd5b6040516370a0823160e01b81523060048201525f906001600160a01b038516906370a0823190602401602060405180830381865afa1580156122ca573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122ee9190612fef565b90506122fa84826128c4565b90508281101561231d57604051631e9acf1760e31b815260040160405180910390fd5b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b0316846001600160a01b031614801561236a575082600b54612367919061301a565b81105b1561238857604051631e9acf1760e31b815260040160405180910390fd5b6040516341976e0960e01b81526001600160a01b0385811660048301525f917f000000000000000000000000425dbc2db879a9d88f259d15cac45786ffe48c9c909116906341976e0990602401602060405180830381865afa1580156123f0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124149190612fef565b90505f61242c8583670de0b6b3a76400006001612881565b905061243886826128c4565b905080600a5f82825461244b919061301a565b909155505f905061245c8787612c5b565b9050612469873383612cf2565b60408051828152602081018490526001600160a01b038916917f29c75c0e649b2eb3b9b9b321a06d4b74a31094c8d282ab0d04028d65d347f166910160405180910390a250505050505050565b6001600160a01b0383165f9081526006602052604081205460ff16156124ef5760405163035edea360e41b815260040160405180910390fd5b6124f98484611bf1565b9050805f0361251b57604051639811e0c760e01b815260040160405180910390fd5b600954817f000000000000000000000000a762588624acf7001162aedb6eca6447d60c8de46001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561257b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061259f9190612fef565b6125a9919061301a565b11156125c8576040516305a2e88560e21b815260040160405180910390fd5b6125d48433308661298d565b6001600160a01b0384165f908152600760205260408120548015612603576126008382620f4240612a97565b91505b815f0361268a576040516340c10f1960e01b81526001600160a01b037f000000000000000000000000a762588624acf7001162aedb6eca6447d60c8de416906340c10f19906126589087908790600401613045565b5f604051808303815f87803b15801561266f575f80fd5b505af1158015612681573d5f803e3d5ffd5b505050506127d9565b612694828461305e565b6040516340c10f1960e01b81529093506001600160a01b037f000000000000000000000000a762588624acf7001162aedb6eca6447d60c8de416906340c10f19906126e59087908790600401613045565b5f604051808303815f87803b1580156126fc575f80fd5b505af115801561270e573d5f803e3d5ffd5b5050600e546040516340c10f1960e01b81526001600160a01b037f000000000000000000000000a762588624acf7001162aedb6eca6447d60c8de4811694506340c10f1993506127649216908690600401613045565b5f604051808303815f87803b15801561277b575f80fd5b505af115801561278d573d5f803e3d5ffd5b5050600e546040517f55bb3cade9d43b798a4fe5ffdd05024b2d7870df53920673bfc7e68047cd0ab193506127d092506001600160a01b03909116908590613045565b60405180910390a15b60408051868152602081018590526001600160a01b03808916929087169133917f5fe47ed6d4225326d3303476197d782ded5a4e9c14f479dc9ec4992af4e85d599101610d5e565b6060600180548060200260200160405190810160405280929190818152602001828054801561287757602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311612859575b5050505050905090565b5f8061288e868686612a97565b905061289983612df7565b80156128b457505f84806128af576128af6130a0565b868809115b15611ce35761214e60018261301a565b5f80836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612902573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061292691906130b4565b60ff16905060128111156129565761294f600161294460128461305e565b6109c090600a6131b4565b9250612985565b60128110156129855761298261296d82601261305e565b61297890600a6131b4565b849060015f612881565b92505b509092915050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291515f928392908816916129f091906131bf565b5f604051808303815f865af19150503d805f8114612a29576040519150601f19603f3d011682016040523d82523d5f602084013e612a2e565b606091505b5091509150818015612a58575080511580612a58575080806020019051810190612a5891906131eb565b612a8f5760405162461bcd60e51b815260206004820152600360248201526229aa2360e91b60448201526064015b60405180910390fd5b505050505050565b5f838302815f1985870982811083820303915050805f03612acb57838281612ac157612ac16130a0565b04925050506109d0565b808411612aeb5760405163227bc15360e01b815260040160405180910390fd5b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b612b608133612e23565b50565b5f612b6e8383611938565b612beb575f838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055612ba33390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161091d565b505f61091d565b5f612bfd8383611938565b15612beb575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161091d565b5f80836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c99573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612cbd91906130b4565b60ff1690506012811015612cdb5761294f600161294483601261305e565b60128111156129855761298261296d60128361305e565b5f80846001600160a01b031663a9059cbb60e01b8585604051602401612d19929190613045565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051612d5791906131bf565b5f604051808303815f865af19150503d805f8114612d90576040519150601f19603f3d011682016040523d82523d5f602084013e612d95565b606091505b5091509150818015612dbf575080511580612dbf575080806020019051810190612dbf91906131eb565b612df05760405162461bcd60e51b815260206004820152600260248201526114d560f21b6044820152606401612a86565b5050505050565b5f6002826003811115612e0c57612e0c613206565b612e16919061321a565b60ff166001149050919050565b612e2d8282611938565b612e4e57808260405163e2517d3f60e01b8152600401612a86929190613045565b5050565b5f60208284031215612e62575f80fd5b81356001600160e01b0319811681146109d0575f80fd5b5f60208284031215612e89575f80fd5b5035919050565b6001600160a01b0381168114612b60575f80fd5b5f805f60608486031215612eb6575f80fd5b8335612ec181612e90565b9250602084013591506040840135612ed881612e90565b809150509250925092565b5f60208284031215612ef3575f80fd5b81356109d081612e90565b8015158114612b60575f80fd5b5f8060408385031215612f1c575f80fd5b8235612f2781612e90565b91506020830135612f3781612efe565b809150509250929050565b5f8060408385031215612f53575f80fd5b823591506020830135612f3781612e90565b5f8060408385031215612f76575f80fd5b8235612f8181612e90565b946020939093013593505050565b602080825282518282018190525f9190848201906040850190845b81811015612fcf5783516001600160a01b031683529284019291840191600101612faa565b50909695505050505050565b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215612fff575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b8082018082111561091d5761091d613006565b5f6001820161303e5761303e613006565b5060010190565b6001600160a01b03929092168252602082015260400190565b8181038181111561091d5761091d613006565b634e487b7160e01b5f52603160045260245ffd5b5f60208284031215613095575f80fd5b81516109d081612e90565b634e487b7160e01b5f52601260045260245ffd5b5f602082840312156130c4575f80fd5b815160ff811681146109d0575f80fd5b600181815b8085111561310e57815f19048211156130f4576130f4613006565b8085161561310157918102915b93841c93908002906130d9565b509250929050565b5f826131245750600161091d565b8161313057505f61091d565b816001811461314657600281146131505761316c565b600191505061091d565b60ff84111561316157613161613006565b50506001821b61091d565b5060208310610133831016604e8410600b841016171561318f575081810a61091d565b61319983836130d4565b805f19048211156131ac576131ac613006565b029392505050565b5f6109d08383613116565b5f82515f5b818110156131de57602081860181015185830152016131c4565b505f920191825250919050565b5f602082840312156131fb575f80fd5b81516109d081612efe565b634e487b7160e01b5f52602160045260245ffd5b5f60ff83168061323857634e487b7160e01b5f52601260045260245ffd5b8060ff8416069150509291505056fe696e87880cf63dca8f080e7a026952044d39afbd9cb8ab3582bd4b29e6071b29a164736f6c6343000814000a

Verified Source Code Partial Match

Compiler: v0.8.20+commit.a1b79de6 EVM: shanghai Optimization: Yes (200 runs)
BeraPreDepositVault.sol 470 lines
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.20;

import {AccessControl} from '@openzeppelin/contracts/access/AccessControl.sol';
import {ERC20} from '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import {Math} from '@openzeppelin/contracts/utils/math/Math.sol';
import {TransferHelper} from '@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol';

import {Token} from './Token.sol';
import {OracleConfigurator} from './oracle/OracleConfigurator.sol';

import './Errors.sol';

contract StoneBeraVault is AccessControl {
  using Math for uint256;

  bytes32 public constant VAULT_OPERATOR_ROLE = keccak256('VAULT_OPERATOR_ROLE');
  bytes32 public constant ASSETS_MANAGEMENT_ROLE = keccak256('ASSETS_MANAGEMENT_ROLE');

  uint256 public constant D18 = 1e18;
  uint256 public constant D6 = 1e6;

  Token public immutable lpToken;
  ERC20 public immutable withdrawToken;

  OracleConfigurator public immutable oracleConfigurator;

  address[] public underlyingAssets;

  mapping(address => bool) public isUnderlyingAssets;
  mapping(address => RedeemRequest) public redeemRequests;
  mapping(uint256 => uint256) public roundPricePerShare;
  mapping(uint256 => uint256) public withdrawTokenPrice;
  mapping(address => bool) public depositPaused;

  mapping(address => uint256) public feeRate;

  uint256 public latestRoundID;
  uint256 public cap;
  uint256 public assetsBorrowed;

  uint256 public redeemableAmountInPast; // calculated as withdrawToken
  uint256 public requestingSharesInPast; // calculated as share
  uint256 public requestingSharesInRound; // calculated as share

  address public feeRecipient;

  struct RedeemRequest {
    uint256 requestRound;
    uint256 requestShares;
  }

  event Deposit(
    address indexed caller,
    address indexed owner,
    address indexed asset,
    uint256 amount,
    uint256 shares
  );
  event RedeemRequested(address indexed owner, uint256 shares, uint256 round);
  event RedeemCancelled(address indexed owner, uint256 shares, uint256 round);
  event RedeemClaimed(address indexed owner, uint256 amount);
  event RollToNextRound(
    uint256 round,
    uint256 share,
    uint256 withdrawTokenAmount,
    uint256 sharePrice,
    uint256 withdrawTokenPrice
  );
  event FeeCharged(address recipient, uint256 fee);
  event SetCap(uint256 oldValue, uint256 newValue);
  event SetDepositPause(address indexed asset, bool flag);
  event SetFeeRate(address indexed asset, uint256 feeRate);
  event SetFeeRecipient(address oldValue, address newValue);
  event AddUnderlyingAsset(address indexed asset);
  event RemoveUnderlyingAsset(address indexed asset);
  event AssetsWithdrawn(address indexed asset, uint256 amount, uint256 value);
  event AssetsRepaid(address indexed asset, uint256 amount, uint256 value);

  constructor(address _lpToken, address _withdrawToken, address _oracleConfigurator, uint256 _cap) {
    if (_lpToken == address(0) || _withdrawToken == address(0) || _oracleConfigurator == address(0))
      revert ZeroAddress();

    _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);

    lpToken = Token(_lpToken);
    withdrawToken = Token(_withdrawToken);
    cap = _cap;

    oracleConfigurator = OracleConfigurator(_oracleConfigurator);

    if (oracleConfigurator.oracles(address(_withdrawToken)) == address(0)) revert InvalidOracle();
  }

  function deposit(
    address _asset,
    uint256 _amount,
    address _receiver
  ) public returns (uint256 shares) {
    if (depositPaused[_asset]) revert DepositPaused();
    if ((shares = previewDeposit(_asset, _amount)) == 0) revert ZeroShares();

    if (lpToken.totalSupply() + shares > cap) revert DepositCapped();

    TransferHelper.safeTransferFrom(_asset, msg.sender, address(this), _amount);

    uint256 fee;
    uint256 rate = feeRate[_asset];
    if (rate != 0) {
      fee = shares.mulDiv(rate, D6);
    }

    if (fee == 0) {
      lpToken.mint(_receiver, shares);
    } else {
      shares -= fee;
      lpToken.mint(_receiver, shares);
      lpToken.mint(feeRecipient, fee);

      emit FeeCharged(feeRecipient, fee);
    }

    emit Deposit(msg.sender, _receiver, _asset, _amount, shares);
  }

  function mint(
    address _asset,
    uint256 _shares,
    address _receiver
  ) external returns (uint256 assets) {
    if (depositPaused[_asset]) revert DepositPaused();
    if (_shares == 0) revert ZeroShares();
    if (lpToken.totalSupply() + _shares > cap) revert DepositCapped();

    assets = previewMint(_asset, _shares);
    if (assets == 0) revert ZeroAmount();

    TransferHelper.safeTransferFrom(_asset, msg.sender, address(this), assets);

    uint256 fee;
    uint256 rate = feeRate[_asset];
    if (rate != 0) {
      fee = _shares.mulDiv(rate, D6);
    }

    if (fee == 0) {
      lpToken.mint(_receiver, _shares);
    } else {
      _shares -= fee;
      lpToken.mint(_receiver, _shares);
      lpToken.mint(feeRecipient, fee);

      emit FeeCharged(feeRecipient, fee);
    }

    emit Deposit(msg.sender, _receiver, _asset, assets, _shares);
  }

  function requestRedeem(uint256 _shares) external {
    if (_shares == 0) revert ZeroShares();
    if (_shares > lpToken.balanceOf(msg.sender)) revert InsufficientBalance();

    TransferHelper.safeTransferFrom(address(lpToken), msg.sender, address(this), _shares);

    RedeemRequest storage redeemRequest = redeemRequests[msg.sender];

    if (redeemRequest.requestShares > 0 && redeemRequest.requestRound < latestRoundID) {
      claimRedeemRequest();
    }

    if (redeemRequest.requestRound == latestRoundID) {
      redeemRequest.requestShares += _shares;
    } else {
      redeemRequest.requestRound = latestRoundID;
      redeemRequest.requestShares = _shares;
    }
    requestingSharesInRound += _shares;

    emit RedeemRequested(msg.sender, _shares, latestRoundID);
  }

  function cancelRequest() external {
    if (pendingRedeemRequest() == 0) revert NoRequestingShares();

    RedeemRequest storage redeemRequest = redeemRequests[msg.sender];

    uint256 requestingShares = redeemRequest.requestShares;
    redeemRequest.requestShares = 0;

    requestingSharesInRound -= requestingShares;

    TransferHelper.safeTransfer(address(lpToken), msg.sender, requestingShares);

    emit RedeemCancelled(msg.sender, requestingShares, latestRoundID);
  }

  function claimRedeemRequest() public {
    RedeemRequest storage redeemRequest = redeemRequests[msg.sender];
    uint256 requestShares = redeemRequest.requestShares;

    uint256 claimable;
    uint256 round = redeemRequest.requestRound;
    if (round < latestRoundID && redeemRequest.requestShares != 0) {
      claimable = redeemRequest.requestShares.mulDiv(
        roundPricePerShare[round],
        withdrawTokenPrice[round],
        Math.Rounding.Floor
      );
    } else {
      revert NoClaimableRedeem();
    }

    lpToken.burn(address(this), requestShares);

    redeemRequest.requestShares = 0;

    redeemableAmountInPast -= claimable;
    requestingSharesInPast -= requestShares;

    if (claimable > 0) {
      // Convert the claimable amount (18-decimal) to native withdraw token units.
      uint256 nativeClaimable = _convertFrom18(address(withdrawToken), claimable);
      TransferHelper.safeTransfer(address(withdrawToken), msg.sender, nativeClaimable);
    }

    emit RedeemClaimed(msg.sender, claimable);
  }

  function pendingRedeemRequest() public view returns (uint256 shares) {
    RedeemRequest memory redeemRequest = redeemRequests[msg.sender];

    return redeemRequest.requestRound == latestRoundID ? redeemRequest.requestShares : 0;
  }

  function claimableRedeemRequest() external view returns (uint256 assets) {
    RedeemRequest memory redeemRequest = redeemRequests[msg.sender];

    uint256 round = redeemRequest.requestRound;
    if (round < latestRoundID && redeemRequest.requestShares != 0) {
      assets = redeemRequest.requestShares.mulDiv(
        roundPricePerShare[round],
        withdrawTokenPrice[round],
        Math.Rounding.Floor
      );
    }
  }

  function totalAssets() public view returns (uint256 totalManagedAssets) {
    uint256 length = underlyingAssets.length;
    uint256 i;

    address _this = address(this);

    for (i; i < length; i++) {
      address tokenAddr = underlyingAssets[i];
      ERC20 token = ERC20(tokenAddr);
      uint256 balance = token.balanceOf(_this);

      if (balance != 0) {
        uint256 price = oracleConfigurator.getPrice(tokenAddr);
        uint256 value = price.mulDiv(balance, D18, Math.Rounding.Floor);
        value = _convertTo18(address(tokenAddr), value);

        totalManagedAssets += value;
      }
    }
    totalManagedAssets += assetsBorrowed;
  }

  function activeAssets() public view returns (uint256 assets) {
    uint256 price = oracleConfigurator.getPrice(address(withdrawToken));
    uint256 reservedValue = redeemableAmountInPast.mulDiv(price, D18, Math.Rounding.Floor);
    // reservedValue = _convertFrom18(address(withdrawToken), reservedValue);

    return totalAssets() - reservedValue;
  }

  function activeShares() public view returns (uint256 shares) {
    return lpToken.totalSupply() - requestingSharesInPast;
  }

  function convertToShares(uint256 _assets) public view returns (uint256 shares) {
    uint256 supply = lpToken.totalSupply();

    return
      supply == 0 ? _assets : _assets.mulDiv(activeShares(), activeAssets(), Math.Rounding.Floor);
  }

  function convertToAssets(uint256 _shares) public view returns (uint256 assets) {
    uint256 supply = lpToken.totalSupply();

    return
      supply == 0 ? _shares : _shares.mulDiv(activeAssets(), activeShares(), Math.Rounding.Floor);
  }

  function previewDeposit(address _asset, uint256 _amount) public view returns (uint256 shares) {
    if (!isUnderlyingAssets[_asset]) revert InvalidAsset();

    uint256 price = oracleConfigurator.getPrice(_asset);
    uint256 value = _amount.mulDiv(price, D18, Math.Rounding.Floor);
    value = _convertTo18(address(_asset), value);

    return convertToShares(value);
  }

  function previewMint(address _asset, uint256 _shares) public view returns (uint256 assets) {
    if (!isUnderlyingAssets[_asset]) revert InvalidAsset();

    uint256 price = oracleConfigurator.getPrice(_asset);
    uint256 amount = _shares.mulDiv(D18, price, Math.Rounding.Ceil);
    uint256 supply = lpToken.totalSupply();
    amount = _convertFrom18(address(_asset), amount);

    return supply == 0 ? amount : amount.mulDiv(activeAssets(), activeShares(), Math.Rounding.Ceil);
  }

  function getRate() public view returns (uint256 rate) {
    return activeAssets().mulDiv(D18, activeShares(), Math.Rounding.Floor);
  }

  function getUnderlyings() external view returns (address[] memory underlyings) {
    return underlyingAssets;
  }

  function rollToNextRound() external onlyRole(VAULT_OPERATOR_ROLE) {
    uint256 price = oracleConfigurator.getPrice(address(withdrawToken));
    uint256 rate = getRate();

    uint256 requestingShares = requestingSharesInRound;
    uint256 withdrawTokenAmount = requestingShares.mulDiv(rate, price, Math.Rounding.Ceil);
    // withdrawTokenAmount = _convertTo18(address(withdrawToken), withdrawTokenAmount);

    uint balance = withdrawToken.balanceOf(address(this));
    balance = _convertTo18(address(withdrawToken), balance);

    if (balance < redeemableAmountInPast + withdrawTokenAmount)
      revert InsufficientBalance();

    redeemableAmountInPast += withdrawTokenAmount;
    requestingSharesInPast += requestingShares;
    requestingSharesInRound = 0;

    roundPricePerShare[latestRoundID] = rate;
    withdrawTokenPrice[latestRoundID] = price;

    emit RollToNextRound(latestRoundID, requestingShares, withdrawTokenAmount, rate, price);
    latestRoundID++;
  }

  function withdrawAssets(
    address _asset,
    uint256 _amount
  ) external onlyRole(ASSETS_MANAGEMENT_ROLE) {
    if (!isUnderlyingAssets[_asset]) revert InvalidAsset();

    uint256 balance = ERC20(_asset).balanceOf(address(this));
    balance = _convertTo18(address(_asset), balance);
    if (balance < _amount) revert InsufficientBalance();

    if (_asset == address(withdrawToken) && balance < redeemableAmountInPast + _amount)
      revert InsufficientBalance();

    uint256 price = oracleConfigurator.getPrice(_asset);
    uint256 value = _amount.mulDiv(price, D18, Math.Rounding.Ceil);
    value = _convertTo18(address(_asset), value);

    assetsBorrowed += value;

    // Convert the withdrawal amount from 18 decimals back to native token units.
    uint256 nativeAmount = _convertFrom18(_asset, _amount);
    TransferHelper.safeTransfer(_asset, msg.sender, nativeAmount);

    emit AssetsWithdrawn(_asset, nativeAmount, value);
  }

  function repayAssets(address _asset, uint256 _amount) external onlyRole(ASSETS_MANAGEMENT_ROLE) {
    if (!isUnderlyingAssets[_asset]) revert InvalidAsset();

    TransferHelper.safeTransferFrom(_asset, msg.sender, address(this), _amount);

    uint256 price = oracleConfigurator.getPrice(_asset);
    uint256 value = _amount.mulDiv(price, D18, Math.Rounding.Floor);
    value = _convertTo18(address(_asset), value);

    if (value > assetsBorrowed) {
      assetsBorrowed = 0;
    } else {
      assetsBorrowed -= value;
    }

    emit AssetsRepaid(_asset, _amount, value);
  }

  function setCap(uint256 _cap) external onlyRole(VAULT_OPERATOR_ROLE) {
    emit SetCap(cap, _cap);
    cap = _cap;
  }

  function addUnderlyingAsset(address _asset) external onlyRole(VAULT_OPERATOR_ROLE) {
    if (_asset == address(0) || isUnderlyingAssets[_asset]) revert InvalidAsset();
    if (oracleConfigurator.oracles(_asset) == address(0)) revert InvalidOracle();

    isUnderlyingAssets[_asset] = true;
    underlyingAssets.push(_asset);

    emit AddUnderlyingAsset(_asset);
  }

  function removeUnderlyingAsset(address _asset) external onlyRole(VAULT_OPERATOR_ROLE) {
    if (!isUnderlyingAssets[_asset]) revert InvalidAsset();

    address[] memory assets = underlyingAssets;

    uint256 length = assets.length;
    uint256 i;
    for (i; i < length; i++) {
      if (assets[i] == _asset) {
        underlyingAssets[i] = underlyingAssets[length - 1];
        underlyingAssets.pop();
        break;
      }
    }
    isUnderlyingAssets[_asset] = false;

    emit RemoveUnderlyingAsset(_asset);
  }

  function setDepositPause(address _token, bool _pause) external onlyRole(VAULT_OPERATOR_ROLE) {
    depositPaused[_token] = _pause;
    emit SetDepositPause(_token, _pause);
  }

  function setFeeRate(address _token, uint256 _feeRate) external onlyRole(VAULT_OPERATOR_ROLE) {
    if (feeRecipient == address(0)) revert NoFeeRecipient();
    if (!isUnderlyingAssets[_token]) revert InvalidAsset();
    if (_feeRate > D6) revert InvalidFeeRate();

    feeRate[_token] = _feeRate;

    emit SetFeeRate(_token, _feeRate);
  }

  function setFeeRecipient(address _feeRecipient) external onlyRole(VAULT_OPERATOR_ROLE) {
    if (_feeRecipient == address(0)) revert ZeroAddress();

    emit SetFeeRecipient(feeRecipient, _feeRecipient);
    feeRecipient = _feeRecipient;
  }

  function _convertTo18(address _asset, uint256 value) internal view returns (uint256) {
    uint decimals = ERC20(_asset).decimals();
    if(decimals > 18){
      value = value.mulDiv(1, 10**(decimals-18), Math.Rounding.Floor);
    }else if(decimals < 18){
      value = value.mulDiv(10**(18 - decimals), 1,Math.Rounding.Floor);
    }

    return value;
  }

  function _convertFrom18(address _asset, uint256 amount18) internal view returns (uint256) {
    uint256 decimals = ERC20(_asset).decimals();
    if(decimals < 18){
      amount18 = amount18.mulDiv(1, 10**(18-decimals), Math.Rounding.Floor);
    } else if(decimals > 18){
      amount18 = amount18.mulDiv(10**(decimals-18), 1, Math.Rounding.Floor);
    }
    return amount18;
  }
}
AccessControl.sol 209 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address account => bool) hasRole;
        bytes32 adminRole;
    }

    mapping(bytes32 role => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with an {AccessControlUnauthorizedAccount} error including the required role.
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual returns (bool) {
        return _roles[role].hasRole[account];
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
     * is missing `role`.
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert AccessControlUnauthorizedAccount(account, role);
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address callerConfirmation) public virtual {
        if (callerConfirmation != _msgSender()) {
            revert AccessControlBadConfirmation();
        }

        _revokeRole(role, callerConfirmation);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
        if (!hasRole(role, account)) {
            _roles[role].hasRole[account] = true;
            emit RoleGranted(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
        if (hasRole(role, account)) {
            _roles[role].hasRole[account] = false;
            emit RoleRevoked(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }
}
ERC20.sol 316 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

    mapping(address account => mapping(address spender => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `value`.
     */
    function transfer(address to, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, value);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     * ```
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}
Math.sol 415 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
     * denominator == 0.
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
     * Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.
            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
            // works in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
     * towards zero.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}
TransferHelper.sol 60 lines
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.0;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';

library TransferHelper {
    /// @notice Transfers tokens from the targeted address to the given destination
    /// @notice Errors with 'STF' if transfer fails
    /// @param token The contract address of the token to be transferred
    /// @param from The originating address from which the tokens will be transferred
    /// @param to The destination address of the transfer
    /// @param value The amount to be transferred
    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) =
            token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF');
    }

    /// @notice Transfers tokens from msg.sender to a recipient
    /// @dev Errors with ST if transfer fails
    /// @param token The contract address of the token which will be transferred
    /// @param to The recipient of the transfer
    /// @param value The value of the transfer
    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST');
    }

    /// @notice Approves the stipulated contract to spend the given allowance in the given token
    /// @dev Errors with 'SA' if transfer fails
    /// @param token The contract address of the token to be approved
    /// @param to The target of the approval
    /// @param value The amount of the given token the target will be allowed to spend
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA');
    }

    /// @notice Transfers ETH to the recipient address
    /// @dev Fails with `STE`
    /// @param to The destination of the transfer
    /// @param value The value to be transferred
    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, 'STE');
    }
}
Token.sol 22 lines
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.20;

import {ERC20} from '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import {AccessControl} from '@openzeppelin/contracts/access/AccessControl.sol';

contract Token is ERC20, AccessControl {
  bytes32 public constant MINTER_ROLE = keccak256('MINTER_ROLE');
  bytes32 public constant BURNER_ROLE = keccak256('BURNER_ROLE');

  constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) {
    _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
  }

  function mint(address _to, uint256 _amount) external onlyRole(MINTER_ROLE) {
    _mint(_to, _amount);
  }

  function burn(address _from, uint256 _amount) external onlyRole(BURNER_ROLE) {
    _burn(_from, _amount);
  }
}
OracleConfigurator.sol 36 lines
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.20;

import {AccessControl} from '@openzeppelin/contracts/access/AccessControl.sol';

import {Oracle} from './Oracle.sol';
import '../Errors.sol';

contract OracleConfigurator is AccessControl {
  bytes32 public constant ORACLE_MANAGER_ROLE = keccak256('ORACLE_MANAGER_ROLE');

  mapping(address => address) public oracles;

  event OracleUpdated(address oldOracle, address newOracle);

  constructor() {
    _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
  }

  function updateOracle(address _token, address _oracle) external onlyRole(ORACLE_MANAGER_ROLE) {
    if (_token == address(0)) revert InvalidToken();
    if (_oracle == address(0)) revert InvalidOracle();

    emit OracleUpdated(oracles[_token], _oracle);

    oracles[_token] = _oracle;
  }

  function getPrice(address _token) external view returns (uint256 price) {
    address oracle = oracles[_token];

    if (_token == address(0) || oracle == address(0)) revert InvalidToken();

    price = Oracle(oracle).getPrice();
  }
}
Errors.sol 54 lines
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.20;

error InvalidToken();

error InvalidAsset();

error InsufficientBalance();

error InvalidOracle();

error InvalidPrice();

error InvalidArrayLength();

error DepositCapped();

error DepositPaused();

error ZeroShares();

error ZeroAmount();

error NoRequestingShares();

error NoClaimableRedeem();

error ZeroAddress();

error InvalidRequest();

error InvalidRequestToken();

error CannotRemove();

error InvalidDecimals();

error InvalidFeeRate();

error NoFeeRecipient();

error InvalidAddress();

// error InvalidArrayLength();

// error InvalidToken();

error UnsupportedToken();

error Paused();

error ExceedCap();

error InvalidAmount();
IAccessControl.sol 98 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)

pragma solidity ^0.8.20;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     */
    function renounceRole(bytes32 role, address callerConfirmation) external;
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
ERC165.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}
IERC20Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}
draft-IERC6093.sol 161 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
Oracle.sol 15 lines
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.20;

abstract contract Oracle {
  address public immutable token;

  string public name;

  constructor(address _token, string memory _name) {
    token = _token;
    name = _name;
  }

  function getPrice() external view virtual returns (uint256 price) {}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

Read Contract

ASSETS_MANAGEMENT_ROLE 0xf71aa5c6 → bytes32
D18 0xe3f5aeb9 → uint256
D6 0xa11bac74 → uint256
DEFAULT_ADMIN_ROLE 0xa217fddf → bytes32
VAULT_OPERATOR_ROLE 0xbed62365 → bytes32
activeAssets 0x1c17b946 → uint256
activeShares 0xbfefcd7b → uint256
assetsBorrowed 0x761e8cb9 → uint256
cap 0x355274ea → uint256
claimableRedeemRequest 0x0ef575ed → uint256
convertToAssets 0x07a2d13a → uint256
convertToShares 0xc6e6f592 → uint256
depositPaused 0x4a34a55d → bool
feeRate 0xd0254a2c → uint256
feeRecipient 0x46904840 → address
getRate 0x679aefce → uint256
getRoleAdmin 0x248a9ca3 → bytes32
getUnderlyings 0xf65baefa → address[]
hasRole 0x91d14854 → bool
isUnderlyingAssets 0xc1df984f → bool
latestRoundID 0xf76339dc → uint256
lpToken 0x5fcbd285 → address
oracleConfigurator 0x844f31bf → address
pendingRedeemRequest 0x85a94243 → uint256
previewDeposit 0xb8f82b26 → uint256
previewMint 0xd1f810a5 → uint256
redeemRequests 0x8d158c2a → uint256, uint256
redeemableAmountInPast 0x26582137 → uint256
requestingSharesInPast 0x8fed9c44 → uint256
requestingSharesInRound 0x4494fdc0 → uint256
roundPricePerShare 0x87153eb1 → uint256
supportsInterface 0x01ffc9a7 → bool
totalAssets 0x01e1d114 → uint256
underlyingAssets 0x3b50c4d1 → address
withdrawToken 0xca628c78 → address
withdrawTokenPrice 0x0ede8a6f → uint256

Write Contract 17 functions

These functions modify contract state and require a wallet transaction to execute.

addUnderlyingAsset 0xca3f42a3
address _asset
cancelRequest 0x851b16f5
No parameters
claimRedeemRequest 0x7ec77ae4
No parameters
deposit 0xf45346dc
address _asset
uint256 _amount
address _receiver
returns: uint256
grantRole 0x2f2ff15d
bytes32 role
address account
mint 0x0d4d1513
address _asset
uint256 _shares
address _receiver
returns: uint256
removeUnderlyingAsset 0x177aaeef
address _asset
renounceRole 0x36568abe
bytes32 role
address callerConfirmation
repayAssets 0x327d5f19
address _asset
uint256 _amount
requestRedeem 0xaa2f892d
uint256 _shares
revokeRole 0xd547741f
bytes32 role
address account
rollToNextRound 0x5069fb57
No parameters
setCap 0x47786d37
uint256 _cap
setDepositPause 0x252ca2b5
address _token
bool _pause
setFeeRate 0x942dc573
address _token
uint256 _feeRate
setFeeRecipient 0xe74b981b
address _feeRecipient
withdrawAssets 0xefb65e89
address _asset
uint256 _amount

Recent Transactions

No transactions found for this address