@etherisc/gif-next 0.0.2-f9905e1 → 0.0.2-fe77319
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/InstanceLinked.dbg.json +1 -1
- package/artifacts/contracts/components/IPool.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProduct.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/experiment/A.sol/A.dbg.json +4 -0
- package/artifacts/contracts/experiment/{inheritance/A.sol → A.sol}/A.json +5 -5
- package/artifacts/contracts/experiment/A.sol/AShared.dbg.json +4 -0
- package/artifacts/contracts/experiment/{inheritance/A.sol → A.sol}/AShared.json +3 -3
- package/artifacts/contracts/experiment/B.sol/B.dbg.json +4 -0
- package/artifacts/contracts/experiment/{inheritance/B.sol → B.sol}/B.json +2 -2
- package/artifacts/contracts/experiment/C.sol/C.dbg.json +4 -0
- package/artifacts/contracts/experiment/{inheritance/C.sol → C.sol}/C.json +2 -2
- package/artifacts/contracts/experiment/IA.sol/IA.dbg.json +4 -0
- package/artifacts/contracts/experiment/{inheritance/IA.sol → IA.sol}/IA.json +1 -1
- package/artifacts/contracts/experiment/IA.sol/ISharedA.dbg.json +4 -0
- package/artifacts/contracts/experiment/{inheritance/IA.sol → IA.sol}/ISharedA.json +1 -1
- package/artifacts/contracts/experiment/IB.sol/IB.dbg.json +4 -0
- package/artifacts/contracts/experiment/{inheritance/IB.sol → IB.sol}/IB.json +1 -1
- package/artifacts/contracts/experiment/IC.sol/IC.dbg.json +4 -0
- package/artifacts/contracts/experiment/{inheritance/IC.sol → IC.sol}/IC.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/access/Access.sol/AccessModule.dbg.json +1 -1
- package/artifacts/contracts/instance/access/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessCheckRole.dbg.json +1 -1
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.dbg.json +1 -1
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessModule.dbg.json +1 -1
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentModule.dbg.json +1 -1
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/component/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentContract.dbg.json +1 -1
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.dbg.json +1 -1
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/component/IComponent.sol/IInstanceLinked.dbg.json +1 -1
- package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicyModule.dbg.json +1 -1
- package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.dbg.json +1 -1
- package/artifacts/contracts/instance/pool/IPoolModule.sol/IPool.dbg.json +1 -1
- package/artifacts/contracts/instance/pool/IPoolModule.sol/IPoolModule.dbg.json +1 -1
- package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.dbg.json +1 -1
- package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.dbg.json +1 -1
- package/artifacts/contracts/instance/product/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.dbg.json +1 -1
- package/artifacts/contracts/instance/product/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IOwnable.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/RegistryLinked.dbg.json +1 -1
- package/contracts/experiment/{inheritance/B.sol → B.sol} +1 -1
- package/contracts/experiment/{inheritance/C.sol → C.sol} +1 -1
- package/package.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +0 -4
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +0 -4
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.json +0 -10
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +0 -4
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.json +0 -10
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.json +0 -10
- package/contracts/experiment/types/TypeA.sol +0 -42
- package/contracts/experiment/types/TypeB.sol +0 -24
- package/contracts/types/ChainId.sol +0 -24
- /package/contracts/experiment/{inheritance/A.sol → A.sol} +0 -0
- /package/contracts/experiment/{inheritance/IA.sol → IA.sol} +0 -0
- /package/contracts/experiment/{inheritance/IB.sol → IB.sol} +0 -0
- /package/contracts/experiment/{inheritance/IC.sol → IC.sol} +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"_format": "hh-sol-artifact-1",
|
3
3
|
"contractName": "A",
|
4
|
-
"sourceName": "contracts/experiment/
|
4
|
+
"sourceName": "contracts/experiment/A.sol",
|
5
5
|
"abi": [
|
6
6
|
{
|
7
7
|
"inputs": [],
|
@@ -98,7 +98,7 @@
|
|
98
98
|
"inputs": [
|
99
99
|
{
|
100
100
|
"internalType": "uint256",
|
101
|
-
"name": "
|
101
|
+
"name": "newA",
|
102
102
|
"type": "uint256"
|
103
103
|
}
|
104
104
|
],
|
@@ -111,7 +111,7 @@
|
|
111
111
|
"inputs": [
|
112
112
|
{
|
113
113
|
"internalType": "uint256",
|
114
|
-
"name": "
|
114
|
+
"name": "newA",
|
115
115
|
"type": "uint256"
|
116
116
|
}
|
117
117
|
],
|
@@ -121,8 +121,8 @@
|
|
121
121
|
"type": "function"
|
122
122
|
}
|
123
123
|
],
|
124
|
-
"bytecode": "
|
125
|
-
"deployedBytecode": "
|
124
|
+
"bytecode": "0x608060405234801561001057600080fd5b50602a600081905550600180819055506002808190555061044c806100366000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063d46300fd11610066578063d46300fd1461010e578063d4febc861461012c578063e2c11f201461014a578063ee919d5014610168578063eeb4914e1461018457610093565b806309cdcf9b14610098578063a1c51915146100b4578063a2375d1e146100d2578063b9c23ae9146100f0575b600080fd5b6100b260048036038101906100ad919061037d565b6101a0565b005b6100bc6101aa565b6040516100c991906103b9565b60405180910390f35b6100da6101b4565b6040516100e791906103b9565b60405180910390f35b6100f86101be565b60405161010591906103b9565b60405180910390f35b610116610239565b60405161012391906103b9565b60405180910390f35b610134610242565b60405161014191906103b9565b60405180910390f35b6101526102b8565b60405161015f91906103b9565b60405180910390f35b610182600480360381019061017d919061037d565b61032e565b005b61019e6004803603810190610199919061037d565b610338565b005b8060018190555050565b6000600154905090565b6000600254905090565b6000803090508073ffffffffffffffffffffffffffffffffffffffff1663a1c519156040518163ffffffff1660e01b8152600401602060405180830381865afa15801561020f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023391906103e9565b91505090565b60008054905090565b60003073ffffffffffffffffffffffffffffffffffffffff1663d46300fd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561028f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b391906103e9565b905090565b60003073ffffffffffffffffffffffffffffffffffffffff1663d46300fd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610305573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032991906103e9565b905090565b8060008190555050565b8060028190555050565b600080fd5b6000819050919050565b61035a81610347565b811461036557600080fd5b50565b60008135905061037781610351565b92915050565b60006020828403121561039357610392610342565b5b60006103a184828501610368565b91505092915050565b6103b381610347565b82525050565b60006020820190506103ce60008301846103aa565b92915050565b6000815190506103e381610351565b92915050565b6000602082840312156103ff576103fe610342565b5b600061040d848285016103d4565b9150509291505056fea26469706673582212202d931bc33f86e9a5286a0a8ad07e1a8664ee116f92363c21d53c6e11073a5a2a64736f6c63430008140033",
|
125
|
+
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063d46300fd11610066578063d46300fd1461010e578063d4febc861461012c578063e2c11f201461014a578063ee919d5014610168578063eeb4914e1461018457610093565b806309cdcf9b14610098578063a1c51915146100b4578063a2375d1e146100d2578063b9c23ae9146100f0575b600080fd5b6100b260048036038101906100ad919061037d565b6101a0565b005b6100bc6101aa565b6040516100c991906103b9565b60405180910390f35b6100da6101b4565b6040516100e791906103b9565b60405180910390f35b6100f86101be565b60405161010591906103b9565b60405180910390f35b610116610239565b60405161012391906103b9565b60405180910390f35b610134610242565b60405161014191906103b9565b60405180910390f35b6101526102b8565b60405161015f91906103b9565b60405180910390f35b610182600480360381019061017d919061037d565b61032e565b005b61019e6004803603810190610199919061037d565b610338565b005b8060018190555050565b6000600154905090565b6000600254905090565b6000803090508073ffffffffffffffffffffffffffffffffffffffff1663a1c519156040518163ffffffff1660e01b8152600401602060405180830381865afa15801561020f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023391906103e9565b91505090565b60008054905090565b60003073ffffffffffffffffffffffffffffffffffffffff1663d46300fd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561028f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b391906103e9565b905090565b60003073ffffffffffffffffffffffffffffffffffffffff1663d46300fd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610305573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032991906103e9565b905090565b8060008190555050565b8060028190555050565b600080fd5b6000819050919050565b61035a81610347565b811461036557600080fd5b50565b60008135905061037781610351565b92915050565b60006020828403121561039357610392610342565b5b60006103a184828501610368565b91505092915050565b6103b381610347565b82525050565b60006020820190506103ce60008301846103aa565b92915050565b6000815190506103e381610351565b92915050565b6000602082840312156103ff576103fe610342565b5b600061040d848285016103d4565b9150509291505056fea26469706673582212202d931bc33f86e9a5286a0a8ad07e1a8664ee116f92363c21d53c6e11073a5a2a64736f6c63430008140033",
|
126
126
|
"linkReferences": {},
|
127
127
|
"deployedLinkReferences": {}
|
128
128
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"_format": "hh-sol-artifact-1",
|
3
3
|
"contractName": "AShared",
|
4
|
-
"sourceName": "contracts/experiment/
|
4
|
+
"sourceName": "contracts/experiment/A.sol",
|
5
5
|
"abi": [
|
6
6
|
{
|
7
7
|
"inputs": [],
|
@@ -35,8 +35,8 @@
|
|
35
35
|
"type": "function"
|
36
36
|
}
|
37
37
|
],
|
38
|
-
"bytecode": "
|
39
|
-
"deployedBytecode": "
|
38
|
+
"bytecode": "0x608060405234801561001057600080fd5b50602a600081905550610150806100286000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063d46300fd1461003b578063ee919d5014610059575b600080fd5b610043610075565b60405161005091906100a1565b60405180910390f35b610073600480360381019061006e91906100ed565b61007e565b005b60008054905090565b8060008190555050565b6000819050919050565b61009b81610088565b82525050565b60006020820190506100b66000830184610092565b92915050565b600080fd5b6100ca81610088565b81146100d557600080fd5b50565b6000813590506100e7816100c1565b92915050565b600060208284031215610103576101026100bc565b5b6000610111848285016100d8565b9150509291505056fea2646970667358221220826c344856745ae98ad9c154b4a8bee55e55fc3323c8fba296136a694c2448a664736f6c63430008140033",
|
39
|
+
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063d46300fd1461003b578063ee919d5014610059575b600080fd5b610043610075565b60405161005091906100a1565b60405180910390f35b610073600480360381019061006e91906100ed565b61007e565b005b60008054905090565b8060008190555050565b6000819050919050565b61009b81610088565b82525050565b60006020820190506100b66000830184610092565b92915050565b600080fd5b6100ca81610088565b81146100d557600080fd5b50565b6000813590506100e7816100c1565b92915050565b600060208284031215610103576101026100bc565b5b6000610111848285016100d8565b9150509291505056fea2646970667358221220826c344856745ae98ad9c154b4a8bee55e55fc3323c8fba296136a694c2448a664736f6c63430008140033",
|
40
40
|
"linkReferences": {},
|
41
41
|
"deployedLinkReferences": {}
|
42
42
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"_format": "hh-sol-artifact-1",
|
3
3
|
"contractName": "B",
|
4
|
-
"sourceName": "contracts/experiment/
|
4
|
+
"sourceName": "contracts/experiment/B.sol",
|
5
5
|
"abi": [
|
6
6
|
{
|
7
7
|
"inputs": [],
|
@@ -59,7 +59,7 @@
|
|
59
59
|
"inputs": [
|
60
60
|
{
|
61
61
|
"internalType": "uint256",
|
62
|
-
"name": "
|
62
|
+
"name": "newA",
|
63
63
|
"type": "uint256"
|
64
64
|
}
|
65
65
|
],
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"_format": "hh-sol-artifact-1",
|
3
3
|
"contractName": "C",
|
4
|
-
"sourceName": "contracts/experiment/
|
4
|
+
"sourceName": "contracts/experiment/C.sol",
|
5
5
|
"abi": [
|
6
6
|
{
|
7
7
|
"inputs": [],
|
@@ -72,7 +72,7 @@
|
|
72
72
|
"inputs": [
|
73
73
|
{
|
74
74
|
"internalType": "uint256",
|
75
|
-
"name": "
|
75
|
+
"name": "newA",
|
76
76
|
"type": "uint256"
|
77
77
|
}
|
78
78
|
],
|
@@ -15,7 +15,7 @@ abstract contract B is ISharedA, IB {
|
|
15
15
|
|
16
16
|
// access own state
|
17
17
|
function getB() external view override returns(uint256) { return _x; }
|
18
|
-
function setB(uint256
|
18
|
+
function setB(uint256 newA) external override { _x = newA; }
|
19
19
|
|
20
20
|
// access state from parent contract A
|
21
21
|
function getAfromB() external view override returns(uint256) { return this.getA(); }
|
@@ -15,7 +15,7 @@ abstract contract C is ISharedA, IC {
|
|
15
15
|
|
16
16
|
// access own state
|
17
17
|
function getC() external view override returns(uint256) { return _x; }
|
18
|
-
function setC(uint256
|
18
|
+
function setC(uint256 newA) external override { _x = newA; }
|
19
19
|
|
20
20
|
// access state from parent contract A
|
21
21
|
function getAfromC() external view override returns(uint256) { return this.getA(); }
|
package/package.json
CHANGED
@@ -1,10 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"_format": "hh-sol-artifact-1",
|
3
|
-
"contractName": "TypeALib",
|
4
|
-
"sourceName": "contracts/experiment/types/TypeA.sol",
|
5
|
-
"abi": [],
|
6
|
-
"bytecode": "0x60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220631fcbb9cdf05c22d0340bcc90e8220e3513b6efe9d2460153613f0ee92bc95b64736f6c63430008140033",
|
7
|
-
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220631fcbb9cdf05c22d0340bcc90e8220e3513b6efe9d2460153613f0ee92bc95b64736f6c63430008140033",
|
8
|
-
"linkReferences": {},
|
9
|
-
"deployedLinkReferences": {}
|
10
|
-
}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"_format": "hh-sol-artifact-1",
|
3
|
-
"contractName": "TypeBLib",
|
4
|
-
"sourceName": "contracts/experiment/types/TypeB.sol",
|
5
|
-
"abi": [],
|
6
|
-
"bytecode": "0x60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ba12bbf5b38107a97ab834773cb7cc766833169e48de20a43a90102809418e7964736f6c63430008140033",
|
7
|
-
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ba12bbf5b38107a97ab834773cb7cc766833169e48de20a43a90102809418e7964736f6c63430008140033",
|
8
|
-
"linkReferences": {},
|
9
|
-
"deployedLinkReferences": {}
|
10
|
-
}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"_format": "hh-sol-artifact-1",
|
3
|
-
"contractName": "ChainIdLib",
|
4
|
-
"sourceName": "contracts/types/ChainId.sol",
|
5
|
-
"abi": [],
|
6
|
-
"bytecode": "0x60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220834afee6f90bd20143d82475fe6713238237b9c6714c9ef8e26d210a9190099a64736f6c63430008140033",
|
7
|
-
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220834afee6f90bd20143d82475fe6713238237b9c6714c9ef8e26d210a9190099a64736f6c63430008140033",
|
8
|
-
"linkReferences": {},
|
9
|
-
"deployedLinkReferences": {}
|
10
|
-
}
|
@@ -1,42 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.19;
|
3
|
-
|
4
|
-
/*
|
5
|
-
# chisel session for user defined types
|
6
|
-
|
7
|
-
import {TypeA, toTypeA} from "./contracts/experiment/types/TypeA.sol";
|
8
|
-
TypeA a = toTypeA(1);
|
9
|
-
TypeA b = toTypeA(2);
|
10
|
-
uint(a.toInt())
|
11
|
-
uint(b.toInt())
|
12
|
-
a == b
|
13
|
-
a != b
|
14
|
-
|
15
|
-
import {TypeB, toTypeB} from "./contracts/experiment/types/TypeB.sol";
|
16
|
-
TypeB x = toTypeB(33);
|
17
|
-
uint(x.toInt())
|
18
|
-
a == x; // -> error
|
19
|
-
a.toInt() == x.toInt() // -> no error
|
20
|
-
*/
|
21
|
-
|
22
|
-
// bytes5 allows for chain ids up to 13 digits
|
23
|
-
type TypeA is uint248;
|
24
|
-
|
25
|
-
// type bindings
|
26
|
-
using {
|
27
|
-
eqTypeA as ==,
|
28
|
-
neTypeA as !=,
|
29
|
-
TypeALib.toInt
|
30
|
-
} for TypeA global;
|
31
|
-
|
32
|
-
// general pure free functions
|
33
|
-
function toTypeA(uint256 typeA) pure returns(TypeA) { return TypeA.wrap(uint248(typeA)); }
|
34
|
-
|
35
|
-
// pure free functions for operators
|
36
|
-
function eqTypeA(TypeA a, TypeA b) pure returns(bool isSame) { return TypeA.unwrap(a) == TypeA.unwrap(b); }
|
37
|
-
function neTypeA(TypeA a, TypeA b) pure returns(bool isDifferent) { return TypeA.unwrap(a) != TypeA.unwrap(b); }
|
38
|
-
|
39
|
-
// library functions that operate on user defined type
|
40
|
-
library TypeALib {
|
41
|
-
function toInt(TypeA typeA) internal pure returns(uint256) { return uint256(TypeA.unwrap(typeA)); }
|
42
|
-
}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.19;
|
3
|
-
|
4
|
-
// bytes5 allows for chain ids up to 13 digits
|
5
|
-
type TypeB is uint248;
|
6
|
-
|
7
|
-
// type bindings
|
8
|
-
using {
|
9
|
-
eqTypeB as ==,
|
10
|
-
addTypeB as +,
|
11
|
-
TypeBLib.toInt
|
12
|
-
} for TypeB global;
|
13
|
-
|
14
|
-
// general pure free functions
|
15
|
-
function toTypeB(uint256 x) pure returns(TypeB) { return TypeB.wrap(uint248(x)); }
|
16
|
-
|
17
|
-
// pure free functions for operators
|
18
|
-
function eqTypeB(TypeB a, TypeB b) pure returns(bool isSame) { return TypeB.unwrap(a) == TypeB.unwrap(b); }
|
19
|
-
function addTypeB(TypeB a, TypeB b) pure returns(TypeB sum) { return TypeB.wrap(TypeB.unwrap(a) + TypeB.unwrap(b)); }
|
20
|
-
|
21
|
-
// library functions that operate on user defined type
|
22
|
-
library TypeBLib {
|
23
|
-
function toInt(TypeB b) internal pure returns(uint256) { return uint256(TypeB.unwrap(b)); }
|
24
|
-
}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.19;
|
3
|
-
|
4
|
-
// bytes5 allows for chain ids up to 13 digits
|
5
|
-
type ChainId is bytes5;
|
6
|
-
|
7
|
-
// type bindings
|
8
|
-
using {
|
9
|
-
eqChainId as ==,
|
10
|
-
neChainId as !=,
|
11
|
-
ChainIdLib.toInt
|
12
|
-
} for ChainId global;
|
13
|
-
|
14
|
-
// general pure free functions
|
15
|
-
function toChainId(uint256 chainId) pure returns(ChainId) { return ChainId.wrap(bytes5(uint40(chainId))); }
|
16
|
-
|
17
|
-
// pure free functions for operators
|
18
|
-
function eqChainId(ChainId a, ChainId b) pure returns(bool isSame) { return ChainId.unwrap(a) == ChainId.unwrap(b); }
|
19
|
-
function neChainId(ChainId a, ChainId b) pure returns(bool isDifferent) { return ChainId.unwrap(a) != ChainId.unwrap(b); }
|
20
|
-
|
21
|
-
// library functions that operate on user defined type
|
22
|
-
library ChainIdLib {
|
23
|
-
function toInt(ChainId chainId) internal pure returns(uint256) { return uint256(uint40(ChainId.unwrap(chainId))); }
|
24
|
-
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|