diff --git a/contracts/contracts/coordination/FreeFeeModel.sol b/contracts/contracts/coordination/FreeFeeModel.sol new file mode 100644 index 00000000..726a6e1b --- /dev/null +++ b/contracts/contracts/coordination/FreeFeeModel.sol @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later + +pragma solidity ^0.8.0; + +import "@openzeppelin/contracts/access/Ownable.sol"; + +/** + * @title FreeFeeModel + * @notice Free FeeModel + */ +contract FreeFeeModel is Ownable { + mapping(address initiator => bool approved) public initiatorWhiteList; + + constructor() Ownable(msg.sender) {} + + function approveInitiator(address initiator) external onlyOwner { + initiatorWhiteList[initiator] = true; + } + + function processRitualPayment(address initiator, uint32, uint256, uint32) external { + require(initiatorWhiteList[initiator], "Initiator not approved"); + } + + function processRitualExtending(address initiator, uint32, uint256, uint32) external { + require(initiatorWhiteList[initiator], "Initiator not approved"); + } + + function beforeSetAuthorization( + uint32 ritualId, + address[] calldata addresses, + bool value + ) external { + // solhint-disable-previous-line no-empty-blocks + } + + function beforeIsAuthorized(uint32 ritualId) external view { + // solhint-disable-previous-line no-empty-blocks + } +} diff --git a/contracts/contracts/coordination/IFeeModel.sol b/contracts/contracts/coordination/IFeeModel.sol index efb9701d..6a002304 100644 --- a/contracts/contracts/coordination/IFeeModel.sol +++ b/contracts/contracts/coordination/IFeeModel.sol @@ -2,8 +2,6 @@ pragma solidity ^0.8.0; -import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; - /** * @title IFeeModel * @notice IFeeModel diff --git a/deployment/artifacts/lynx.json b/deployment/artifacts/lynx.json index d03a8e7f..1f5d5793 100644 --- a/deployment/artifacts/lynx.json +++ b/deployment/artifacts/lynx.json @@ -2304,68 +2304,57 @@ { "name": "_coordinator", "type": "address", - "components": null, - "internal_type": "contract Coordinator" + "internalType": "contract Coordinator" }, { "name": "_accessController", "type": "address", - "components": null, - "internal_type": "contract GlobalAllowList" + "internalType": "contract GlobalAllowList" }, { "name": "_feeToken", "type": "address", - "components": null, - "internal_type": "contract IERC20" + "internalType": "contract IERC20" }, { "name": "_adopter", "type": "address", - "components": null, - "internal_type": "address" + "internalType": "address" }, { "name": "_initialBaseFeeRate", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" }, { "name": "_baseFeeRateIncrease", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" }, { "name": "_encryptorFeeRate", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" }, { "name": "_maxNodes", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" }, { "name": "_subscriptionPeriodDuration", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" }, { "name": "_yellowPeriodDuration", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" }, { "name": "_redPeriodDuration", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" } ] }, @@ -2376,8 +2365,7 @@ { "name": "target", "type": "address", - "components": null, - "internal_type": "address" + "internalType": "address" } ] }, @@ -2388,8 +2376,7 @@ { "name": "account", "type": "address", - "components": null, - "internal_type": "address" + "internalType": "address" } ] }, @@ -2415,8 +2402,7 @@ { "name": "owner", "type": "address", - "components": null, - "internal_type": "address" + "internalType": "address" } ] }, @@ -2427,8 +2413,7 @@ { "name": "account", "type": "address", - "components": null, - "internal_type": "address" + "internalType": "address" } ] }, @@ -2439,8 +2424,7 @@ { "name": "token", "type": "address", - "components": null, - "internal_type": "address" + "internalType": "address" } ] }, @@ -2451,29 +2435,25 @@ { "name": "sponsor", "type": "address", - "components": null, - "internal_type": "address", + "internalType": "address", "indexed": true }, { "name": "amount", "type": "uint256", - "components": null, - "internal_type": "uint256", + "internalType": "uint256", "indexed": false }, { "name": "encryptorSlots", "type": "uint128", - "components": null, - "internal_type": "uint128", + "internalType": "uint128", "indexed": false }, { "name": "endOfCurrentPeriod", "type": "uint32", - "components": null, - "internal_type": "uint32", + "internalType": "uint32", "indexed": false } ], @@ -2486,8 +2466,7 @@ { "name": "version", "type": "uint64", - "components": null, - "internal_type": "uint64", + "internalType": "uint64", "indexed": false } ], @@ -2500,15 +2479,13 @@ { "name": "previousOwner", "type": "address", - "components": null, - "internal_type": "address", + "internalType": "address", "indexed": true }, { "name": "newOwner", "type": "address", - "components": null, - "internal_type": "address", + "internalType": "address", "indexed": true } ], @@ -2521,29 +2498,25 @@ { "name": "subscriber", "type": "address", - "components": null, - "internal_type": "address", + "internalType": "address", "indexed": true }, { "name": "amount", "type": "uint256", - "components": null, - "internal_type": "uint256", + "internalType": "uint256", "indexed": false }, { "name": "encryptorSlots", "type": "uint128", - "components": null, - "internal_type": "uint128", + "internalType": "uint128", "indexed": false }, { "name": "endOfSubscription", "type": "uint32", - "components": null, - "internal_type": "uint32", + "internalType": "uint32", "indexed": false } ], @@ -2556,15 +2529,13 @@ { "name": "treasury", "type": "address", - "components": null, - "internal_type": "address", + "internalType": "address", "indexed": true }, { "name": "amount", "type": "uint256", - "components": null, - "internal_type": "uint256", + "internalType": "uint256", "indexed": false } ], @@ -2579,8 +2550,7 @@ { "name": "", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" } ] }, @@ -2593,8 +2563,7 @@ { "name": "", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ] }, @@ -2607,8 +2576,7 @@ { "name": "", "type": "address", - "components": null, - "internal_type": "contract GlobalAllowList" + "internalType": "contract GlobalAllowList" } ] }, @@ -2621,8 +2589,7 @@ { "name": "", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" } ] }, @@ -2635,8 +2602,7 @@ { "name": "", "type": "address", - "components": null, - "internal_type": "address" + "internalType": "address" } ] }, @@ -2649,8 +2615,7 @@ { "name": "", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ] }, @@ -2662,16 +2627,14 @@ { "name": "periodNumber", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ], "outputs": [ { "name": "", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ] }, @@ -2684,8 +2647,7 @@ { "name": "", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ] }, @@ -2697,8 +2659,7 @@ { "name": "ritualId", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" } ], "outputs": [] @@ -2711,20 +2672,17 @@ { "name": "ritualId", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" }, { "name": "addresses", "type": "address[]", - "components": null, - "internal_type": "address[]" + "internalType": "address[]" }, { "name": "value", "type": "bool", - "components": null, - "internal_type": "bool" + "internalType": "bool" } ], "outputs": [] @@ -2737,22 +2695,19 @@ { "name": "periodNumber", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ], "outputs": [ { "name": "paid", "type": "bool", - "components": null, - "internal_type": "bool" + "internalType": "bool" }, { "name": "encryptorSlots", "type": "uint128", - "components": null, - "internal_type": "uint128" + "internalType": "uint128" } ] }, @@ -2765,8 +2720,7 @@ { "name": "", "type": "address", - "components": null, - "internal_type": "contract Coordinator" + "internalType": "contract Coordinator" } ] }, @@ -2779,8 +2733,7 @@ { "name": "", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ] }, @@ -2792,22 +2745,19 @@ { "name": "encryptorSlots", "type": "uint128", - "components": null, - "internal_type": "uint128" + "internalType": "uint128" }, { "name": "duration", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" } ], "outputs": [ { "name": "", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ] }, @@ -2820,8 +2770,7 @@ { "name": "", "type": "address", - "components": null, - "internal_type": "contract IERC20" + "internalType": "contract IERC20" } ] }, @@ -2834,8 +2783,7 @@ { "name": "", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ] }, @@ -2848,8 +2796,7 @@ { "name": "endOfSubscription", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" } ] }, @@ -2861,16 +2808,14 @@ { "name": "periodNumber", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ], "outputs": [ { "name": "", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ] }, @@ -2883,8 +2828,7 @@ { "name": "", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ] }, @@ -2896,8 +2840,7 @@ { "name": "_treasury", "type": "address", - "components": null, - "internal_type": "address" + "internalType": "address" } ], "outputs": [] @@ -2910,16 +2853,14 @@ { "name": "periodNumber", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ], "outputs": [ { "name": "", "type": "bool", - "components": null, - "internal_type": "bool" + "internalType": "bool" } ] }, @@ -2932,8 +2873,7 @@ { "name": "", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ] }, @@ -2946,8 +2886,7 @@ { "name": "", "type": "address", - "components": null, - "internal_type": "address" + "internalType": "address" } ] }, @@ -2959,8 +2898,7 @@ { "name": "additionalEncryptorSlots", "type": "uint128", - "components": null, - "internal_type": "uint128" + "internalType": "uint128" } ], "outputs": [] @@ -2973,8 +2911,7 @@ { "name": "encryptorSlots", "type": "uint128", - "components": null, - "internal_type": "uint128" + "internalType": "uint128" } ], "outputs": [] @@ -2987,26 +2924,22 @@ { "name": "", "type": "address", - "components": null, - "internal_type": "address" + "internalType": "address" }, { "name": "ritualId", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" }, { "name": "", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" }, { "name": "", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" } ], "outputs": [] @@ -3019,26 +2952,22 @@ { "name": "initiator", "type": "address", - "components": null, - "internal_type": "address" + "internalType": "address" }, { "name": "ritualId", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" }, { "name": "numberOfProviders", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" }, { "name": "duration", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" } ], "outputs": [] @@ -3052,8 +2981,7 @@ { "name": "", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" } ] }, @@ -3073,8 +3001,7 @@ { "name": "", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" } ] }, @@ -3087,8 +3014,7 @@ { "name": "", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" } ] }, @@ -3100,8 +3026,7 @@ { "name": "newOwner", "type": "address", - "components": null, - "internal_type": "address" + "internalType": "address" } ], "outputs": [] @@ -3115,8 +3040,7 @@ { "name": "", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ] }, @@ -3128,8 +3052,7 @@ { "name": "amount", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ], "outputs": [] @@ -3143,8 +3066,7 @@ { "name": "", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" } ] } @@ -3164,16 +3086,6 @@ "name": "_application", "type": "address", "internalType": "contract ITACoChildApplication" - }, - { - "name": "_currency", - "type": "address", - "internalType": "contract IERC20" - }, - { - "name": "_feeRatePerSecond", - "type": "uint256", - "internalType": "uint256" } ] }, @@ -3225,33 +3137,6 @@ } ] }, - { - "type": "error", - "name": "AddressEmptyCode", - "inputs": [ - { - "name": "target", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "AddressInsufficientBalance", - "inputs": [ - { - "name": "account", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "FailedInnerCall", - "inputs": [] - }, { "type": "error", "name": "InvalidInitialization", @@ -3278,17 +3163,6 @@ } ] }, - { - "type": "error", - "name": "SafeERC20FailedOperation", - "inputs": [ - { - "name": "token", - "type": "address", - "internalType": "address" - } - ] - }, { "type": "event", "name": "AggregationPosted", @@ -3383,6 +3257,19 @@ ], "anonymous": false }, + { + "type": "event", + "name": "FeeModelApproved", + "inputs": [ + { + "name": "feeModel", + "type": "address", + "internalType": "contract IFeeModel", + "indexed": false + } + ], + "anonymous": false + }, { "type": "event", "name": "Initialized", @@ -3495,6 +3382,25 @@ ], "anonymous": false }, + { + "type": "event", + "name": "RitualExtended", + "inputs": [ + { + "name": "ritualId", + "type": "uint32", + "internalType": "uint32", + "indexed": true + }, + { + "name": "endTimestamp", + "type": "uint32", + "internalType": "uint32", + "indexed": false + } + ], + "anonymous": false + }, { "type": "event", "name": "RoleAdminChanged", @@ -3665,19 +3571,6 @@ } ] }, - { - "type": "function", - "name": "INITIATOR_ROLE", - "stateMutability": "view", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "bytes32", - "internalType": "bytes32" - } - ] - }, { "type": "function", "name": "TREASURY_ROLE", @@ -3711,6 +3604,19 @@ } ] }, + { + "type": "function", + "name": "approveFeeModel", + "stateMutability": "nonpayable", + "inputs": [ + { + "name": "feeModel", + "type": "address", + "internalType": "contract IFeeModel" + } + ], + "outputs": [] + }, { "type": "function", "name": "beginDefaultAdminTransfer", @@ -3765,33 +3671,33 @@ }, { "type": "function", - "name": "currency", + "name": "defaultAdmin", "stateMutability": "view", "inputs": [], "outputs": [ { "name": "", "type": "address", - "internalType": "contract IERC20" + "internalType": "address" } ] }, { "type": "function", - "name": "defaultAdmin", + "name": "defaultAdminDelay", "stateMutability": "view", "inputs": [], "outputs": [ { "name": "", - "type": "address", - "internalType": "address" + "type": "uint48", + "internalType": "uint48" } ] }, { "type": "function", - "name": "defaultAdminDelay", + "name": "defaultAdminDelayIncreaseWait", "stateMutability": "view", "inputs": [], "outputs": [ @@ -3804,57 +3710,101 @@ }, { "type": "function", - "name": "defaultAdminDelayIncreaseWait", + "name": "extendRitual", + "stateMutability": "nonpayable", + "inputs": [ + { + "name": "ritualId", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "duration", + "type": "uint32", + "internalType": "uint32" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "feeModelsRegistry", "stateMutability": "view", - "inputs": [], + "inputs": [ + { + "name": "", + "type": "address", + "internalType": "contract IFeeModel" + } + ], "outputs": [ { "name": "", - "type": "uint48", - "internalType": "uint48" + "type": "bool", + "internalType": "bool" } ] }, { "type": "function", - "name": "feeDeduction", - "stateMutability": "pure", + "name": "getAccessController", + "stateMutability": "view", "inputs": [ { - "name": "", - "type": "uint256", - "internalType": "uint256" - }, + "name": "ritualId", + "type": "uint32", + "internalType": "uint32" + } + ], + "outputs": [ { "name": "", - "type": "uint256", - "internalType": "uint256" + "type": "address", + "internalType": "contract IEncryptionAuthorizer" + } + ] + }, + { + "type": "function", + "name": "getAuthority", + "stateMutability": "view", + "inputs": [ + { + "name": "ritualId", + "type": "uint32", + "internalType": "uint32" } ], "outputs": [ { "name": "", - "type": "uint256", - "internalType": "uint256" + "type": "address", + "internalType": "address" } ] }, { "type": "function", - "name": "feeRatePerSecond", + "name": "getFeeModel", "stateMutability": "view", - "inputs": [], + "inputs": [ + { + "name": "ritualId", + "type": "uint32", + "internalType": "uint32" + } + ], "outputs": [ { "name": "", - "type": "uint256", - "internalType": "uint256" + "type": "address", + "internalType": "contract IFeeModel" } ] }, { "type": "function", - "name": "getAuthority", + "name": "getInitiator", "stateMutability": "view", "inputs": [ { @@ -4189,35 +4139,11 @@ }, { "type": "function", - "name": "getRitualInitiationCost", + "name": "getRitualState", "stateMutability": "view", "inputs": [ { - "name": "providers", - "type": "address[]", - "internalType": "address[]" - }, - { - "name": "duration", - "type": "uint32", - "internalType": "uint32" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "function", - "name": "getRitualState", - "stateMutability": "view", - "inputs": [ - { - "name": "ritualId", + "name": "ritualId", "type": "uint32", "internalType": "uint32" } @@ -4268,6 +4194,30 @@ } ] }, + { + "type": "function", + "name": "getTimestamps", + "stateMutability": "view", + "inputs": [ + { + "name": "ritualId", + "type": "uint32", + "internalType": "uint32" + } + ], + "outputs": [ + { + "name": "initTimestamp", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "endTimestamp", + "type": "uint32", + "internalType": "uint32" + } + ] + }, { "type": "function", "name": "grantRole", @@ -4338,6 +4288,11 @@ "name": "initiateRitual", "stateMutability": "nonpayable", "inputs": [ + { + "name": "feeModel", + "type": "address", + "internalType": "contract IFeeModel" + }, { "name": "providers", "type": "address[]", @@ -4396,19 +4351,6 @@ } ] }, - { - "type": "function", - "name": "isInitiationPublic", - "stateMutability": "view", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "bool", - "internalType": "bool" - } - ] - }, { "type": "function", "name": "isParticipant", @@ -4471,13 +4413,6 @@ } ] }, - { - "type": "function", - "name": "makeInitiationPublic", - "stateMutability": "nonpayable", - "inputs": [], - "outputs": [] - }, { "type": "function", "name": "maxDkgSize", @@ -4553,25 +4488,6 @@ } ] }, - { - "type": "function", - "name": "pendingFees", - "stateMutability": "view", - "inputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ] - }, { "type": "function", "name": "postAggregation", @@ -4630,25 +4546,6 @@ ], "outputs": [] }, - { - "type": "function", - "name": "processPendingFee", - "stateMutability": "nonpayable", - "inputs": [ - { - "name": "ritualId", - "type": "uint32", - "internalType": "uint32" - } - ], - "outputs": [ - { - "name": "refundableFee", - "type": "uint256", - "internalType": "uint256" - } - ] - }, { "type": "function", "name": "renounceRole", @@ -4768,6 +4665,11 @@ "name": "aggregatedTranscript", "type": "bytes", "internalType": "bytes" + }, + { + "name": "feeModel", + "type": "address", + "internalType": "contract IFeeModel" } ] }, @@ -4881,56 +4783,236 @@ }, { "type": "function", - "name": "totalPendingFees", + "name": "transferRitualAuthority", + "stateMutability": "nonpayable", + "inputs": [ + { + "name": "ritualId", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "newAuthority", + "type": "address", + "internalType": "address" + } + ], + "outputs": [] + } + ], + "tx_hash": "0x4207f1fd038945ef7d5da06a0989446d3ed2eb031adad1233c7e3a61951652a1", + "block_number": 5198668, + "deployer": "0x3B42d26E19FF860bC4dEbB920DD8caA53F93c600" + }, + "FreeFeeModel": { + "address": "0x14EB9BB700E45D2Ee9233056b8cc341276c688Ba", + "abi": [ + { + "type": "constructor", + "stateMutability": "nonpayable", + "inputs": [] + }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "internalType": "address", + "indexed": true + }, + { + "name": "newOwner", + "type": "address", + "internalType": "address", + "indexed": true + } + ], + "anonymous": false + }, + { + "type": "function", + "name": "approveInitiator", + "stateMutability": "nonpayable", + "inputs": [ + { + "name": "initiator", + "type": "address", + "internalType": "address" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "beforeIsAuthorized", + "stateMutability": "view", + "inputs": [ + { + "name": "ritualId", + "type": "uint32", + "internalType": "uint32" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "beforeSetAuthorization", + "stateMutability": "nonpayable", + "inputs": [ + { + "name": "ritualId", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "addresses", + "type": "address[]", + "internalType": "address[]" + }, + { + "name": "value", + "type": "bool", + "internalType": "bool" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "initiatorWhiteList", + "stateMutability": "view", + "inputs": [ + { + "name": "initiator", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "approved", + "type": "bool", + "internalType": "bool" + } + ] + }, + { + "type": "function", + "name": "owner", "stateMutability": "view", "inputs": [], "outputs": [ { "name": "", - "type": "uint256", - "internalType": "uint256" + "type": "address", + "internalType": "address" } ] }, { "type": "function", - "name": "transferRitualAuthority", + "name": "processRitualExtending", "stateMutability": "nonpayable", "inputs": [ { - "name": "ritualId", + "name": "initiator", + "type": "address", + "internalType": "address" + }, + { + "name": "", "type": "uint32", "internalType": "uint32" }, { - "name": "newAuthority", - "type": "address", - "internalType": "address" + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint32", + "internalType": "uint32" } ], "outputs": [] }, { "type": "function", - "name": "withdrawTokens", + "name": "processRitualPayment", "stateMutability": "nonpayable", "inputs": [ { - "name": "token", + "name": "initiator", "type": "address", - "internalType": "contract IERC20" + "internalType": "address" }, { - "name": "amount", + "name": "", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "", "type": "uint256", "internalType": "uint256" + }, + { + "name": "", + "type": "uint32", + "internalType": "uint32" + } + ], + "outputs": [] + }, + { + "type": "function", + "name": "renounceOwnership", + "stateMutability": "nonpayable", + "inputs": [], + "outputs": [] + }, + { + "type": "function", + "name": "transferOwnership", + "stateMutability": "nonpayable", + "inputs": [ + { + "name": "newOwner", + "type": "address", + "internalType": "address" } ], "outputs": [] } ], - "tx_hash": "0x4207f1fd038945ef7d5da06a0989446d3ed2eb031adad1233c7e3a61951652a1", - "block_number": 5198668, + "tx_hash": "0x9672d91bcbab5b746288e592e420c7cda089ef598023971d6525243d1504758b", + "block_number": 9106650, "deployer": "0x3B42d26E19FF860bC4dEbB920DD8caA53F93c600" }, "GlobalAllowList": { @@ -4943,8 +5025,7 @@ { "name": "_coordinator", "type": "address", - "components": null, - "internal_type": "contract Coordinator" + "internalType": "contract Coordinator" } ] }, @@ -4960,8 +5041,7 @@ { "name": "length", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ] }, @@ -4972,8 +5052,7 @@ { "name": "s", "type": "bytes32", - "components": null, - "internal_type": "bytes32" + "internalType": "bytes32" } ] }, @@ -4984,22 +5063,19 @@ { "name": "ritualId", "type": "uint32", - "components": null, - "internal_type": "uint32", + "internalType": "uint32", "indexed": true }, { "name": "_address", "type": "address", - "components": null, - "internal_type": "address", + "internalType": "address", "indexed": true }, { "name": "isAuthorized", "type": "bool", - "components": null, - "internal_type": "bool", + "internalType": "bool", "indexed": false } ], @@ -5014,8 +5090,7 @@ { "name": "", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" } ] }, @@ -5027,16 +5102,14 @@ { "name": "", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" } ], "outputs": [ { "name": "", "type": "uint256", - "components": null, - "internal_type": "uint256" + "internalType": "uint256" } ] }, @@ -5048,14 +5121,12 @@ { "name": "ritualId", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" }, { "name": "addresses", "type": "address[]", - "components": null, - "internal_type": "address[]" + "internalType": "address[]" } ], "outputs": [] @@ -5069,8 +5140,7 @@ { "name": "", "type": "address", - "components": null, - "internal_type": "contract Coordinator" + "internalType": "contract Coordinator" } ] }, @@ -5082,14 +5152,12 @@ { "name": "ritualId", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" }, { "name": "addresses", "type": "address[]", - "components": null, - "internal_type": "address[]" + "internalType": "address[]" } ], "outputs": [] @@ -5102,22 +5170,19 @@ { "name": "ritualId", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" }, { "name": "encryptor", "type": "address", - "components": null, - "internal_type": "address" + "internalType": "address" } ], "outputs": [ { "name": "", "type": "bool", - "components": null, - "internal_type": "bool" + "internalType": "bool" } ] }, @@ -5129,28 +5194,24 @@ { "name": "ritualId", "type": "uint32", - "components": null, - "internal_type": "uint32" + "internalType": "uint32" }, { "name": "evidence", "type": "bytes", - "components": null, - "internal_type": "bytes" + "internalType": "bytes" }, { "name": "ciphertextHeader", "type": "bytes", - "components": null, - "internal_type": "bytes" + "internalType": "bytes" } ], "outputs": [ { "name": "", "type": "bool", - "components": null, - "internal_type": "bool" + "internalType": "bool" } ] } diff --git a/deployment/constructor_params/lynx/free-fee-model.yml b/deployment/constructor_params/lynx/free-fee-model.yml new file mode 100644 index 00000000..b57535dd --- /dev/null +++ b/deployment/constructor_params/lynx/free-fee-model.yml @@ -0,0 +1,10 @@ +deployment: + name: lynx-free-fee-model + chain_id: 80002 + +artifacts: + dir: ./deployment/artifacts/ + filename: free-fee-model.json + +contracts: + - FreeFeeModel diff --git a/deployment/registry.py b/deployment/registry.py index 74c7b8b4..8e1483ef 100644 --- a/deployment/registry.py +++ b/deployment/registry.py @@ -6,6 +6,7 @@ from typing import Dict, List, NamedTuple, Optional from ape.contracts import ContractInstance +from ape import chain from eth_typing import ChecksumAddress from eth_utils import to_checksum_address from web3.types import ABI @@ -35,7 +36,7 @@ def _get_abi(contract_instance: ContractInstance) -> ABI: """Returns the ABI of a contract instance.""" contract_abi = list() for entry in contract_instance.contract_type.abi: - contract_abi.append(entry.dict()) + contract_abi.append(entry.model_dump()) return contract_abi @@ -59,7 +60,7 @@ def _get_entry( ) -> RegistryEntry: contract_abi = _get_abi(contract_instance) contract_name = _get_name(contract_instance=contract_instance, registry_names=registry_names) - receipt = contract_instance.receipt + receipt = chain.get_receipt(contract_instance.txn_hash) entry = RegistryEntry( name=contract_name, address=to_checksum_address(contract_instance.address), diff --git a/scripts/lynx/coordinator_approve_fee_model.py b/scripts/lynx/coordinator_approve_bqeth_fee_model.py similarity index 100% rename from scripts/lynx/coordinator_approve_fee_model.py rename to scripts/lynx/coordinator_approve_bqeth_fee_model.py diff --git a/scripts/lynx/coordinator_approve_free_fee_model.py b/scripts/lynx/coordinator_approve_free_fee_model.py new file mode 100644 index 00000000..32db8230 --- /dev/null +++ b/scripts/lynx/coordinator_approve_free_fee_model.py @@ -0,0 +1,25 @@ +#!/usr/bin/python3 + +from ape import project, networks + +from deployment.constants import ARTIFACTS_DIR +from deployment.params import Transactor +from deployment.registry import contracts_from_registry + +LYNX_REGISTRY_FILEPATH = ARTIFACTS_DIR / "lynx.json" + +def main(): + """ + Coordinator approves the fee model for Free Fee Model + + ape run lynx coordinator_approve_free_fee_model --network polygon:amoy:infura + """ + + transactor = Transactor() + deployments = contracts_from_registry( + filepath=LYNX_REGISTRY_FILEPATH, chain_id=networks.active_provider.chain_id + ) + coordinator = deployments[project.Coordinator.contract_type.name] + free_fee_model = deployments[project.FreeFeeModel.contract_type.name] + + transactor.transact(coordinator.approveFeeModel, free_fee_model.address) diff --git a/scripts/lynx/deploy_free_fee_model.py b/scripts/lynx/deploy_free_fee_model.py new file mode 100644 index 00000000..64d75852 --- /dev/null +++ b/scripts/lynx/deploy_free_fee_model.py @@ -0,0 +1,23 @@ +#!/usr/bin/python3 + +from ape import project + +from deployment.constants import ( + CONSTRUCTOR_PARAMS_DIR, ARTIFACTS_DIR, +) +from deployment.params import Deployer +from deployment.registry import merge_registries + +VERIFY = False +CONSTRUCTOR_PARAMS_FILEPATH = CONSTRUCTOR_PARAMS_DIR / "lynx" / "free-fee-model.yml" +LYNX_REGISTRY = ARTIFACTS_DIR / "lynx.json" + + +def main(): + deployer = Deployer.from_yaml(filepath=CONSTRUCTOR_PARAMS_FILEPATH, verify=VERIFY) + + free_fee_model = deployer.deploy(project.FreeFeeModel) + + deployments = [free_fee_model] + + deployer.finalize(deployments=deployments)