@etherisc/gif-next 0.0.2-da77c50-824 → 0.0.2-dc7e4cb-141
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +2 -2
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +2 -2
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +6 -11
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +1 -1
- package/artifacts/contracts/instance/IServiceLinked.sol/IServiceLinked.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +71 -86
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +5 -5
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/compensation/CompensationModule.sol/CompensationModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/compensation/CompensationModule.sol/CompensationModule.json +10 -0
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensation.dbg.json +4 -0
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensation.json +10 -0
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensationModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensationModule.json +10 -0
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/lifecycle/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/lifecycle/ILifecycle.sol/ILifecycleModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/lifecycle/LifecycleModule.sol/LifecycleModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{product/ProductModule.sol/ProductModule.json → risk/IRisk.sol/IRisk.json} +2 -2
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{product/IProductModule.sol/IProductModule.json → risk/IRisk.sol/IRiskModule.json} +2 -2
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +10 -0
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.json +1 -6
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.json +1 -6
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +25 -53
- package/artifacts/contracts/instance/service/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentServiceBase.sol/ComponentServiceBase.json +5 -5
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +5 -5
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +5 -5
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +5 -5
- package/artifacts/contracts/instance/service/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IService.sol/IService.json +5 -5
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +18 -46
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +47 -59
- package/artifacts/contracts/instance/service/ServiceBase.sol/ServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ServiceBase.sol/ServiceBase.json +5 -5
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +2 -2
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +5 -5
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +5 -5
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +28 -4
- package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +1 -1
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +2 -2
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +1 -1
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +2 -2
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +2 -2
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +15 -43
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +14 -18
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +15 -39
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +4 -0
- package/artifacts/contracts/test/Usdc.sol/USDC.json +338 -0
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +4 -0
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +218 -0
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.json +34 -8
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +63 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
- package/contracts/instance/IInstance.sol +4 -1
- package/contracts/instance/Instance.sol +4 -0
- package/contracts/instance/InstanceBase.sol +2 -5
- package/contracts/instance/module/compensation/CompensationModule.sol +8 -0
- package/contracts/instance/module/compensation/ICompensation.sol +10 -0
- package/contracts/instance/module/component/ComponentModule.sol +1 -2
- package/contracts/instance/module/{product/IProductModule.sol → risk/IRisk.sol} +6 -2
- package/contracts/instance/module/risk/RiskModule.sol +8 -0
- package/contracts/instance/module/treasury/ITreasury.sol +2 -3
- package/contracts/instance/module/treasury/TreasuryModule.sol +15 -11
- package/contracts/instance/service/ComponentOwnerService.sol +3 -6
- package/contracts/instance/service/PoolService.sol +35 -10
- package/contracts/instance/service/ProductService.sol +5 -8
- package/contracts/instance/service/ServiceBase.sol +1 -1
- package/contracts/shared/IVersionable.sol +2 -2
- package/contracts/shared/Versionable.sol +3 -6
- package/contracts/test/TestFee.sol +3 -3
- package/contracts/test/TestPool.sol +1 -1
- package/contracts/test/TestProduct.sol +1 -1
- package/contracts/test/TestService.sol +2 -5
- package/contracts/test/TestVersion.sol +4 -7
- package/contracts/test/TestVersionable.sol +2 -5
- package/contracts/test/Usdc.sol +26 -0
- package/contracts/types/Fee.sol +39 -20
- package/contracts/types/UFixed.sol +19 -16
- package/contracts/types/Version.sol +29 -25
- package/package.json +1 -1
- package/artifacts/contracts/instance/module/product/IProductModule.sol/IProductModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/product/ProductModule.sol/ProductModule.dbg.json +0 -4
- package/contracts/instance/module/product/ProductModule.sol +0 -8
@@ -44,15 +44,41 @@
|
|
44
44
|
},
|
45
45
|
{
|
46
46
|
"inputs": [],
|
47
|
-
"name": "
|
47
|
+
"name": "ROUNDING_DOWN",
|
48
48
|
"outputs": [
|
49
49
|
{
|
50
|
-
"internalType": "
|
50
|
+
"internalType": "uint8",
|
51
51
|
"name": "",
|
52
|
-
"type": "
|
52
|
+
"type": "uint8"
|
53
53
|
}
|
54
54
|
],
|
55
|
-
"stateMutability": "
|
55
|
+
"stateMutability": "pure",
|
56
|
+
"type": "function"
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"inputs": [],
|
60
|
+
"name": "ROUNDING_HALF_UP",
|
61
|
+
"outputs": [
|
62
|
+
{
|
63
|
+
"internalType": "uint8",
|
64
|
+
"name": "",
|
65
|
+
"type": "uint8"
|
66
|
+
}
|
67
|
+
],
|
68
|
+
"stateMutability": "pure",
|
69
|
+
"type": "function"
|
70
|
+
},
|
71
|
+
{
|
72
|
+
"inputs": [],
|
73
|
+
"name": "ROUNDING_UP",
|
74
|
+
"outputs": [
|
75
|
+
{
|
76
|
+
"internalType": "uint8",
|
77
|
+
"name": "",
|
78
|
+
"type": "uint8"
|
79
|
+
}
|
80
|
+
],
|
81
|
+
"stateMutability": "pure",
|
56
82
|
"type": "function"
|
57
83
|
},
|
58
84
|
{
|
@@ -373,9 +399,9 @@
|
|
373
399
|
"type": "uint256"
|
374
400
|
},
|
375
401
|
{
|
376
|
-
"internalType": "
|
402
|
+
"internalType": "uint8",
|
377
403
|
"name": "rounding",
|
378
|
-
"type": "
|
404
|
+
"type": "uint8"
|
379
405
|
}
|
380
406
|
],
|
381
407
|
"name": "toIntWithRounding",
|
@@ -446,8 +472,8 @@
|
|
446
472
|
"type": "function"
|
447
473
|
}
|
448
474
|
],
|
449
|
-
"bytecode": "
|
450
|
-
"deployedBytecode": "
|
475
|
+
"bytecode": "0x610a2a61003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106101625760003560e01c80637a858b97116100cd578063bc1b392d11610086578063bc1b392d146102c7578063bdbb4630146102ce578063c8a4ac9c146102d5578063cc8b7b73146102e8578063ea6515c4146102fb578063eb646d711461030e57600080fd5b80637a858b971461025f57806389fa8ed71461027257806393aa872514610287578063a391c15b1461028e578063b4773329146102a1578063b67d77c5146102b457600080fd5b8063313ce5671161011f578063313ce567146101f957806332148d731461020057806344aa68361461021357806345ebb61e14610226578063753b14a514610239578063771602f71461024c57600080fd5b8063059f8b161461016757806308c76ec414610182578063118fc88c146101955780631488c845146101b85780631a12cd47146101cb57806321e5749b146101e6575b600080fd5b61016f610316565b6040519081526020015b60405180910390f35b61016f610190366004610797565b610325565b6101a86101a33660046107cd565b6103ad565b6040519015158152602001610179565b61016f6101c63660046107ef565b6103ba565b6101d3601281565b60405160009190910b8152602001610179565b6101a86101f43660046107cd565b61049c565b601261016f565b6101a861020e3660046107cd565b6104a6565b61016f61022136600461081a565b6104b0565b61016f61023436600461081a565b6104bd565b6101a861024736600461081a565b6104d5565b61016f61025a3660046107cd565b6104de565b6101a861026d36600461081a565b6104ea565b60025b60405160ff9091168152602001610179565b6000610275565b61016f61029c3660046107cd565b6104f4565b6101a86102af3660046107cd565b610500565b61016f6102c23660046107cd565b61050b565b600061016f565b6001610275565b61016f6102e33660046107cd565b610517565b61016f6102f63660046107cd565b610523565b6101a86103093660046107cd565b61052f565b61016f61053a565b6103226012600a61092d565b81565b600060011960ff8316016103745761036d60026103446012600a61092d565b61034e919061094f565b6103589085610971565b60016103666012600a61092d565b6000610552565b90506103a7565b60ff821661038e5761036d8360016103666012600a61092d565b61036d8360016103a06012600a61092d565b6001610552565b92915050565b60008282115b9392505050565b6000806103c8836012610984565b60000b121561041e5760405162461bcd60e51b815260206004820152601f60248201527f4552524f523a464d2d3031303a4558504f4e454e545f544f4f5f534d414c4c0060448201526064015b60405180910390fd5b604061042b836012610984565b60000b131561047c5760405162461bcd60e51b815260206004820152601f60248201527f4552524f523a464d2d3031313a4558504f4e454e545f544f4f5f4c41524745006044820152606401610415565b610487826012610984565b61049290600a6109a5565b6103b390846109b4565b60008282106103b3565b60008183146103b3565b60006103a7826002610325565b60006104cb6012600a61092d565b6103a790836109b4565b600081156103a7565b60006103b383836105af565b60008115156103a7565b60006103b383836105bb565b6000828211156103b3565b60006103b3838361061f565b60006103b3838361067b565b60006103b38383610690565b6000828210156103b3565b60026105486012600a61092d565b610322919061094f565b6000806105608686866106ae565b90506001836002811115610576576105766109cb565b14801561059357506000848061058e5761058e610939565b868809115b156105a6576105a3600182610971565b90505b95945050505050565b60006103b38284610971565b600080821161060c5760405162461bcd60e51b815260206004820152601a60248201527f4552524f523a55464d2d3032303a44495649534f525f5a45524f0000000000006044820152606401610415565b6103b383670de0b6b3a7640000846106ae565b6000828211156106715760405162461bcd60e51b815260206004820152601d60248201527f4552524f523a55464d2d3031303a4e454741544956455f524553554c540000006044820152606401610415565b6103b382846109e1565b60006103b38383670de0b6b3a76400006106ae565b6000828210156106a45761036d838361061f565b6103b3828461061f565b60008080600019858709858702925082811083820303915050806000036106e8578382816106de576106de610939565b04925050506103b3565b80841161072f5760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b6044820152606401610415565b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b600080604083850312156107aa57600080fd5b82359150602083013560ff811681146107c257600080fd5b809150509250929050565b600080604083850312156107e057600080fd5b50508035926020909101359150565b6000806040838503121561080257600080fd5b8235915060208301358060000b81146107c257600080fd5b60006020828403121561082c57600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561088457816000190482111561086a5761086a610833565b8085161561087757918102915b93841c939080029061084e565b509250929050565b60008261089b575060016103a7565b816108a8575060006103a7565b81600181146108be57600281146108c8576108e4565b60019150506103a7565b60ff8411156108d9576108d9610833565b50506001821b6103a7565b5060208310610133831016604e8410600b8410161715610907575081810a6103a7565b6109118383610849565b806000190482111561092557610925610833565b029392505050565b60006103b3838361088c565b634e487b7160e01b600052601260045260246000fd5b60008261096c57634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156103a7576103a7610833565b600081810b9083900b01607f8113607f19821217156103a7576103a7610833565b60006103b360ff84168361088c565b80820281158282048414176103a7576103a7610833565b634e487b7160e01b600052602160045260246000fd5b818103818111156103a7576103a761083356fea2646970667358221220fb084aab1469254041156892d0f0d9cc43b94e6c38b151c477083dab1d1e70aa64736f6c63430008140033",
|
476
|
+
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106101625760003560e01c80637a858b97116100cd578063bc1b392d11610086578063bc1b392d146102c7578063bdbb4630146102ce578063c8a4ac9c146102d5578063cc8b7b73146102e8578063ea6515c4146102fb578063eb646d711461030e57600080fd5b80637a858b971461025f57806389fa8ed71461027257806393aa872514610287578063a391c15b1461028e578063b4773329146102a1578063b67d77c5146102b457600080fd5b8063313ce5671161011f578063313ce567146101f957806332148d731461020057806344aa68361461021357806345ebb61e14610226578063753b14a514610239578063771602f71461024c57600080fd5b8063059f8b161461016757806308c76ec414610182578063118fc88c146101955780631488c845146101b85780631a12cd47146101cb57806321e5749b146101e6575b600080fd5b61016f610316565b6040519081526020015b60405180910390f35b61016f610190366004610797565b610325565b6101a86101a33660046107cd565b6103ad565b6040519015158152602001610179565b61016f6101c63660046107ef565b6103ba565b6101d3601281565b60405160009190910b8152602001610179565b6101a86101f43660046107cd565b61049c565b601261016f565b6101a861020e3660046107cd565b6104a6565b61016f61022136600461081a565b6104b0565b61016f61023436600461081a565b6104bd565b6101a861024736600461081a565b6104d5565b61016f61025a3660046107cd565b6104de565b6101a861026d36600461081a565b6104ea565b60025b60405160ff9091168152602001610179565b6000610275565b61016f61029c3660046107cd565b6104f4565b6101a86102af3660046107cd565b610500565b61016f6102c23660046107cd565b61050b565b600061016f565b6001610275565b61016f6102e33660046107cd565b610517565b61016f6102f63660046107cd565b610523565b6101a86103093660046107cd565b61052f565b61016f61053a565b6103226012600a61092d565b81565b600060011960ff8316016103745761036d60026103446012600a61092d565b61034e919061094f565b6103589085610971565b60016103666012600a61092d565b6000610552565b90506103a7565b60ff821661038e5761036d8360016103666012600a61092d565b61036d8360016103a06012600a61092d565b6001610552565b92915050565b60008282115b9392505050565b6000806103c8836012610984565b60000b121561041e5760405162461bcd60e51b815260206004820152601f60248201527f4552524f523a464d2d3031303a4558504f4e454e545f544f4f5f534d414c4c0060448201526064015b60405180910390fd5b604061042b836012610984565b60000b131561047c5760405162461bcd60e51b815260206004820152601f60248201527f4552524f523a464d2d3031313a4558504f4e454e545f544f4f5f4c41524745006044820152606401610415565b610487826012610984565b61049290600a6109a5565b6103b390846109b4565b60008282106103b3565b60008183146103b3565b60006103a7826002610325565b60006104cb6012600a61092d565b6103a790836109b4565b600081156103a7565b60006103b383836105af565b60008115156103a7565b60006103b383836105bb565b6000828211156103b3565b60006103b3838361061f565b60006103b3838361067b565b60006103b38383610690565b6000828210156103b3565b60026105486012600a61092d565b610322919061094f565b6000806105608686866106ae565b90506001836002811115610576576105766109cb565b14801561059357506000848061058e5761058e610939565b868809115b156105a6576105a3600182610971565b90505b95945050505050565b60006103b38284610971565b600080821161060c5760405162461bcd60e51b815260206004820152601a60248201527f4552524f523a55464d2d3032303a44495649534f525f5a45524f0000000000006044820152606401610415565b6103b383670de0b6b3a7640000846106ae565b6000828211156106715760405162461bcd60e51b815260206004820152601d60248201527f4552524f523a55464d2d3031303a4e454741544956455f524553554c540000006044820152606401610415565b6103b382846109e1565b60006103b38383670de0b6b3a76400006106ae565b6000828210156106a45761036d838361061f565b6103b3828461061f565b60008080600019858709858702925082811083820303915050806000036106e8578382816106de576106de610939565b04925050506103b3565b80841161072f5760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b6044820152606401610415565b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b600080604083850312156107aa57600080fd5b82359150602083013560ff811681146107c257600080fd5b809150509250929050565b600080604083850312156107e057600080fd5b50508035926020909101359150565b6000806040838503121561080257600080fd5b8235915060208301358060000b81146107c257600080fd5b60006020828403121561082c57600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561088457816000190482111561086a5761086a610833565b8085161561087757918102915b93841c939080029061084e565b509250929050565b60008261089b575060016103a7565b816108a8575060006103a7565b81600181146108be57600281146108c8576108e4565b60019150506103a7565b60ff8411156108d9576108d9610833565b50506001821b6103a7565b5060208310610133831016604e8410600b8410161715610907575081810a6103a7565b6109118383610849565b806000190482111561092557610925610833565b029392505050565b60006103b3838361088c565b634e487b7160e01b600052601260045260246000fd5b60008261096c57634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156103a7576103a7610833565b600081810b9083900b01607f8113607f19821217156103a7576103a7610833565b60006103b360ff84168361088c565b80820281158282048414176103a7576103a7610833565b634e487b7160e01b600052602160045260246000fd5b818103818111156103a7576103a761083356fea2646970667358221220fb084aab1469254041156892d0f0d9cc43b94e6c38b151c477083dab1d1e70aa64736f6c63430008140033",
|
451
477
|
"linkReferences": {},
|
452
478
|
"deployedLinkReferences": {}
|
453
479
|
}
|
@@ -41,6 +41,54 @@
|
|
41
41
|
"stateMutability": "pure",
|
42
42
|
"type": "function"
|
43
43
|
},
|
44
|
+
{
|
45
|
+
"inputs": [
|
46
|
+
{
|
47
|
+
"internalType": "uint256",
|
48
|
+
"name": "major",
|
49
|
+
"type": "uint256"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"internalType": "uint256",
|
53
|
+
"name": "minor",
|
54
|
+
"type": "uint256"
|
55
|
+
},
|
56
|
+
{
|
57
|
+
"internalType": "uint256",
|
58
|
+
"name": "patch",
|
59
|
+
"type": "uint256"
|
60
|
+
}
|
61
|
+
],
|
62
|
+
"name": "toVersion",
|
63
|
+
"outputs": [
|
64
|
+
{
|
65
|
+
"internalType": "Version",
|
66
|
+
"name": "",
|
67
|
+
"type": "uint24"
|
68
|
+
}
|
69
|
+
],
|
70
|
+
"stateMutability": "pure",
|
71
|
+
"type": "function"
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"inputs": [
|
75
|
+
{
|
76
|
+
"internalType": "uint256",
|
77
|
+
"name": "versionPart",
|
78
|
+
"type": "uint256"
|
79
|
+
}
|
80
|
+
],
|
81
|
+
"name": "toVersionPart",
|
82
|
+
"outputs": [
|
83
|
+
{
|
84
|
+
"internalType": "VersionPart",
|
85
|
+
"name": "",
|
86
|
+
"type": "uint8"
|
87
|
+
}
|
88
|
+
],
|
89
|
+
"stateMutability": "pure",
|
90
|
+
"type": "function"
|
91
|
+
},
|
44
92
|
{
|
45
93
|
"inputs": [
|
46
94
|
{
|
@@ -69,10 +117,23 @@
|
|
69
117
|
],
|
70
118
|
"stateMutability": "pure",
|
71
119
|
"type": "function"
|
120
|
+
},
|
121
|
+
{
|
122
|
+
"inputs": [],
|
123
|
+
"name": "zeroVersion",
|
124
|
+
"outputs": [
|
125
|
+
{
|
126
|
+
"internalType": "Version",
|
127
|
+
"name": "",
|
128
|
+
"type": "uint24"
|
129
|
+
}
|
130
|
+
],
|
131
|
+
"stateMutability": "pure",
|
132
|
+
"type": "function"
|
72
133
|
}
|
73
134
|
],
|
74
|
-
"bytecode": "
|
75
|
-
"deployedBytecode": "
|
135
|
+
"bytecode": "0x61030c61003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361061006c5760003560e01c806304b8f6c5146100715780632efe01131461008d57806349a7111a146100a057806355601007146100d75780638e4ad86c146100fb578063c9e66e291461011e575b600080fd5b60005b60405162ffffff90911681526020015b60405180910390f35b61007461009b366004610213565b610135565b6100b36100ae36600461023f565b6101d6565b6040805160ff94851681529284166020840152921691810191909152606001610084565b6100ed6100e536600461023f565b62ffffff1690565b604051908152602001610084565b61010c61010936600461026b565b90565b60405160ff9091168152602001610084565b61010c61012c36600461023f565b60101c60ff1690565b600061010084108015610149575061010083105b8015610156575061010082105b6101b15760405162461bcd60e51b815260206004820152602260248201527f4552524f523a5652532d3031303a56455253494f4e5f504152545f544f4f5f42604482015261494760f01b606482015260840160405180910390fd5b816101c4600885901b601087901b61029a565b6101ce919061029a565b949350505050565b600080808360ff601082901c166101ed83836102b3565b915061ffff600883901c16600061020481856102b3565b92989197509195509350505050565b60008060006060848603121561022857600080fd5b505081359360208301359350604090920135919050565b60006020828403121561025157600080fd5b813562ffffff8116811461026457600080fd5b9392505050565b60006020828403121561027d57600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156102ad576102ad610284565b92915050565b62ffffff8281168282160390808211156102cf576102cf610284565b509291505056fea2646970667358221220ba37649b9b622a7a14f84638f29a11cfa2b93f381baaceb770e1fea23e6fae7964736f6c63430008140033",
|
136
|
+
"deployedBytecode": "0x730000000000000000000000000000000000000000301460806040526004361061006c5760003560e01c806304b8f6c5146100715780632efe01131461008d57806349a7111a146100a057806355601007146100d75780638e4ad86c146100fb578063c9e66e291461011e575b600080fd5b60005b60405162ffffff90911681526020015b60405180910390f35b61007461009b366004610213565b610135565b6100b36100ae36600461023f565b6101d6565b6040805160ff94851681529284166020840152921691810191909152606001610084565b6100ed6100e536600461023f565b62ffffff1690565b604051908152602001610084565b61010c61010936600461026b565b90565b60405160ff9091168152602001610084565b61010c61012c36600461023f565b60101c60ff1690565b600061010084108015610149575061010083105b8015610156575061010082105b6101b15760405162461bcd60e51b815260206004820152602260248201527f4552524f523a5652532d3031303a56455253494f4e5f504152545f544f4f5f42604482015261494760f01b606482015260840160405180910390fd5b816101c4600885901b601087901b61029a565b6101ce919061029a565b949350505050565b600080808360ff601082901c166101ed83836102b3565b915061ffff600883901c16600061020481856102b3565b92989197509195509350505050565b60008060006060848603121561022857600080fd5b505081359360208301359350604090920135919050565b60006020828403121561025157600080fd5b813562ffffff8116811461026457600080fd5b9392505050565b60006020828403121561027d57600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156102ad576102ad610284565b92915050565b62ffffff8281168282160390808211156102cf576102cf610284565b509291505056fea2646970667358221220ba37649b9b622a7a14f84638f29a11cfa2b93f381baaceb770e1fea23e6fae7964736f6c63430008140033",
|
76
137
|
"linkReferences": {},
|
77
138
|
"deployedLinkReferences": {}
|
78
139
|
}
|
@@ -23,8 +23,8 @@
|
|
23
23
|
"type": "function"
|
24
24
|
}
|
25
25
|
],
|
26
|
-
"bytecode": "
|
27
|
-
"deployedBytecode": "
|
26
|
+
"bytecode": "0x60b9610039600b82828239805160001a60731461002c57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c8063ac43d834146038575b600080fd5b60496043366004605b565b60ff1690565b60405190815260200160405180910390f35b600060208284031215606c57600080fd5b813560ff81168114607c57600080fd5b939250505056fea2646970667358221220f9eff042249ef4290a2228b4a1d7046915ad93d6defe14b8c405ef07df444fa264736f6c63430008140033",
|
27
|
+
"deployedBytecode": "0x730000000000000000000000000000000000000000301460806040526004361060335760003560e01c8063ac43d834146038575b600080fd5b60496043366004605b565b60ff1690565b60405190815260200160405180910390f35b600060208284031215606c57600080fd5b813560ff81168114607c57600080fd5b939250505056fea2646970667358221220f9eff042249ef4290a2228b4a1d7046915ad93d6defe14b8c405ef07df444fa264736f6c63430008140033",
|
28
28
|
"linkReferences": {},
|
29
29
|
"deployedLinkReferences": {}
|
30
30
|
}
|
@@ -10,11 +10,13 @@ import {IOwnable} from "../shared/IOwnable.sol";
|
|
10
10
|
import {RoleId} from "../types/RoleId.sol";
|
11
11
|
|
12
12
|
import {IAccessModule} from "./module/access/IAccess.sol";
|
13
|
+
import {IBundleModule} from "./module/bundle/IBundle.sol";
|
14
|
+
import {ICompensationModule} from "./module/compensation/ICompensation.sol";
|
13
15
|
import {ILifecycleModule} from "./module/lifecycle/ILifecycle.sol";
|
14
16
|
import {IComponentModule} from "./module/component/IComponent.sol";
|
15
17
|
import {IPolicyModule} from "./module/policy/IPolicy.sol";
|
16
18
|
import {IPoolModule} from "./module/pool/IPoolModule.sol";
|
17
|
-
import {
|
19
|
+
import {IRiskModule} from "./module/risk/IRisk.sol";
|
18
20
|
import {ITreasuryModule} from "./module/treasury/ITreasury.sol";
|
19
21
|
|
20
22
|
import {IRegistry, IRegistryLinked} from "../registry/IRegistryLinked.sol";
|
@@ -37,6 +39,7 @@ interface IInstance is
|
|
37
39
|
IBundleModule,
|
38
40
|
IComponentModule,
|
39
41
|
ITreasuryModule,
|
42
|
+
ICompensationModule,
|
40
43
|
IServiceLinked
|
41
44
|
{
|
42
45
|
function getRegistry() external view override (IBundleModule, IComponentModule, IPolicyModule, IRegisterable) returns (IRegistry registry);
|
@@ -6,10 +6,12 @@ import {RoleId} from "../types/RoleId.sol";
|
|
6
6
|
|
7
7
|
import {InstanceBase} from "./InstanceBase.sol";
|
8
8
|
import {AccessModule} from "./module/access/Access.sol";
|
9
|
+
import {CompensationModule} from "./module/compensation/CompensationModule.sol";
|
9
10
|
import {LifecycleModule} from "./module/lifecycle/LifecycleModule.sol";
|
10
11
|
import {ComponentModule} from "./module/component/ComponentModule.sol";
|
11
12
|
import {PolicyModule} from "./module/policy/PolicyModule.sol";
|
12
13
|
import {PoolModule} from "./module/pool/PoolModule.sol";
|
14
|
+
import {RiskModule} from "./module/risk/RiskModule.sol";
|
13
15
|
import {BundleModule} from "./module/bundle/BundleModule.sol";
|
14
16
|
import {TreasuryModule} from "./module/treasury/TreasuryModule.sol";
|
15
17
|
|
@@ -31,9 +33,11 @@ contract Instance is
|
|
31
33
|
AccessModule,
|
32
34
|
BundleModule,
|
33
35
|
ComponentModule,
|
36
|
+
CompensationModule,
|
34
37
|
LifecycleModule,
|
35
38
|
PolicyModule,
|
36
39
|
PoolModule,
|
40
|
+
RiskModule,
|
37
41
|
TreasuryModule
|
38
42
|
{
|
39
43
|
constructor(
|
@@ -8,7 +8,7 @@ import {Registerable} from "../shared/Registerable.sol";
|
|
8
8
|
// import {IInstance} from "./IInstance.sol";
|
9
9
|
import {ObjectType, INSTANCE} from "../types/ObjectType.sol";
|
10
10
|
import {NftId} from "../types/NftId.sol";
|
11
|
-
import {Version, VersionPart,
|
11
|
+
import {Version, VersionPart, VersionLib} from "../types/Version.sol";
|
12
12
|
|
13
13
|
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
14
14
|
import {IProductService} from "./service/IProductService.sol";
|
@@ -44,10 +44,7 @@ abstract contract InstanceBase is
|
|
44
44
|
virtual override
|
45
45
|
returns(Version)
|
46
46
|
{
|
47
|
-
return toVersion(
|
48
|
-
toVersionPart(3),
|
49
|
-
toVersionPart(0),
|
50
|
-
toVersionPart(0));
|
47
|
+
return VersionLib.toVersion(3,0,0);
|
51
48
|
}
|
52
49
|
|
53
50
|
// from registerable
|
@@ -12,8 +12,7 @@ import {IComponentOwnerService} from "../../service/IComponentOwnerService.sol";
|
|
12
12
|
import {ObjectType, PRODUCT, ORACLE, POOL} from "../../../types/ObjectType.sol";
|
13
13
|
import {StateId, ACTIVE, PAUSED} from "../../../types/StateId.sol";
|
14
14
|
import {NftId, NftIdLib, zeroNftId} from "../../../types/NftId.sol";
|
15
|
-
import {Fee
|
16
|
-
// import {IBaseComponent} from "../../../components/IBaseComponent.sol";
|
15
|
+
import {Fee} from "../../../types/Fee.sol";
|
17
16
|
|
18
17
|
abstract contract ComponentModule is
|
19
18
|
IComponentModule
|
@@ -18,7 +18,6 @@ interface ITreasury {
|
|
18
18
|
NftId distributorNftId;
|
19
19
|
NftId poolNftId;
|
20
20
|
IERC20Metadata token;
|
21
|
-
TokenHandler tokenHandler;
|
22
21
|
address wallet;
|
23
22
|
Fee policyFee;
|
24
23
|
Fee processingFee;
|
@@ -27,7 +26,7 @@ interface ITreasury {
|
|
27
26
|
struct DistributorSetup {
|
28
27
|
NftId distributorNftId;
|
29
28
|
address wallet;
|
30
|
-
Fee
|
29
|
+
Fee commissionFee;
|
31
30
|
}
|
32
31
|
|
33
32
|
struct PoolSetup {
|
@@ -70,7 +69,7 @@ interface ITreasuryModule is ITreasury {
|
|
70
69
|
) external;
|
71
70
|
|
72
71
|
function getTokenHandler(
|
73
|
-
NftId
|
72
|
+
NftId componentNftId
|
74
73
|
) external view returns (TokenHandler tokenHandler);
|
75
74
|
|
76
75
|
function getProductSetup(
|
@@ -4,7 +4,7 @@ pragma solidity ^0.8.19;
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
6
|
import {NftId} from "../../../types/NftId.sol";
|
7
|
-
import {Fee,
|
7
|
+
import {Fee, FeeLib} from "../../../types/Fee.sol";
|
8
8
|
import {UFixed, UFixedMathLib} from "../../../types/UFixed.sol";
|
9
9
|
import {TokenHandler} from "./TokenHandler.sol";
|
10
10
|
import {ITreasuryModule} from "./ITreasury.sol";
|
@@ -14,6 +14,7 @@ abstract contract TreasuryModule is ITreasuryModule {
|
|
14
14
|
mapping(NftId distributorNftId => DistributorSetup setup)
|
15
15
|
private _distributorSetup;
|
16
16
|
mapping(NftId poolNftId => PoolSetup setup) private _poolSetup;
|
17
|
+
mapping(NftId componentNftId => TokenHandler tokenHanlder) _tokenHandler;
|
17
18
|
|
18
19
|
function registerProduct(
|
19
20
|
NftId productNftId,
|
@@ -25,17 +26,23 @@ abstract contract TreasuryModule is ITreasuryModule {
|
|
25
26
|
Fee memory processingFee
|
26
27
|
) external override // TODO add authz (only component module)
|
27
28
|
{
|
28
|
-
|
29
|
+
require(address(_tokenHandler[productNftId]) == address(0), "ERROR:TRS-010:TOKEN_HANDLER_ALREADY_REGISTERED");
|
30
|
+
require(address(_tokenHandler[poolNftId]) == address(0), "ERROR:TRS-011:TOKEN_HANDLER_ALREADY_REGISTERED");
|
31
|
+
require(address(_tokenHandler[distributorNftId]) == address(0), "ERROR:TRS-012:TOKEN_HANDLER_ALREADY_REGISTERED");
|
32
|
+
// TODO add additional validations
|
29
33
|
|
30
34
|
// deploy product specific handler contract
|
31
35
|
TokenHandler tokenHandler = new TokenHandler(productNftId, address(token));
|
36
|
+
_tokenHandler[productNftId] = tokenHandler;
|
37
|
+
_tokenHandler[poolNftId] = tokenHandler;
|
38
|
+
_tokenHandler[distributorNftId] = tokenHandler;
|
32
39
|
|
40
|
+
// create product setup
|
33
41
|
_productSetup[productNftId] = ProductSetup(
|
34
42
|
productNftId,
|
35
43
|
distributorNftId,
|
36
44
|
poolNftId,
|
37
45
|
token,
|
38
|
-
tokenHandler,
|
39
46
|
wallet,
|
40
47
|
policyFee,
|
41
48
|
processingFee
|
@@ -94,9 +101,9 @@ abstract contract TreasuryModule is ITreasuryModule {
|
|
94
101
|
}
|
95
102
|
|
96
103
|
function getTokenHandler(
|
97
|
-
NftId
|
104
|
+
NftId componentNftId
|
98
105
|
) external view override returns (TokenHandler tokenHandler) {
|
99
|
-
return
|
106
|
+
return _tokenHandler[componentNftId];
|
100
107
|
}
|
101
108
|
|
102
109
|
function getProductSetup(
|
@@ -115,21 +122,18 @@ abstract contract TreasuryModule is ITreasuryModule {
|
|
115
122
|
uint256 amount,
|
116
123
|
Fee memory fee
|
117
124
|
) public pure override returns (uint256 feeAmount, uint256 netAmount) {
|
118
|
-
|
119
|
-
fee.fractionalFee;
|
120
|
-
feeAmount = fractionalAmount.toInt() + fee.fixedFee;
|
121
|
-
netAmount = amount - feeAmount;
|
125
|
+
return FeeLib.calculateFee(amount, fee);
|
122
126
|
}
|
123
127
|
|
124
128
|
function getFee(
|
125
129
|
UFixed fractionalFee,
|
126
130
|
uint256 fixedFee
|
127
131
|
) external pure override returns (Fee memory fee) {
|
128
|
-
return toFee(fractionalFee, fixedFee);
|
132
|
+
return FeeLib.toFee(fractionalFee, fixedFee);
|
129
133
|
}
|
130
134
|
|
131
135
|
function getZeroFee() external pure override returns (Fee memory fee) {
|
132
|
-
return zeroFee();
|
136
|
+
return FeeLib.zeroFee();
|
133
137
|
}
|
134
138
|
|
135
139
|
function getUFixed(
|
@@ -20,8 +20,8 @@ import {RoleId, PRODUCT_OWNER_ROLE, POOL_OWNER_ROLE, ORACLE_OWNER_ROLE} from "..
|
|
20
20
|
import {ObjectType, PRODUCT, ORACLE, POOL} from "../../types/ObjectType.sol";
|
21
21
|
import {StateId, ACTIVE, PAUSED} from "../../types/StateId.sol";
|
22
22
|
import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
|
23
|
-
import {Fee
|
24
|
-
import {Version,
|
23
|
+
import {Fee} from "../../types/Fee.sol";
|
24
|
+
import {Version, VersionLib} from "../../types/Version.sol";
|
25
25
|
|
26
26
|
import {IProductComponent} from "../../components/IProductComponent.sol";
|
27
27
|
import {ServiceBase} from "./ServiceBase.sol";
|
@@ -55,10 +55,7 @@ contract ComponentOwnerService is
|
|
55
55
|
virtual override (IVersionable, Versionable)
|
56
56
|
returns(Version)
|
57
57
|
{
|
58
|
-
return toVersion(
|
59
|
-
toVersionPart(3),
|
60
|
-
toVersionPart(0),
|
61
|
-
toVersionPart(0));
|
58
|
+
return VersionLib.toVersion(3,0,0);
|
62
59
|
}
|
63
60
|
|
64
61
|
function getName() external pure override returns(string memory name) {
|
@@ -10,8 +10,8 @@ import {Versionable} from "../../shared/Versionable.sol";
|
|
10
10
|
|
11
11
|
import {NftId, NftIdLib} from "../../types/NftId.sol";
|
12
12
|
import {POOL, BUNDLE} from "../../types/ObjectType.sol";
|
13
|
-
import {Fee
|
14
|
-
import {Version,
|
13
|
+
import {Fee} from "../../types/Fee.sol";
|
14
|
+
import {Version, VersionLib} from "../../types/Version.sol";
|
15
15
|
|
16
16
|
import {ComponentServiceBase} from "./ComponentServiceBase.sol";
|
17
17
|
import {IPoolService} from "./IPoolService.sol";
|
@@ -36,10 +36,7 @@ contract PoolService is ComponentServiceBase, IPoolService {
|
|
36
36
|
virtual override (IVersionable, Versionable)
|
37
37
|
returns(Version)
|
38
38
|
{
|
39
|
-
return toVersion(
|
40
|
-
toVersionPart(3),
|
41
|
-
toVersionPart(0),
|
42
|
-
toVersionPart(0));
|
39
|
+
return VersionLib.toVersion(3,0,0);
|
43
40
|
}
|
44
41
|
|
45
42
|
function getName() external pure override returns(string memory name) {
|
@@ -59,7 +56,7 @@ contract PoolService is ComponentServiceBase, IPoolService {
|
|
59
56
|
|
60
57
|
function createBundle(
|
61
58
|
address owner,
|
62
|
-
uint256
|
59
|
+
uint256 stakingAmount,
|
63
60
|
uint256 lifetime,
|
64
61
|
bytes calldata filter
|
65
62
|
)
|
@@ -81,7 +78,7 @@ contract PoolService is ComponentServiceBase, IPoolService {
|
|
81
78
|
instance.createBundleInfo(
|
82
79
|
bundleNftId,
|
83
80
|
poolNftId,
|
84
|
-
|
81
|
+
stakingAmount,
|
85
82
|
lifetime,
|
86
83
|
filter);
|
87
84
|
|
@@ -89,10 +86,38 @@ contract PoolService is ComponentServiceBase, IPoolService {
|
|
89
86
|
instance.addBundleToPool(
|
90
87
|
bundleNftId,
|
91
88
|
poolNftId,
|
92
|
-
|
89
|
+
stakingAmount);
|
93
90
|
|
94
|
-
//
|
91
|
+
// collect capital
|
92
|
+
_processStakingByTreasury(
|
93
|
+
instance,
|
94
|
+
poolNftId,
|
95
|
+
bundleNftId,
|
96
|
+
stakingAmount);
|
95
97
|
|
96
98
|
// TODO add logging
|
97
99
|
}
|
100
|
+
|
101
|
+
|
102
|
+
function _processStakingByTreasury(
|
103
|
+
IInstance instance,
|
104
|
+
NftId poolNftId,
|
105
|
+
NftId bundleNftId,
|
106
|
+
uint256 stakingAmount
|
107
|
+
)
|
108
|
+
internal
|
109
|
+
{
|
110
|
+
// process token transfer(s)
|
111
|
+
if(stakingAmount > 0) {
|
112
|
+
TokenHandler tokenHandler = instance.getTokenHandler(poolNftId);
|
113
|
+
address bundleOwner = _registry.getOwner(bundleNftId);
|
114
|
+
address poolWallet = instance.getPoolSetup(poolNftId).wallet;
|
115
|
+
|
116
|
+
tokenHandler.transfer(
|
117
|
+
bundleOwner,
|
118
|
+
poolWallet,
|
119
|
+
stakingAmount
|
120
|
+
);
|
121
|
+
}
|
122
|
+
}
|
98
123
|
}
|
@@ -19,8 +19,8 @@ import {ObjectType, INSTANCE, PRODUCT, POLICY} from "../../types/ObjectType.sol"
|
|
19
19
|
import {APPLIED, UNDERWRITTEN, ACTIVE} from "../../types/StateId.sol";
|
20
20
|
import {NftId, NftIdLib} from "../../types/NftId.sol";
|
21
21
|
import {Blocknumber, blockNumber} from "../../types/Blocknumber.sol";
|
22
|
-
import {Fee,
|
23
|
-
import {Version,
|
22
|
+
import {Fee, FeeLib} from "../../types/Fee.sol";
|
23
|
+
import {Version, VersionLib} from "../../types/Version.sol";
|
24
24
|
|
25
25
|
import {ComponentServiceBase} from "./ComponentServiceBase.sol";
|
26
26
|
import {IProductService} from "./IProductService.sol";
|
@@ -47,10 +47,7 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
47
47
|
virtual override (IVersionable, Versionable)
|
48
48
|
returns(Version)
|
49
49
|
{
|
50
|
-
return toVersion(
|
51
|
-
toVersionPart(3),
|
52
|
-
toVersionPart(0),
|
53
|
-
toVersionPart(0));
|
50
|
+
return VersionLib.toVersion(3,0,0);
|
54
51
|
}
|
55
52
|
|
56
53
|
function getName() external pure override returns(string memory name) {
|
@@ -329,13 +326,13 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
329
326
|
{
|
330
327
|
// process token transfer(s)
|
331
328
|
if(premiumAmount > 0) {
|
332
|
-
TokenHandler tokenHandler = product.
|
329
|
+
TokenHandler tokenHandler = instance.getTokenHandler(product.productNftId);
|
333
330
|
address policyOwner = _registry.getOwner(policyNftId);
|
334
331
|
address poolWallet = instance.getPoolSetup(product.poolNftId).wallet;
|
335
332
|
netPremiumAmount = premiumAmount;
|
336
333
|
Fee memory policyFee = product.policyFee;
|
337
334
|
|
338
|
-
if (feeIsZero(policyFee)) {
|
335
|
+
if (FeeLib.feeIsZero(policyFee)) {
|
339
336
|
tokenHandler.transfer(
|
340
337
|
policyOwner,
|
341
338
|
poolWallet,
|
@@ -5,7 +5,7 @@ pragma solidity ^0.8.19;
|
|
5
5
|
// import {ITreasury, ITreasuryModule, TokenHandler} from "../../instance/module/treasury/ITreasury.sol";
|
6
6
|
import {NftId, zeroNftId} from "../../types/NftId.sol";
|
7
7
|
import {ObjectType, SERVICE} from "../../types/ObjectType.sol";
|
8
|
-
import {Version, VersionPart
|
8
|
+
import {Version, VersionPart} from "../../types/Version.sol";
|
9
9
|
|
10
10
|
import {Registerable} from "../../shared/Registerable.sol";
|
11
11
|
import {IVersionable} from "../../shared/IVersionable.sol";
|
@@ -3,7 +3,7 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {Blocknumber, blockNumber} from "../types/Blocknumber.sol";
|
5
5
|
import {Timestamp, blockTimestamp} from "../types/Timestamp.sol";
|
6
|
-
import {Version, VersionPart
|
6
|
+
import {Version, VersionPart} from "../types/Version.sol";
|
7
7
|
|
8
8
|
interface IVersionable {
|
9
9
|
|
@@ -11,8 +11,8 @@ interface IVersionable {
|
|
11
11
|
Version version;
|
12
12
|
address implementation;
|
13
13
|
address activatedBy;
|
14
|
-
Blocknumber activatedIn;
|
15
14
|
Timestamp activatedAt;
|
15
|
+
Blocknumber activatedIn;
|
16
16
|
}
|
17
17
|
|
18
18
|
event LogVersionableActivated(Version version, address implementation, address activatedBy);
|