Issue | Instances | |
---|---|---|
Med-1 | Centralization Risk for trusted owners | 7 |
Med-2 | Contracts are vulnerable to fee-on-transfer-token-related accounting issues | 3 |
Med-3 | Use safeTransfer()/safeTransferFrom() Instead of transfer()/transferFrom() |
2 |
Contracts have owners with privileged rights to perform admin tasks and need to be trusted to not perform malicious updates or drain funds.
File:solady-main/src/auth/OwnableRoles.sol
11:abstract contract OwnableRoles is Ownable {
148: function grantRoles(address user, uint256 roles) public payable virtual onlyOwner {
154: function revokeRoles(address user, uint256 roles) public payable virtual onlyOwner {
File:solady-main/src/auth/Ownable.sol
9:abstract contract Ownable {
124: function transferOwnership(address newOwner) public payable virtual onlyOwner {
136: function renounceOwnership() public payable virtual onlyOwner {
172: function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {
Instances (7)
Without measuring the balance before and after the transfer, there's no way to ensure that enough tokens were transferred, in the cases where the token has a fee-on-transfer mechanic. If there are latent funds in the contract, subsequent transfers will succeed.
File:solady-main/src/tokens/ERC721.sol
308: transferFrom(from, to, id);
329: transferFrom(from, to, id);
File:solady-main/src/tokens/ERC4626.sol
453: SafeTransferLib.safeTransferFrom(asset(), by, address(this), assets);
Instances (3)
Use of transfer()/transferFrom()
can can cause silent failures and affect token accounting in the contract.
File:solady-main/src/tokens/ERC721.sol
308: transferFrom(from, to, id);
329: transferFrom(from, to, id);
Instances (2)
Issue | Instances | |
---|---|---|
Low-1 | The owner is a single point of failure and a centralization risk |
5 |
Low-2 | Loss of precision | 21 |
Low-3 | Use safeTransferOwnership instead of transferOwnership function | 1 |
Low-4 | Use _safeMint instead of _mint |
6 |
Low-5 | Division before multiplication causing significant loss of precision | 1 |
Having a single EOA as the only owner of contracts is a large centralization risk and a single point of failure. A single private key may be taken in a hack, or the sole holder of the key may become unable to retrieve the key when necessary. Consider changing to a multi-signature setup, or having a role-based authorization model.
File:solady-main/src/auth/OwnableRoles.sol
148: function grantRoles(address user, uint256 roles) public payable virtual onlyOwner {
154: function revokeRoles(address user, uint256 roles) public payable virtual onlyOwner {
File:solady-main/src/auth/Ownable.sol
124: function transferOwnership(address newOwner) public payable virtual onlyOwner {
136: function renounceOwnership() public payable virtual onlyOwner {
172: function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {
Instances (5)
Division by large numbers may result in the result being zero, due to solidity not supporting fractions. Consider requiring a minimum amount for the numerator to ensure that it is always larger than the denominator
File:solady-main/src/utils/DateTimeLib.sol
126: (year, month, day) = epochDayToDate(timestamp / 86400);
163: (year, month, day) = epochDayToDate(timestamp / 86400);
165: hour = secs / 3600;
167: minute = secs / 60;
196: result = ((timestamp / 86400 + 3) % 7) + 1;
305: (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400);
319: (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400);
321: result = _offsetted(year + month / 12, _add(month % 12, 1), day, timestamp);
360: (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400);
374: (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400);
376: result = _offsetted(yearMonth / 12, _add(yearMonth % 12, 1), day, timestamp);
418: (uint256 fromYear,,) = epochDayToDate(fromTimestamp / 86400);
419: (uint256 toYear,,) = epochDayToDate(toTimestamp / 86400);
434: (uint256 fromYear, uint256 fromMonth,) = epochDayToDate(fromTimestamp / 86400);
435: (uint256 toYear, uint256 toMonth,) = epochDayToDate(toTimestamp / 86400);
445: result = (toTimestamp - fromTimestamp) / 86400;
454: result = (toTimestamp - fromTimestamp) / 3600;
463: result = (toTimestamp - fromTimestamp) / 60;
File:solady-main/src/utils/FixedPointMathLib.sol
142: x = (x << 78) / 5 ** 18;
147: int256 k = ((x << 96) / 54916777467707473351141471128 + 2 ** 95) >> 96;
File:solady-main/src/utils/LibMap.sol
109: result = uint40(map.map[index / 6] >> ((index % 6) * 40));
Instances (21)
transferOwnership
function is used to change Ownership from Ownable.sol. Use a 2 structure transferOwnership
which is safer. safeTransferOwnership
, use it is more secure due to 2-stage ownership transfer.
File:solady-main/src/auth/Ownable.sol
124: function transferOwnership(address newOwner) public payable virtual onlyOwner {
Instances (1)
File:solady-main/src/tokens/ERC20.sol
426: function _mint(address to, uint256 amount) internal virtual {
File:solady-main/src/tokens/ERC721.sol
438: function _mint(address to, uint256 id) internal virtual {
494: _mint(to, id);
File:solady-main/src/tokens/ERC1155.sol
473: function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {
File:solady-main/src/tokens/ERC4626.sol
454: _mint(to, shares);
File:solady-main/src/tokens/WETH.sol
58: _mint(msg.sender, msg.value);
Instances (6)
First divides and then multiplies again, there is a significant loss of precision
File:solady-main/src/utils/LibMap.sol
109: result = uint40(map.map[index / 6] >> ((index % 6) * 40));
Instances (1)
Issue | Instances | |
---|---|---|
NC-1 | Return values of approve() not checked |
2 |
NC-2 | Constants should be defined rather than using magic numbers | 187 |
NC-3 | Lines are too long | 539 |
NC-4 | Not using the named return variables anywhere in the function is confusing | 117 |
NC-5 | Use a single file for all system-wide constants | 347 |
NC-6 | Functions guaranteed to revert when called by normal users can be marked payable | 5 |
NC-7 | Numeric values having to do with time should use time units for readability | 61 |
NC-8 | Variables need not be initialized to zero | 2 |
NC-9 | Some number values can be refactored with _ |
39 |
NC-10 | Imports could be organized more systematically | 34 |
NC-11 | Hardcoded values can’t be changed | 296 |
NC-12 | Use scientific notation (e.g. 1e18) rather than exponentiation (e.g. 10**18) | 4 |
Not all IERC20 implementations revert()
when there's a failure in approve()
. The function signature has a boolean return value and they indicate errors that way instead. By not checking the return value, operations that should have marked as failed, may potentially go through without actually approving anything
File:solady-main/src/tokens/ERC721.sol
190: _approve(msg.sender, account, id);
616: _approve(address(0), account, id);
Instances (2)
File:solady-main/src/tokens/ERC20.sol
155: log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, caller(), shr(96, mload(0x2c)))
183: log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, caller(), shr(96, mload(0x2c)))
210: log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, caller(), shr(96, mload(0x2c)))
246: log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, caller(), shr(96, mload(0x0c)))
265: let from_ := shl(96, from)
301: log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c)))
347: owner := shr(96, shl(96, owner))
348: spender := shr(96, shl(96, spender))
386: mstore(0x40, or(shl(160, _ALLOWANCE_SLOT_SEED), spender))
447: log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, 0, shr(96, mload(0x0c)))
479: log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), 0)
493: let from_ := shl(96, from)
514: log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c)))
552: let owner_ := shl(96, owner)
559: log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, shr(96, owner_), shr(96, mload(0x2c)))
File:solady-main/src/tokens/ERC721.sol
173: if iszero(shr(96, shl(96, sload(ownershipSlot)))) {
225: 0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator))
245: let bitmaskAddress := shr(96, not(0))
355: result := shl(96, sload(add(id, add(id, keccak256(0x00, 0x20)))))
366: result := shr(96, shl(96, sload(add(id, add(id, keccak256(0x00, 0x20))))))
408: result := shr(160, sload(add(id, add(id, keccak256(0x00, 0x20)))))
422: sstore(ownershipSlot, xor(packed, shl(160, xor(value, shr(160, packed)))))
443: to := shr(96, shl(96, to))
455: if shl(96, ownershipPacked) {
522: by := shr(96, shl(96, by))
529: owner := shr(96, shl(96, ownershipPacked))
581: account := shr(96, shl(96, account))
586: let owner := shr(96, shl(96, sload(ownershipSlot)))
630: let bitmaskAddress := shr(96, not(0))
667: by := shr(96, shl(96, by))
668: operator := shr(96, shl(96, operator))
706: let bitmaskAddress := shr(96, not(0))
854: mstore(add(m, 0x40), shr(96, shl(96, from)))
870: if iszero(eq(mload(m), shl(224, onERC721ReceivedSelector))) {
File:solady-main/src/tokens/ERC1155.sol
166: log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator)))
193: let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))
194: let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))
197: from := shr(96, fromSlotSeed)
198: to := shr(96, toSlotSeed)
266: if iszero(eq(mload(m), shl(224, onERC1155ReceivedSelector))) {
302: let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))
303: let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))
306: from := shr(96, fromSlotSeed)
307: to := shr(96, toSlotSeed)
410: if iszero(eq(mload(m), shl(224, onERC1155BatchReceivedSelector))) {
442: mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner)))
479: let to_ := shl(96, to)
502: log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), 0, shr(96, to_))
534: let to_ := shl(96, to)
576: log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), 0, shr(96, to_))
608: let from_ := shl(96, from)
612: if iszero(or(iszero(shl(96, by)), eq(shl(96, by), from_))) {
633: log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), 0)
670: let from_ := shl(96, from)
674: let by_ := shl(96, by)
716: log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), 0)
744: let m := shr(96, not(0))
785: let from_ := shl(96, from)
786: let to_ := shl(96, to)
795: let by_ := shl(96, by)
829: log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))
877: let from_ := shl(96, from)
878: let to_ := shl(96, to)
889: let by_ := shl(96, by)
944: log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))
1037: mstore(add(m, 0x40), shr(96, shl(96, from)))
1054: if iszero(eq(mload(m), shl(224, onERC1155ReceivedSelector))) {
1077: mstore(add(m, 0x40), shr(96, shl(96, from)))
1105: if iszero(eq(mload(m), shl(224, onERC1155BatchReceivedSelector))) {
File:solady-main/src/tokens/ERC4626.sol
460: let m := shr(96, not(0))
482: let m := shr(96, not(0))
File:solady-main/src/auth/OwnableRoles.sol
57: log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), roles)
78: log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), roles)
File:solady-main/src/auth/Ownable.sol
85: newOwner := shr(96, shl(96, newOwner))
99: newOwner := shr(96, shl(96, newOwner))
127: if iszero(shl(96, newOwner)) {
File:solady-main/src/utils/Base64.sol
48: mstore8(0, mload(and(shr(18, input), 0x3F)))
49: mstore8(1, mload(and(shr(12, input), 0x3F)))
61: mstore(sub(ptr, o), shl(240, 0x3d3d))
115: add(iszero(byte(30, t)), iszero(byte(31, t)))
148: and(m, mload(byte(28, input))),
150: and(m, mload(byte(29, input))),
152: and(m, mload(byte(30, input))),
153: shr(6, mload(byte(31, input)))
File:solady-main/src/utils/Clone.sol
32: arg := shr(96, calldataload(add(offset, argOffset)))
100: arg := shr(16, calldataload(add(offset, argOffset)))
109: arg := shr(24, calldataload(add(offset, argOffset)))
127: arg := shr(40, calldataload(add(offset, argOffset)))
136: arg := shr(48, calldataload(add(offset, argOffset)))
145: arg := shr(56, calldataload(add(offset, argOffset)))
154: arg := shr(64, calldataload(add(offset, argOffset)))
163: arg := shr(72, calldataload(add(offset, argOffset)))
172: arg := shr(80, calldataload(add(offset, argOffset)))
181: arg := shr(88, calldataload(add(offset, argOffset)))
190: arg := shr(96, calldataload(add(offset, argOffset)))
208: arg := shr(112, calldataload(add(offset, argOffset)))
217: arg := shr(120, calldataload(add(offset, argOffset)))
235: arg := shr(136, calldataload(add(offset, argOffset)))
244: arg := shr(144, calldataload(add(offset, argOffset)))
253: arg := shr(152, calldataload(add(offset, argOffset)))
262: arg := shr(160, calldataload(add(offset, argOffset)))
271: arg := shr(168, calldataload(add(offset, argOffset)))
280: arg := shr(176, calldataload(add(offset, argOffset)))
289: arg := shr(184, calldataload(add(offset, argOffset)))
298: arg := shr(192, calldataload(add(offset, argOffset)))
307: arg := shr(200, calldataload(add(offset, argOffset)))
316: arg := shr(208, calldataload(add(offset, argOffset)))
325: arg := shr(216, calldataload(add(offset, argOffset)))
334: arg := shr(224, calldataload(add(offset, argOffset)))
343: arg := shr(232, calldataload(add(offset, argOffset)))
352: arg := shr(240, calldataload(add(offset, argOffset)))
361: arg := shr(248, calldataload(add(offset, argOffset)))
369: offset := sub(calldatasize(), shr(240, calldataload(sub(calldatasize(), 2))))
File:solady-main/src/utils/DateTimeLib.sol
76: let doy := add(shr(11, add(mul(62719, mod(add(month, 9), 12)), 769)), day)
97: let doy := sub(doe, sub(add(mul(365, yoe), shr(2, yoe)), div(yoe, 100)))
99: day := add(sub(doy, shr(11, add(mul(mp, 62719), 769))), 1)
188: add(byte(month, shl(152, 0x1F1C1F1E1F1E1F1F1E1F1E1F)), and(eq(month, 2), flag))
273: result := mul(mul(86400, add(date, d)), and(lt(date, md), iszero(iszero(n))))
File:solady-main/src/utils/ECDSA.sol
149: v := add(shr(255, vs), 27)
318: v := add(shr(255, vs), 27)
403: mstore8(ptr, add(48, mod(temp, 10)))
File:solady-main/src/utils/ERC1967Factory.sol
205: if iszero(or(iszero(shr(96, salt)), eq(caller(), shr(96, salt)))) {
268: mstore(0x01, shl(96, address()))
406: switch shr(112, address())
File:solady-main/src/utils/FixedPointMathLib.sol
158: p = p * x + (4385272521454847904659076985693276 << 96);
185: (uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k)
224: v := or(v, shr(16, v))
227: k := sub(or(k, byte(shr(251, mul(v, shl(224, 0x07c4acdd))),
233: x <<= uint256(159 - k);
244: p = p * x - (795164235651350426258249787498 << 96);
481: z := shr(18, mul(z, add(shr(r, x), 65536))) // A `mul()` is saved from starting `z` at 181.
514: z := div(z, byte(mod(r, 3), shl(232, 0x7f624b)))
568: x := or(x, shr(16, x))
571: r := or(r, byte(shr(251, mul(x, shl(224, 0x07c4acdd))),
605: let mask := sub(0, shr(255, x))
File:solady-main/src/utils/LibBitmap.sol
184: let offset := and(0xff, not(before)) // `256 - (255 & before) - 1`.
File:solady-main/src/utils/LibBit.sol
32: x := or(x, shr(16, x))
35: r := or(r, byte(shr(251, mul(x, shl(224, 0x07c4acdd))),
58: x := or(x, shr(16, x))
61: r := sub(t, or(r, byte(shr(251, mul(x, shl(224, 0x07c4acdd))),
86: r := or(r, byte(shr(251, mul(shr(r, x), shl(224, 0x077cb531))),
100: c := or(shl(8, isMax), shr(248, mul(x, div(max, 255))))
File:solady-main/src/utils/LibClone.sol
571: mstore(0x01, shl(96, deployer))
584: if iszero(or(iszero(shr(96, salt)), eq(caller(), shr(96, salt)))) {
File:solady-main/src/utils/LibMap.sol
51: result := byte(and(31, not(index)), sload(keccak256(0x00, 0x40)))
63: mstore8(and(31, not(index)), value)
120: let o := mul(40, mod(index, 6)) // Storage slot offset (bits).
File:solady-main/src/utils/LibSort.sol
149: let p := add(shl(5, shr(6, add(l, h))), and(31, l))
155: if iszero(lt(e0, e1)) {
160: if iszero(lt(e0, e2)) {
165: if iszero(lt(e1, e2)) {
537: let w := shl(255, 1)
560: m := add(shl(5, shr(6, add(l, h))), and(31, l))
File:solady-main/src/utils/LibString.sol
50: mstore8(str, add(48, mod(temp, 10)))
223: let hashed := and(keccak256(o, 40), mul(34, mask)) // `0b10001000 ... `
224: let t := shl(240, 136) // `0b10001000 << 240`
271: value := shl(96, value)
339: o := add(o, byte(0, mload(shr(250, mload(o)))))
855: let flags := shl(add(70, shl(5, toUpper)), 0x3ffffff)
896: mstore(0x00, shl(64, 0x2671756f743b26616d703b262333393b266c743b2667743b))
906: let t := shr(248, mload(c))
File:solady-main/src/utils/LibZip.sol
28: _r := or(shl(16, byte(2, w)), or(shl(8, byte(1, w)), byte(0, w)))
51: o_ := ms8(ms8(ms8(o_, add(224, shr(8, d_))), 253), and(0xff, d_))
54: _r := ms8(ms8(ms8(o_, add(224, shr(8, d_))), sub(l_, 7)), and(0xff, d_))
61: mstore(p, xor(mload(p), shl(224, xor(shr(224, mload(p)), v_))))
64: _r := and(shr(19, mul(2654435769, v_)), 0x1fff)
78: r := add(ipStart, shr(224, mload(add(mload(0x40), shl(2, h)))))
173: mstore(o_, shl(240, or(and(0xff, add(d_, 0xff)), and(0x80, v_))))
182: let c := byte(31, mload(data))
223: let c := byte(31, mload(data))
226: let d := byte(31, mload(data))
256: let f := shl(224, 0xffffffff) // For negating the first 4 bytes.
File:solady-main/src/utils/RedBlackTreeLib.sol
78: uint256 private constant _BITMASK_RED = 1 << (31 * 3);
File:solady-main/src/utils/SafeTransferLib.sol
160: mstore(0x2c, shl(96, from)) // Store the `from` argument.
197: mstore(0x2c, shl(96, from)) // Store the `from` argument.
File:solady-main/src/utils/SignatureCheckerLib.sol
35: for { signer := shr(96, shl(96, signer)) } signer {} {
71: let f := shl(224, 0x1626ba7e)
123: for { signer := shr(96, shl(96, signer)) } signer {} {
156: let f := shl(224, 0x1626ba7e)
203: v := add(shr(255, vs), 27)
219: for { signer := shr(96, shl(96, signer)) } signer {} {
250: let f := shl(224, 0x1626ba7e)
305: let f := shl(224, 0x1626ba7e)
358: let f := shl(224, 0x1626ba7e)
402: v := add(shr(255, vs), 27)
421: let f := shl(224, 0x1626ba7e)
File:solady-main/src/utils/SSTORE2.sol
144: mstore(0x01, shl(96, deployer))
Instances (187)
Usually lines in source code are limited to 80 characters. Today's screens are much larger so it's reasonable to stretch this in some cases. Since the files will most likely reside in GitHub, and GitHub starts using a scroll bar in all cases when the length is over 164 characters, the lines below should be split when they reach that length
File:solady-main/src/tokens/ERC20.sol
47: event Approval(address indexed owner, address indexed spender, uint256 amount);
117: function balanceOf(address owner) public view virtual returns (uint256 result) {
145: function approve(address spender, uint256 amount) public virtual returns (bool) {
155: log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, caller(), shr(96, mload(0x2c)))
163: function increaseAllowance(address spender, uint256 difference) public virtual returns (bool) {
183: log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, caller(), shr(96, mload(0x2c)))
191: function decreaseAllowance(address spender, uint256 difference) public virtual returns (bool) {
210: log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, caller(), shr(96, mload(0x2c)))
221: function transfer(address to, uint256 amount) public virtual returns (bool) {
246: log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, caller(), shr(96, mload(0x0c)))
261: function transferFrom(address from, address to, uint256 amount) public virtual returns (bool) {
301: log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c)))
313: function nonces(address owner) public view virtual returns (uint256 result) {
359: mstore(m, 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9)
408: mstore(m, 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f)
412: mstore(add(m, 0x40), 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6)
447: log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, 0, shr(96, mload(0x0c)))
479: log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), 0)
489: function _transfer(address from, address to, uint256 amount) internal virtual {
514: log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c)))
524: function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
549: function _approve(address owner, address spender, uint256 amount) internal virtual {
559: log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, shr(96, owner_), shr(96, mload(0x2c)))
569: function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}
573: function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
File:solady-main/src/tokens/ERC721.sol
54: event Transfer(address indexed from, address indexed to, uint256 indexed id);
57: event Approval(address indexed owner, address indexed account, uint256 indexed id);
60: event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved);
108: uint256 private constant _ERC721_MASTER_SLOT_SEED = 0x7d8825530a5a2e7a << 192;
111: uint256 private constant _ERC721_MASTER_SLOT_SEED_MASKED = 0x0a5a2e7a00000000;
149: function balanceOf(address owner) public view virtual returns (uint256 result) {
167: function getApproved(uint256 id) public view virtual returns (address result) {
212: function setApprovalForAll(address operator, bool isApproved) public virtual {
225: 0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator))
240: function transferFrom(address from, address to, uint256 id) public payable virtual {
273: if iszero(or(eq(caller(), from), eq(caller(), approvedAddress))) {
307: function safeTransferFrom(address from, address to, uint256 id) public payable virtual {
324: function safeTransferFrom(address from, address to, uint256 id, bytes calldata data)
336: function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {
341: result := or(or(eq(s, 0x01ffc9a7), eq(s, 0x80ac58cd)), eq(s, 0x5b5e139f))
361: function _ownerOf(uint256 id) internal view virtual returns (address result) {
366: result := shr(96, shl(96, sload(add(id, add(id, keccak256(0x00, 0x20))))))
377: function _getAux(address owner) internal view virtual returns (uint224 result) {
396: sstore(balanceSlot, xor(packed, shl(32, xor(value, shr(32, packed)))))
403: function _getExtraData(uint256 id) internal view virtual returns (uint96 result) {
422: sstore(ownershipSlot, xor(packed, shl(160, xor(value, shr(160, packed)))))
493: function _safeMint(address to, uint256 id, bytes memory data) internal virtual {
541: if iszero(or(iszero(by), or(eq(by, owner), eq(by, approvedAddress)))) {
605: function _getApproved(uint256 id) internal view virtual returns (address result) {
627: function _approve(address by, address account, uint256 id) internal virtual {
663: function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual {
701: function _transfer(address by, address from, address to, uint256 id) internal virtual {
736: if iszero(or(iszero(by), or(eq(by, from), eq(by, approvedAddress)))) {
770: function _safeTransfer(address from, address to, uint256 id) internal virtual {
786: function _safeTransfer(address from, address to, uint256 id, bytes memory data)
795: function _safeTransfer(address by, address from, address to, uint256 id) internal virtual {
812: function _safeTransfer(address by, address from, address to, uint256 id, bytes memory data)
825: function _beforeTokenTransfer(address from, address to, uint256 id) internal virtual {}
828: function _afterTokenTransfer(address from, address to, uint256 id) internal virtual {}
844: function _checkOnERC721Received(address from, address to, uint256 id, bytes memory data)
853: mstore(add(m, 0x20), caller()) // The `operator`, which is always `msg.sender`.
859: if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xc0), n)) }
861: if iszero(call(gas(), to, 0, add(m, 0x1c), add(n, 0xa4), m, 0x20)) {
871: mstore(0x00, 0xd1a57ed6) // `TransferToNonERC721ReceiverImplementer()`.
File:solady-main/src/tokens/ERC1155.sol
61: event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved);
124: function balanceOf(address owner, uint256 id) public view virtual returns (uint256 result) {
153: function setApprovalForAll(address operator, bool isApproved) public virtual {
166: log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator)))
237: log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), from, to)
255: calldatacopy(add(m, 0xc0), sub(data.offset, 0x20), add(0x20, data.length))
257: if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, data.length), m, 0x20)) {
267: mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.
333: mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.
345: mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.
410: if iszero(eq(mload(m), shl(224, onERC1155BatchReceivedSelector))) {
411: mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.
452: function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {
457: result := or(or(eq(s, 0x01ffc9a7), eq(s, 0xd9b67a26)), eq(s, 0x0e89341c))
473: function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {
475: _beforeTokenTransfer(address(0), to, _single(id), _single(amount), data);
502: log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), 0, shr(96, to_))
505: _afterTokenTransfer(address(0), to, _single(id), _single(amount), data);
507: if (_hasCode(to)) _checkOnERC1155Received(address(0), to, id, amount, data);
554: mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.
576: log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), 0, shr(96, to_))
582: if (_hasCode(to)) _checkOnERC1155BatchReceived(address(0), to, ids, amounts, data);
602: function _burn(address by, address from, uint256 id, uint256 amount) internal virtual {
604: _beforeTokenTransfer(from, address(0), _single(id), _single(amount), "");
633: log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), 0)
636: _afterTokenTransfer(from, address(0), _single(id), _single(amount), "");
641: function _batchBurn(address from, uint256[] memory ids, uint256[] memory amounts)
657: function _batchBurn(address by, address from, uint256[] memory ids, uint256[] memory amounts)
694: mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.
716: log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), 0)
732: function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual {
745: log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, and(m, by), and(m, operator))
754: function _safeTransfer(address from, address to, uint256 id, uint256 amount, bytes memory data)
829: log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))
910: mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.
922: mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.
944: log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))
950: if (_hasCode(to)) _checkOnERC1155BatchReceived(from, to, ids, amounts, data);
1043: if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xe0), n)) }
1045: if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, n), m, 0x20)) {
1055: mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.
1106: mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.
1113: function _single(uint256 x) private pure returns (uint256[] memory result) {
File:solady-main/src/tokens/ERC4626.sol
44: event Deposit(address indexed by, address indexed owner, uint256 assets, uint256 shares);
167: function convertToShares(uint256 assets) public view virtual returns (uint256 shares) {
176: return FixedPointMathLib.fullMulDiv(assets, totalSupply() + 1, _inc(totalAssets()));
178: return FixedPointMathLib.fullMulDiv(assets, totalSupply() + 10 ** o, _inc(totalAssets()));
192: function convertToAssets(uint256 shares) public view virtual returns (uint256 assets) {
201: return FixedPointMathLib.fullMulDiv(shares, totalAssets() + 1, _inc(totalSupply()));
203: return FixedPointMathLib.fullMulDiv(shares, totalAssets() + 1, totalSupply() + 10 ** o);
220: function previewDeposit(uint256 assets) public view virtual returns (uint256 shares) {
238: function previewMint(uint256 shares) public view virtual returns (uint256 assets) {
243: : FixedPointMathLib.fullMulDivUp(shares, totalAssets(), supply);
247: return FixedPointMathLib.fullMulDivUp(shares, totalAssets() + 1, _inc(totalSupply()));
249: return FixedPointMathLib.fullMulDivUp(shares, totalAssets() + 1, totalSupply() + 10 ** o);
266: function previewWithdraw(uint256 assets) public view virtual returns (uint256 shares) {
271: : FixedPointMathLib.fullMulDivUp(assets, supply, totalAssets());
275: return FixedPointMathLib.fullMulDivUp(assets, totalSupply() + 1, _inc(totalAssets()));
277: return FixedPointMathLib.fullMulDivUp(assets, totalSupply() + 10 ** o, _inc(totalAssets()));
294: function previewRedeem(uint256 shares) public view virtual returns (uint256 assets) {
299: function _eitherIsZero(uint256 a, uint256 b) private pure returns (bool result) {
323: function maxDeposit(address to) public view virtual returns (uint256 maxAssets) {
334: function maxMint(address to) public view virtual returns (uint256 maxShares) {
344: function maxWithdraw(address owner) public view virtual returns (uint256 maxAssets) {
354: function maxRedeem(address owner) public view virtual returns (uint256 maxShares) {
373: function deposit(uint256 assets, address to) public virtual returns (uint256 shares) {
374: if (assets > maxDeposit(to)) _revert(0xb3c61a83); // `DepositMoreThanMax()`.
390: function mint(uint256 shares, address to) public virtual returns (uint256 assets) {
411: if (assets > maxWithdraw(owner)) _revert(0x936941fc); // `WithdrawMoreThanMax()`.
431: if (shares > maxRedeem(owner)) _revert(0x4656425a); // `RedeemMoreThanMax()`.
452: function _deposit(address by, address to, uint256 assets, uint256 shares) internal virtual {
469: function _withdraw(address by, address to, address owner, uint256 assets, uint256 shares)
483: log4(0x00, 0x40, _WITHDRAW_EVENT_SIGNATURE, and(m, by), and(m, to), and(m, owner))
520: function _beforeWithdraw(uint256 assets, uint256 shares) internal virtual {}
File:solady-main/src/auth/OwnableRoles.sol
57: log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), roles)
78: log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), roles)
148: function grantRoles(address user, uint256 roles) public payable virtual onlyOwner {
154: function revokeRoles(address user, uint256 roles) public payable virtual onlyOwner {
169: function hasAnyRole(address user, uint256 roles) public view virtual returns (bool result) {
182: function hasAllRoles(address user, uint256 roles) public view virtual returns (bool result) {
194: function rolesOf(address user) public view virtual returns (uint256 roles) {
208: function rolesFromOrdinals(uint8[] memory ordinals) public pure returns (uint256 roles) {
222: function ordinalsFromRoles(uint256 roles) public pure returns (uint8[] memory ordinals) {
File:solady-main/src/auth/Ownable.sol
31: event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);
101: log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
124: function transferOwnership(address newOwner) public payable virtual onlyOwner {
152: log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())
172: function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {
File:solady-main/src/Milady.sol
5:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⣿⣷⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
6:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⣿⣿⣿⣿⣿⣿⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
7:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣠⣤⣴⣶⣾⣿⣷⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⠻⢿⣿⣿⣿⣿⣷⣦⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀
8:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠻⢿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀
9:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⣿⣿⣿⣿⣿⡿⠿⠟⠛⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠻⣿⣿⣿⣆⠀⠀⠀⠀⠀
10:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⡿⠟⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣧⠀⠀⠀⠀
11:⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢻⣿⣇⠀⠀⠀
12:⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣴⣶⣿⣿⣿⣿⣿⣿⣿⣶⣤⡀⠀⠙⠋⠀⠀⠀
13:⠀⠀⠀⠀⠀⣠⣾⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⣾⠟⢋⣥⣤⠀⣶⣶⣶⣦⣤⣌⣉⠛⠀⠀⠀⠀⠀⠀
14:⠀⠀⠀⠀⣴⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠋⢁⣴⣿⣿⡿⠀⣿⣿⣿⣿⣿⣿⣿⣷⡄⠀⠀⠀⠀⠀
15:⠀⠀⠀⣼⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣤⣶⣶⣾⣿⣿⣿⣿⣷⣶⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⣿⣿⠁⠀⠀⢹⣿⣿⣿⣿⣿⣿⢻⣿⡄⠀⠀⠀⠀
16:⠀⠀⠀⠛⠋⠀⠀⠀⠀⠀⠀⠀⢀⣤⣾⣿⠿⠛⣛⣉⣉⣀⣀⡀⠀⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⣿⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⢸⣿⣿⡄⠀⠀⠀
17:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⡿⢋⣩⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣶⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣦⣀⣀⣴⣿⣿⣿⣿⣿⡿⢸⣿⢿⣷⡀⠀⠀
18:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣡⣄⠀⠋⠁⠀⠈⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⡟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⡿⠀⠛⠃⠀⠀
19:⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣧⡀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⠛⠃⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠁⠈⠁⠀⠀⠀⠀⠀
20:⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⢿⣿⣿⣿⣷⣦⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣶⣶⠀⠈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⣿⠇⠀⠀⠀⠀⠀
21:⠀⠀⠀⠀⠀⢠⣿⣿⣿⠟⠉⠀⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣿⠀⠀⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⠁⢸⣿⠀⠀⠀⠀⠀⠀
22:⠀⠀⠀⠀⠀⣼⣿⡟⠁⣠⣦⠀⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠉⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⡆⠀⠀⢻⣿⣿⣿⣿⣿⣿⣿⠏⠀⣸⡏⠀⠀⠀⠀⠀⠀
23:⠀⠀⠀⠀⠀⣿⡏⠀⠀⣿⣿⡀⠀⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠀⢹⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣇⠀⠀⠀⠙⢿⣿⣿⡿⠟⠁⠀⣸⡿⠁⠀⠀⠀⠀⠀⠀
24:⠀⠀⠀⠀⢸⣿⠁⠀⠀⢸⣿⣇⠀⠀⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⠀⢀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢿⣦⡀⠀⠀⠀⠈⠉⠀⠀⠀⣼⡿⠁⠀⠀⠀⠀⠀⠀⠀
25:⠀⠀⠀⠀⠈⠁⠀⠀⠀⠀⢿⣿⡄⠀⠀⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⠀⠀⣼⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣷⣦⣄⣀⠀⠀⢀⡈⠙⠁⠀⠀⠀⠀⠀⠀⠀⠀
26:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢻⣿⣆⠀⠀⠀⠉⠛⠿⢿⣿⣿⠿⠛⠁⠀⠀⠀⣠⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠿⣿⣿⣷⣿⣯⣤⣶⠄⠀⠀⠀⠀⠀⠀⠀
27:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿⣷⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠙⠛⠋⠁⠀⠀⠀⠀⠀⠀⠀
28:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⢿⣷⣤⣀⠀⠀⠀⠀⠀⠀⠀⠺⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
29:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⢻⣿⣶⣤⣤⣤⣶⣷⣤⠈⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
30:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢿⣿⣿⣿⣿⡿⠿⠛⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
31:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
32:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
33:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
34:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠶⢤⣄⣀⣀⣤⠶⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
35:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀*/
75: address internal constant CONTRACT = 0x5Af0D9827E0c53E4799BB226655A1de152A425a5;
File:solady-main/src/utils/Base64.sol
36: mstore(0x3f, sub("ghijklmnopqrstuvwxyz0123456789-_", mul(iszero(fileSafe), 0x0230)))
72: function encode(bytes memory data) internal pure returns (string memory result) {
100: function decode(string memory data) internal pure returns (bytes memory result) {
120: decodedLength := add(decodedLength, sub(and(dataLength, 3), 1))
135: let m := 0xfc000000fc00686c7074787c8084888c9094989ca0a4a8acb0b4b8bcc0c4c8cc
137: mstore(0x3b, 0x04080c1014181c2024282c3034383c4044484c5054585c6064)
File:solady-main/src/utils/Clone.sol
28: function _getArgAddress(uint256 argOffset) internal pure returns (address arg) {
47: calldatacopy(add(arg, 0x20), add(offset, argOffset), shl(5, length))
48: mstore(0x40, add(add(arg, 0x20), shl(5, length))) // Allocate the memory.
63: calldatacopy(add(arg, 0x20), add(offset, argOffset), shl(5, length))
64: mstore(0x40, add(add(arg, 0x20), shl(5, length))) // Allocate the memory.
69: function _getArgBytes32(uint256 argOffset) internal pure returns (bytes32 arg) {
78: function _getArgUint256(uint256 argOffset) internal pure returns (uint256 arg) {
87: function _getArgUint248(uint256 argOffset) internal pure returns (uint248 arg) {
96: function _getArgUint240(uint256 argOffset) internal pure returns (uint240 arg) {
105: function _getArgUint232(uint256 argOffset) internal pure returns (uint232 arg) {
114: function _getArgUint224(uint256 argOffset) internal pure returns (uint224 arg) {
123: function _getArgUint216(uint256 argOffset) internal pure returns (uint216 arg) {
132: function _getArgUint208(uint256 argOffset) internal pure returns (uint208 arg) {
141: function _getArgUint200(uint256 argOffset) internal pure returns (uint200 arg) {
150: function _getArgUint192(uint256 argOffset) internal pure returns (uint192 arg) {
159: function _getArgUint184(uint256 argOffset) internal pure returns (uint184 arg) {
168: function _getArgUint176(uint256 argOffset) internal pure returns (uint176 arg) {
177: function _getArgUint168(uint256 argOffset) internal pure returns (uint168 arg) {
186: function _getArgUint160(uint256 argOffset) internal pure returns (uint160 arg) {
195: function _getArgUint152(uint256 argOffset) internal pure returns (uint152 arg) {
204: function _getArgUint144(uint256 argOffset) internal pure returns (uint144 arg) {
213: function _getArgUint136(uint256 argOffset) internal pure returns (uint136 arg) {
222: function _getArgUint128(uint256 argOffset) internal pure returns (uint128 arg) {
231: function _getArgUint120(uint256 argOffset) internal pure returns (uint120 arg) {
240: function _getArgUint112(uint256 argOffset) internal pure returns (uint112 arg) {
249: function _getArgUint104(uint256 argOffset) internal pure returns (uint104 arg) {
258: function _getArgUint96(uint256 argOffset) internal pure returns (uint96 arg) {
267: function _getArgUint88(uint256 argOffset) internal pure returns (uint88 arg) {
276: function _getArgUint80(uint256 argOffset) internal pure returns (uint80 arg) {
285: function _getArgUint72(uint256 argOffset) internal pure returns (uint72 arg) {
294: function _getArgUint64(uint256 argOffset) internal pure returns (uint64 arg) {
303: function _getArgUint56(uint256 argOffset) internal pure returns (uint56 arg) {
312: function _getArgUint48(uint256 argOffset) internal pure returns (uint48 arg) {
321: function _getArgUint40(uint256 argOffset) internal pure returns (uint40 arg) {
330: function _getArgUint32(uint256 argOffset) internal pure returns (uint32 arg) {
339: function _getArgUint24(uint256 argOffset) internal pure returns (uint24 arg) {
348: function _getArgUint16(uint256 argOffset) internal pure returns (uint16 arg) {
357: function _getArgUint8(uint256 argOffset) internal pure returns (uint8 arg) {
369: offset := sub(calldatasize(), shr(240, calldataload(sub(calldatasize(), 2))))
File:solady-main/src/utils/CREATE3.sol
48: uint256 private constant _PROXY_BYTECODE = 0x67363d3d37363d34f03d5260086018f3;
121: function getDeployed(bytes32 salt) internal view returns (address deployed) {
File:solady-main/src/utils/DateTimeLib.sol
76: let doy := add(shr(11, add(mul(62719, mod(add(month, 9), 12)), 769)), day)
78: let doe := sub(add(add(mul(yoe, 365), shr(2, yoe)), doy), div(yoe, 100))
96: div(sub(sub(add(doe, div(doe, 36524)), div(doe, 1460)), eq(doe, 146096)), 365)
97: let doy := sub(doe, sub(add(mul(365, yoe), shr(2, yoe)), div(yoe, 100)))
101: year := add(add(yoe, mul(div(epochDay, 146097), 400)), lt(month, 3))
142: result = dateToEpochDay(year, month, day) * 86400 + hour * 3600 + minute * 60 + second;
181: function daysInMonth(uint256 year, uint256 month) internal pure returns (uint256 result) {
188: add(byte(month, shl(152, 0x1F1C1F1E1F1E1F1F1E1F1E1F)), and(eq(month, 2), flag))
194: function weekday(uint256 timestamp) internal pure returns (uint256 result) {
239: result := and(lt(hour, 24), and(lt(minute, 60), lt(second, 60)))
245: function isSupportedEpochDay(uint256 epochDay) internal pure returns (bool result) {
252: function isSupportedTimestamp(uint256 timestamp) internal pure returns (bool result) {
262: function nthWeekdayInMonthOfYearTimestamp(uint256 year, uint256 month, uint256 n, uint256 wd)
273: result := mul(mul(86400, add(date, d)), and(lt(date, md), iszero(iszero(n))))
278: function mondayTimestamp(uint256 timestamp) internal pure returns (uint256 result) {
283: result := mul(mul(sub(day, mod(add(day, 3), 7)), 86400), gt(t, 345599))
304: function addYears(uint256 timestamp, uint256 numYears) internal pure returns (uint256 result) {
305: (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400);
319: (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400);
321: result = _offsetted(year + month / 12, _add(month % 12, 1), day, timestamp);
325: function addDays(uint256 timestamp, uint256 numDays) internal pure returns (uint256 result) {
330: function addHours(uint256 timestamp, uint256 numHours) internal pure returns (uint256 result) {
359: function subYears(uint256 timestamp, uint256 numYears) internal pure returns (uint256 result) {
360: (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400);
374: (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400);
376: result = _offsetted(yearMonth / 12, _add(yearMonth % 12, 1), day, timestamp);
380: function subDays(uint256 timestamp, uint256 numDays) internal pure returns (uint256 result) {
385: function subHours(uint256 timestamp, uint256 numHours) internal pure returns (uint256 result) {
434: (uint256 fromYear, uint256 fromMonth,) = epochDayToDate(fromTimestamp / 86400);
435: (uint256 toYear, uint256 toMonth,) = epochDayToDate(toTimestamp / 86400);
436: result = _sub(_totalMonths(toYear, toMonth), _totalMonths(fromYear, fromMonth));
505: function _offsetted(uint256 year, uint256 month, uint256 day, uint256 timestamp)
514: result = dateToEpochDay(year, month, day) * 86400 + (timestamp % 86400);
File:solady-main/src/utils/DynamicBufferLib.sol
41: let capacity := mload(add(bufferData, w)) // `mload(sub(bufferData, 0x20))`.
44: capacity := mul(div(capacity, prime), iszero(mod(capacity, prime)))
54: and(add(capacity, add(or(capacity, newBufferDataLength), 0x20)), w)
57: if iszero(eq(mload(0x40), add(bufferData, add(0x40, capacity)))) {
61: mstore(0x40, add(newBufferData, add(0x40, newCapacity)))
65: for { let o := and(add(bufferDataLength, 0x20), w) } 1 {} {
66: mstore(add(newBufferData, o), mload(add(bufferData, o)))
101: function append(DynamicBuffer memory buffer, bytes memory data0, bytes memory data1)
129: return append(append(append(append(buffer, data0), data1), data2), data3);
File:solady-main/src/utils/ECDSA.sol
38: function recover(bytes32 hash, bytes memory signature) internal view returns (address result) {
143: function recover(bytes32 hash, bytes32 r, bytes32 vs) internal view returns (address result) {
173: lt(s, add(_MALLEABILITY_THRESHOLD, 1)), // Address of `ecrecover`.
275: mstore(0x20, byte(0, calldataload(add(signature.offset, 0x40))))
369: function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 result) {
384: function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32 result) {
408: mstore(sub(ptr, 0x20), "\x00\x00\x00\x00\x00\x00\x19Ethereum Signed Message:\n")
422: function emptySignature() internal pure returns (bytes calldata signature) {
File:solady-main/src/utils/EIP712.sol
88: function _domainSeparator() internal view virtual returns (bytes32 separator) {
108: function _hashTypedData(bytes32 structHash) internal view virtual returns (bytes32 digest) {
173: function _cachedDomainSeparatorInvalidated() private view returns (bool result) {
178: result := iszero(and(eq(chainid(), cachedChainId), eq(address(), cachedThis)))
File:solady-main/src/utils/ERC1967FactoryConstants.sol
24: address internal constant ADDRESS = 0x0000000000006396FF2a80c067f99B3d2Ab4Df24;
30: hex"6080604052600436106100b15760003560e01c8063545e7c611161006957806399a88ec41161004e57806399a88ec41461019d578063a97b90d5146101b0578063db4c545e146101c357600080fd5b8063545e7c61146101775780639623609d1461018a57600080fd5b80633729f9221161009a5780633729f922146101315780634314f120146101445780635414dff01461015757600080fd5b80631acfd02a146100b65780632abbef15146100d8575b600080fd5b3480156100c257600080fd5b506100d66100d1366004610604565b6101e6565b005b3480156100e457600080fd5b506101076100f3366004610637565b30600c908152600091909152602090205490565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b61010761013f366004610652565b610237565b6101076101523660046106d7565b61024e565b34801561016357600080fd5b50610107610172366004610738565b610267565b610107610185366004610604565b61029a565b6100d66101983660046106d7565b6102af565b6100d66101ab366004610604565b61035f565b6101076101be366004610751565b610370565b3480156101cf57600080fd5b506101d86103a9565b604051908152602001610128565b30600c52816000526020600c2033815414610209576382b429006000526004601cfd5b81905580827f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f600080a35050565b60006102468484843685610370565b949350505050565b600061025e8585838087876103c2565b95945050505050565b6000806102726103a9565b905060ff600053806035523060601b6001528260155260556000209150600060355250919050565b60006102a88383368461024e565b9392505050565b30600c5283600052336020600c2054146102d1576382b429006000526004601cfd5b6040518381527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc602082015281836040830137600080836040018334895af1610331573d610327576355299b496000526004601cfd5b3d6000803e3d6000fd5b5082847f5d611f318680d00598bb735d61bacf0c514c6b50e1e5ad30040a4df2b12791c7600080a350505050565b61036c82823660006102af565b5050565b60008360601c33148460601c151761039057632f6348366000526004601cfd5b61039f868686600187876103c2565b9695505050505050565b6000806103b461049c565b608960139091012092915050565b6000806103cd61049c565b90508480156103e757866089601384016000f592506103f3565b6089601383016000f092505b50816104075763301164256000526004601cfd5b8781527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc602082015282846040830137600080846040018334865af161045a573d6103275763301164256000526004601cfd5b30600c5281600052866020600c20558688837fc95935a66d15e0da5e412aca0ad27ae891d20b2fb91cf3994b6a3bf2b8178082600080a4509695505050505050565b6040513060701c801561054257666052573d6000fd607b8301527f3d356020355560408036111560525736038060403d373d3d355af43d6000803e60748301527f3735a920a3ca505d382bbc545af43d6000803e6052573d6000fd5b3d6000f35b60548301527f14605757363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc60348301523060148301526c607f3d8160093d39f33d3d337382525090565b66604c573d6000fd60758301527f3d3560203555604080361115604c5736038060403d373d3d355af43d6000803e606e8301527f3735a920a3ca505d382bbc545af43d6000803e604c573d6000fd5b3d6000f35b604e8301527f14605157363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc602e83015230600e8301526c60793d8160093d39f33d3d336d82525090565b803573ffffffffffffffffffffffffffffffffffffffff811681146105ff57600080fd5b919050565b6000806040838503121561061757600080fd5b610620836105db565b915061062e602084016105db565b90509250929050565b60006020828403121561064957600080fd5b6102a8826105db565b60008060006060848603121561066757600080fd5b610670846105db565b925061067e602085016105db565b9150604084013590509250925092565b60008083601f8401126106a057600080fd5b50813567ffffffffffffffff8111156106b857600080fd5b6020830191508360208285010111156106d057600080fd5b9250929050565b600080600080606085870312156106ed57600080fd5b6106f6856105db565b9350610704602086016105db565b9250604085013567ffffffffffffffff81111561072057600080fd5b61072c8782880161068e565b95989497509550505050565b60006020828403121561074a57600080fd5b5035919050565b60008060008060006080868803121561076957600080fd5b610772866105db565b9450610780602087016105db565b935060408601359250606086013567ffffffffffffffff8111156107a357600080fd5b6107af8882890161068e565b96999598509396509294939250505056fea26469706673582212200ac7c3ccbc2d311c48bf5465b021542e0e306fe3c462c060ba6a3d2f81ff6c5f64736f6c63430008130033";
34: hex"608060405234801561001057600080fd5b506107f6806100206000396000f3fe", BYTECODE
File:solady-main/src/utils/ERC1967Factory.sol
34: uint256 internal constant _SALT_DOES_NOT_START_WITH_CALLER_ERROR_SELECTOR = 0x2f634836;
47: event Deployed(address indexed proxy, address indexed implementation, address indexed admin);
124: function upgradeAndCall(address proxy, address implementation, bytes calldata data)
143: if iszero(call(gas(), proxy, callvalue(), m, add(0x40, data.length), 0x00, 0x00)) {
165: function deploy(address implementation, address admin) public payable returns (address proxy) {
173: function deployAndCall(address implementation, address admin, bytes calldata data)
184: function deployDeterministic(address implementation, address admin, bytes32 salt)
189: proxy = deployDeterministicAndCall(implementation, admin, salt, _emptyData());
239: if iszero(call(gas(), proxy, callvalue(), m, add(0x40, data.length), 0x00, 0x00)) {
261: function predictDeterministicAddress(bytes32 salt) public view returns (address predicted) {
410: mstore(add(m, 0x6e), 0x3d3560203555604080361115604c5736038060403d373d3d355af43d6000803e) // 32
411: mstore(add(m, 0x4e), 0x3735a920a3ca505d382bbc545af43d6000803e604c573d6000fd5b3d6000f35b) // 32
412: mstore(add(m, 0x2e), 0x14605157363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc) // 32
418: mstore(add(m, 0x74), 0x3d356020355560408036111560525736038060403d373d3d355af43d6000803e) // 32
419: mstore(add(m, 0x54), 0x3735a920a3ca505d382bbc545af43d6000803e6052573d6000fd5b3d6000f35b) // 32
420: mstore(add(m, 0x34), 0x14605757363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc) // 32
File:solady-main/src/utils/FixedPointMathLib.sol
147: int256 k = ((x << 96) / 54916777467707473351141471128 + 2 ** 95) >> 96;
185: (uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k)
228: 0x0009010a0d15021d0b0e10121619031e080c141c0f111807131b17061a05041f)), 96)
274: r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k;
276: r += 600920179829731861736702779321621459595472258049074101567377883020018308;
289: function fullMulDiv(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 result) {
363: result := mul(prod0, mul(inv, sub(2, mul(d, inv)))) // inverse mod 2**256
373: function fullMulDivUp(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 result) {
391: function mulDiv(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) {
407: function mulDivUp(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) {
437: function zeroFloorSub(uint256 x, uint256 y) internal pure returns (uint256 z) {
449: z := 181 // The "correct" value is 1, but this saves a multiplication later.
481: z := shr(18, mul(z, add(shr(r, x), 65536))) // A `mul()` is saved from starting `z` at 181.
572: 0x0009010a0d15021d0b0e10121619031e080c141c0f111807131b17061a05041f))
661: function clamp(int256 x, int256 minValue, int256 maxValue) internal pure returns (int256 z) {
757: function rawAddMod(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) {
765: function rawMulMod(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) {
File:solady-main/src/utils/LibBitmap.sol
32: function get(Bitmap storage bitmap, uint256 index) internal view returns (bool isSet) {
55: function toggle(Bitmap storage bitmap, uint256 index) internal returns (bool newIsSet) {
76: function setTo(Bitmap storage bitmap, uint256 index, bool shouldSet) internal {
88: or(and(storageValue, not(shl(shift, 1))), shl(shift, iszero(iszero(shouldSet))))
94: function setBatch(Bitmap storage bitmap, uint256 start, uint256 amount) internal {
108: for {} iszero(eq(bucket, bucketEnd)) { bucket := add(bucket, 1) } {
115: sstore(storageSlot, or(sload(storageSlot), shl(shift, shr(sub(256, amount), max))))
120: function unsetBatch(Bitmap storage bitmap, uint256 start, uint256 amount) internal {
128: sstore(storageSlot, and(sload(storageSlot), not(shl(shift, not(0)))))
133: for {} iszero(eq(bucket, bucketEnd)) { bucket := add(bucket, 1) } {
141: storageSlot, and(sload(storageSlot), not(shl(shift, shr(sub(256, amount), not(0)))))
165: count += LibBit.popCount((bitmap.map[bucket] >> shift) << (256 - amount));
185: bucketBits := shr(offset, shl(offset, sload(keccak256(0x00, 0x40))))
File:solady-main/src/utils/LibBit.sol
36: 0x0009010a0d15021d0b0e10121619031e080c141c0f111807131b17061a05041f))
62: 0x0009010a0d15021d0b0e10121619031e080c141c0f111807131b17061a05041f)))
87: 0x00011c021d0e18031e16140f191104081f1b0d17151310071a0c12060b050a09))
File:solady-main/src/utils/LibClone.sol
43: function clone(address implementation) internal returns (address instance) {
144: function initCodeHash(address implementation) internal pure returns (bytes32 hash) {
158: function predictDeterministicAddress(address implementation, bytes32 salt, address deployer)
172: function clone_PUSH0(address implementation) internal returns (address instance) {
274: function initCodeHash_PUSH0(address implementation) internal pure returns (bytes32 hash) {
303: function clone(address implementation, bytes memory data) internal returns (address instance) {
403: or(shl(0x48, extraLength), 0x593da1005b363d3d373d3d3d3d610000806062363936013d73)
407: sub(data, 0x3a), 0x9e4ac34f21c619cefc926c8bd93b54bf5a39c7ab2127a895af1cc0691d7e3dff
411: or(shl(0x78, add(extraLength, 0x62)), 0x6100003d81600a3d39f336602c57343d527f)
437: function cloneDeterministic(address implementation, bytes memory data, bytes32 salt)
460: or(shl(0x48, extraLength), 0x593da1005b363d3d373d3d3d3d610000806062363936013d73)
464: sub(data, 0x3a), 0x9e4ac34f21c619cefc926c8bd93b54bf5a39c7ab2127a895af1cc0691d7e3dff
468: or(shl(0x78, add(extraLength, 0x62)), 0x6100003d81600a3d39f336602c57343d527f)
473: instance := create2(0, sub(data, 0x4c), add(extraLength, 0x6c), salt)
519: or(shl(0x48, extraLength), 0x593da1005b363d3d373d3d3d3d610000806062363936013d73)
523: sub(data, 0x3a), 0x9e4ac34f21c619cefc926c8bd93b54bf5a39c7ab2127a895af1cc0691d7e3dff
527: or(shl(0x78, add(extraLength, 0x62)), 0x6100003d81600a3d39f336602c57343d527f)
561: function predictDeterministicAddress(bytes32 hash, bytes32 salt, address deployer)
File:solady-main/src/utils/LibMap.sol
46: function get(Uint8Map storage map, uint256 index) internal view returns (uint8 result) {
69: function get(Uint16Map storage map, uint256 index) internal view returns (uint16 result) {
88: function get(Uint32Map storage map, uint256 index) internal view returns (uint32 result) {
107: function get(Uint40Map storage map, uint256 index) internal view returns (uint40 result) {
128: function get(Uint64Map storage map, uint256 index) internal view returns (uint64 result) {
147: function get(Uint128Map storage map, uint256 index) internal view returns (uint128 result) {
152: function set(Uint128Map storage map, uint256 index, uint128 value) internal {
File:solady-main/src/utils/LibPRNG.sol
55: function uniform(PRNG memory prng, uint256 upper) internal pure returns (uint256 result) {
File:solady-main/src/utils/LibSort.sol
84: for {} iszero(or(eq(j, h), gt(mload(j), mload(add(j, s))))) {} {
115: for { let stackBottom := mload(0x40) } iszero(eq(stack, stackBottom)) {} {
292: (found, index) = _searchSorted(_toUints(a), uint256(uint160(needle)), 0);
365: function isSortedAndUniquified(uint256[] memory a) internal pure returns (bool result) {
382: function isSortedAndUniquified(int256[] memory a) internal pure returns (bool result) {
399: function isSortedAndUniquified(address[] memory a) internal pure returns (bool result) {
498: function _toUints(int256[] memory a) private pure returns (uint256[] memory casted) {
506: function _toUints(address[] memory a) private pure returns (uint256[] memory casted) {
517: function _toInts(uint256[] memory a) private pure returns (int256[] memory casted) {
525: function _toAddresses(uint256[] memory a) private pure returns (address[] memory casted) {
581: function _difference(uint256[] memory a, uint256[] memory b, uint256 signed)
623: function _intersection(uint256[] memory a, uint256[] memory b, uint256 signed)
File:solady-main/src/utils/LibString.sol
27: function toString(uint256 value) internal pure returns (string memory str) {
92: function toHexString(uint256 value, uint256 length) internal pure returns (string memory str) {
162: function toHexString(uint256 value) internal pure returns (string memory str) {
177: function toHexStringNoPrefix(uint256 value) internal pure returns (string memory str) {
217: function toHexStringChecksumed(address value) internal pure returns (string memory str) {
223: let hashed := and(keccak256(o, 40), mul(34, mask)) // `0b10001000 ... `
230: mstore(o, xor(mload(o), shr(1, and(mload(0x00), and(mload(o), mask)))))
232: mstore(o, xor(mload(o), shr(1, and(mload(0x20), and(mload(o), mask)))))
238: function toHexString(address value) internal pure returns (string memory str) {
251: function toHexStringNoPrefix(address value) internal pure returns (string memory str) {
288: function toHexString(bytes memory raw) internal pure returns (string memory str) {
301: function toHexStringNoPrefix(bytes memory raw) internal pure returns (string memory str) {
330: function runeCount(string memory s) internal pure returns (uint256 result) {
335: mstore(0x20, 0x0202020202020202020202020202020202020202020202020303030304040506)
380: function replace(string memory subject, string memory search, string memory replacement)
400: if iszero(lt(searchLength, 0x20)) { h := keccak256(search, searchLength) }
409: if iszero(eq(keccak256(subject, searchLength), h)) {
413: if iszero(lt(subject, subjectSearchEnd)) { break }
439: let k := add(sub(resultRemainder, result), sub(subjectEnd, subject))
447: let last := add(add(result, 0x20), k) // Zeroize the slot after the string.
479: let end := add(sub(add(subjectStart, subjectLength), searchLength), 1)
484: if iszero(and(lt(subject, end), lt(from, subjectLength))) { break }
487: for { let h := keccak256(add(search, 0x20), searchLength) } 1 {} {
526: function lastIndexOf(string memory subject, string memory search, uint256 from)
547: for { let h := keccak256(add(search, 0x20), searchLength) } 1 {} {
611: add(add(subject, 0x20), mul(withinRange, sub(subjectLength, searchLength))),
714: let subjectSearchEnd := add(sub(add(subject, subjectLength), searchLength), 1)
716: if iszero(lt(searchLength, 0x20)) { h := keccak256(search, searchLength) }
725: if iszero(eq(keccak256(subject, searchLength), h)) {
727: if iszero(lt(subject, subjectSearchEnd)) { break }
780: mstore(add(element, o), mload(add(add(subject, prevIndex), o)))
788: mstore(0x40, add(element, and(add(elementLength, 0x3f), w)))
874: function lower(string memory subject) internal pure returns (string memory result) {
880: function upper(string memory subject) internal pure returns (string memory result) {
885: function escapeHTML(string memory s) internal pure returns (string memory result) {
896: mstore(0x00, shl(64, 0x2671756f743b26616d703b262333393b266c743b2667743b))
919: function escapeJSON(string memory s) internal pure returns (string memory result) {
929: mstore(0x15, 0x5c75303030303031323334353637383961626364656662746e006672)
968: function eq(string memory a, string memory b) internal pure returns (bool result) {
970: result := eq(keccak256(add(a, 0x20), mload(a)), keccak256(add(b, 0x20), mload(b)))
995: function unpackOne(bytes32 packed) internal pure returns (string memory result) {
1013: function packTwo(string memory a, string memory b) internal pure returns (bytes32 result) {
1023: shl(shl(3, sub(0x1f, aLength)), mload(add(a, aLength))),
1053: mstore(add(resultB, 0x1f), mload(add(add(resultA, 0x20), mload(resultA))))
File:solady-main/src/utils/LibZip.sol
19: function flzCompress(bytes memory data) internal pure returns (bytes memory result) {
28: _r := or(shl(16, byte(2, w)), or(shl(8, byte(1, w)), byte(0, w)))
40: for { _r := dest_ } iszero(lt(runs_, 0x20)) { runs_ := sub(runs_, 0x20) } {
50: for { d_ := sub(d_, 1) } iszero(lt(l_, 263)) { l_ := sub(l_, 262) } {
51: o_ := ms8(ms8(ms8(o_, add(224, shr(8, d_))), 253), and(0xff, d_))
54: _r := ms8(ms8(ms8(o_, add(224, shr(8, d_))), sub(l_, 7)), and(0xff, d_))
78: r := add(ipStart, shr(224, mload(add(mload(0x40), shl(2, h)))))
104: for { let i } lt(i, n) { i := add(i, 0x20) } { mstore(add(o, i), mload(add(t, i))) }
111: function flzDecompress(bytes memory data) internal pure returns (bytes memory result) {
131: let s := add(add(shl(8, and(0x1f, c)), byte(add(1, g), w)), 1)
169: function cdCompress(bytes memory data) internal pure returns (bytes memory result) {
173: mstore(o_, shl(240, or(and(0xff, add(d_, 0xff)), and(0x80, v_))))
180: for { let end := add(data, mload(data)) } iszero(eq(data, end)) {} {
211: function cdDecompress(bytes memory data) internal pure returns (bytes memory result) {
229: if iszero(gt(d, 0x7f)) { codecopy(o, codesize(), add(d, 1)) }
254: if iszero(calldatasize()) { return(calldatasize(), calldatasize()) }
265: if iszero(gt(d, 0x7f)) { codecopy(o, codesize(), add(d, 1)) }
File:solady-main/src/utils/MerkleProofLib.sol
46: function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf)
110: isValid := eq(mload(xor(leafs, mul(xor(proof, leafs), proofLength))), root)
122: for { let i := 0 } iszero(eq(i, leafsLength)) { i := add(i, 0x20) } {
188: for {} eq(add(leafs.length, proof.length), add(flags.length, 1)) {} {
195: xor(leafs.offset, mul(xor(proof.offset, leafs.offset), proof.length))
File:solady-main/src/utils/MinHeapLib.sol
39: mstore(0x00, 0xa6ca772e) // Store the function selector of `HeapIsEmpty()`.
64: function pushPop(Heap storage heap, uint256 value) internal returns (uint256 popped) {
70: function replace(Heap storage heap, uint256 value) internal returns (uint256 popped) {
100: function _set(Heap storage heap, uint256 value, uint256 maxLength, uint256 mode)
115: mstore(0x00, 0xa6ca772e) // Store the function selector of `HeapIsEmpty()`.
File:solady-main/src/utils/Multicallable.sol
19: function multicall(bytes[] calldata data) public virtual returns (bytes[] memory) {
46: if iszero(delegatecall(gas(), address(), memPtr, calldataload(o), 0x00, 0x00)) {
60: and(add(add(resultsOffset, returndatasize()), 0x3f), 0xffffffffffffffe0)
File:solady-main/src/utils/RedBlackTreeLib.sol
98: function find(Tree storage tree, uint256 x) internal view returns (bytes32 result) {
106: function nearest(Tree storage tree, uint256 x) internal view returns (bytes32 result) {
125: function nearestBefore(Tree storage tree, uint256 x) internal view returns (bytes32 result) {
135: function nearestAfter(Tree storage tree, uint256 x) internal view returns (bytes32 result) {
144: function exists(Tree storage tree, uint256 x) internal view returns (bool result) {
159: function tryInsert(Tree storage tree, uint256 x) internal returns (uint256 err) {
174: function tryRemove(Tree storage tree, uint256 x) internal returns (uint256 err) {
221: if iszero(result) { result := sload(or(ptr, _BIT_FULL_VALUE_SLOT)) }
261: function _unpack(bytes32 ptr) private pure returns (uint256 nodes, uint256 key) {
270: function _pack(uint256 nodes, uint256 key) private pure returns (bytes32 result) {
278: function _end(Tree storage tree, uint256 L) private view returns (bytes32 result) {
296: function _step(bytes32 ptr, uint256 L, uint256 R) private view returns (bytes32 result) {
308: if iszero(eq(target, and(shr(R, packed), _BITMASK_KEY))) { break }
310: result := and(shr(_BITPOS_PARENT, packed), _BITMASK_KEY)
327: function _update(uint256 nodes, uint256 cursor, uint256 key, uint256 x, uint256 mode)
338: result_ := or(and(not(shl(bitpos_, _BITMASK_KEY)), packed_), shl(bitpos_, key_))
342: result_ := or(and(not(_BITMASK_RED), packed_), shl(_BITPOS_RED, red_))
350: result_ := or(and(not(_BITMASK_RED), packed_), and(_BITMASK_RED, fromPacked_))
380: sstore(or(nodes_, key_), setKey(packed_, _BITPOS_PARENT, cursor_))
396: let R := mul(eq(parent_, getKey(grandParentPacked_, 0)), _BITPOS_RIGHT)
406: parent_ := getKey(sload(or(nodes_, key_)), _BITPOS_PARENT)
417: sstore(or(nodes_, grandParent_), setRed(grandParentPacked_, 1))
459: let cursorValue_ := shr(_BITPOS_PACKED_VALUE, cursorPacked_)
460: if iszero(cursorValue_) { cursorValue_ := sload(or(s_, _BIT_FULL_VALUE_SLOT)) }
462: sstore(s_, setKey(cursorPacked_, _BITPOS_RIGHT, totalNodes_))
465: sstore(s_, setKey(cursorPacked_, _BITPOS_LEFT, totalNodes_))
480: let R := mul(eq(key_, getKey(parentPacked_, 0)), _BITPOS_RIGHT)
499: if iszero(or(isRed(cursorLeftPacked_), isRed(cursorRightPacked_))) {
506: sstore(or(nodes_, cursorLeft_), setRed(cursorLeftPacked_, 0))
516: sstore(or(nodes_, cursor_), copyRed(cursorPacked_, parentPacked_))
518: sstore(or(nodes_, cursorRight_), setRed(cursorRightPacked_, 0))
531: lastValue_ := sload(or(_BIT_FULL_VALUE_SLOT, or(nodes_, last_)))
539: cursorValue_ := sload(or(_BIT_FULL_VALUE_SLOT, or(nodes_, cursor_)))
546: sstore(or(_BIT_FULL_VALUE_SLOT, or(nodes_, cursor_)), lastFullValue_)
548: for { let lastParent_ := getKey(lastPacked_, _BITPOS_PARENT) } 1 {} {
571: if lastFullValue_ { sstore(or(_BIT_FULL_VALUE_SLOT, or(nodes_, last_)), 0) }
600: let cursorLeft_ := getKey(sload(or(nodes_, cursor_)), _BITPOS_LEFT)
609: if iszero(probe_) { probe_ := getKey(cursorPacked_, _BITPOS_RIGHT) }
611: for { let yParent_ := getKey(cursorPacked_, _BITPOS_PARENT) } 1 {} {
613: sstore(probeSlot_, setKey(sload(probeSlot_), _BITPOS_PARENT, yParent_))
645: sstore(leftSlot_, setKey(sload(leftSlot_), _BITPOS_PARENT, cursor_))
649: sstore(rightSlot_, setKey(sload(rightSlot_), _BITPOS_PARENT, cursor_))
654: xor(cursorPacked_, and(xor(packed_, cursorPacked_), m_))
710: nodeValue := sload(or(or(nodes, probe), _BIT_FULL_VALUE_SLOT))
716: probe := and(shr(mload(gt(x, nodeValue)), nodePacked), _BITMASK_KEY)
File:solady-main/src/utils/SafeTransferLib.sol
65: function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal {
153: function safeTransferFrom(address token, address from, address to, uint256 amount) internal {
165: and( // The arguments of `and` are evaluated from right to left.
201: and( // The arguments of `and` are evaluated from right to left.
218: and( // The arguments of `and` are evaluated from right to left.
247: and( // The arguments of `and` are evaluated from right to left.
266: function safeTransferAll(address token, address to) internal returns (uint256 amount) {
269: mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`.
270: mstore(0x20, address()) // Store the address of the current contract.
272: and( // The arguments of `and` are evaluated from right to left.
290: and( // The arguments of `and` are evaluated from right to left.
318: and( // The arguments of `and` are evaluated from right to left.
337: function balanceOf(address token, address account) internal view returns (uint256 amount) {
346: and( // The arguments of `and` are evaluated from right to left.
347: gt(returndatasize(), 0x1f), // At least 32 bytes returned.
File:solady-main/src/utils/SignatureCheckerLib.sol
27: function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature)
51: mstore(add(m, 0x20), byte(0, mload(add(signature, 0x60))))
54: gas(), // Amount of gas left for the transaction.
75: mstore(add(m, 0x24), 0x40) // The offset of the `signature` in the calldata.
102: add(signatureLength, 0x64), // Length of calldata in memory.
115: function isValidSignatureNowCalldata(address signer, bytes32 hash, bytes calldata signature)
133: if iszero(gt(mload(add(m, 0x60)), _MALLEABILITY_THRESHOLD)) {
136: mstore(add(m, 0x20), byte(0, calldataload(add(signature.offset, 0x40))))
139: gas(), // Amount of gas left for the transaction.
160: mstore(add(m, 0x24), 0x40) // The offset of the `signature` in the calldata.
180: add(signature.length, 0x64), // Length of calldata in memory.
193: function isValidSignatureNow(address signer, bytes32 hash, bytes32 r, bytes32 vs)
211: function isValidSignatureNow(address signer, bytes32 hash, uint8 v, bytes32 r, bytes32 s)
252: mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`.
254: mstore(add(m, 0x24), 0x40) // The offset of the `signature` in the calldata.
291: function isValidERC1271SignatureNow(address signer, bytes32 hash, bytes memory signature)
309: mstore(add(m, 0x24), 0x40) // The offset of the `signature` in the calldata.
336: add(signatureLength, 0x64), // Length of calldata in memory.
362: mstore(add(m, 0x24), 0x40) // The offset of the `signature` in the calldata.
382: add(signature.length, 0x64), // Length of calldata in memory.
392: function isValidERC1271SignatureNow(address signer, bytes32 hash, bytes32 r, bytes32 vs)
409: function isValidERC1271SignatureNow(address signer, bytes32 hash, uint8 v, bytes32 r, bytes32 s)
423: mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`.
425: mstore(add(m, 0x24), 0x40) // The offset of the `signature` in the calldata.
459: function emptySignature() internal pure returns (bytes calldata signature) {
File:solady-main/src/utils/SSTORE2.sol
116: function initCodeHash(bytes memory data) internal pure returns (bytes32 hash) {
133: function predictDeterministicAddress(bytes memory data, bytes32 salt, address deployer)
184: function read(address pointer, uint256 start) internal view returns (bytes memory data) {
213: extcodecopy(pointer, add(data, 0x20), add(start, DATA_OFFSET), size)
258: extcodecopy(pointer, add(data, 0x20), add(start, DATA_OFFSET), size)
Instances (539)
File:solady-main/src/tokens/ERC20.sol
101: return 18;
157: return true;
185: return true;
212: return true;
249: return true;
304: return true;
File:solady-main/src/tokens/ERC1155.sol
960: return false;
979: return false;
File:solady-main/src/tokens/ERC4626.sol
78: return _DEFAULT_UNDERLYING_DECIMALS;
87: return _DEFAULT_DECIMALS_OFFSET;
97: return true;
104: if (!_useVirtualShares()) return _underlyingDecimals();
105: return _underlyingDecimals() + _decimalsOffset();
170: return _eitherIsZero(assets, supply)
176: return FixedPointMathLib.fullMulDiv(assets, totalSupply() + 1, _inc(totalAssets()));
178: return FixedPointMathLib.fullMulDiv(assets, totalSupply() + 10 ** o, _inc(totalAssets()));
195: return supply == 0
201: return FixedPointMathLib.fullMulDiv(shares, totalAssets() + 1, _inc(totalSupply()));
203: return FixedPointMathLib.fullMulDiv(shares, totalAssets() + 1, totalSupply() + 10 ** o);
241: return supply == 0
247: return FixedPointMathLib.fullMulDivUp(shares, totalAssets() + 1, _inc(totalSupply()));
249: return FixedPointMathLib.fullMulDivUp(shares, totalAssets() + 1, totalSupply() + 10 ** o);
269: return _eitherIsZero(assets, supply)
275: return FixedPointMathLib.fullMulDivUp(assets, totalSupply() + 1, _inc(totalAssets()));
277: return FixedPointMathLib.fullMulDivUp(assets, totalSupply() + 10 ** o, _inc(totalAssets()));
309: return x + 1;
File:solady-main/src/tokens/WETH.sol
42: return "Wrapped Ether";
47: return "WETH";
File:solady-main/src/auth/Ownable.sol
221: return 48 * 3600;
File:solady-main/src/utils/DynamicBufferLib.sol
96: return buffer;
106: return append(append(buffer, data0), data1);
117: return append(append(append(buffer, data0), data1), data2);
129: return append(append(append(append(buffer, data0), data1), data2), data3);
143: return append(buffer, data4);
158: return append(append(buffer, data4), data5);
174: return append(append(append(buffer, data4), data5), data6);
File:solady-main/src/utils/FixedPointMathLib.sol
117: return expWad((lnWad(x) * y) / int256(WAD));
125: if (x <= -42139678854452767551) return r;
583: return log2(x) + isNotPo2;
File:solady-main/src/utils/LibString.sol
67: return toString(uint256(value));
File:solady-main/src/utils/MinHeapLib.sol
49: return heap.data.length;
File:solady-main/src/utils/RedBlackTreeLib.sol
109: if (cursor == 0) return result; // Nothing found -- empty tree.
110: if (key != 0) return _pack(nodes, key); // Exact match.
114: if (b == bytes32(0)) return a; // Only node found.
118: if (aDist == bDist) return aValue < bValue ? a : b; // Tie-breaker.
119: return aDist < bDist ? a : b;
127: if (cursor == 0) return result; // Nothing found -- empty tree.
128: if (key != 0) return _pack(nodes, key); // Exact match.
130: return value(a) < x ? a : prev(a);
137: if (cursor == 0) return result; // Nothing found -- empty tree.
138: if (key != 0) return _pack(nodes, key); // Exact match.
140: return value(a) > x ? a : next(a);
216: if (ptr == bytes32(0)) return result;
297: if (ptr == bytes32(0)) return ptr;
File:solady-main/src/utils/SafeCastLib.sol
20: return uint8(x);
25: return uint16(x);
30: return uint24(x);
35: return uint32(x);
40: return uint40(x);
45: return uint48(x);
50: return uint56(x);
55: return uint64(x);
60: return uint72(x);
65: return uint80(x);
70: return uint88(x);
75: return uint96(x);
80: return uint104(x);
85: return uint112(x);
90: return uint120(x);
95: return uint128(x);
100: return uint136(x);
105: return uint144(x);
110: return uint152(x);
115: return uint160(x);
120: return uint168(x);
125: return uint176(x);
130: return uint184(x);
135: return uint192(x);
140: return uint200(x);
145: return uint208(x);
150: return uint216(x);
155: return uint224(x);
160: return uint232(x);
165: return uint240(x);
170: return uint248(x);
180: return y;
186: return y;
192: return y;
198: return y;
204: return y;
210: return y;
216: return y;
222: return y;
228: return y;
234: return y;
240: return y;
246: return y;
252: return y;
258: return y;
264: return y;
270: return y;
276: return y;
282: return y;
288: return y;
294: return y;
300: return y;
306: return y;
312: return y;
318: return y;
324: return y;
330: return y;
336: return y;
342: return y;
348: return y;
354: return y;
360: return y;
369: return int256(x);
Instances (117)
File:solady-main/src/tokens/ERC20.sol
50: uint256 private constant _TRANSFER_EVENT_SIGNATURE =
54: uint256 private constant _APPROVAL_EVENT_SIGNATURE =
62: uint256 private constant _TOTAL_SUPPLY_SLOT = 0x05345cdf77eb68f44c;
70: uint256 private constant _BALANCE_SLOT_SEED = 0x87a211a2;
79: uint256 private constant _ALLOWANCE_SLOT_SEED = 0x7f5e9f20;
87: uint256 private constant _NONCES_SLOT_SEED = 0x38377508;
File:solady-main/src/tokens/ERC721.sol
18: uint256 internal constant _MAX_ACCOUNT_BALANCE = 0xffffffff;
63: uint256 private constant _TRANSFER_EVENT_SIGNATURE =
67: uint256 private constant _APPROVAL_EVENT_SIGNATURE =
71: uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE =
108: uint256 private constant _ERC721_MASTER_SLOT_SEED = 0x7d8825530a5a2e7a << 192;
111: uint256 private constant _ERC721_MASTER_SLOT_SEED_MASKED = 0x0a5a2e7a00000000;
File:solady-main/src/tokens/ERC1155.sol
71: uint256 private constant _TRANSFER_SINGLE_EVENT_SIGNATURE =
75: uint256 private constant _TRANSFER_BATCH_EVENT_SIGNATURE =
79: uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE =
104: uint256 private constant _ERC1155_MASTER_SLOT_SEED = 0x9a31110384e0b0c9;
File:solady-main/src/tokens/ERC4626.sol
18: uint8 internal constant _DEFAULT_UNDERLYING_DECIMALS = 18;
21: uint8 internal constant _DEFAULT_DECIMALS_OFFSET = 0;
56: uint256 private constant _DEPOSIT_EVENT_SIGNATURE =
60: uint256 private constant _WITHDRAW_EVENT_SIGNATURE =
File:solady-main/src/tokens/WETH.sol
29: uint256 private constant _DEPOSIT_EVENT_SIGNATURE =
33: uint256 private constant _WITHDRAWAL_EVENT_SIGNATURE =
File:solady-main/src/auth/OwnableRoles.sol
21: uint256 private constant _ROLES_UPDATED_EVENT_SIGNATURE =
37: uint256 private constant _ROLE_SLOT_SEED = 0x8b78c6d8;
277: uint256 internal constant _ROLE_0 = 1 << 0;
278: uint256 internal constant _ROLE_1 = 1 << 1;
279: uint256 internal constant _ROLE_2 = 1 << 2;
280: uint256 internal constant _ROLE_3 = 1 << 3;
281: uint256 internal constant _ROLE_4 = 1 << 4;
282: uint256 internal constant _ROLE_5 = 1 << 5;
283: uint256 internal constant _ROLE_6 = 1 << 6;
284: uint256 internal constant _ROLE_7 = 1 << 7;
285: uint256 internal constant _ROLE_8 = 1 << 8;
286: uint256 internal constant _ROLE_9 = 1 << 9;
287: uint256 internal constant _ROLE_10 = 1 << 10;
288: uint256 internal constant _ROLE_11 = 1 << 11;
289: uint256 internal constant _ROLE_12 = 1 << 12;
290: uint256 internal constant _ROLE_13 = 1 << 13;
291: uint256 internal constant _ROLE_14 = 1 << 14;
292: uint256 internal constant _ROLE_15 = 1 << 15;
293: uint256 internal constant _ROLE_16 = 1 << 16;
294: uint256 internal constant _ROLE_17 = 1 << 17;
295: uint256 internal constant _ROLE_18 = 1 << 18;
296: uint256 internal constant _ROLE_19 = 1 << 19;
297: uint256 internal constant _ROLE_20 = 1 << 20;
298: uint256 internal constant _ROLE_21 = 1 << 21;
299: uint256 internal constant _ROLE_22 = 1 << 22;
300: uint256 internal constant _ROLE_23 = 1 << 23;
301: uint256 internal constant _ROLE_24 = 1 << 24;
302: uint256 internal constant _ROLE_25 = 1 << 25;
303: uint256 internal constant _ROLE_26 = 1 << 26;
304: uint256 internal constant _ROLE_27 = 1 << 27;
305: uint256 internal constant _ROLE_28 = 1 << 28;
306: uint256 internal constant _ROLE_29 = 1 << 29;
307: uint256 internal constant _ROLE_30 = 1 << 30;
308: uint256 internal constant _ROLE_31 = 1 << 31;
309: uint256 internal constant _ROLE_32 = 1 << 32;
310: uint256 internal constant _ROLE_33 = 1 << 33;
311: uint256 internal constant _ROLE_34 = 1 << 34;
312: uint256 internal constant _ROLE_35 = 1 << 35;
313: uint256 internal constant _ROLE_36 = 1 << 36;
314: uint256 internal constant _ROLE_37 = 1 << 37;
315: uint256 internal constant _ROLE_38 = 1 << 38;
316: uint256 internal constant _ROLE_39 = 1 << 39;
317: uint256 internal constant _ROLE_40 = 1 << 40;
318: uint256 internal constant _ROLE_41 = 1 << 41;
319: uint256 internal constant _ROLE_42 = 1 << 42;
320: uint256 internal constant _ROLE_43 = 1 << 43;
321: uint256 internal constant _ROLE_44 = 1 << 44;
322: uint256 internal constant _ROLE_45 = 1 << 45;
323: uint256 internal constant _ROLE_46 = 1 << 46;
324: uint256 internal constant _ROLE_47 = 1 << 47;
325: uint256 internal constant _ROLE_48 = 1 << 48;
326: uint256 internal constant _ROLE_49 = 1 << 49;
327: uint256 internal constant _ROLE_50 = 1 << 50;
328: uint256 internal constant _ROLE_51 = 1 << 51;
329: uint256 internal constant _ROLE_52 = 1 << 52;
330: uint256 internal constant _ROLE_53 = 1 << 53;
331: uint256 internal constant _ROLE_54 = 1 << 54;
332: uint256 internal constant _ROLE_55 = 1 << 55;
333: uint256 internal constant _ROLE_56 = 1 << 56;
334: uint256 internal constant _ROLE_57 = 1 << 57;
335: uint256 internal constant _ROLE_58 = 1 << 58;
336: uint256 internal constant _ROLE_59 = 1 << 59;
337: uint256 internal constant _ROLE_60 = 1 << 60;
338: uint256 internal constant _ROLE_61 = 1 << 61;
339: uint256 internal constant _ROLE_62 = 1 << 62;
340: uint256 internal constant _ROLE_63 = 1 << 63;
341: uint256 internal constant _ROLE_64 = 1 << 64;
342: uint256 internal constant _ROLE_65 = 1 << 65;
343: uint256 internal constant _ROLE_66 = 1 << 66;
344: uint256 internal constant _ROLE_67 = 1 << 67;
345: uint256 internal constant _ROLE_68 = 1 << 68;
346: uint256 internal constant _ROLE_69 = 1 << 69;
347: uint256 internal constant _ROLE_70 = 1 << 70;
348: uint256 internal constant _ROLE_71 = 1 << 71;
349: uint256 internal constant _ROLE_72 = 1 << 72;
350: uint256 internal constant _ROLE_73 = 1 << 73;
351: uint256 internal constant _ROLE_74 = 1 << 74;
352: uint256 internal constant _ROLE_75 = 1 << 75;
353: uint256 internal constant _ROLE_76 = 1 << 76;
354: uint256 internal constant _ROLE_77 = 1 << 77;
355: uint256 internal constant _ROLE_78 = 1 << 78;
356: uint256 internal constant _ROLE_79 = 1 << 79;
357: uint256 internal constant _ROLE_80 = 1 << 80;
358: uint256 internal constant _ROLE_81 = 1 << 81;
359: uint256 internal constant _ROLE_82 = 1 << 82;
360: uint256 internal constant _ROLE_83 = 1 << 83;
361: uint256 internal constant _ROLE_84 = 1 << 84;
362: uint256 internal constant _ROLE_85 = 1 << 85;
363: uint256 internal constant _ROLE_86 = 1 << 86;
364: uint256 internal constant _ROLE_87 = 1 << 87;
365: uint256 internal constant _ROLE_88 = 1 << 88;
366: uint256 internal constant _ROLE_89 = 1 << 89;
367: uint256 internal constant _ROLE_90 = 1 << 90;
368: uint256 internal constant _ROLE_91 = 1 << 91;
369: uint256 internal constant _ROLE_92 = 1 << 92;
370: uint256 internal constant _ROLE_93 = 1 << 93;
371: uint256 internal constant _ROLE_94 = 1 << 94;
372: uint256 internal constant _ROLE_95 = 1 << 95;
373: uint256 internal constant _ROLE_96 = 1 << 96;
374: uint256 internal constant _ROLE_97 = 1 << 97;
375: uint256 internal constant _ROLE_98 = 1 << 98;
376: uint256 internal constant _ROLE_99 = 1 << 99;
377: uint256 internal constant _ROLE_100 = 1 << 100;
378: uint256 internal constant _ROLE_101 = 1 << 101;
379: uint256 internal constant _ROLE_102 = 1 << 102;
380: uint256 internal constant _ROLE_103 = 1 << 103;
381: uint256 internal constant _ROLE_104 = 1 << 104;
382: uint256 internal constant _ROLE_105 = 1 << 105;
383: uint256 internal constant _ROLE_106 = 1 << 106;
384: uint256 internal constant _ROLE_107 = 1 << 107;
385: uint256 internal constant _ROLE_108 = 1 << 108;
386: uint256 internal constant _ROLE_109 = 1 << 109;
387: uint256 internal constant _ROLE_110 = 1 << 110;
388: uint256 internal constant _ROLE_111 = 1 << 111;
389: uint256 internal constant _ROLE_112 = 1 << 112;
390: uint256 internal constant _ROLE_113 = 1 << 113;
391: uint256 internal constant _ROLE_114 = 1 << 114;
392: uint256 internal constant _ROLE_115 = 1 << 115;
393: uint256 internal constant _ROLE_116 = 1 << 116;
394: uint256 internal constant _ROLE_117 = 1 << 117;
395: uint256 internal constant _ROLE_118 = 1 << 118;
396: uint256 internal constant _ROLE_119 = 1 << 119;
397: uint256 internal constant _ROLE_120 = 1 << 120;
398: uint256 internal constant _ROLE_121 = 1 << 121;
399: uint256 internal constant _ROLE_122 = 1 << 122;
400: uint256 internal constant _ROLE_123 = 1 << 123;
401: uint256 internal constant _ROLE_124 = 1 << 124;
402: uint256 internal constant _ROLE_125 = 1 << 125;
403: uint256 internal constant _ROLE_126 = 1 << 126;
404: uint256 internal constant _ROLE_127 = 1 << 127;
405: uint256 internal constant _ROLE_128 = 1 << 128;
406: uint256 internal constant _ROLE_129 = 1 << 129;
407: uint256 internal constant _ROLE_130 = 1 << 130;
408: uint256 internal constant _ROLE_131 = 1 << 131;
409: uint256 internal constant _ROLE_132 = 1 << 132;
410: uint256 internal constant _ROLE_133 = 1 << 133;
411: uint256 internal constant _ROLE_134 = 1 << 134;
412: uint256 internal constant _ROLE_135 = 1 << 135;
413: uint256 internal constant _ROLE_136 = 1 << 136;
414: uint256 internal constant _ROLE_137 = 1 << 137;
415: uint256 internal constant _ROLE_138 = 1 << 138;
416: uint256 internal constant _ROLE_139 = 1 << 139;
417: uint256 internal constant _ROLE_140 = 1 << 140;
418: uint256 internal constant _ROLE_141 = 1 << 141;
419: uint256 internal constant _ROLE_142 = 1 << 142;
420: uint256 internal constant _ROLE_143 = 1 << 143;
421: uint256 internal constant _ROLE_144 = 1 << 144;
422: uint256 internal constant _ROLE_145 = 1 << 145;
423: uint256 internal constant _ROLE_146 = 1 << 146;
424: uint256 internal constant _ROLE_147 = 1 << 147;
425: uint256 internal constant _ROLE_148 = 1 << 148;
426: uint256 internal constant _ROLE_149 = 1 << 149;
427: uint256 internal constant _ROLE_150 = 1 << 150;
428: uint256 internal constant _ROLE_151 = 1 << 151;
429: uint256 internal constant _ROLE_152 = 1 << 152;
430: uint256 internal constant _ROLE_153 = 1 << 153;
431: uint256 internal constant _ROLE_154 = 1 << 154;
432: uint256 internal constant _ROLE_155 = 1 << 155;
433: uint256 internal constant _ROLE_156 = 1 << 156;
434: uint256 internal constant _ROLE_157 = 1 << 157;
435: uint256 internal constant _ROLE_158 = 1 << 158;
436: uint256 internal constant _ROLE_159 = 1 << 159;
437: uint256 internal constant _ROLE_160 = 1 << 160;
438: uint256 internal constant _ROLE_161 = 1 << 161;
439: uint256 internal constant _ROLE_162 = 1 << 162;
440: uint256 internal constant _ROLE_163 = 1 << 163;
441: uint256 internal constant _ROLE_164 = 1 << 164;
442: uint256 internal constant _ROLE_165 = 1 << 165;
443: uint256 internal constant _ROLE_166 = 1 << 166;
444: uint256 internal constant _ROLE_167 = 1 << 167;
445: uint256 internal constant _ROLE_168 = 1 << 168;
446: uint256 internal constant _ROLE_169 = 1 << 169;
447: uint256 internal constant _ROLE_170 = 1 << 170;
448: uint256 internal constant _ROLE_171 = 1 << 171;
449: uint256 internal constant _ROLE_172 = 1 << 172;
450: uint256 internal constant _ROLE_173 = 1 << 173;
451: uint256 internal constant _ROLE_174 = 1 << 174;
452: uint256 internal constant _ROLE_175 = 1 << 175;
453: uint256 internal constant _ROLE_176 = 1 << 176;
454: uint256 internal constant _ROLE_177 = 1 << 177;
455: uint256 internal constant _ROLE_178 = 1 << 178;
456: uint256 internal constant _ROLE_179 = 1 << 179;
457: uint256 internal constant _ROLE_180 = 1 << 180;
458: uint256 internal constant _ROLE_181 = 1 << 181;
459: uint256 internal constant _ROLE_182 = 1 << 182;
460: uint256 internal constant _ROLE_183 = 1 << 183;
461: uint256 internal constant _ROLE_184 = 1 << 184;
462: uint256 internal constant _ROLE_185 = 1 << 185;
463: uint256 internal constant _ROLE_186 = 1 << 186;
464: uint256 internal constant _ROLE_187 = 1 << 187;
465: uint256 internal constant _ROLE_188 = 1 << 188;
466: uint256 internal constant _ROLE_189 = 1 << 189;
467: uint256 internal constant _ROLE_190 = 1 << 190;
468: uint256 internal constant _ROLE_191 = 1 << 191;
469: uint256 internal constant _ROLE_192 = 1 << 192;
470: uint256 internal constant _ROLE_193 = 1 << 193;
471: uint256 internal constant _ROLE_194 = 1 << 194;
472: uint256 internal constant _ROLE_195 = 1 << 195;
473: uint256 internal constant _ROLE_196 = 1 << 196;
474: uint256 internal constant _ROLE_197 = 1 << 197;
475: uint256 internal constant _ROLE_198 = 1 << 198;
476: uint256 internal constant _ROLE_199 = 1 << 199;
477: uint256 internal constant _ROLE_200 = 1 << 200;
478: uint256 internal constant _ROLE_201 = 1 << 201;
479: uint256 internal constant _ROLE_202 = 1 << 202;
480: uint256 internal constant _ROLE_203 = 1 << 203;
481: uint256 internal constant _ROLE_204 = 1 << 204;
482: uint256 internal constant _ROLE_205 = 1 << 205;
483: uint256 internal constant _ROLE_206 = 1 << 206;
484: uint256 internal constant _ROLE_207 = 1 << 207;
485: uint256 internal constant _ROLE_208 = 1 << 208;
486: uint256 internal constant _ROLE_209 = 1 << 209;
487: uint256 internal constant _ROLE_210 = 1 << 210;
488: uint256 internal constant _ROLE_211 = 1 << 211;
489: uint256 internal constant _ROLE_212 = 1 << 212;
490: uint256 internal constant _ROLE_213 = 1 << 213;
491: uint256 internal constant _ROLE_214 = 1 << 214;
492: uint256 internal constant _ROLE_215 = 1 << 215;
493: uint256 internal constant _ROLE_216 = 1 << 216;
494: uint256 internal constant _ROLE_217 = 1 << 217;
495: uint256 internal constant _ROLE_218 = 1 << 218;
496: uint256 internal constant _ROLE_219 = 1 << 219;
497: uint256 internal constant _ROLE_220 = 1 << 220;
498: uint256 internal constant _ROLE_221 = 1 << 221;
499: uint256 internal constant _ROLE_222 = 1 << 222;
500: uint256 internal constant _ROLE_223 = 1 << 223;
501: uint256 internal constant _ROLE_224 = 1 << 224;
502: uint256 internal constant _ROLE_225 = 1 << 225;
503: uint256 internal constant _ROLE_226 = 1 << 226;
504: uint256 internal constant _ROLE_227 = 1 << 227;
505: uint256 internal constant _ROLE_228 = 1 << 228;
506: uint256 internal constant _ROLE_229 = 1 << 229;
507: uint256 internal constant _ROLE_230 = 1 << 230;
508: uint256 internal constant _ROLE_231 = 1 << 231;
509: uint256 internal constant _ROLE_232 = 1 << 232;
510: uint256 internal constant _ROLE_233 = 1 << 233;
511: uint256 internal constant _ROLE_234 = 1 << 234;
512: uint256 internal constant _ROLE_235 = 1 << 235;
513: uint256 internal constant _ROLE_236 = 1 << 236;
514: uint256 internal constant _ROLE_237 = 1 << 237;
515: uint256 internal constant _ROLE_238 = 1 << 238;
516: uint256 internal constant _ROLE_239 = 1 << 239;
517: uint256 internal constant _ROLE_240 = 1 << 240;
518: uint256 internal constant _ROLE_241 = 1 << 241;
519: uint256 internal constant _ROLE_242 = 1 << 242;
520: uint256 internal constant _ROLE_243 = 1 << 243;
521: uint256 internal constant _ROLE_244 = 1 << 244;
522: uint256 internal constant _ROLE_245 = 1 << 245;
523: uint256 internal constant _ROLE_246 = 1 << 246;
524: uint256 internal constant _ROLE_247 = 1 << 247;
525: uint256 internal constant _ROLE_248 = 1 << 248;
526: uint256 internal constant _ROLE_249 = 1 << 249;
527: uint256 internal constant _ROLE_250 = 1 << 250;
528: uint256 internal constant _ROLE_251 = 1 << 251;
529: uint256 internal constant _ROLE_252 = 1 << 252;
530: uint256 internal constant _ROLE_253 = 1 << 253;
531: uint256 internal constant _ROLE_254 = 1 << 254;
532: uint256 internal constant _ROLE_255 = 1 << 255;
File:solady-main/src/auth/Ownable.sol
40: uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =
44: uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =
48: uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =
60: uint256 private constant _OWNER_SLOT_NOT = 0x8b78c6d8;
68: uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;
File:solady-main/src/Milady.sol
73: string internal constant WEBSITE = "https://miladymaker.net";
75: address internal constant CONTRACT = 0x5Af0D9827E0c53E4799BB226655A1de152A425a5;
File:solady-main/src/utils/CREATE3.sol
48: uint256 private constant _PROXY_BYTECODE = 0x67363d3d37363d34f03d5260086018f3;
52: bytes32 private constant _PROXY_BYTECODE_HASH =
File:solady-main/src/utils/DateTimeLib.sol
30: uint256 internal constant MON = 1;
31: uint256 internal constant TUE = 2;
32: uint256 internal constant WED = 3;
33: uint256 internal constant THU = 4;
34: uint256 internal constant FRI = 5;
35: uint256 internal constant SAT = 6;
36: uint256 internal constant SUN = 7;
40: uint256 internal constant JAN = 1;
41: uint256 internal constant FEB = 2;
42: uint256 internal constant MAR = 3;
43: uint256 internal constant APR = 4;
44: uint256 internal constant MAY = 5;
45: uint256 internal constant JUN = 6;
46: uint256 internal constant JUL = 7;
47: uint256 internal constant AUG = 8;
48: uint256 internal constant SEP = 9;
49: uint256 internal constant OCT = 10;
50: uint256 internal constant NOV = 11;
51: uint256 internal constant DEC = 12;
56: uint256 internal constant MAX_SUPPORTED_YEAR = 0xffffffff;
57: uint256 internal constant MAX_SUPPORTED_EPOCH_DAY = 0x16d3e098039;
58: uint256 internal constant MAX_SUPPORTED_TIMESTAMP = 0x1e18549868c76ff;
File:solady-main/src/utils/ECDSA.sol
22: bytes32 private constant _MALLEABILITY_THRESHOLD =
File:solady-main/src/utils/EIP712.sol
20: bytes32 internal constant _DOMAIN_TYPEHASH =
File:solady-main/src/utils/ERC1967FactoryConstants.sol
24: address internal constant ADDRESS = 0x0000000000006396FF2a80c067f99B3d2Ab4Df24;
29: bytes internal constant BYTECODE =
33: bytes internal constant INITCODE = abi.encodePacked(
38: bytes32 internal constant SALT =
File:solady-main/src/utils/ERC1967Factory.sol
25: uint256 internal constant _UNAUTHORIZED_ERROR_SELECTOR = 0x82b42900;
28: uint256 internal constant _DEPLOYMENT_FAILED_ERROR_SELECTOR = 0x30116425;
31: uint256 internal constant _UPGRADE_FAILED_ERROR_SELECTOR = 0x55299b49;
34: uint256 internal constant _SALT_DOES_NOT_START_WITH_CALLER_ERROR_SELECTOR = 0x2f634836;
50: uint256 internal constant _ADMIN_CHANGED_EVENT_SIGNATURE =
54: uint256 internal constant _UPGRADED_EVENT_SIGNATURE =
58: uint256 internal constant _DEPLOYED_EVENT_SIGNATURE =
74: uint256 internal constant _IMPLEMENTATION_SLOT =
File:solady-main/src/utils/FixedPointMathLib.sol
47: uint256 internal constant WAD = 1e18;
File:solady-main/src/utils/LibBitmap.sol
16: uint256 internal constant NOT_FOUND = type(uint256).max;
File:solady-main/src/utils/LibString.sol
20: uint256 internal constant NOT_FOUND = type(uint256).max;
File:solady-main/src/utils/RedBlackTreeLib.sol
30: uint256 internal constant ERROR_VALUE_ALREADY_EXISTS = 0xbb33e6ac;
33: uint256 internal constant ERROR_VALUE_DOES_NOT_EXISTS = 0xb113638a;
36: uint256 internal constant ERROR_POINTER_OUT_OF_BOUNDS = 0xccd52fbc;
39: uint256 internal constant ERROR_TREE_IS_FULL = 0xed732d0c;
71: uint256 private constant _NODES_SLOT_SEED = 0x1dc27bb5462fdadcb;
72: uint256 private constant _NODES_SLOT_SHIFT = 32;
73: uint256 private constant _BITMASK_KEY = (1 << 31) - 1;
74: uint256 private constant _BITPOS_LEFT = 0;
75: uint256 private constant _BITPOS_RIGHT = 31;
76: uint256 private constant _BITPOS_PARENT = 31 * 2;
77: uint256 private constant _BITPOS_RED = 31 * 3;
78: uint256 private constant _BITMASK_RED = 1 << (31 * 3);
79: uint256 private constant _BITPOS_PACKED_VALUE = 96;
80: uint256 private constant _BITMASK_PACKED_VALUE = (1 << 160) - 1;
81: uint256 private constant _BIT_FULL_VALUE_SLOT = 1 << 31;
File:solady-main/src/utils/SafeTransferLib.sol
31: uint256 internal constant _GAS_STIPEND_NO_STORAGE_WRITES = 2300;
36: uint256 internal constant _GAS_STIPEND_NO_GRIEF = 100000;
File:solady-main/src/utils/SignatureCheckerLib.sol
17: bytes32 private constant _MALLEABILITY_THRESHOLD =
File:solady-main/src/utils/SSTORE2.sol
16: uint256 internal constant DATA_OFFSET = 1;
Instances (347)
If a function modifier such as onlyOwner
is used, the function will revert if a normal user tries to pay the function. Marking the function as payable will lower the gas cost for legitimate callers because the compiler will not include checks for whether a payment was provided.
File:solady-main/src/auth/OwnableRoles.sol
148: function grantRoles(address user, uint256 roles) public payable virtual onlyOwner {
154: function revokeRoles(address user, uint256 roles) public payable virtual onlyOwner {
File:solady-main/src/auth/Ownable.sol
124: function transferOwnership(address newOwner) public payable virtual onlyOwner {
136: function renounceOwnership() public payable virtual onlyOwner {
172: function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {
Instances (5)
File:solady-main/src/utils/DateTimeLib.sol
79: epochDay := sub(add(mul(div(year, 400), 146097), doe), 719469)
93: epochDay := add(epochDay, 719468)
94: let doe := mod(epochDay, 146097)
96: div(sub(sub(add(doe, div(doe, 36524)), div(doe, 1460)), eq(doe, 146096)), 365)
99: day := add(sub(doy, shr(11, add(mul(mp, 62719), 769))), 1)
101: year := add(add(yoe, mul(div(epochDay, 146097), 400)), lt(month, 3))
114: result = dateToEpochDay(year, month, day) * 86400;
126: (year, month, day) = epochDayToDate(timestamp / 86400);
142: result = dateToEpochDay(year, month, day) * 86400 + hour * 3600 + minute * 60 + second;
163: (year, month, day) = epochDayToDate(timestamp / 86400);
164: uint256 secs = timestamp % 86400;
196: result = ((timestamp / 86400 + 3) % 7) + 1;
282: let day := div(t, 86400)
283: result := mul(mul(sub(day, mod(add(day, 3), 7)), 86400), gt(t, 345599))
305: (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400);
319: (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400);
326: result = timestamp + numDays * 86400;
360: (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400);
374: (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400);
381: result = timestamp - numDays * 86400;
418: (uint256 fromYear,,) = epochDayToDate(fromTimestamp / 86400);
419: (uint256 toYear,,) = epochDayToDate(toTimestamp / 86400);
434: (uint256 fromYear, uint256 fromMonth,) = epochDayToDate(fromTimestamp / 86400);
435: (uint256 toYear, uint256 toMonth,) = epochDayToDate(toTimestamp / 86400);
445: result = (toTimestamp - fromTimestamp) / 86400;
514: result = dateToEpochDay(year, month, day) * 86400 + (timestamp % 86400);
File:solady-main/src/utils/DynamicBufferLib.sol
40: let prime := 1621250193422201
File:solady-main/src/utils/FixedPointMathLib.sol
131: if iszero(slt(x, 135305999368893231589)) {
147: int256 k = ((x << 96) / 54916777467707473351141471128 + 2 ** 95) >> 96;
148: x = x - k * 54916777467707473351141471128;
154: int256 y = x + 1346386616545796478920950773328;
155: y = ((y * x) >> 96) + 57155421227552351082224309758442;
156: int256 p = y + x - 94201549194550492254356042504812;
157: p = ((p * y) >> 96) + 28719021644029726153956944680412240;
161: int256 q = x - 2855989394907223263936484059900;
162: q = ((q * x) >> 96) + 50020603652535783019961831881945;
163: q = ((q * x) >> 96) - 533845033583426703283633433725380;
164: q = ((q * x) >> 96) + 3604857256930695427073651918091429;
165: q = ((q * x) >> 96) - 14423608567350463180887372962807573;
166: q = ((q * x) >> 96) + 26449188498355588339934803723976023;
185: (uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k)
238: int256 p = x + 3273285459638523848632254066296;
239: p = ((p * x) >> 96) + 24828157081833163892658089445524;
240: p = ((p * x) >> 96) + 43456485725739037958740375743393;
241: p = ((p * x) >> 96) - 11111509109440967052023855526967;
242: p = ((p * x) >> 96) - 45023709667254063763336534515857;
243: p = ((p * x) >> 96) - 14706773417378608786704636184526;
248: int256 q = x + 5573035233440673466300451813936;
249: q = ((q * x) >> 96) + 71694874799317883764090561454958;
250: q = ((q * x) >> 96) + 283447036172924575727196451306956;
251: q = ((q * x) >> 96) + 401686690394027663651624208769553;
252: q = ((q * x) >> 96) + 204048457590392012362485061816622;
253: q = ((q * x) >> 96) + 31853899698501571402653359427138;
254: q = ((q * x) >> 96) + 909429971244387300277376558375;
272: r *= 1677202110996718588342820967067443963516166;
274: r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k;
276: r += 600920179829731861736702779321621459595472258049074101567377883020018308;
481: z := shr(18, mul(z, add(shr(r, x), 65536))) // A `mul()` is saved from starting `z` at 181.
File:solady-main/src/utils/SafeTransferLib.sol
36: uint256 internal constant _GAS_STIPEND_NO_GRIEF = 100000;
84: if iszero(gt(gas(), 1000000)) { revert(0, 0) }
119: if iszero(gt(gas(), 1000000)) { revert(0, 0) }
Instances (61)
The default value for variables is zero, so initializing them to zero is superfluous.
File:solady-main/src/tokens/ERC4626.sol
21: uint8 internal constant _DEFAULT_DECIMALS_OFFSET = 0;
File:solady-main/src/utils/RedBlackTreeLib.sol
74: uint256 private constant _BITPOS_LEFT = 0;
Instances (2)
Consider using underscores for number values to improve readability.
File:solady-main/src/auth/Ownable.sol
221: return 48 * 3600;
File:solady-main/src/utils/DateTimeLib.sol
114: result = dateToEpochDay(year, month, day) * 86400;
164: uint256 secs = timestamp % 86400;
165: hour = secs / 3600;
166: secs = secs % 3600;
326: result = timestamp + numDays * 86400;
331: result = timestamp + numHours * 3600;
381: result = timestamp - numDays * 86400;
386: result = timestamp - numHours * 3600;
445: result = (toTimestamp - fromTimestamp) / 86400;
454: result = (toTimestamp - fromTimestamp) / 3600;
File:solady-main/src/utils/FixedPointMathLib.sol
148: x = x - k * 54916777467707473351141471128;
154: int256 y = x + 1346386616545796478920950773328;
155: y = ((y * x) >> 96) + 57155421227552351082224309758442;
156: int256 p = y + x - 94201549194550492254356042504812;
157: p = ((p * y) >> 96) + 28719021644029726153956944680412240;
161: int256 q = x - 2855989394907223263936484059900;
162: q = ((q * x) >> 96) + 50020603652535783019961831881945;
163: q = ((q * x) >> 96) - 533845033583426703283633433725380;
164: q = ((q * x) >> 96) + 3604857256930695427073651918091429;
165: q = ((q * x) >> 96) - 14423608567350463180887372962807573;
166: q = ((q * x) >> 96) + 26449188498355588339934803723976023;
238: int256 p = x + 3273285459638523848632254066296;
239: p = ((p * x) >> 96) + 24828157081833163892658089445524;
240: p = ((p * x) >> 96) + 43456485725739037958740375743393;
241: p = ((p * x) >> 96) - 11111509109440967052023855526967;
242: p = ((p * x) >> 96) - 45023709667254063763336534515857;
243: p = ((p * x) >> 96) - 14706773417378608786704636184526;
248: int256 q = x + 5573035233440673466300451813936;
249: q = ((q * x) >> 96) + 71694874799317883764090561454958;
250: q = ((q * x) >> 96) + 283447036172924575727196451306956;
251: q = ((q * x) >> 96) + 401686690394027663651624208769553;
252: q = ((q * x) >> 96) + 204048457590392012362485061816622;
253: q = ((q * x) >> 96) + 31853899698501571402653359427138;
254: q = ((q * x) >> 96) + 909429971244387300277376558375;
272: r *= 1677202110996718588342820967067443963516166;
276: r += 600920179829731861736702779321621459595472258049074101567377883020018308;
File:solady-main/src/utils/SafeTransferLib.sol
31: uint256 internal constant _GAS_STIPEND_NO_STORAGE_WRITES = 2300;
36: uint256 internal constant _GAS_STIPEND_NO_GRIEF = 100000;
Instances (39)
The contract's interface should be imported first, followed by each of the interfaces it uses, followed by all other files. The examples below do not follow this layout.
File:solady-main/src/Milady.sol
37:import "./auth/Ownable.sol";
38:import "./auth/OwnableRoles.sol";
39:import "./tokens/WETH.sol";
40:import "./tokens/ERC20.sol";
41:import "./tokens/ERC4626.sol";
42:import "./tokens/ERC721.sol";
43:import "./tokens/ERC1155.sol";
44:import "./utils/Base64.sol";
45:import "./utils/CREATE3.sol";
46:import "./utils/Clone.sol";
47:import "./utils/DateTimeLib.sol";
48:import "./utils/DynamicBufferLib.sol";
49:import "./utils/ECDSA.sol";
50:import "./utils/EIP712.sol";
51:import "./utils/ERC1967Factory.sol";
52:import "./utils/ERC1967FactoryConstants.sol";
53:import "./utils/FixedPointMathLib.sol";
54:import "./utils/LibBit.sol";
55:import "./utils/LibBitmap.sol";
56:import "./utils/LibMap.sol";
57:import "./utils/LibClone.sol";
58:import "./utils/LibPRNG.sol";
59:import "./utils/LibRLP.sol";
60:import "./utils/LibSort.sol";
61:import "./utils/LibString.sol";
62:import "./utils/LibZip.sol";
63:import "./utils/MerkleProofLib.sol";
64:import "./utils/MinHeapLib.sol";
65:import "./utils/Multicallable.sol";
66:import "./utils/RedBlackTreeLib.sol";
67:import "./utils/SSTORE2.sol";
68:import "./utils/SafeCastLib.sol";
69:import "./utils/SafeTransferLib.sol";
70:import "./utils/SignatureCheckerLib.sol";
Instances (34)
File:solady-main/src/tokens/ERC20.sol
62: uint256 private constant _TOTAL_SUPPLY_SLOT = 0x05345cdf77eb68f44c;
70: uint256 private constant _BALANCE_SLOT_SEED = 0x87a211a2;
79: uint256 private constant _ALLOWANCE_SLOT_SEED = 0x7f5e9f20;
87: uint256 private constant _NONCES_SLOT_SEED = 0x38377508;
File:solady-main/src/tokens/ERC721.sol
18: uint256 internal constant _MAX_ACCOUNT_BALANCE = 0xffffffff;
108: uint256 private constant _ERC721_MASTER_SLOT_SEED = 0x7d8825530a5a2e7a << 192;
111: uint256 private constant _ERC721_MASTER_SLOT_SEED_MASKED = 0x0a5a2e7a00000000;
File:solady-main/src/tokens/ERC1155.sol
104: uint256 private constant _ERC1155_MASTER_SLOT_SEED = 0x9a31110384e0b0c9;
File:solady-main/src/tokens/ERC4626.sol
18: uint8 internal constant _DEFAULT_UNDERLYING_DECIMALS = 18;
File:solady-main/src/auth/OwnableRoles.sol
37: uint256 private constant _ROLE_SLOT_SEED = 0x8b78c6d8;
277: uint256 internal constant _ROLE_0 = 1 << 0;
278: uint256 internal constant _ROLE_1 = 1 << 1;
279: uint256 internal constant _ROLE_2 = 1 << 2;
280: uint256 internal constant _ROLE_3 = 1 << 3;
281: uint256 internal constant _ROLE_4 = 1 << 4;
282: uint256 internal constant _ROLE_5 = 1 << 5;
283: uint256 internal constant _ROLE_6 = 1 << 6;
284: uint256 internal constant _ROLE_7 = 1 << 7;
285: uint256 internal constant _ROLE_8 = 1 << 8;
286: uint256 internal constant _ROLE_9 = 1 << 9;
287: uint256 internal constant _ROLE_10 = 1 << 10;
288: uint256 internal constant _ROLE_11 = 1 << 11;
289: uint256 internal constant _ROLE_12 = 1 << 12;
290: uint256 internal constant _ROLE_13 = 1 << 13;
291: uint256 internal constant _ROLE_14 = 1 << 14;
292: uint256 internal constant _ROLE_15 = 1 << 15;
293: uint256 internal constant _ROLE_16 = 1 << 16;
294: uint256 internal constant _ROLE_17 = 1 << 17;
295: uint256 internal constant _ROLE_18 = 1 << 18;
296: uint256 internal constant _ROLE_19 = 1 << 19;
297: uint256 internal constant _ROLE_20 = 1 << 20;
298: uint256 internal constant _ROLE_21 = 1 << 21;
299: uint256 internal constant _ROLE_22 = 1 << 22;
300: uint256 internal constant _ROLE_23 = 1 << 23;
301: uint256 internal constant _ROLE_24 = 1 << 24;
302: uint256 internal constant _ROLE_25 = 1 << 25;
303: uint256 internal constant _ROLE_26 = 1 << 26;
304: uint256 internal constant _ROLE_27 = 1 << 27;
305: uint256 internal constant _ROLE_28 = 1 << 28;
306: uint256 internal constant _ROLE_29 = 1 << 29;
307: uint256 internal constant _ROLE_30 = 1 << 30;
308: uint256 internal constant _ROLE_31 = 1 << 31;
309: uint256 internal constant _ROLE_32 = 1 << 32;
310: uint256 internal constant _ROLE_33 = 1 << 33;
311: uint256 internal constant _ROLE_34 = 1 << 34;
312: uint256 internal constant _ROLE_35 = 1 << 35;
313: uint256 internal constant _ROLE_36 = 1 << 36;
314: uint256 internal constant _ROLE_37 = 1 << 37;
315: uint256 internal constant _ROLE_38 = 1 << 38;
316: uint256 internal constant _ROLE_39 = 1 << 39;
317: uint256 internal constant _ROLE_40 = 1 << 40;
318: uint256 internal constant _ROLE_41 = 1 << 41;
319: uint256 internal constant _ROLE_42 = 1 << 42;
320: uint256 internal constant _ROLE_43 = 1 << 43;
321: uint256 internal constant _ROLE_44 = 1 << 44;
322: uint256 internal constant _ROLE_45 = 1 << 45;
323: uint256 internal constant _ROLE_46 = 1 << 46;
324: uint256 internal constant _ROLE_47 = 1 << 47;
325: uint256 internal constant _ROLE_48 = 1 << 48;
326: uint256 internal constant _ROLE_49 = 1 << 49;
327: uint256 internal constant _ROLE_50 = 1 << 50;
328: uint256 internal constant _ROLE_51 = 1 << 51;
329: uint256 internal constant _ROLE_52 = 1 << 52;
330: uint256 internal constant _ROLE_53 = 1 << 53;
331: uint256 internal constant _ROLE_54 = 1 << 54;
332: uint256 internal constant _ROLE_55 = 1 << 55;
333: uint256 internal constant _ROLE_56 = 1 << 56;
334: uint256 internal constant _ROLE_57 = 1 << 57;
335: uint256 internal constant _ROLE_58 = 1 << 58;
336: uint256 internal constant _ROLE_59 = 1 << 59;
337: uint256 internal constant _ROLE_60 = 1 << 60;
338: uint256 internal constant _ROLE_61 = 1 << 61;
339: uint256 internal constant _ROLE_62 = 1 << 62;
340: uint256 internal constant _ROLE_63 = 1 << 63;
341: uint256 internal constant _ROLE_64 = 1 << 64;
342: uint256 internal constant _ROLE_65 = 1 << 65;
343: uint256 internal constant _ROLE_66 = 1 << 66;
344: uint256 internal constant _ROLE_67 = 1 << 67;
345: uint256 internal constant _ROLE_68 = 1 << 68;
346: uint256 internal constant _ROLE_69 = 1 << 69;
347: uint256 internal constant _ROLE_70 = 1 << 70;
348: uint256 internal constant _ROLE_71 = 1 << 71;
349: uint256 internal constant _ROLE_72 = 1 << 72;
350: uint256 internal constant _ROLE_73 = 1 << 73;
351: uint256 internal constant _ROLE_74 = 1 << 74;
352: uint256 internal constant _ROLE_75 = 1 << 75;
353: uint256 internal constant _ROLE_76 = 1 << 76;
354: uint256 internal constant _ROLE_77 = 1 << 77;
355: uint256 internal constant _ROLE_78 = 1 << 78;
356: uint256 internal constant _ROLE_79 = 1 << 79;
357: uint256 internal constant _ROLE_80 = 1 << 80;
358: uint256 internal constant _ROLE_81 = 1 << 81;
359: uint256 internal constant _ROLE_82 = 1 << 82;
360: uint256 internal constant _ROLE_83 = 1 << 83;
361: uint256 internal constant _ROLE_84 = 1 << 84;
362: uint256 internal constant _ROLE_85 = 1 << 85;
363: uint256 internal constant _ROLE_86 = 1 << 86;
364: uint256 internal constant _ROLE_87 = 1 << 87;
365: uint256 internal constant _ROLE_88 = 1 << 88;
366: uint256 internal constant _ROLE_89 = 1 << 89;
367: uint256 internal constant _ROLE_90 = 1 << 90;
368: uint256 internal constant _ROLE_91 = 1 << 91;
369: uint256 internal constant _ROLE_92 = 1 << 92;
370: uint256 internal constant _ROLE_93 = 1 << 93;
371: uint256 internal constant _ROLE_94 = 1 << 94;
372: uint256 internal constant _ROLE_95 = 1 << 95;
373: uint256 internal constant _ROLE_96 = 1 << 96;
374: uint256 internal constant _ROLE_97 = 1 << 97;
375: uint256 internal constant _ROLE_98 = 1 << 98;
376: uint256 internal constant _ROLE_99 = 1 << 99;
377: uint256 internal constant _ROLE_100 = 1 << 100;
378: uint256 internal constant _ROLE_101 = 1 << 101;
379: uint256 internal constant _ROLE_102 = 1 << 102;
380: uint256 internal constant _ROLE_103 = 1 << 103;
381: uint256 internal constant _ROLE_104 = 1 << 104;
382: uint256 internal constant _ROLE_105 = 1 << 105;
383: uint256 internal constant _ROLE_106 = 1 << 106;
384: uint256 internal constant _ROLE_107 = 1 << 107;
385: uint256 internal constant _ROLE_108 = 1 << 108;
386: uint256 internal constant _ROLE_109 = 1 << 109;
387: uint256 internal constant _ROLE_110 = 1 << 110;
388: uint256 internal constant _ROLE_111 = 1 << 111;
389: uint256 internal constant _ROLE_112 = 1 << 112;
390: uint256 internal constant _ROLE_113 = 1 << 113;
391: uint256 internal constant _ROLE_114 = 1 << 114;
392: uint256 internal constant _ROLE_115 = 1 << 115;
393: uint256 internal constant _ROLE_116 = 1 << 116;
394: uint256 internal constant _ROLE_117 = 1 << 117;
395: uint256 internal constant _ROLE_118 = 1 << 118;
396: uint256 internal constant _ROLE_119 = 1 << 119;
397: uint256 internal constant _ROLE_120 = 1 << 120;
398: uint256 internal constant _ROLE_121 = 1 << 121;
399: uint256 internal constant _ROLE_122 = 1 << 122;
400: uint256 internal constant _ROLE_123 = 1 << 123;
401: uint256 internal constant _ROLE_124 = 1 << 124;
402: uint256 internal constant _ROLE_125 = 1 << 125;
403: uint256 internal constant _ROLE_126 = 1 << 126;
404: uint256 internal constant _ROLE_127 = 1 << 127;
405: uint256 internal constant _ROLE_128 = 1 << 128;
406: uint256 internal constant _ROLE_129 = 1 << 129;
407: uint256 internal constant _ROLE_130 = 1 << 130;
408: uint256 internal constant _ROLE_131 = 1 << 131;
409: uint256 internal constant _ROLE_132 = 1 << 132;
410: uint256 internal constant _ROLE_133 = 1 << 133;
411: uint256 internal constant _ROLE_134 = 1 << 134;
412: uint256 internal constant _ROLE_135 = 1 << 135;
413: uint256 internal constant _ROLE_136 = 1 << 136;
414: uint256 internal constant _ROLE_137 = 1 << 137;
415: uint256 internal constant _ROLE_138 = 1 << 138;
416: uint256 internal constant _ROLE_139 = 1 << 139;
417: uint256 internal constant _ROLE_140 = 1 << 140;
418: uint256 internal constant _ROLE_141 = 1 << 141;
419: uint256 internal constant _ROLE_142 = 1 << 142;
420: uint256 internal constant _ROLE_143 = 1 << 143;
421: uint256 internal constant _ROLE_144 = 1 << 144;
422: uint256 internal constant _ROLE_145 = 1 << 145;
423: uint256 internal constant _ROLE_146 = 1 << 146;
424: uint256 internal constant _ROLE_147 = 1 << 147;
425: uint256 internal constant _ROLE_148 = 1 << 148;
426: uint256 internal constant _ROLE_149 = 1 << 149;
427: uint256 internal constant _ROLE_150 = 1 << 150;
428: uint256 internal constant _ROLE_151 = 1 << 151;
429: uint256 internal constant _ROLE_152 = 1 << 152;
430: uint256 internal constant _ROLE_153 = 1 << 153;
431: uint256 internal constant _ROLE_154 = 1 << 154;
432: uint256 internal constant _ROLE_155 = 1 << 155;
433: uint256 internal constant _ROLE_156 = 1 << 156;
434: uint256 internal constant _ROLE_157 = 1 << 157;
435: uint256 internal constant _ROLE_158 = 1 << 158;
436: uint256 internal constant _ROLE_159 = 1 << 159;
437: uint256 internal constant _ROLE_160 = 1 << 160;
438: uint256 internal constant _ROLE_161 = 1 << 161;
439: uint256 internal constant _ROLE_162 = 1 << 162;
440: uint256 internal constant _ROLE_163 = 1 << 163;
441: uint256 internal constant _ROLE_164 = 1 << 164;
442: uint256 internal constant _ROLE_165 = 1 << 165;
443: uint256 internal constant _ROLE_166 = 1 << 166;
444: uint256 internal constant _ROLE_167 = 1 << 167;
445: uint256 internal constant _ROLE_168 = 1 << 168;
446: uint256 internal constant _ROLE_169 = 1 << 169;
447: uint256 internal constant _ROLE_170 = 1 << 170;
448: uint256 internal constant _ROLE_171 = 1 << 171;
449: uint256 internal constant _ROLE_172 = 1 << 172;
450: uint256 internal constant _ROLE_173 = 1 << 173;
451: uint256 internal constant _ROLE_174 = 1 << 174;
452: uint256 internal constant _ROLE_175 = 1 << 175;
453: uint256 internal constant _ROLE_176 = 1 << 176;
454: uint256 internal constant _ROLE_177 = 1 << 177;
455: uint256 internal constant _ROLE_178 = 1 << 178;
456: uint256 internal constant _ROLE_179 = 1 << 179;
457: uint256 internal constant _ROLE_180 = 1 << 180;
458: uint256 internal constant _ROLE_181 = 1 << 181;
459: uint256 internal constant _ROLE_182 = 1 << 182;
460: uint256 internal constant _ROLE_183 = 1 << 183;
461: uint256 internal constant _ROLE_184 = 1 << 184;
462: uint256 internal constant _ROLE_185 = 1 << 185;
463: uint256 internal constant _ROLE_186 = 1 << 186;
464: uint256 internal constant _ROLE_187 = 1 << 187;
465: uint256 internal constant _ROLE_188 = 1 << 188;
466: uint256 internal constant _ROLE_189 = 1 << 189;
467: uint256 internal constant _ROLE_190 = 1 << 190;
468: uint256 internal constant _ROLE_191 = 1 << 191;
469: uint256 internal constant _ROLE_192 = 1 << 192;
470: uint256 internal constant _ROLE_193 = 1 << 193;
471: uint256 internal constant _ROLE_194 = 1 << 194;
472: uint256 internal constant _ROLE_195 = 1 << 195;
473: uint256 internal constant _ROLE_196 = 1 << 196;
474: uint256 internal constant _ROLE_197 = 1 << 197;
475: uint256 internal constant _ROLE_198 = 1 << 198;
476: uint256 internal constant _ROLE_199 = 1 << 199;
477: uint256 internal constant _ROLE_200 = 1 << 200;
478: uint256 internal constant _ROLE_201 = 1 << 201;
479: uint256 internal constant _ROLE_202 = 1 << 202;
480: uint256 internal constant _ROLE_203 = 1 << 203;
481: uint256 internal constant _ROLE_204 = 1 << 204;
482: uint256 internal constant _ROLE_205 = 1 << 205;
483: uint256 internal constant _ROLE_206 = 1 << 206;
484: uint256 internal constant _ROLE_207 = 1 << 207;
485: uint256 internal constant _ROLE_208 = 1 << 208;
486: uint256 internal constant _ROLE_209 = 1 << 209;
487: uint256 internal constant _ROLE_210 = 1 << 210;
488: uint256 internal constant _ROLE_211 = 1 << 211;
489: uint256 internal constant _ROLE_212 = 1 << 212;
490: uint256 internal constant _ROLE_213 = 1 << 213;
491: uint256 internal constant _ROLE_214 = 1 << 214;
492: uint256 internal constant _ROLE_215 = 1 << 215;
493: uint256 internal constant _ROLE_216 = 1 << 216;
494: uint256 internal constant _ROLE_217 = 1 << 217;
495: uint256 internal constant _ROLE_218 = 1 << 218;
496: uint256 internal constant _ROLE_219 = 1 << 219;
497: uint256 internal constant _ROLE_220 = 1 << 220;
498: uint256 internal constant _ROLE_221 = 1 << 221;
499: uint256 internal constant _ROLE_222 = 1 << 222;
500: uint256 internal constant _ROLE_223 = 1 << 223;
501: uint256 internal constant _ROLE_224 = 1 << 224;
502: uint256 internal constant _ROLE_225 = 1 << 225;
503: uint256 internal constant _ROLE_226 = 1 << 226;
504: uint256 internal constant _ROLE_227 = 1 << 227;
505: uint256 internal constant _ROLE_228 = 1 << 228;
506: uint256 internal constant _ROLE_229 = 1 << 229;
507: uint256 internal constant _ROLE_230 = 1 << 230;
508: uint256 internal constant _ROLE_231 = 1 << 231;
509: uint256 internal constant _ROLE_232 = 1 << 232;
510: uint256 internal constant _ROLE_233 = 1 << 233;
511: uint256 internal constant _ROLE_234 = 1 << 234;
512: uint256 internal constant _ROLE_235 = 1 << 235;
513: uint256 internal constant _ROLE_236 = 1 << 236;
514: uint256 internal constant _ROLE_237 = 1 << 237;
515: uint256 internal constant _ROLE_238 = 1 << 238;
516: uint256 internal constant _ROLE_239 = 1 << 239;
517: uint256 internal constant _ROLE_240 = 1 << 240;
518: uint256 internal constant _ROLE_241 = 1 << 241;
519: uint256 internal constant _ROLE_242 = 1 << 242;
520: uint256 internal constant _ROLE_243 = 1 << 243;
521: uint256 internal constant _ROLE_244 = 1 << 244;
522: uint256 internal constant _ROLE_245 = 1 << 245;
523: uint256 internal constant _ROLE_246 = 1 << 246;
524: uint256 internal constant _ROLE_247 = 1 << 247;
525: uint256 internal constant _ROLE_248 = 1 << 248;
526: uint256 internal constant _ROLE_249 = 1 << 249;
527: uint256 internal constant _ROLE_250 = 1 << 250;
528: uint256 internal constant _ROLE_251 = 1 << 251;
529: uint256 internal constant _ROLE_252 = 1 << 252;
530: uint256 internal constant _ROLE_253 = 1 << 253;
531: uint256 internal constant _ROLE_254 = 1 << 254;
532: uint256 internal constant _ROLE_255 = 1 << 255;
File:solady-main/src/auth/Ownable.sol
60: uint256 private constant _OWNER_SLOT_NOT = 0x8b78c6d8;
68: uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;
File:solady-main/src/Milady.sol
75: address internal constant CONTRACT = 0x5Af0D9827E0c53E4799BB226655A1de152A425a5;
File:solady-main/src/utils/CREATE3.sol
48: uint256 private constant _PROXY_BYTECODE = 0x67363d3d37363d34f03d5260086018f3;
File:solady-main/src/utils/DateTimeLib.sol
49: uint256 internal constant OCT = 10;
50: uint256 internal constant NOV = 11;
51: uint256 internal constant DEC = 12;
56: uint256 internal constant MAX_SUPPORTED_YEAR = 0xffffffff;
57: uint256 internal constant MAX_SUPPORTED_EPOCH_DAY = 0x16d3e098039;
58: uint256 internal constant MAX_SUPPORTED_TIMESTAMP = 0x1e18549868c76ff;
File:solady-main/src/utils/ERC1967FactoryConstants.sol
24: address internal constant ADDRESS = 0x0000000000006396FF2a80c067f99B3d2Ab4Df24;
File:solady-main/src/utils/ERC1967Factory.sol
25: uint256 internal constant _UNAUTHORIZED_ERROR_SELECTOR = 0x82b42900;
28: uint256 internal constant _DEPLOYMENT_FAILED_ERROR_SELECTOR = 0x30116425;
31: uint256 internal constant _UPGRADE_FAILED_ERROR_SELECTOR = 0x55299b49;
34: uint256 internal constant _SALT_DOES_NOT_START_WITH_CALLER_ERROR_SELECTOR = 0x2f634836;
File:solady-main/src/utils/FixedPointMathLib.sol
47: uint256 internal constant WAD = 1e18;
File:solady-main/src/utils/RedBlackTreeLib.sol
30: uint256 internal constant ERROR_VALUE_ALREADY_EXISTS = 0xbb33e6ac;
33: uint256 internal constant ERROR_VALUE_DOES_NOT_EXISTS = 0xb113638a;
36: uint256 internal constant ERROR_POINTER_OUT_OF_BOUNDS = 0xccd52fbc;
39: uint256 internal constant ERROR_TREE_IS_FULL = 0xed732d0c;
71: uint256 private constant _NODES_SLOT_SEED = 0x1dc27bb5462fdadcb;
72: uint256 private constant _NODES_SLOT_SHIFT = 32;
75: uint256 private constant _BITPOS_RIGHT = 31;
76: uint256 private constant _BITPOS_PARENT = 31 * 2;
77: uint256 private constant _BITPOS_RED = 31 * 3;
78: uint256 private constant _BITMASK_RED = 1 << (31 * 3);
79: uint256 private constant _BITPOS_PACKED_VALUE = 96;
81: uint256 private constant _BIT_FULL_VALUE_SLOT = 1 << 31;
File:solady-main/src/utils/SafeTransferLib.sol
31: uint256 internal constant _GAS_STIPEND_NO_STORAGE_WRITES = 2300;
36: uint256 internal constant _GAS_STIPEND_NO_GRIEF = 100000;
Instances (296)
While the compiler knows to optimize away the exponentiation, it's still better coding practice to use idioms that do not require compiler optimization, if they exist
File:solady-main/src/tokens/ERC4626.sol
178: return FixedPointMathLib.fullMulDiv(assets, totalSupply() + 10 ** o, _inc(totalAssets()));
203: return FixedPointMathLib.fullMulDiv(shares, totalAssets() + 1, totalSupply() + 10 ** o);
249: return FixedPointMathLib.fullMulDivUp(shares, totalAssets() + 1, totalSupply() + 10 ** o);
277: return FixedPointMathLib.fullMulDivUp(assets, totalSupply() + 10 ** o, _inc(totalAssets()));
Instances (4)
Issue | Instances | |
---|---|---|
GAS-1 | Functions guaranteed to revert when called by normal users can be marked payable | 5 |
GAS-2 | >= costs less gas than > |
16 |
GAS-3 | ++i costs less gas than i++ , especially when it's used in for -loops (--i /i-- too) |
1 |
GAS-4 | x += y/x -= y costs more gas than x = x + y/x = x - y for state variables | 5 |
GAS-5 | Usage of uints/ints smaller than 32 bytes (256 bits) incurs overhead | 66 |
GAS-6 | Don't initialize variables with default value | 2 |
GAS-7 | 10 ** 18, can be changed to 1e18 and save some gas | 4 |
GAS-8 | Inverting the condition of an if-else-statement wastes gas | 4 |
GAS-9 | ++i /i++ should be unchecked{++i} /unchecked{i++} when it is not possible for them to overflow, as is the case when used in for - and while -loops |
1 |
GAS-10 | Using storage instead of memory for structs/arrays saves gas | 4 |
GAS-11 | Use constants instead of type(uintx).max | 4 |
GAS-12 | Use != 0 instead of > 0 for unsigned integer comparison |
1 |
GAS-13 | Use shift Right/Left instead of division/multiplication if possible | 63 |
If a function modifier such as onlyOwner
is used, the function will revert if a normal user tries to pay the function. Marking the function as payable will lower the gas cost for legitimate callers because the compiler will not include checks for whether a payment was provided.
File:solady-main/src/auth/OwnableRoles.sol
148: function grantRoles(address user, uint256 roles) public payable virtual onlyOwner {
154: function revokeRoles(address user, uint256 roles) public payable virtual onlyOwner {
File:solady-main/src/auth/Ownable.sol
124: function transferOwnership(address newOwner) public payable virtual onlyOwner {
136: function renounceOwnership() public payable virtual onlyOwner {
172: function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {
Instances (5)
File:solady-main/src/tokens/ERC4626.sol
374: if (assets > maxDeposit(to)) _revert(0xb3c61a83); // `DepositMoreThanMax()`.
391: if (shares > maxMint(to)) _revert(0x6a695959); // `MintMoreThanMax()`.
411: if (assets > maxWithdraw(owner)) _revert(0x936941fc); // `WithdrawMoreThanMax()`.
431: if (shares > maxRedeem(owner)) _revert(0x4656425a); // `RedeemMoreThanMax()`.
File:solady-main/src/utils/DateTimeLib.sol
247: result = epochDay < MAX_SUPPORTED_EPOCH_DAY + 1;
254: result = timestamp < MAX_SUPPORTED_TIMESTAMP + 1;
290: result = weekday(timestamp) > FRI;
File:solady-main/src/utils/LibBitmap.sol
156: if (!(amount + shift < 257)) {
196: setBitIndex = (bucket << 8) | LibBit.fls(bucketBits);
File:solady-main/src/utils/RedBlackTreeLib.sol
113: bytes32 b = x < aValue ? prev(a) : next(a);
116: uint256 aDist = x < aValue ? aValue - x : x - aValue;
117: uint256 bDist = x < bValue ? bValue - x : x - bValue;
118: if (aDist == bDist) return aValue < bValue ? a : b; // Tie-breaker.
119: return aDist < bDist ? a : b;
130: return value(a) < x ? a : prev(a);
140: return value(a) > x ? a : next(a);
Instances (16)
Saves 5 gas per loop
File:solady-main/src/utils/LibBitmap.sol
161: for (++bucket; bucket != bucketEnd; ++bucket) {
Instances (1)
File:solady-main/src/utils/FixedPointMathLib.sol
274: r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k;
276: r += 600920179829731861736702779321621459595472258049074101567377883020018308;
File:solady-main/src/utils/LibBitmap.sol
45: bitmap.map[index >> 8] |= (1 << (index & 0xff));
162: count += LibBit.popCount(bitmap.map[bucket]);
165: count += LibBit.popCount((bitmap.map[bucket] >> shift) << (256 - amount));
Instances (5)
When using elements that are smaller than 32 bytes, your contracts gas usage may be higher. This is because the EVM operates on 32 bytes at a time. Therefore, if the element is smaller than that, the EVM must use more operations in order to reduce the size of the element from 32 bytes to the desired size. https://docs.soliditylang.org/en/v0.8.11/internals/layout_in_storage.html
File:solady-main/src/tokens/ERC20.sol
100: function decimals() public view virtual returns (uint8) {
332: uint8 v,
File:solady-main/src/tokens/ERC721.sol
403: function _getExtraData(uint256 id) internal view virtual returns (uint96 result) {
415: function _setExtraData(uint256 id, uint96 value) internal virtual {
File:solady-main/src/tokens/ERC4626.sol
18: uint8 internal constant _DEFAULT_UNDERLYING_DECIMALS = 18;
21: uint8 internal constant _DEFAULT_DECIMALS_OFFSET = 0;
77: function _underlyingDecimals() internal view virtual returns (uint8) {
86: function _decimalsOffset() internal view virtual returns (uint8) {
103: function decimals() public view virtual override(ERC20) returns (uint8) {
125: returns (bool success, uint8 result)
File:solady-main/src/auth/OwnableRoles.sol
208: function rolesFromOrdinals(uint8[] memory ordinals) public pure returns (uint256 roles) {
222: function ordinalsFromRoles(uint256 roles) public pure returns (uint8[] memory ordinals) {
File:solady-main/src/auth/Ownable.sol
220: function ownershipHandoverValidFor() public view virtual returns (uint64) {
File:solady-main/src/utils/Clone.sol
177: function _getArgUint168(uint256 argOffset) internal pure returns (uint168 arg) {
186: function _getArgUint160(uint256 argOffset) internal pure returns (uint160 arg) {
222: function _getArgUint128(uint256 argOffset) internal pure returns (uint128 arg) {
258: function _getArgUint96(uint256 argOffset) internal pure returns (uint96 arg) {
267: function _getArgUint88(uint256 argOffset) internal pure returns (uint88 arg) {
276: function _getArgUint80(uint256 argOffset) internal pure returns (uint80 arg) {
294: function _getArgUint64(uint256 argOffset) internal pure returns (uint64 arg) {
330: function _getArgUint32(uint256 argOffset) internal pure returns (uint32 arg) {
348: function _getArgUint16(uint256 argOffset) internal pure returns (uint16 arg) {
357: function _getArgUint8(uint256 argOffset) internal pure returns (uint8 arg) {
File:solady-main/src/utils/ECDSA.sol
144: uint8 v;
156: function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s)
313: uint8 v;
325: function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s)
File:solady-main/src/utils/LibMap.sol
46: function get(Uint8Map storage map, uint256 index) internal view returns (uint8 result) {
56: function set(Uint8Map storage map, uint256 index, uint8 value) internal {
69: function get(Uint16Map storage map, uint256 index) internal view returns (uint16 result) {
70: result = uint16(map.map[index >> 4] >> ((index & 15) << 4));
74: function set(Uint16Map storage map, uint256 index, uint16 value) internal {
88: function get(Uint32Map storage map, uint256 index) internal view returns (uint32 result) {
89: result = uint32(map.map[index >> 3] >> ((index & 7) << 5));
93: function set(Uint32Map storage map, uint256 index, uint32 value) internal {
128: function get(Uint64Map storage map, uint256 index) internal view returns (uint64 result) {
129: result = uint64(map.map[index >> 2] >> ((index & 3) << 6));
133: function set(Uint64Map storage map, uint256 index, uint64 value) internal {
147: function get(Uint128Map storage map, uint256 index) internal view returns (uint128 result) {
148: result = uint128(map.map[index >> 1] >> ((index & 1) << 7));
152: function set(Uint128Map storage map, uint256 index, uint128 value) internal {
File:solady-main/src/utils/LibSort.sol
292: (found, index) = _searchSorted(_toUints(a), uint256(uint160(needle)), 0);
File:solady-main/src/utils/SafeCastLib.sol
18: function toUint8(uint256 x) internal pure returns (uint8) {
20: return uint8(x);
23: function toUint16(uint256 x) internal pure returns (uint16) {
25: return uint16(x);
33: function toUint32(uint256 x) internal pure returns (uint32) {
35: return uint32(x);
53: function toUint64(uint256 x) internal pure returns (uint64) {
55: return uint64(x);
63: function toUint80(uint256 x) internal pure returns (uint80) {
65: return uint80(x);
68: function toUint88(uint256 x) internal pure returns (uint88) {
70: return uint88(x);
73: function toUint96(uint256 x) internal pure returns (uint96) {
75: return uint96(x);
93: function toUint128(uint256 x) internal pure returns (uint128) {
95: return uint128(x);
113: function toUint160(uint256 x) internal pure returns (uint160) {
115: return uint160(x);
118: function toUint168(uint256 x) internal pure returns (uint168) {
120: return uint168(x);
File:solady-main/src/utils/SignatureCheckerLib.sol
198: uint8 v;
211: function isValidSignatureNow(address signer, bytes32 hash, uint8 v, bytes32 r, bytes32 s)
397: uint8 v;
409: function isValidERC1271SignatureNow(address signer, bytes32 hash, uint8 v, bytes32 r, bytes32 s)
Instances (66)
File:solady-main/src/tokens/ERC4626.sol
21: uint8 internal constant _DEFAULT_DECIMALS_OFFSET = 0;
File:solady-main/src/utils/RedBlackTreeLib.sol
74: uint256 private constant _BITPOS_LEFT = 0;
Instances (2)
10 ** 18 can be changed to 1e18 to avoid unnecessary arithmetic operation and save gas.
File:solady-main/src/tokens/ERC4626.sol
178: return FixedPointMathLib.fullMulDiv(assets, totalSupply() + 10 ** o, _inc(totalAssets()));
203: return FixedPointMathLib.fullMulDiv(shares, totalAssets() + 1, totalSupply() + 10 ** o);
249: return FixedPointMathLib.fullMulDivUp(shares, totalAssets() + 1, totalSupply() + 10 ** o);
277: return FixedPointMathLib.fullMulDivUp(assets, totalSupply() + 10 ** o, _inc(totalAssets()));
Instances (4)
Flipping the true
and false
blocks instead saves 3 gas
File:solady-main/src/utils/RedBlackTreeLib.sol
113: bytes32 b = x < aValue ? prev(a) : next(a);
116: uint256 aDist = x < aValue ? aValue - x : x - aValue;
117: uint256 bDist = x < bValue ? bValue - x : x - bValue;
118: if (aDist == bDist) return aValue < bValue ? a : b; // Tie-breaker.
Instances (4)
[GAS-9] ++i
/i++
should be unchecked{++i}
/unchecked{i++}
when it is not possible for them to overflow, as is the case when used in for
- and while
-loops
The unchecked
keyword is new in solidity version 0.8.0, so this only applies to that version or higher, which these instances are. This saves 30-40 gas per loop
File:solady-main/src/utils/LibBitmap.sol
161: for (++bucket; bucket != bucketEnd; ++bucket) {
Instances (1)
When fetching data from a storage location, assigning the data to a memory variable causes all fields of the struct/array to be read from storage, which incurs a Gcoldsload (2100 gas) for each field of the struct/array. If the fields are read from the new memory variable, they incur an additional MLOAD rather than a cheap stack read. Instead of declearing the variable with the memory keyword, declaring the variable with the storage keyword and caching any fields that need to be re-read in stack variables, will be much cheaper, only incuring the Gcoldsload for the fields actually read. The only time it makes sense to read the whole struct/array into a memory variable, is if the full struct/array is being returned by the function, is being passed to a function that requires memory, or if the array/struct is being read from another memory array/struct
File:solady-main/src/utils/EIP712.sol
41: (string memory name, string memory version) = _domainNameAndVersion();
File:solady-main/src/utils/ERC1967Factory.sol
221: bytes memory m = _initCode();
279: bytes memory m = _initCode();
File:solady-main/src/utils/LibString.sol
762: uint256[] memory indices = indicesOf(subject, delimiter);
Instances (4)
it uses more gas in the distribution process and also for each transaction than constant usage.
File:solady-main/src/tokens/ERC4626.sol
325: maxAssets = type(uint256).max;
336: maxShares = type(uint256).max;
File:solady-main/src/utils/LibBitmap.sol
16: uint256 internal constant NOT_FOUND = type(uint256).max;
File:solady-main/src/utils/LibString.sol
20: uint256 internal constant NOT_FOUND = type(uint256).max;
Instances (4)
File:solady-main/src/utils/LibString.sol
224: let t := shl(240, 136) // `0b10001000 << 240`
Instances (1)
File:solady-main/src/tokens/ERC4626.sol
314: /* DEPOSIT / WITHDRAWAL LIMIT LOGIC */
359: /* DEPOSIT / WITHDRAWAL LOGIC */
File:solady-main/src/auth/Ownable.sol
221: return 48 * 3600;
File:solady-main/src/utils/DateTimeLib.sol
114: result = dateToEpochDay(year, month, day) * 86400;
126: (year, month, day) = epochDayToDate(timestamp / 86400);
142: result = dateToEpochDay(year, month, day) * 86400 + hour * 3600 + minute * 60 + second;
163: (year, month, day) = epochDayToDate(timestamp / 86400);
165: hour = secs / 3600;
167: minute = secs / 60;
196: result = ((timestamp / 86400 + 3) % 7) + 1;
305: (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400);
319: (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400);
321: result = _offsetted(year + month / 12, _add(month % 12, 1), day, timestamp);
326: result = timestamp + numDays * 86400;
331: result = timestamp + numHours * 3600;
340: result = timestamp + numMinutes * 60;
360: (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400);
374: (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400);
376: result = _offsetted(yearMonth / 12, _add(yearMonth % 12, 1), day, timestamp);
381: result = timestamp - numDays * 86400;
386: result = timestamp - numHours * 3600;
395: result = timestamp - numMinutes * 60;
418: (uint256 fromYear,,) = epochDayToDate(fromTimestamp / 86400);
419: (uint256 toYear,,) = epochDayToDate(toTimestamp / 86400);
434: (uint256 fromYear, uint256 fromMonth,) = epochDayToDate(fromTimestamp / 86400);
435: (uint256 toYear, uint256 toMonth,) = epochDayToDate(toTimestamp / 86400);
445: result = (toTimestamp - fromTimestamp) / 86400;
454: result = (toTimestamp - fromTimestamp) / 3600;
463: result = (toTimestamp - fromTimestamp) / 60;
486: total = numYears * 12 + numMonths;
514: result = dateToEpochDay(year, month, day) * 86400 + (timestamp % 86400);
File:solady-main/src/utils/FixedPointMathLib.sol
117: return expWad((lnWad(x) * y) / int256(WAD));
142: x = (x << 78) / 5 ** 18;
147: int256 k = ((x << 96) / 54916777467707473351141471128 + 2 ** 95) >> 96;
148: x = x - k * 54916777467707473351141471128;
155: y = ((y * x) >> 96) + 57155421227552351082224309758442;
157: p = ((p * y) >> 96) + 28719021644029726153956944680412240;
158: p = p * x + (4385272521454847904659076985693276 << 96);
162: q = ((q * x) >> 96) + 50020603652535783019961831881945;
163: q = ((q * x) >> 96) - 533845033583426703283633433725380;
164: q = ((q * x) >> 96) + 3604857256930695427073651918091429;
165: q = ((q * x) >> 96) - 14423608567350463180887372962807573;
166: q = ((q * x) >> 96) + 26449188498355588339934803723976023;
185: (uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k)
239: p = ((p * x) >> 96) + 24828157081833163892658089445524;
240: p = ((p * x) >> 96) + 43456485725739037958740375743393;
241: p = ((p * x) >> 96) - 11111509109440967052023855526967;
242: p = ((p * x) >> 96) - 45023709667254063763336534515857;
243: p = ((p * x) >> 96) - 14706773417378608786704636184526;
244: p = p * x - (795164235651350426258249787498 << 96);
249: q = ((q * x) >> 96) + 71694874799317883764090561454958;
250: q = ((q * x) >> 96) + 283447036172924575727196451306956;
251: q = ((q * x) >> 96) + 401686690394027663651624208769553;
252: q = ((q * x) >> 96) + 204048457590392012362485061816622;
253: q = ((q * x) >> 96) + 31853899698501571402653359427138;
254: q = ((q * x) >> 96) + 909429971244387300277376558375;
274: r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k;
713: z = x * y;
720: z = x * y;
File:solady-main/src/utils/LibMap.sol
109: result = uint40(map.map[index / 6] >> ((index % 6) * 40));
File:solady-main/src/utils/RedBlackTreeLib.sol
76: uint256 private constant _BITPOS_PARENT = 31 * 2;
77: uint256 private constant _BITPOS_RED = 31 * 3;
78: uint256 private constant _BITMASK_RED = 1 << (31 * 3);
Instances (63)