@1inch/solidity-utils 2.2.5 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity ^0.8.0;
|
|
4
|
+
pragma abicoder v1;
|
|
5
|
+
|
|
6
|
+
type Address is uint256;
|
|
7
|
+
|
|
8
|
+
library AddressLib {
|
|
9
|
+
function get(Address a) internal pure returns (address) {
|
|
10
|
+
return address(uint160(Address.unwrap(a)));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function getFlag(Address a, uint256 flag) internal pure returns (bool) {
|
|
14
|
+
return (Address.unwrap(a) & flag) != 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getUint32(Address a, uint256 offset) internal pure returns (uint32) {
|
|
18
|
+
return uint32(Address.unwrap(a) >> offset);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function getUint64(Address a, uint256 offset) internal pure returns (uint64) {
|
|
22
|
+
return uint64(Address.unwrap(a) >> offset);
|
|
23
|
+
}
|
|
24
|
+
}
|