diff --git a/.env.sample b/.env.sample index 1f1dcd5a..f46079df 100644 --- a/.env.sample +++ b/.env.sample @@ -21,10 +21,6 @@ CSP_REPORT_URI= # subgraph urls SUBGRAPH_MAINNET=https://api.thegraph.com/subgraphs/name/lidofinance/lido -SUBGRAPH_ROPSTEN= -SUBGRAPH_RINKEBY= SUBGRAPH_GOERLI=https://api.thegraph.com/subgraphs/name/lidofinance/lido-testnet -SUBGRAPH_KOVAN= -SUBGRAPH_KINTSUGI= WALLETCONNECT_PROJECT_ID= diff --git a/abi/newReward/AddAllowedRecipient.abi.json b/abi/newReward/AddAllowedRecipient.abi.json new file mode 100644 index 00000000..c73e072e --- /dev/null +++ b/abi/newReward/AddAllowedRecipient.abi.json @@ -0,0 +1,60 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_trustedCaller", + "type": "address" + }, + { + "internalType": "address", + "name": "_allowedRecipientsRegistry", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "allowedRecipientsRegistry", + "outputs": [ + { + "internalType": "contract AllowedRecipientsRegistry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_creator", "type": "address" }, + { "internalType": "bytes", "name": "_evmScriptCallData", "type": "bytes" } + ], + "name": "createEVMScript", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes", "name": "_evmScriptCallData", "type": "bytes" } + ], + "name": "decodeEVMScriptCallData", + "outputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "string", "name": "", "type": "string" } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "trustedCaller", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/abi/newReward/AddAllowedRecipientLDO.abi.json b/abi/newReward/AddAllowedRecipientLDO.abi.json deleted file mode 100644 index cff62f3c..00000000 --- a/abi/newReward/AddAllowedRecipientLDO.abi.json +++ /dev/null @@ -1 +0,0 @@ -[{"inputs":[{"internalType":"address","name":"_trustedCaller","type":"address"},{"internalType":"address","name":"_allowedRecipientsRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"allowedRecipientsRegistry","outputs":[{"internalType":"contract AllowedRecipientsRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_creator","type":"address"},{"internalType":"bytes","name":"_evmScriptCallData","type":"bytes"}],"name":"createEVMScript","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_evmScriptCallData","type":"bytes"}],"name":"decodeEVMScriptCallData","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"trustedCaller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] diff --git a/abi/newReward/AllowedRecipientsRegistry.abi.json b/abi/newReward/AllowedRecipientsRegistry.abi.json new file mode 100644 index 00000000..a931f36a --- /dev/null +++ b/abi/newReward/AllowedRecipientsRegistry.abi.json @@ -0,0 +1,462 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "_admin", "type": "address" }, + { + "internalType": "address[]", + "name": "_addRecipientToAllowedListRoleHolders", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "_removeRecipientFromAllowedListRoleHolders", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "_setParametersRoleHolders", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "_updateSpentAmountRoleHolders", + "type": "address[]" + }, + { + "internalType": "contract IBokkyPooBahsDateTimeContract", + "name": "_bokkyPooBahsDateTimeContract", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_newAddress", + "type": "address" + } + ], + "name": "BokkyPooBahsDateTimeContractChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_periodStartTimestamp", + "type": "uint256" + } + ], + "name": "CurrentPeriodAdvanced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_limit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_periodDurationMonths", + "type": "uint256" + } + ], + "name": "LimitsParametersChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "_title", + "type": "string" + } + ], + "name": "RecipientAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_recipient", + "type": "address" + } + ], + "name": "RecipientRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_alreadySpentAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_spendableBalance", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_periodStartTimestamp", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_periodEndTimestamp", + "type": "uint256" + } + ], + "name": "SpendableAmountChanged", + "type": "event" + }, + { + "inputs": [], + "name": "ADD_RECIPIENT_TO_ALLOWED_LIST_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "REMOVE_RECIPIENT_FROM_ALLOWED_LIST_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SET_PARAMETERS_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "UPDATE_SPENT_AMOUNT_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_recipient", "type": "address" }, + { "internalType": "string", "name": "_title", "type": "string" } + ], + "name": "addRecipient", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "allowedRecipients", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "bokkyPooBahsDateTimeContract", + "outputs": [ + { + "internalType": "contract IBokkyPooBahsDateTimeContract", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllowedRecipients", + "outputs": [ + { "internalType": "address[]", "name": "", "type": "address[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLimitParameters", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPeriodState", + "outputs": [ + { + "internalType": "uint256", + "name": "_alreadySpentAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_spendableBalanceInPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_periodStartTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_periodEndTimestamp", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" } + ], + "name": "getRoleAdmin", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "hasRole", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_recipient", "type": "address" } + ], + "name": "isRecipientAllowed", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_payoutAmount", "type": "uint256" }, + { + "internalType": "uint256", + "name": "_motionDuration", + "type": "uint256" + } + ], + "name": "isUnderSpendableBalance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_recipient", "type": "address" } + ], + "name": "removeRecipient", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_bokkyPooBahsDateTimeContract", + "type": "address" + } + ], + "name": "setBokkyPooBahsDateTimeContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_limit", "type": "uint256" }, + { + "internalType": "uint256", + "name": "_periodDurationMonths", + "type": "uint256" + } + ], + "name": "setLimitParameters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "spendableBalance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" } + ], + "name": "supportsInterface", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_payoutAmount", "type": "uint256" } + ], + "name": "updateSpentAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/abi/newReward/AllowedRecipientsRegistryLDO.abi.json b/abi/newReward/AllowedRecipientsRegistryLDO.abi.json deleted file mode 100644 index 4166e5e3..00000000 --- a/abi/newReward/AllowedRecipientsRegistryLDO.abi.json +++ /dev/null @@ -1 +0,0 @@ -[{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"address[]","name":"_addRecipientToAllowedListRoleHolders","type":"address[]"},{"internalType":"address[]","name":"_removeRecipientFromAllowedListRoleHolders","type":"address[]"},{"internalType":"address[]","name":"_setParametersRoleHolders","type":"address[]"},{"internalType":"address[]","name":"_updateSpentAmountRoleHolders","type":"address[]"},{"internalType":"contract IBokkyPooBahsDateTimeContract","name":"_bokkyPooBahsDateTimeContract","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_newAddress","type":"address"}],"name":"BokkyPooBahsDateTimeContractChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_periodStartTimestamp","type":"uint256"}],"name":"CurrentPeriodAdvanced","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_limit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_periodDurationMonths","type":"uint256"}],"name":"LimitsParametersChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":false,"internalType":"string","name":"_title","type":"string"}],"name":"RecipientAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"}],"name":"RecipientRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_alreadySpentAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_spendableBalance","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_periodStartTimestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_periodEndTimestamp","type":"uint256"}],"name":"SpendableAmountChanged","type":"event"},{"inputs":[],"name":"ADD_RECIPIENT_TO_ALLOWED_LIST_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REMOVE_RECIPIENT_FROM_ALLOWED_LIST_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SET_PARAMETERS_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPDATE_SPENT_AMOUNT_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"string","name":"_title","type":"string"}],"name":"addRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allowedRecipients","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bokkyPooBahsDateTimeContract","outputs":[{"internalType":"contract IBokkyPooBahsDateTimeContract","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllowedRecipients","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLimitParameters","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPeriodState","outputs":[{"internalType":"uint256","name":"_alreadySpentAmount","type":"uint256"},{"internalType":"uint256","name":"_spendableBalanceInPeriod","type":"uint256"},{"internalType":"uint256","name":"_periodStartTimestamp","type":"uint256"},{"internalType":"uint256","name":"_periodEndTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"isRecipientAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_payoutAmount","type":"uint256"},{"internalType":"uint256","name":"_motionDuration","type":"uint256"}],"name":"isUnderSpendableBalance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"removeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_bokkyPooBahsDateTimeContract","type":"address"}],"name":"setBokkyPooBahsDateTimeContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_limit","type":"uint256"},{"internalType":"uint256","name":"_periodDurationMonths","type":"uint256"}],"name":"setLimitParameters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"spendableBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_payoutAmount","type":"uint256"}],"name":"updateSpentAmount","outputs":[],"stateMutability":"nonpayable","type":"function"}] diff --git a/abi/newReward/RemoveAllowedRecipient.abi.json b/abi/newReward/RemoveAllowedRecipient.abi.json new file mode 100644 index 00000000..25079835 --- /dev/null +++ b/abi/newReward/RemoveAllowedRecipient.abi.json @@ -0,0 +1,63 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_trustedCaller", + "type": "address" + }, + { + "internalType": "address", + "name": "_allowedRecipientsRegistry", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "allowedRecipientsRegistry", + "outputs": [ + { + "internalType": "contract AllowedRecipientsRegistry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_creator", "type": "address" }, + { "internalType": "bytes", "name": "_evmScriptCallData", "type": "bytes" } + ], + "name": "createEVMScript", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes", "name": "_evmScriptCallData", "type": "bytes" } + ], + "name": "decodeEVMScriptCallData", + "outputs": [ + { + "internalType": "address", + "name": "recipientAddress", + "type": "address" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "trustedCaller", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/abi/newReward/RemoveAllowedRecipientLDO.abi.json b/abi/newReward/RemoveAllowedRecipientLDO.abi.json deleted file mode 100644 index dcddeca9..00000000 --- a/abi/newReward/RemoveAllowedRecipientLDO.abi.json +++ /dev/null @@ -1 +0,0 @@ -[{"inputs":[{"internalType":"address","name":"_trustedCaller","type":"address"},{"internalType":"address","name":"_allowedRecipientsRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"allowedRecipientsRegistry","outputs":[{"internalType":"contract AllowedRecipientsRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_creator","type":"address"},{"internalType":"bytes","name":"_evmScriptCallData","type":"bytes"}],"name":"createEVMScript","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_evmScriptCallData","type":"bytes"}],"name":"decodeEVMScriptCallData","outputs":[{"internalType":"address","name":"recipientAddress","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"trustedCaller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] diff --git a/abi/newReward/TopUpAllowedRecipients.abi.json b/abi/newReward/TopUpAllowedRecipients.abi.json new file mode 100644 index 00000000..f8b591ad --- /dev/null +++ b/abi/newReward/TopUpAllowedRecipients.abi.json @@ -0,0 +1,92 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_trustedCaller", + "type": "address" + }, + { + "internalType": "address", + "name": "_allowedRecipientsRegistry", + "type": "address" + }, + { "internalType": "address", "name": "_finance", "type": "address" }, + { "internalType": "address", "name": "_token", "type": "address" }, + { "internalType": "address", "name": "_easyTrack", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "allowedRecipientsRegistry", + "outputs": [ + { + "internalType": "contract AllowedRecipientsRegistry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_creator", "type": "address" }, + { "internalType": "bytes", "name": "_evmScriptCallData", "type": "bytes" } + ], + "name": "createEVMScript", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes", "name": "_evmScriptCallData", "type": "bytes" } + ], + "name": "decodeEVMScriptCallData", + "outputs": [ + { + "internalType": "address[]", + "name": "recipients", + "type": "address[]" + }, + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "easyTrack", + "outputs": [ + { "internalType": "contract EasyTrack", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "finance", + "outputs": [ + { "internalType": "contract IFinance", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "trustedCaller", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/abi/newReward/TopUpAllowedRecipientsLDO.abi.json b/abi/newReward/TopUpAllowedRecipientsLDO.abi.json deleted file mode 100644 index 7ac84c5f..00000000 --- a/abi/newReward/TopUpAllowedRecipientsLDO.abi.json +++ /dev/null @@ -1 +0,0 @@ -[{"inputs":[{"internalType":"address","name":"_trustedCaller","type":"address"},{"internalType":"address","name":"_allowedRecipientsRegistry","type":"address"},{"internalType":"address","name":"_finance","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_easyTrack","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"allowedRecipientsRegistry","outputs":[{"internalType":"contract AllowedRecipientsRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_creator","type":"address"},{"internalType":"bytes","name":"_evmScriptCallData","type":"bytes"}],"name":"createEVMScript","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_evmScriptCallData","type":"bytes"}],"name":"decodeEVMScriptCallData","outputs":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"easyTrack","outputs":[{"internalType":"contract EasyTrack","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finance","outputs":[{"internalType":"contract IFinance","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"trustedCaller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] diff --git a/modules/blockChain/contractAddresses.ts b/modules/blockChain/contractAddresses.ts index a015b6ff..d5cc9f20 100644 --- a/modules/blockChain/contractAddresses.ts +++ b/modules/blockChain/contractAddresses.ts @@ -1,151 +1,97 @@ import { CHAINS } from '@lido-sdk/constants' +import type { ChainAddressMap } from './types' -export const NodeOperatorsRegistry = { +export const NodeOperatorsRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0x55032650b14df07b85bF18A3a3eC8E0Af2e028d5', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x7899EF901Ed9B331bAf7759c15D2e8728e8c2a2C', [CHAINS.Goerli]: '0x9D4AF1Ee19Dad8857db3a45B0374c81c8A1C6320', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const EasyTrack = { +export const EasyTrack: ChainAddressMap = { [CHAINS.Mainnet]: '0xF0211b7660680B49De1A7E9f25C65660F0a13Fea', - [CHAINS.Rinkeby]: '0x661090cB830757B2D0Cd53C49Bf0d17a28992e5d', [CHAINS.Goerli]: '0xAf072C8D368E4DD4A9d4fF6A76693887d6ae92Af', } -export const GovernanceToken = { +export const GovernanceToken: ChainAddressMap = { [CHAINS.Mainnet]: '0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x06c6Ab60F0Ad054236d7d4Faf98A5D33e852E717', [CHAINS.Goerli]: '0x56340274fB5a72af1A3C6609061c451De7961Bd4', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const RewardProgramRegistry = { +export const RewardProgramRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0x3129c041b372ee93a5a8756dc4ec6f154d85bc9a', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x648C8Be548F43eca4e482C0801Ebccccfb944931', [CHAINS.Goerli]: '0x28a08f61AE129d0d8BD4380Ae5647e7Add0527ca', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const ReferralPartnersRegistry = { +export const ReferralPartnersRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0xfCaD241D9D2A2766979A2de208E8210eDf7b7D4F', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0x4CB0c9987fd670069e4b24c653981E86b261A2ca', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const STETH = { +export const STETH: ChainAddressMap = { [CHAINS.Mainnet]: '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x06c6Ab60F0Ad054236d7d4Faf98A5D33e852E717', [CHAINS.Goerli]: '0x1643E812aE58766192Cf7D2Cf9567dF2C37e9B7F', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const DAI = { +export const DAI: ChainAddressMap = { [CHAINS.Mainnet]: '0x6B175474E89094C44Da98b954EedeAC495271d0F', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0x11fE4B6AE13d2a6055C8D9cF65c55bac32B5d844', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const Finance = { +export const Finance: ChainAddressMap = { [CHAINS.Mainnet]: '0xB9E5CBB9CA5b0d659238807E84D0176930753d86', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x72cd2b30020fb28de0dfa64d930a183eb732cf46', [CHAINS.Goerli]: '0x75c7b1D23f1cad7Fb4D60281d7069E46440BC179', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const AllowedRecipientRegistry = { +export const AllowedRecipientRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0xAa47c268e6b2D4ac7d7f7Ffb28A39484f5212c2A', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0xaDA19288575f611A6487365f0fE2A742a90BB2C6', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const AllowedRecipientReferralDaiRegistry = { +export const AllowedRecipientReferralDaiRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0xa295C212B44a48D07746d70d32Aa6Ca9b09Fb846', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0x8fB566b1e78e603a86b97ada5FcA858764dF4088', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const AllowedRecipientTrpLdoRegistry = { +export const AllowedRecipientTrpLdoRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0x231Ac69A1A37649C6B06a71Ab32DdD92158C80b8', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0x8C96a6522aEc036C4a384f8B7e05D93d6f3Dae39', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const LegoLDORegistry = { +export const LegoLDORegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0x97615f72c3428A393d65A84A3ea6BBD9ad6C0D74', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0x6342213719839c56fEe817539863aFB9821B03cb', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const LegoDAIRegistry = { +export const LegoDAIRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0xb0FE4D300334461523D9d61AaD90D0494e1Abb43', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0x5884f5849414D4317d175fEc144e2F87f699B082', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const RccDAIRegistry = { +export const RccDAIRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0xDc1A0C7849150f466F07d48b38eAA6cE99079f80', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0x1440E8aDbE3a42a9EDB4b30059df8F6c35205a15', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const PmlDAIRegistry = { +export const PmlDAIRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0xDFfCD3BF14796a62a804c1B16F877Cf7120379dB', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0xAadfBd1ADE92d85c967f4aE096141F0F802F46Db', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const AtcDAIRegistry = { +export const AtcDAIRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0xe07305F43B11F230EaA951002F6a55a16419B707', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0xedD3B813275e1A88c2283FAfa5bf5396938ef59e', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', } -export const gasFunderETHRegistry = { +export const gasFunderETHRegistry: ChainAddressMap = { [CHAINS.Mainnet]: '0xCf46c4c7f936dF6aE12091ADB9897E3F2363f16F', - [CHAINS.Ropsten]: '0x0000000000000000000000000000000000000000', - [CHAINS.Rinkeby]: '0x0000000000000000000000000000000000000000', [CHAINS.Goerli]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kovan]: '0x0000000000000000000000000000000000000000', - [CHAINS.Kintsugi]: '0x0000000000000000000000000000000000000000', +} + +export const StethRewardProgramRegistry: ChainAddressMap = { + [CHAINS.Mainnet]: '0x48c4929630099b217136b64089E8543dB0E5163a', + [CHAINS.Goerli]: '0x78797efCca6C537BF92FA6b25cBb14A6f1c128A0', +} + +export const StethGasSupplyRegistry: ChainAddressMap = { + [CHAINS.Mainnet]: '0x49d1363016aA899bba09ae972a1BF200dDf8C55F', + [CHAINS.Goerli]: '0xF08a5f00824D4554a1FBebaE726609418dc819fb', } diff --git a/modules/blockChain/contracts.ts b/modules/blockChain/contracts.ts index 9af90bad..0dbdbd1e 100644 --- a/modules/blockChain/contracts.ts +++ b/modules/blockChain/contracts.ts @@ -16,11 +16,11 @@ import { EvmAddReferralPartnerAbi__factory, EvmRemoveReferralPartnerAbi__factory, EvmTopUpReferralPartnersAbi__factory, - AllowedRecipientsRegistryLDOAbi__factory, - AllowedRecipientsRegistryLDOAbi, - AddAllowedRecipientLDOAbi__factory, - RemoveAllowedRecipientLDOAbi__factory, - TopUpAllowedRecipientsLDOAbi__factory, + AllowedRecipientsRegistryAbi__factory, + AllowedRecipientsRegistryAbi, + AddAllowedRecipientAbi__factory, + RemoveAllowedRecipientAbi__factory, + TopUpAllowedRecipientsAbi__factory, RegistryWithLimitsAbi__factory, RegistryWithLimitsAbi, TopUpWithLimitsAbi__factory, @@ -35,8 +35,7 @@ export type ContractTypeEasyTrack = EasyTrackAbi */ export type ContractTypeRewardProgramRegistry = RewardProgramRegistryAbi export type ContractTypeReferralPartnersRegistry = ReferralPartnersRegistryAbi -export type ContractTypeAllowedRecipientRegistry = - AllowedRecipientsRegistryLDOAbi +export type ContractTypeAllowedRecipientRegistry = AllowedRecipientsRegistryAbi export type ContractTypeRegistryWithLimits = RegistryWithLimitsAbi export const ContractNodeOperatorsRegistry = createContractHelpers({ @@ -58,57 +57,57 @@ export const ContractRewardProgramRegistry = createContractHelpers({ }) export const ContractAllowedRecipientRegistry = createContractHelpers({ - factory: AllowedRecipientsRegistryLDOAbi__factory, + factory: AllowedRecipientsRegistryAbi__factory, address: CONTRACT_ADDRESSES.AllowedRecipientRegistry, }) export const ContractEvmAllowedRecipientAdd = createContractHelpers({ - factory: AddAllowedRecipientLDOAbi__factory, + factory: AddAllowedRecipientAbi__factory, address: EvmAddressesByType[MotionType.AllowedRecipientAdd], }) export const ContractEvmAllowedRecipientRemove = createContractHelpers({ - factory: RemoveAllowedRecipientLDOAbi__factory, + factory: RemoveAllowedRecipientAbi__factory, address: EvmAddressesByType[MotionType.AllowedRecipientRemove], }) export const ContractEvmAllowedRecipientTopUp = createContractHelpers({ - factory: TopUpAllowedRecipientsLDOAbi__factory, + factory: TopUpAllowedRecipientsAbi__factory, address: EvmAddressesByType[MotionType.AllowedRecipientTopUp], }) // DAI Referral export const ContractAllowedRecipientReferralDaiRegistry = createContractHelpers({ - factory: AllowedRecipientsRegistryLDOAbi__factory, + factory: AllowedRecipientsRegistryAbi__factory, address: CONTRACT_ADDRESSES.AllowedRecipientReferralDaiRegistry, }) export const ContractEvmAllowedRecipientAddReferralDai = createContractHelpers({ - factory: AddAllowedRecipientLDOAbi__factory, + factory: AddAllowedRecipientAbi__factory, address: EvmAddressesByType[MotionType.AllowedRecipientAddReferralDai], }) export const ContractEvmAllowedRecipientRemoveReferralDai = createContractHelpers({ - factory: RemoveAllowedRecipientLDOAbi__factory, + factory: RemoveAllowedRecipientAbi__factory, address: EvmAddressesByType[MotionType.AllowedRecipientRemoveReferralDai], }) export const ContractEvmAllowedRecipientTopUpReferralDai = createContractHelpers({ - factory: TopUpAllowedRecipientsLDOAbi__factory, + factory: TopUpAllowedRecipientsAbi__factory, address: EvmAddressesByType[MotionType.AllowedRecipientTopUpReferralDai], }) // LDO TRP export const ContractAllowedRecipientTrpLdoRegistry = createContractHelpers({ - factory: AllowedRecipientsRegistryLDOAbi__factory, + factory: AllowedRecipientsRegistryAbi__factory, address: CONTRACT_ADDRESSES.AllowedRecipientTrpLdoRegistry, }) export const ContractEvmAllowedRecipientTopUpTrpLdo = createContractHelpers({ - factory: TopUpAllowedRecipientsLDOAbi__factory, + factory: TopUpAllowedRecipientsAbi__factory, address: EvmAddressesByType[MotionType.AllowedRecipientTopUpTrpLdo], }) @@ -230,3 +229,43 @@ export const ContractReferralPartnersRegistry = createContractHelpers({ factory: ReferralPartnersRegistryAbi__factory, address: CONTRACT_ADDRESSES.ReferralPartnersRegistry, }) + +export const ContractStethRewardProgramRegistry = createContractHelpers({ + factory: AllowedRecipientsRegistryAbi__factory, + address: CONTRACT_ADDRESSES.StethRewardProgramRegistry, +}) + +export const ContractStethRewardProgramAdd = createContractHelpers({ + factory: AddAllowedRecipientAbi__factory, + address: EvmAddressesByType[MotionType.StethRewardProgramAdd], +}) + +export const ContractStethRewardProgramRemove = createContractHelpers({ + factory: RemoveAllowedRecipientAbi__factory, + address: EvmAddressesByType[MotionType.StethRewardProgramRemove], +}) + +export const ContractStethRewardProgramTopUp = createContractHelpers({ + factory: TopUpAllowedRecipientsAbi__factory, + address: EvmAddressesByType[MotionType.StethRewardProgramTopUp], +}) + +export const ContractStethGasSupplyRegistry = createContractHelpers({ + factory: AllowedRecipientsRegistryAbi__factory, + address: CONTRACT_ADDRESSES.StethGasSupplyRegistry, +}) + +export const ContractStethGasSupplyAdd = createContractHelpers({ + factory: AddAllowedRecipientAbi__factory, + address: EvmAddressesByType[MotionType.StethGasSupplyAdd], +}) + +export const ContractStethGasSupplyRemove = createContractHelpers({ + factory: RemoveAllowedRecipientAbi__factory, + address: EvmAddressesByType[MotionType.StethGasSupplyRemove], +}) + +export const ContractStethGasSupplyTopUp = createContractHelpers({ + factory: TopUpAllowedRecipientsAbi__factory, + address: EvmAddressesByType[MotionType.StethGasSupplyTopUp], +}) diff --git a/modules/blockChain/hooks/useGnosisOpener.ts b/modules/blockChain/hooks/useGnosisOpener.ts index fdee8f63..d5f27972 100644 --- a/modules/blockChain/hooks/useGnosisOpener.ts +++ b/modules/blockChain/hooks/useGnosisOpener.ts @@ -3,10 +3,10 @@ import { useWeb3 } from 'modules/blockChain/hooks/useWeb3' import { openWindow } from 'modules/shared/utils/openWindow' import { getGnosisSafeLink } from '../utils/getGnosisSafeLink' -export function useGnosisOpener(address: string, linkAddition?: string) { +export function useGnosisOpener(address: string, txHash: string) { const { chainId } = useWeb3() return useCallback(() => { - const link = getGnosisSafeLink(chainId, `${address}${linkAddition || ''}`) + const link = getGnosisSafeLink(chainId, address, txHash) openWindow(link) - }, [chainId, address, linkAddition]) + }, [chainId, address, txHash]) } diff --git a/modules/blockChain/hooks/useTransactionSender.ts b/modules/blockChain/hooks/useTransactionSender.ts index 5eb18190..f61632a7 100644 --- a/modules/blockChain/hooks/useTransactionSender.ts +++ b/modules/blockChain/hooks/useTransactionSender.ts @@ -81,7 +81,11 @@ export function useTransactionSender( if (!resultTx) return const link = resultTx.type === 'safe' - ? getGnosisSafeLink(chainId, `${walletAddress}`) + ? getGnosisSafeLink( + chainId, + String(walletAddress), + resultTx.tx.safeTxHash, + ) : getEtherscanLink(chainId, resultTx.tx.hash, 'tx') openWindow(link) }, [chainId, resultTx, walletAddress]) diff --git a/modules/blockChain/types.ts b/modules/blockChain/types.ts index a67b1946..e55dcda9 100644 --- a/modules/blockChain/types.ts +++ b/modules/blockChain/types.ts @@ -1,4 +1,5 @@ import { ContractTransaction } from '@ethersproject/contracts' +import type { CHAINS } from '@lido-sdk/constants' export type SafeTx = { safeTxHash: string @@ -15,3 +16,5 @@ export type ResultTx = } export type TxStatus = 'empty' | 'pending' | 'failed' | 'success' + +export type ChainAddressMap = Partial> diff --git a/modules/blockChain/utils/getBackendRpcUrl.ts b/modules/blockChain/utils/getBackendRpcUrl.ts index f1cef7f8..06c46bb7 100644 --- a/modules/blockChain/utils/getBackendRpcUrl.ts +++ b/modules/blockChain/utils/getBackendRpcUrl.ts @@ -9,7 +9,4 @@ export const getBackendRpcUrl = (chainId: CHAINS) => { export const backendRPC = { [CHAINS.Mainnet]: getBackendRpcUrl(CHAINS.Mainnet), [CHAINS.Goerli]: getBackendRpcUrl(CHAINS.Goerli), - [CHAINS.Kovan]: getBackendRpcUrl(CHAINS.Kovan), - [CHAINS.Rinkeby]: getBackendRpcUrl(CHAINS.Rinkeby), - [CHAINS.Ropsten]: getBackendRpcUrl(CHAINS.Ropsten), } diff --git a/modules/blockChain/utils/getGnosisSafeLink.ts b/modules/blockChain/utils/getGnosisSafeLink.ts index 986671d7..6773fd65 100644 --- a/modules/blockChain/utils/getGnosisSafeLink.ts +++ b/modules/blockChain/utils/getGnosisSafeLink.ts @@ -6,9 +6,11 @@ const PREFIXES = { [CHAINS.Goerli]: 'gor', } as const -export const getGnosisSafeLink = (chainId: CHAINS, address: string) => - `https://app.safe.global/transactions/history?safe=${get( - PREFIXES, - chainId, - '?', - )}:${address}` +export const getGnosisSafeLink = ( + chainId: CHAINS, + address: string, + txHash: string, +) => { + const chain = get(PREFIXES, chainId, '?') + return `https://app.safe.global/transactions/tx?safe=${chain}:${address}&id=multisig_${address}_${txHash}` +} diff --git a/modules/motions/constants.ts b/modules/motions/constants.ts index 7f61ed26..b84f89ce 100644 --- a/modules/motions/constants.ts +++ b/modules/motions/constants.ts @@ -4,17 +4,13 @@ import * as CONTRACT_ADDRESSES from 'modules/blockChain/contractAddresses' export const MOTION_ATTENTION_PERIOD = 1 / 24 // https://snapshot.org/#/lido-snapshot.eth/proposal/0x75b331e650af1dc6bc98d4e705cfe19c74c55c02a53ad2ae85e207c6004ce847 -export const TRANSITION_LIMITS = [ - CHAINS.Mainnet, - CHAINS.Rinkeby, - CHAINS.Goerli, -].reduce( +export const TRANSITION_LIMITS = [CHAINS.Mainnet, CHAINS.Goerli].reduce( (res, chain) => ({ ...res, [chain]: { '0x0000000000000000000000000000000000000000': 1000, - [CONTRACT_ADDRESSES.STETH[chain]]: 1000, - [CONTRACT_ADDRESSES.GovernanceToken[chain]]: 5000000, + [CONTRACT_ADDRESSES.STETH[chain]!]: 1000, + [CONTRACT_ADDRESSES.GovernanceToken[chain]!]: 5000000, }, }), {} as Record>, diff --git a/modules/motions/evmAddresses.ts b/modules/motions/evmAddresses.ts index aea2a07b..96029df3 100644 --- a/modules/motions/evmAddresses.ts +++ b/modules/motions/evmAddresses.ts @@ -13,12 +13,33 @@ export const EvmAddressesByChain = { [MotionType.NodeOperatorIncreaseLimit]: '0xFeBd8FAC16De88206d4b18764e826AF38546AfE0', [MotionType.LEGOTopUp]: '0x648C8Be548F43eca4e482C0801Ebccccfb944931', - // @deprecated + [MotionType.AllowedRecipientTopUpTrpLdo]: + '0xBd2b6dC189EefD51B273F5cb2d99BA1ce565fb8C', + [MotionType.LegoLDOTopUp]: '0x00caAeF11EC545B192f16313F53912E453c91458', + [MotionType.LegoDAITopUp]: '0x0535a67ea2D6d46f85fE568B7EaA91Ca16824FEC', + [MotionType.RccDAITopUp]: '0x84f74733ede9bFD53c1B3Ea96338867C94EC313e', + [MotionType.PmlDAITopUp]: '0x4E6D3A5023A38cE2C4c5456d3760357fD93A22cD', + [MotionType.AtcDAITopUp]: '0x67Fb97ABB9035E2e93A7e3761a0d0571c5d7CD07', + [MotionType.GasFunderETHTopUp]: + '0x41F9daC5F89092dD6061E59578A2611849317dc8', + [MotionType.StethRewardProgramAdd]: + '0x935cb3366Faf2cFC415B2099d1F974Fd27202b77', + [MotionType.StethRewardProgramRemove]: + '0x22010d1747CaFc370b1f1FBBa61022A313c5693b', + [MotionType.StethRewardProgramTopUp]: + '0x1F2b79FE297B7098875930bBA6dd17068103897E', + [MotionType.StethGasSupplyAdd]: + '0x48c135Ff690C2Aa7F5B11C539104B5855A4f9252', + [MotionType.StethGasSupplyRemove]: + '0x7E8eFfAb3083fB26aCE6832bFcA4C377905F97d7', + [MotionType.StethGasSupplyTopUp]: + '0x200dA0b6a9905A377CF8D469664C65dB267009d1', + + // next motion factories are @deprecated + // we are keeping them here to display history data [MotionType.RewardProgramAdd]: '0x9D15032b91d01d5c1D940eb919461426AB0dD4e3', - // @deprecated [MotionType.RewardProgramRemove]: '0xc21e5e72Ffc223f02fC410aAedE3084a63963932', - // @deprecated [MotionType.RewardProgramTopUp]: '0x77781A93C4824d2299a38AC8bBB11eb3cd6Bc3B7', [MotionType.ReferralPartnerAdd]: @@ -39,46 +60,6 @@ export const EvmAddressesByChain = { '0xd8f9B72Cd97388f23814ECF429cd18815F6352c1', [MotionType.AllowedRecipientTopUpReferralDai]: '0x009ffa22ce4388d2F5De128Ca8E6fD229A312450', - [MotionType.AllowedRecipientTopUpTrpLdo]: - '0xBd2b6dC189EefD51B273F5cb2d99BA1ce565fb8C', - [MotionType.LegoLDOTopUp]: '0x00caAeF11EC545B192f16313F53912E453c91458', - [MotionType.LegoDAITopUp]: '0x0535a67ea2D6d46f85fE568B7EaA91Ca16824FEC', - [MotionType.RccDAITopUp]: '0x84f74733ede9bFD53c1B3Ea96338867C94EC313e', - [MotionType.PmlDAITopUp]: '0x4E6D3A5023A38cE2C4c5456d3760357fD93A22cD', - [MotionType.AtcDAITopUp]: '0x67Fb97ABB9035E2e93A7e3761a0d0571c5d7CD07', - [MotionType.GasFunderETHTopUp]: - '0x41F9daC5F89092dD6061E59578A2611849317dc8', - }, - - // Rinkeby - [CHAINS.Rinkeby]: { - [MotionType.NodeOperatorIncreaseLimit]: - '0xFE5986E06210aC1eCC1aDCafc0cc7f8D63B3F977', - [MotionType.LEGOTopUp]: '0xdA53fF207966b3946facaC52dD22B130D507d276', - // @deprecated - [MotionType.RewardProgramAdd]: '0x3129C041B372eE93a5A8756dc4EC6f154D85Bc9a', - // @deprecated - [MotionType.RewardProgramRemove]: - '0xc21e5e72Ffc223f02fC410aAedE3084a63963932', - // @deprecated - [MotionType.RewardProgramTopUp]: - '0xbb0f594143208eCd04DC7AAe48955902A716F9F7', - [MotionType.ReferralPartnerAdd]: '0x', - [MotionType.ReferralPartnerRemove]: '0x', - [MotionType.ReferralPartnerTopUp]: '0x', - [MotionType.AllowedRecipientAdd]: '0x', - [MotionType.AllowedRecipientRemove]: '0x', - [MotionType.AllowedRecipientTopUp]: '0x', - [MotionType.AllowedRecipientAddReferralDai]: '0x', - [MotionType.AllowedRecipientRemoveReferralDai]: '0x', - [MotionType.AllowedRecipientTopUpReferralDai]: '0x', - [MotionType.AllowedRecipientTopUpTrpLdo]: '0x', - [MotionType.LegoLDOTopUp]: '0x', - [MotionType.LegoDAITopUp]: '0x', - [MotionType.RccDAITopUp]: '0x', - [MotionType.PmlDAITopUp]: '0x', - [MotionType.AtcDAITopUp]: '0x', - [MotionType.GasFunderETHTopUp]: '0x', }, // Goerli @@ -86,12 +67,32 @@ export const EvmAddressesByChain = { [MotionType.NodeOperatorIncreaseLimit]: '0xE033673D83a8a60500BcE02aBd9007ffAB587714', [MotionType.LEGOTopUp]: '0xb2bcf211F103d7F13789394DD475c2274e044C4C', - // @deprecated + [MotionType.AllowedRecipientTopUpTrpLdo]: + '0x43f33C52156d1Fb2eA24d82aBfD342E69835E79f', + [MotionType.LegoLDOTopUp]: '0xc39Dd5B66968e364D99e0c9E7089049351AB89CA', + [MotionType.LegoDAITopUp]: '0xbf44eC2b23cA105F8a62e0587900a09A473288c6', + [MotionType.RccDAITopUp]: '0xd0411e7c4A24E7d4509D5F13AEd19aeb8e5644AB', + [MotionType.PmlDAITopUp]: '0xc749aD24572263887Bc888d3Cb854FCD50eCCB61', + [MotionType.AtcDAITopUp]: '0xF4b8b5760EE4b5c5Cb154edd0f0841465d821006', + [MotionType.GasFunderETHTopUp]: '0x', + [MotionType.StethRewardProgramAdd]: + '0x785A8B1CDC03Bb191670Ed4696e9ED5B11Af910A', + [MotionType.StethRewardProgramRemove]: + '0xEFEa524D1739800fF6F7d2532ED4C8508220239a', + [MotionType.StethRewardProgramTopUp]: + '0xF2f7FC1E8879c10D4579Bc82D5FEa923A5a228dE', + [MotionType.StethGasSupplyAdd]: + '0xa2286d37Af8F8e84428151bF72922c5Fe5c1EeED', + [MotionType.StethGasSupplyRemove]: + '0x48D01979eD9e6CE70a6496B111F5728f9a547C96', + [MotionType.StethGasSupplyTopUp]: + '0x960CcA0BE6419e9684796Ce3ABE980E8a2d0cd80', + + // next motion factories are @deprecated + // we are keeping them here to display history data [MotionType.RewardProgramAdd]: '0x5560d40b00EA3a64E9431f97B3c79b04e0cdF6F2', - // @deprecated [MotionType.RewardProgramRemove]: '0x31B68d81125E52fE1aDfe4076F8945D1014753b5', - // @deprecated [MotionType.RewardProgramTopUp]: '0x8180949ac41EF18e844ff8dafE604a195d86Aea9', [MotionType.ReferralPartnerAdd]: @@ -112,14 +113,6 @@ export const EvmAddressesByChain = { '0x5FEC0bcd7519C4fE41eca5Fe1dD94345fA100A67', [MotionType.AllowedRecipientTopUpReferralDai]: '0x9534A77029D57E249c467E5A1E0854cc26Cd75A0', - [MotionType.AllowedRecipientTopUpTrpLdo]: - '0x43f33C52156d1Fb2eA24d82aBfD342E69835E79f', - [MotionType.LegoLDOTopUp]: '0xc39Dd5B66968e364D99e0c9E7089049351AB89CA', - [MotionType.LegoDAITopUp]: '0xbf44eC2b23cA105F8a62e0587900a09A473288c6', - [MotionType.RccDAITopUp]: '0xd0411e7c4A24E7d4509D5F13AEd19aeb8e5644AB', - [MotionType.PmlDAITopUp]: '0xc749aD24572263887Bc888d3Cb854FCD50eCCB61', - [MotionType.AtcDAITopUp]: '0xF4b8b5760EE4b5c5Cb154edd0f0841465d821006', - [MotionType.GasFunderETHTopUp]: '0x', }, } diff --git a/modules/motions/hooks/useAvailableMotions.ts b/modules/motions/hooks/useAvailableMotions.ts index eb36db4b..328c8efd 100644 --- a/modules/motions/hooks/useAvailableMotions.ts +++ b/modules/motions/hooks/useAvailableMotions.ts @@ -7,17 +7,10 @@ import { EvmTypesByAdress, parseEvmSupportedChainId, } from 'modules/motions/evmAddresses' -import { MotionType } from 'modules/motions/types' import { useNodeOperatorsList } from './useNodeOperatorsList' import { EVM_CONTRACTS } from './useContractEvmScript' - -export const HIDDEN_MOTIONS = [ - 'RewardProgramAdd', - 'RewardProgramRemove', - 'RewardProgramTopUp', - 'LEGOTopUp', -] +import { MotionTypeForms } from 'modules/motions/types' const isHasTrustedCaller = ( contract: unknown, @@ -30,7 +23,7 @@ const isHasTrustedCaller = ( export const useAvailableMotions = () => { const { chainId, walletAddress } = useWeb3() const [availableMotions, setAvailableMotions] = - useState>() + useState>() const nodeOperators = useNodeOperatorsList() const currentNodeOperator = useMemo(() => { @@ -47,18 +40,16 @@ export const useAvailableMotions = () => { Boolean(currentNodeOperator) const nodeOperatorIncreaseLimitAddressMap = - EvmAddressesByType[MotionType.NodeOperatorIncreaseLimit] + EvmAddressesByType[MotionTypeForms.NodeOperatorIncreaseLimit] const nodeOperatorIncreaseLimitAddress = nodeOperatorIncreaseLimitAddressMap[parseEvmSupportedChainId(chainId)] - const contracts = useMemo( - () => - Object.values(EVM_CONTRACTS).filter( - contract => - contract.address[chainId] !== nodeOperatorIncreaseLimitAddress, - ), - [chainId, nodeOperatorIncreaseLimitAddress], - ) + const contracts = useMemo(() => { + return Object.values(EVM_CONTRACTS).filter( + contract => + contract.address[chainId] !== nodeOperatorIncreaseLimitAddress, + ) + }, [chainId, nodeOperatorIncreaseLimitAddress]) const getTrustedConnectionInfo = useCallback(async () => { const promiseResult = await Promise.allSettled( @@ -80,14 +71,15 @@ export const useAvailableMotions = () => { const contractType = EvmTypesByAdress[parseEvmSupportedChainId(chainId)][contractAddress] - if (HIDDEN_MOTIONS.includes(contractType)) return acc - acc[contractType] = cur.value === walletAddress + if (!Object.keys(MotionTypeForms).includes(contractType)) return acc + + acc[contractType as MotionTypeForms] = cur.value === walletAddress return acc }, { - [MotionType.NodeOperatorIncreaseLimit]: isNodeOperatorConnected, - } as Record, + [MotionTypeForms.NodeOperatorIncreaseLimit]: isNodeOperatorConnected, + } as Record, ) setAvailableMotions(trustedCallerConnectedMap) diff --git a/modules/motions/hooks/useContractEvmScript.ts b/modules/motions/hooks/useContractEvmScript.ts index b9ace38d..4e9f5cfd 100644 --- a/modules/motions/hooks/useContractEvmScript.ts +++ b/modules/motions/hooks/useContractEvmScript.ts @@ -25,6 +25,12 @@ import { ContractEvmPmlDAITopUp, ContractEvmAtcDAITopUp, ContractEvmGasFunderETHTopUp, + ContractStethRewardProgramAdd, + ContractStethRewardProgramRemove, + ContractStethRewardProgramTopUp, + ContractStethGasSupplyAdd, + ContractStethGasSupplyRemove, + ContractStethGasSupplyTopUp, } from 'modules/blockChain/contracts' import { EvmUnrecognized } from '../evmAddresses' @@ -54,6 +60,12 @@ export const EVM_CONTRACTS = { [MotionType.PmlDAITopUp]: ContractEvmPmlDAITopUp, [MotionType.AtcDAITopUp]: ContractEvmAtcDAITopUp, [MotionType.GasFunderETHTopUp]: ContractEvmGasFunderETHTopUp, + [MotionType.StethRewardProgramAdd]: ContractStethRewardProgramAdd, + [MotionType.StethRewardProgramRemove]: ContractStethRewardProgramRemove, + [MotionType.StethRewardProgramTopUp]: ContractStethRewardProgramTopUp, + [MotionType.StethGasSupplyAdd]: ContractStethGasSupplyAdd, + [MotionType.StethGasSupplyRemove]: ContractStethGasSupplyRemove, + [MotionType.StethGasSupplyTopUp]: ContractStethGasSupplyTopUp, } as const export function useContractEvmScript( diff --git a/modules/motions/hooks/useEVMScriptDecoder.ts b/modules/motions/hooks/useEVMScriptDecoder.ts index 1df32763..4e28ab49 100644 --- a/modules/motions/hooks/useEVMScriptDecoder.ts +++ b/modules/motions/hooks/useEVMScriptDecoder.ts @@ -4,48 +4,45 @@ import { useWeb3 } from 'modules/blockChain/hooks/useWeb3' import { EVMScriptDecoder } from '@lidofinance/evm-script-decoder/lib/EVMScriptDecoder' import { ABIProviderLocal } from '@lidofinance/evm-script-decoder/lib/ABIProviderLocal' -import ReferralPartnersRegistry from 'abi/ReferralPartnersRegistry.abi.json' -import RewardProgramRegistryAbi from 'abi/RewardProgramRegistry.abi.json' -import NodeOperatorsRegistryAbi from 'abi/NodeOperators.abi.json' -import AllowedRecipientsRegistryLDOAbi from 'abi/newReward/AllowedRecipientsRegistryLDO.abi.json' -import RegistryWithLimitsAbi from 'abi/TopUp/RegistryWithLimits.abi.json' -import FinanceAbi from 'abi/Finance.abi.json' -import * as CONTRACT_ADDRESSES from 'modules/blockChain/contractAddresses' +import * as abis from 'generated' +import * as ADDR from 'modules/blockChain/contractAddresses' export function useEVMScriptDecoder() { const { chainId } = useWeb3() - return useGlobalMemo( - () => - new EVMScriptDecoder( - new ABIProviderLocal({ - [CONTRACT_ADDRESSES.ReferralPartnersRegistry[chainId]]: - ReferralPartnersRegistry as any, - [CONTRACT_ADDRESSES.RewardProgramRegistry[chainId]]: - RewardProgramRegistryAbi as any, - [CONTRACT_ADDRESSES.NodeOperatorsRegistry[chainId]]: - NodeOperatorsRegistryAbi as any, - [CONTRACT_ADDRESSES.Finance[chainId]]: FinanceAbi as any, - [CONTRACT_ADDRESSES.AllowedRecipientRegistry[chainId]]: - AllowedRecipientsRegistryLDOAbi as any, - [CONTRACT_ADDRESSES.AllowedRecipientReferralDaiRegistry[chainId]]: - AllowedRecipientsRegistryLDOAbi as any, - [CONTRACT_ADDRESSES.AllowedRecipientTrpLdoRegistry[chainId]]: - AllowedRecipientsRegistryLDOAbi as any, - [CONTRACT_ADDRESSES.LegoLDORegistry[chainId]]: - RegistryWithLimitsAbi as any, - [CONTRACT_ADDRESSES.LegoDAIRegistry[chainId]]: - RegistryWithLimitsAbi as any, - [CONTRACT_ADDRESSES.RccDAIRegistry[chainId]]: - RegistryWithLimitsAbi as any, - [CONTRACT_ADDRESSES.PmlDAIRegistry[chainId]]: - RegistryWithLimitsAbi as any, - [CONTRACT_ADDRESSES.AtcDAIRegistry[chainId]]: - RegistryWithLimitsAbi as any, - [CONTRACT_ADDRESSES.gasFunderETHRegistry[chainId]]: - RegistryWithLimitsAbi as any, - }), - ), - `evm-script-decoder-${chainId}`, - ) + return useGlobalMemo(() => { + const KEYS = Object.keys(ADDR).reduce( + (keys, contractName: keyof typeof ADDR) => ({ + ...keys, + [contractName]: ADDR[contractName][chainId]!, + }), + {} as Record, + ) + + return new EVMScriptDecoder( + new ABIProviderLocal({ + [KEYS.ReferralPartnersRegistry]: abis + .ReferralPartnersRegistryAbi__factory.abi as any, + [KEYS.RewardProgramRegistry]: + abis.RewardProgramRegistryAbi__factory.abi, + [KEYS.NodeOperatorsRegistry]: abis.NodeOperatorsAbi__factory.abi, + [KEYS.Finance]: abis.FinanceAbi__factory.abi, + [KEYS.AllowedRecipientRegistry]: + abis.AllowedRecipientsRegistryAbi__factory.abi, + [KEYS.AllowedRecipientReferralDaiRegistry]: + abis.AllowedRecipientsRegistryAbi__factory.abi, + [KEYS.AllowedRecipientTrpLdoRegistry]: + abis.AllowedRecipientsRegistryAbi__factory.abi, + [KEYS.LegoLDORegistry]: abis.RegistryWithLimitsAbi__factory.abi, + [KEYS.LegoDAIRegistry]: abis.RegistryWithLimitsAbi__factory.abi, + [KEYS.RccDAIRegistry]: abis.RegistryWithLimitsAbi__factory.abi, + [KEYS.PmlDAIRegistry]: abis.RegistryWithLimitsAbi__factory.abi, + [KEYS.AtcDAIRegistry]: abis.RegistryWithLimitsAbi__factory.abi, + [KEYS.gasFunderETHRegistry]: abis.RegistryWithLimitsAbi__factory.abi, + [KEYS.StethRewardProgramRegistry]: + abis.RegistryWithLimitsAbi__factory.abi, + [KEYS.StethGasSupplyRegistry]: abis.RegistryWithLimitsAbi__factory.abi, + }), + ) + }, `evm-script-decoder-${chainId}`) } diff --git a/modules/motions/hooks/useLegoTokenOptions.ts b/modules/motions/hooks/useLegoTokenOptions.ts index 6d9a495a..00ef4f39 100644 --- a/modules/motions/hooks/useLegoTokenOptions.ts +++ b/modules/motions/hooks/useLegoTokenOptions.ts @@ -14,15 +14,15 @@ export function useLegoTokenOptions() { }, { label: governanceSymbol || '', - value: CONTRACT_ADDRESSES.GovernanceToken[chainId], + value: CONTRACT_ADDRESSES.GovernanceToken[chainId]!, }, { label: 'stETH', - value: CONTRACT_ADDRESSES.STETH[chainId], + value: CONTRACT_ADDRESSES.STETH[chainId]!, }, { label: 'DAI', - value: CONTRACT_ADDRESSES.DAI[chainId], + value: CONTRACT_ADDRESSES.DAI[chainId]!, }, ], [governanceSymbol, chainId], diff --git a/modules/motions/hooks/usePeriodLimitsInfo.ts b/modules/motions/hooks/usePeriodLimitsInfo.ts index 793520a3..3861f2f0 100644 --- a/modules/motions/hooks/usePeriodLimitsInfo.ts +++ b/modules/motions/hooks/usePeriodLimitsInfo.ts @@ -11,6 +11,7 @@ import { ContractAtcDAIRegistry, ContractGasFunderETHRegistry, ContractPmlDAIRegistry, + ContractStethRewardProgramRegistry, } from 'modules/blockChain/contracts' import { useWeb3 } from 'modules/blockChain/hooks/useWeb3' import { useSWR, SWRResponse } from 'modules/network/hooks/useSwr' @@ -111,6 +112,7 @@ const registryByMotionType: { ContractAllowedRecipientReferralDaiRegistry, [MotionType.AllowedRecipientTopUpTrpLdo]: ContractAllowedRecipientTrpLdoRegistry, + [MotionType.StethRewardProgramTopUp]: ContractStethRewardProgramRegistry, } export const usePeriodLimitsInfoByMotionType = (props: { diff --git a/modules/motions/hooks/useRegistryWithLimits.ts b/modules/motions/hooks/useRegistryWithLimits.ts index 943bf033..a504af85 100644 --- a/modules/motions/hooks/useRegistryWithLimits.ts +++ b/modules/motions/hooks/useRegistryWithLimits.ts @@ -11,6 +11,8 @@ import { ContractAllowedRecipientRegistry, ContractAllowedRecipientReferralDaiRegistry, ContractAllowedRecipientTrpLdoRegistry, + ContractStethRewardProgramRegistry, + ContractStethGasSupplyRegistry, } from 'modules/blockChain/contracts' import { getEventsRecipientAdded } from 'modules/motions/utils' import { MotionType } from 'modules/motions/types' @@ -40,6 +42,12 @@ export const REGISTRY_WITH_LIMITS_BY_MOTION_TYPE = { ContractAllowedRecipientReferralDaiRegistry, [MotionType.AllowedRecipientTopUpTrpLdo]: ContractAllowedRecipientTrpLdoRegistry, + [MotionType.StethRewardProgramAdd]: ContractStethRewardProgramRegistry, + [MotionType.StethRewardProgramRemove]: ContractStethRewardProgramRegistry, + [MotionType.StethRewardProgramTopUp]: ContractStethRewardProgramRegistry, + [MotionType.StethGasSupplyAdd]: ContractStethGasSupplyRegistry, + [MotionType.StethGasSupplyRemove]: ContractStethGasSupplyRegistry, + [MotionType.StethGasSupplyTopUp]: ContractStethGasSupplyRegistry, } type HookArgs = { diff --git a/modules/motions/hooks/useTokenByTopUpType.ts b/modules/motions/hooks/useTokenByTopUpType.ts index b5bf8a4f..b4e7895f 100644 --- a/modules/motions/hooks/useTokenByTopUpType.ts +++ b/modules/motions/hooks/useTokenByTopUpType.ts @@ -46,6 +46,10 @@ const TOKEN = { value: (chainId: CHAINS) => ContractGovernanceToken.address[chainId] as string, }, + [MotionType.StethRewardProgramTopUp]: { + label: 'stETH', + value: (chainId: CHAINS) => CONTRACT_ADDRESSES.STETH[chainId], + }, } const isTopUpType = (type: unknown): type is keyof typeof TOKEN => { @@ -76,7 +80,7 @@ export const useTokenByTopUpType = ({ if (!isTopUpType(registryType)) return { label: '', address: '' } const label = TOKEN[registryType].label - const address = TOKEN[registryType].value(chainId) + const address = TOKEN[registryType].value(chainId)! return { label, address } } diff --git a/modules/motions/types.ts b/modules/motions/types.ts index fae8b0af..262cd065 100644 --- a/modules/motions/types.ts +++ b/modules/motions/types.ts @@ -5,11 +5,24 @@ import type { EasyTrackAbi } from 'generated' export const MotionType = { NodeOperatorIncreaseLimit: 'NodeOperatorIncreaseLimit', LEGOTopUp: 'LEGOTopUp', - // @deprecated + AllowedRecipientTopUpTrpLdo: 'AllowedRecipientTopUpTrpLdo', + LegoLDOTopUp: 'LegoLDOTopUp', + LegoDAITopUp: 'LegoDAITopUp', + RccDAITopUp: 'RccDAITopUp', + PmlDAITopUp: 'PmlDAITopUp', + AtcDAITopUp: 'AtcDAITopUp', + GasFunderETHTopUp: 'GasFunderETHTopUp', + StethRewardProgramAdd: 'StethRewardProgramAdd', + StethRewardProgramRemove: 'StethRewardProgramRemove', + StethRewardProgramTopUp: 'StethRewardProgramTopUp', + StethGasSupplyAdd: 'StethGasSupplyAdd', + StethGasSupplyRemove: 'StethGasSupplyRemove', + StethGasSupplyTopUp: 'StethGasSupplyTopUp', + + // next motion types are retired + // we are keeping them here to display history data RewardProgramAdd: 'RewardProgramAdd', - // @deprecated RewardProgramRemove: 'RewardProgramRemove', - // @deprecated RewardProgramTopUp: 'RewardProgramTopUp', ReferralPartnerAdd: 'ReferralPartnerAdd', ReferralPartnerRemove: 'ReferralPartnerRemove', @@ -20,18 +33,34 @@ export const MotionType = { AllowedRecipientAddReferralDai: 'AllowedRecipientAddReferralDai', AllowedRecipientRemoveReferralDai: 'AllowedRecipientRemoveReferralDai', AllowedRecipientTopUpReferralDai: 'AllowedRecipientTopUpReferralDai', - AllowedRecipientTopUpTrpLdo: 'AllowedRecipientTopUpTrpLdo', - LegoLDOTopUp: 'LegoLDOTopUp', - LegoDAITopUp: 'LegoDAITopUp', - RccDAITopUp: 'RccDAITopUp', - PmlDAITopUp: 'PmlDAITopUp', - AtcDAITopUp: 'AtcDAITopUp', - GasFunderETHTopUp: 'GasFunderETHTopUp', } as const // intentionally // eslint-disable-next-line @typescript-eslint/no-redeclare export type MotionType = typeof MotionType[keyof typeof MotionType] +// Only motions currently supported to start +export const MotionTypeForms = { + NodeOperatorIncreaseLimit: MotionType.NodeOperatorIncreaseLimit, + LEGOTopUp: MotionType.LEGOTopUp, + AllowedRecipientTopUpTrpLdo: MotionType.AllowedRecipientTopUpTrpLdo, + LegoLDOTopUp: MotionType.LegoLDOTopUp, + LegoDAITopUp: MotionType.LegoDAITopUp, + RccDAITopUp: MotionType.RccDAITopUp, + PmlDAITopUp: MotionType.PmlDAITopUp, + AtcDAITopUp: MotionType.AtcDAITopUp, + GasFunderETHTopUp: MotionType.GasFunderETHTopUp, + StethRewardProgramAdd: MotionType.StethRewardProgramAdd, + StethRewardProgramRemove: MotionType.StethRewardProgramRemove, + StethRewardProgramTopUp: MotionType.StethRewardProgramTopUp, + StethGasSupplyAdd: MotionType.StethGasSupplyAdd, + StethGasSupplyRemove: MotionType.StethGasSupplyRemove, + StethGasSupplyTopUp: MotionType.StethGasSupplyTopUp, +} as const +// intentionally +// eslint-disable-next-line @typescript-eslint/no-redeclare +export type MotionTypeForms = + typeof MotionTypeForms[keyof typeof MotionTypeForms] + export const MotionStatus = { ACTIVE: 'ACTIVE', PENDING: 'PENDING', diff --git a/modules/motions/ui/MotionDescription/DescAllowedRecipient.tsx b/modules/motions/ui/MotionDescription/DescAllowedRecipient.tsx index 27efbfbc..b5a4c870 100644 --- a/modules/motions/ui/MotionDescription/DescAllowedRecipient.tsx +++ b/modules/motions/ui/MotionDescription/DescAllowedRecipient.tsx @@ -11,16 +11,16 @@ import { MotionTypeDisplayNames } from 'modules/motions/utils' import { formatEther } from 'ethers/lib/utils' import { - AddAllowedRecipientLDOAbi, - RemoveAllowedRecipientLDOAbi, - TopUpAllowedRecipientsLDOAbi, + AddAllowedRecipientAbi, + RemoveAllowedRecipientAbi, + TopUpAllowedRecipientsAbi, } from 'generated' import { NestProps } from './types' export function DescAllowedRecipientAdd({ callData, registryType, -}: NestProps & { +}: NestProps & { registryType: keyof typeof REGISTRY_WITH_LIMITS_BY_MOTION_TYPE }) { const name = MotionTypeDisplayNames[registryType] @@ -36,7 +36,7 @@ export function DescAllowedRecipientAdd({ export function DescAllowedRecipientTopUp({ callData, registryType, -}: NestProps & { +}: NestProps & { registryType: keyof typeof REGISTRY_WITH_LIMITS_BY_MOTION_TYPE }) { const token = useTokenByTopUpType({ registryType }) @@ -68,7 +68,7 @@ export function DescAllowedRecipientTopUp({ export function DescAllowedRecipientRemove({ callData, registryType, -}: NestProps & { +}: NestProps & { registryType: keyof typeof REGISTRY_WITH_LIMITS_BY_MOTION_TYPE }) { const { data: allowedRecipients } = useRecipientAll({ diff --git a/modules/motions/ui/MotionDescription/MotionDescription.tsx b/modules/motions/ui/MotionDescription/MotionDescription.tsx index 9cb78e07..17ac1533 100644 --- a/modules/motions/ui/MotionDescription/MotionDescription.tsx +++ b/modules/motions/ui/MotionDescription/MotionDescription.tsx @@ -25,8 +25,8 @@ import { DescTopUpWithLimits } from './DescTopUpWithLimits' import { TopUpWithLimitsAbi, - RemoveAllowedRecipientLDOAbi, - AddAllowedRecipientLDOAbi, + RemoveAllowedRecipientAbi, + AddAllowedRecipientAbi, } from 'generated' import { Motion, MotionType } from 'modules/motions/types' import { EvmUnrecognized } from 'modules/motions/evmAddresses' @@ -37,10 +37,10 @@ type DescWithLimitsProps = NestProps< TopUpWithLimitsAbi['decodeEVMScriptCallData'] > type DescAllowedRecipientRemoveProps = NestProps< - RemoveAllowedRecipientLDOAbi['decodeEVMScriptCallData'] + RemoveAllowedRecipientAbi['decodeEVMScriptCallData'] > type DescAllowedRecipientAddProps = NestProps< - AddAllowedRecipientLDOAbi['decodeEVMScriptCallData'] + AddAllowedRecipientAbi['decodeEVMScriptCallData'] > const MOTION_DESCRIPTIONS = { @@ -123,6 +123,47 @@ const MOTION_DESCRIPTIONS = { registryType={MotionType.GasFunderETHTopUp} /> ), + [MotionType.StethRewardProgramAdd]: (props: DescAllowedRecipientAddProps) => ( + + ), + [MotionType.StethRewardProgramRemove]: ( + props: DescAllowedRecipientRemoveProps, + ) => ( + + ), + [MotionType.StethRewardProgramTopUp]: (props: DescWithLimitsProps) => ( + + ), + + [MotionType.StethGasSupplyAdd]: (props: DescAllowedRecipientAddProps) => ( + + ), + [MotionType.StethGasSupplyRemove]: ( + props: DescAllowedRecipientRemoveProps, + ) => ( + + ), + [MotionType.StethGasSupplyTopUp]: (props: DescWithLimitsProps) => ( + + ), } as const type Props = { diff --git a/modules/motions/ui/MotionFormComplete/MotionFormComplete.tsx b/modules/motions/ui/MotionFormComplete/MotionFormComplete.tsx index be7131e1..f5ece24f 100644 --- a/modules/motions/ui/MotionFormComplete/MotionFormComplete.tsx +++ b/modules/motions/ui/MotionFormComplete/MotionFormComplete.tsx @@ -28,10 +28,7 @@ type BodySafeProps = { // Can be improved with https://safe-transaction.rinkeby.gnosis.io/ function BodySafe({ tx }: BodySafeProps) { const { walletAddress } = useWeb3() - const openGnosis = useGnosisOpener( - String(walletAddress), - `/transactions/tx?id=multisig_${String(walletAddress)}_${tx.safeTxHash}`, - ) + const openGnosis = useGnosisOpener(String(walletAddress), tx.safeTxHash) return (
diff --git a/modules/motions/ui/MotionFormStartNew/MotionFormStartNew.tsx b/modules/motions/ui/MotionFormStartNew/MotionFormStartNew.tsx index f880f8f3..759b6b25 100644 --- a/modules/motions/ui/MotionFormStartNew/MotionFormStartNew.tsx +++ b/modules/motions/ui/MotionFormStartNew/MotionFormStartNew.tsx @@ -1,7 +1,7 @@ import { useCallback, useEffect, useState } from 'react' import { useForm } from 'react-hook-form' import { useWeb3 } from 'modules/blockChain/hooks/useWeb3' -import { useAvailableMotions, HIDDEN_MOTIONS } from 'modules/motions/hooks' +import { useAvailableMotions } from 'modules/motions/hooks' import { useSendTransactionGnosisWorkaround } from 'modules/blockChain/hooks/useSendTransactionGnosisWorkaround' import { Button, ToastError } from '@lidofinance/lido-ui' @@ -12,13 +12,13 @@ import { Fieldset, RetryHint, MessageBox } from './CreateMotionFormStyle' import { formParts, FormData, getDefaultFormPartsData } from './Parts' import { ContractEasyTrack } from 'modules/blockChain/contracts' -import { MotionType } from 'modules/motions/types' import { getScriptFactoryByMotionType, getMotionTypeDisplayName, } from 'modules/motions/utils' import { ResultTx } from 'modules/blockChain/types' import { getErrorMessage } from 'modules/shared/utils/getErrorMessage' +import { MotionTypeForms } from 'modules/motions/types' type Props = { onComplete: (tx: ResultTx) => void @@ -96,24 +96,22 @@ export function MotionFormStartNew({ onComplete }: Props) { ) if (!availableMotions) return - if (notHaveAvailableMotions) + if (notHaveAvailableMotions) { return ( Only Trusted Callers & Node Operator have access to Easy Track motion creation ) + } return (
- {Object.values(MotionType) - .filter( - motion => - !HIDDEN_MOTIONS.includes(motion) && availableMotions[motion], - ) - .map(type => ( + {Object.values(MotionTypeForms) + .filter(motion => Boolean(availableMotions[motion])) + .map((type: MotionTypeForms) => (