From f0cbaf2e14dbf7bbb71d320fc10d7d0aae08301a Mon Sep 17 00:00:00 2001 From: DannyThomx Date: Sat, 23 Mar 2024 00:22:02 +0200 Subject: [PATCH 01/35] added 010-arbitrum-l1-l2-messaging.js to /goverance/proposals --- governance/.env | 27 + governance/.env.copy | 17 +- governance/helpers/abi/erc20-abi.json | 290 +++++ governance/helpers/abi/inbox-abi.json | 1001 +++++++++++++++++ governance/package.json | 5 +- .../proposals/010-arbitrum-l1-l2-messaging.js | 166 +++ 6 files changed, 1504 insertions(+), 2 deletions(-) create mode 100644 governance/.env create mode 100644 governance/helpers/abi/erc20-abi.json create mode 100644 governance/helpers/abi/inbox-abi.json create mode 100644 governance/proposals/010-arbitrum-l1-l2-messaging.js diff --git a/governance/.env b/governance/.env new file mode 100644 index 00000000000..9da7350d6f7 --- /dev/null +++ b/governance/.env @@ -0,0 +1,27 @@ +# private key of the signer that will deploy the contract +export DEPLOYER_PRIVATE_KEY="0x14e1a3103ce06d0348acf19df3df1965ee55f9cdb16708c0bb8cd3d843ab8805" + +# block explorers API keys +export ETHERSCAN_API_KEY="988a82bfe0a540ad84aa1a5d534c2bc6" +export POLYGONSCAN_API_KEY= +export OPTIMISTIC_ETHERSCAN_API_KEY= +export BSCSCAN_API_KEY= +export SNOWTRACE_API_KEY= +export ARBISCAN_API_KEY= +export CELO_API_KEY= +export GNOSISSCAN_API_KEY= + +# This is a sample .env file for use in local development. + +# Duplicate this file as .env + +# Your Private key +DEVNET_PRIVKEY="0x14e1a3103ce06d0348acf19df3df1965ee55f9cdb16708c0bb8cd3d843ab8805" + +# Hosted Aggregator Node (JSON-RPC Endpoint). This is Arbitrum Sepolia Testnet, can use any Arbitrum chain + +L2RPC="https://arbitrum-mainnet.infura.io/v3/988a82bfe0a540ad84aa1a5d534c2bc6" + +# Ethereum RPC; i.e., for Sepolia https://sepolia.infura.io/v3/ + +L1RPC="https://mainnet.infura.io/v3/988a82bfe0a540ad84aa1a5d534c2bc6" diff --git a/governance/.env.copy b/governance/.env.copy index f1c3af9c2a4..97cbc1f3c23 100644 --- a/governance/.env.copy +++ b/governance/.env.copy @@ -9,4 +9,19 @@ export BSCSCAN_API_KEY= export SNOWTRACE_API_KEY= export ARBISCAN_API_KEY= export CELO_API_KEY= -export GNOSISSCAN_API_KEY= \ No newline at end of file +export GNOSISSCAN_API_KEY= + +# This is a sample .env file for use in local development. + +# Duplicate this file as .env + +# Your Private key +DEVNET_PRIVKEY="0x your key here" + +# Hosted Aggregator Node (JSON-RPC Endpoint). This is Arbitrum Sepolia Testnet, can use any Arbitrum chain + +L2RPC="https://sepolia-rollup.arbitrum.io/rpc" + +# Ethereum RPC; i.e., for Sepolia https://sepolia.infura.io/v3/ + +L1RPC="" diff --git a/governance/helpers/abi/erc20-abi.json b/governance/helpers/abi/erc20-abi.json new file mode 100644 index 00000000000..4aee37e4019 --- /dev/null +++ b/governance/helpers/abi/erc20-abi.json @@ -0,0 +1,290 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/governance/helpers/abi/inbox-abi.json b/governance/helpers/abi/inbox-abi.json new file mode 100644 index 00000000000..9917f993336 --- /dev/null +++ b/governance/helpers/abi/inbox-abi.json @@ -0,0 +1,1001 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "dataLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxDataLength", + "type": "uint256" + } + ], + "name": "DataTooLarge", + "type": "error" + }, + { + "inputs": [], + "name": "GasLimitTooLarge", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expected", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "actual", + "type": "uint256" + } + ], + "name": "InsufficientSubmissionCost", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expected", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "actual", + "type": "uint256" + } + ], + "name": "InsufficientValue", + "type": "error" + }, + { + "inputs": [], + "name": "L1Forked", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "origin", + "type": "address" + } + ], + "name": "NotAllowedOrigin", + "type": "error" + }, + { + "inputs": [], + "name": "NotForked", + "type": "error" + }, + { + "inputs": [], + "name": "NotOrigin", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NotOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "rollup", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NotRollupOrOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "l2CallValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deposit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSubmissionCost", + "type": "uint256" + }, + { + "internalType": "address", + "name": "excessFeeRefundAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "callValueRefundAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "RetryableData", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "val", + "type": "bool" + } + ], + "name": "AllowListAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "isEnabled", + "type": "bool" + } + ], + "name": "AllowListEnabledUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "messageNum", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "InboxMessageDelivered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "messageNum", + "type": "uint256" + } + ], + "name": "InboxMessageDeliveredFromOrigin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "allowListEnabled", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "bridge", + "outputs": [ + { + "internalType": "contract IBridge", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "dataLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseFee", + "type": "uint256" + } + ], + "name": "calculateRetryableSubmissionFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "l2CallValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSubmissionCost", + "type": "uint256" + }, + { + "internalType": "address", + "name": "excessFeeRefundAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "callValueRefundAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "createRetryableTicket", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "l2CallValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSubmissionCost", + "type": "uint256" + }, + { + "internalType": "address", + "name": "excessFeeRefundAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "callValueRefundAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "createRetryableTicketNoRefundAliasRewrite", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "depositEth", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "depositEth", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IBridge", + "name": "_bridge", + "type": "address" + }, + { + "internalType": "contract ISequencerInbox", + "name": "_sequencerInbox", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isAllowed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IBridge", + "name": "", + "type": "address" + } + ], + "name": "postUpgradeInit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "sendContractTransaction", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "sendL1FundedContractTransaction", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "sendL1FundedUnsignedTransaction", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "sendL1FundedUnsignedTransactionToFork", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "messageData", + "type": "bytes" + } + ], + "name": "sendL2Message", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "messageData", + "type": "bytes" + } + ], + "name": "sendL2MessageFromOrigin", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "sendUnsignedTransaction", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "sendUnsignedTransactionToFork", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "address", + "name": "withdrawTo", + "type": "address" + } + ], + "name": "sendWithdrawEthToFork", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "sequencerInbox", + "outputs": [ + { + "internalType": "contract ISequencerInbox", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "user", + "type": "address[]" + }, + { + "internalType": "bool[]", + "name": "val", + "type": "bool[]" + } + ], + "name": "setAllowList", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_allowListEnabled", + "type": "bool" + } + ], + "name": "setAllowListEnabled", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "l2CallValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSubmissionCost", + "type": "uint256" + }, + { + "internalType": "address", + "name": "excessFeeRefundAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "callValueRefundAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "uniswapCreateRetryableTicket", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "l2CallValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSubmissionCost", + "type": "uint256" + }, + { + "internalType": "address", + "name": "excessFeeRefundAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "callValueRefundAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "unsafeCreateRetryableTicket", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/governance/package.json b/governance/package.json index ac88e1f30f6..5c186949f4b 100644 --- a/governance/package.json +++ b/governance/package.json @@ -3,6 +3,8 @@ "description": "Scripts for the management of the Unlock Protocol", "private": true, "dependencies": { + "@arbitrum/nitro-contracts": "v1.0.2", + "@arbitrum/sdk": "^v3.1.9", "@matterlabs/hardhat-zksync-deploy": "1.1.2", "@matterlabs/hardhat-zksync-solc": "1.1.0", "@matterlabs/hardhat-zksync-upgradable": "1.2.4", @@ -21,8 +23,9 @@ "@unlock-protocol/hardhat-helpers": "workspace:^", "@unlock-protocol/hardhat-plugin": "workspace:^", "@unlock-protocol/networks": "workspace:./packages/networks", + "arb-shared-dependencies": "^1.0.0", "eslint": "8.54.0", - "ethers": "6.10.0", + "ethers": "6.11.1", "fs-extra": "11.2.0", "hardhat": "2.20.1", "solhint": "4.1.1", diff --git a/governance/proposals/010-arbitrum-l1-l2-messaging.js b/governance/proposals/010-arbitrum-l1-l2-messaging.js new file mode 100644 index 00000000000..62b68b3e96b --- /dev/null +++ b/governance/proposals/010-arbitrum-l1-l2-messaging.js @@ -0,0 +1,166 @@ +// const { providers, Wallet } = require('ethers') +// const ethers = require('ethers') +const { ethers } = require('hardhat') +const { + L1ToL2MessageGasEstimator, +} = require('@arbitrum/sdk/dist/lib/message/L1ToL2MessageGasEstimator') +const { arbLog } = require('arb-shared-dependencies') +const { + EthBridger, + getL2Network, + addDefaultLocalNetwork, +} = require('@arbitrum/sdk') +const { getBaseFee } = require('@arbitrum/sdk/dist/lib/utils/lib') + +const ERC20_ABI = require('../helpers/abi/erc20-abi.json') +const INBOX_ABI = require('../helpers/abi/inbox-abi.json') + +/** + * Set up: instantiate L1 / L2 wallets connected to providers + */ +const walletPrivateKey = process.env.DEVNET_PRIVKEY +const l1Provider = new ethers.JsonRpcProvider(process.env.L1RPC) +const l2Provider = new ethers.JsonRpcProvider(process.env.L2RPC) +// const l1Wallet = new ethers.Wallet(walletPrivateKey, l1Provider) +const l2Wallet = new ethers.Wallet(walletPrivateKey, l2Provider) + +module.exports = async () => { + await arbLog('Cross-chain Proposer') + addDefaultLocalNetwork() + + const l2Network = await getL2Network(l2Provider) + const ethBridger = new EthBridger(l2Network) + const inboxAddress = ethBridger.l2Network.ethBridge.inbox + const ARBTokenAddressOnL2 = '0x912CE59144191C1204E64559FE8253a0e49E6548' // ARB TOKEN ADDRESS ON ARBITRUM ONE + const grantsContractAddress = '0x00D5E0d31d37cc13C645D86410aB4cB7Cb428ccA' + const L2Alias = '0x28ffDfB0A6e6E06E95B3A1f928Dc4024240bD87c' // Timelock Alias Address on L2 + const L1TimelockContract = '0x17EEDFb0a6E6e06E95B3A1F928dc4024240BC76B' // Timelock Address mainnet + + const L2TokenContract = new ethers.Contract( + ARBTokenAddressOnL2, + ERC20_ABI.abi, + l2Wallet + ).connect(l2Wallet) + + const balanceOf = await L2TokenContract.balanceOf(L2Alias) + console.log('ARB BALANCE::', ethers.formatEther(await balanceOf)) + + const tokenAmount = ethers.parseEther('1') + + // Create an instance of the Interface from the ABIs + const iface_erc20 = new ethers.Interface(ERC20_ABI.abi) + const iface_inbox = new ethers.Interface(INBOX_ABI.abi) + + // Encode the ERC20 Token transfer calldata + const transfer_calldata = iface_erc20.encodeFunctionData('transfer', [ + grantsContractAddress, + tokenAmount, + ]) + /** + * Now we can query the required gas params using the estimateAll method in Arbitrum SDK + */ + const l1ToL2MessageGasEstimate = new L1ToL2MessageGasEstimator(l2Provider) + + /** + * The estimateAll method gives us the following values for sending an L1->L2 message + * (1) maxSubmissionCost: The maximum cost to be paid for submitting the transaction + * (2) gasLimit: The L2 gas limit + * (3) deposit: The total amount to deposit on L1 to cover L2 gas and L2 call value + */ + const L1ToL2MessageGasParams = await l1ToL2MessageGasEstimate.estimateAll( + { + from: L1TimelockContract, + to: ARBTokenAddressOnL2, + l2CallValue: 0, + excessFeeRefundAddress: l2Wallet.address, + callValueRefundAddress: l2Wallet.address, + data: transfer_calldata, + }, + await getBaseFee(l1Provider), + l1Provider + ) + console.log(':::::::::L1ToL2MessageGasParams::::::::::') + console.log( + 'GasParams::::gasLimit', + L1ToL2MessageGasParams.gasLimit.toNumber() + ) + console.log( + 'GasParams::::maxSubmissionCost', + L1ToL2MessageGasParams.maxSubmissionCost.toNumber() + ) + console.log( + 'GasParams::::maxGas', + L1ToL2MessageGasParams.maxFeePerGas.toNumber() + ) + console.log('GasParams::::deposit', L1ToL2MessageGasParams.deposit.toNumber()) + + console.log( + `Current retryable base submission price is: ${L1ToL2MessageGasParams.maxSubmissionCost.toString()}` + ) + + const gasPriceBid = await l2Provider.getGasPrice() + console.log(`L2 gas price: ${gasPriceBid.toString()}`) + + const inbox_calldata = iface_inbox.encodeFunctionData( + 'createRetryableTicket', + [ + ARBTokenAddressOnL2, + 0, + L1ToL2MessageGasParams.maxSubmissionCost, + l2Wallet.address, + l2Wallet.address, + L1ToL2MessageGasParams.gasLimit, + gasPriceBid, + transfer_calldata, + ] + ) + + const proposalName = `# Test Transaction before 7k ARB Transfer To Fund Unlock Protocol’s Ecosystem via Grants Stack This proposal requests to use 1 ARB from the tokens given to Unlock Protocol DAO by ArbitrumDAO to run a test transaction to de-risk the transfer of 7k ARB tokens to fund the retroQF round on Grants Stack.` + console.log(proposalName) + // Proposal ARGS i.e Call Governor.propose() directly with these values + // targets: Inbox contract + // values: depost * 10 + // calldatas: inbox_calldata + // description + const targets = [inboxAddress] + const values = [L1ToL2MessageGasParams.deposit.toNumber() * 10] // I Multiply by 10 to add extra in case gas changes + const calldatas = [inbox_calldata] + console.log( + '______________________________________________________________________\n' + ) + console.log( + 'PROPOSAL ARGS - Can Call Propose function on Governor with the following::' + ) + console.log( + '______________________________________________________________________\n' + ) + + console.log('TARGETS:: ', targets) + console.log('VALUES:: ', values) + console.log('CALLDATAS:: ', calldatas) + console.log('DESCRIPTION:: ', proposalName) + + const calls = [ + { + contractNameOrAbi: INBOX_ABI.abi, + contractAddress: inboxAddress, + functionName: 'createRetryableTicket', + functionArgs: [ + ARBTokenAddressOnL2, + 0, + L1ToL2MessageGasParams.maxSubmissionCost, + l2Wallet.address, + l2Wallet.address, + L1ToL2MessageGasParams.gasLimit, + gasPriceBid, + transfer_calldata, + ], + value: L1ToL2MessageGasParams.deposit.toNumber() * 10, // I Multiply by 10 to add extra in case gas changes due to proposal delay + }, + ] + + return { + proposalName, + calls, + } +} From 85376b1861ab3f611aef6095cafab1dbabe761af Mon Sep 17 00:00:00 2001 From: DannyThomx Date: Sat, 23 Mar 2024 01:01:49 +0200 Subject: [PATCH 02/35] removed unnecessary comments --- governance/proposals/010-arbitrum-l1-l2-messaging.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/governance/proposals/010-arbitrum-l1-l2-messaging.js b/governance/proposals/010-arbitrum-l1-l2-messaging.js index 62b68b3e96b..974aeff8ac4 100644 --- a/governance/proposals/010-arbitrum-l1-l2-messaging.js +++ b/governance/proposals/010-arbitrum-l1-l2-messaging.js @@ -1,6 +1,4 @@ -// const { providers, Wallet } = require('ethers') -// const ethers = require('ethers') -const { ethers } = require('hardhat') +const ethers = require('ethers') const { L1ToL2MessageGasEstimator, } = require('@arbitrum/sdk/dist/lib/message/L1ToL2MessageGasEstimator') @@ -21,7 +19,7 @@ const INBOX_ABI = require('../helpers/abi/inbox-abi.json') const walletPrivateKey = process.env.DEVNET_PRIVKEY const l1Provider = new ethers.JsonRpcProvider(process.env.L1RPC) const l2Provider = new ethers.JsonRpcProvider(process.env.L2RPC) -// const l1Wallet = new ethers.Wallet(walletPrivateKey, l1Provider) +const l1Wallet = new ethers.Wallet(walletPrivateKey, l1Provider) const l2Wallet = new ethers.Wallet(walletPrivateKey, l2Provider) module.exports = async () => { From 247edf01c71171ebf1273e6e4e9322c96752becf Mon Sep 17 00:00:00 2001 From: DannyThomx Date: Mon, 25 Mar 2024 15:45:22 +0200 Subject: [PATCH 03/35] moved ERC20_ABI and INBOX_ABI inline and removed /helper/abi folder --- governance/helpers/abi/erc20-abi.json | 290 ----- governance/helpers/abi/inbox-abi.json | 1001 ----------------- .../proposals/010-arbitrum-l1-l2-messaging.js | 113 +- 3 files changed, 106 insertions(+), 1298 deletions(-) delete mode 100644 governance/helpers/abi/erc20-abi.json delete mode 100644 governance/helpers/abi/inbox-abi.json diff --git a/governance/helpers/abi/erc20-abi.json b/governance/helpers/abi/erc20-abi.json deleted file mode 100644 index 4aee37e4019..00000000000 --- a/governance/helpers/abi/erc20-abi.json +++ /dev/null @@ -1,290 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/governance/helpers/abi/inbox-abi.json b/governance/helpers/abi/inbox-abi.json deleted file mode 100644 index 9917f993336..00000000000 --- a/governance/helpers/abi/inbox-abi.json +++ /dev/null @@ -1,1001 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "dataLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxDataLength", - "type": "uint256" - } - ], - "name": "DataTooLarge", - "type": "error" - }, - { - "inputs": [], - "name": "GasLimitTooLarge", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expected", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "actual", - "type": "uint256" - } - ], - "name": "InsufficientSubmissionCost", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expected", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "actual", - "type": "uint256" - } - ], - "name": "InsufficientValue", - "type": "error" - }, - { - "inputs": [], - "name": "L1Forked", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "origin", - "type": "address" - } - ], - "name": "NotAllowedOrigin", - "type": "error" - }, - { - "inputs": [], - "name": "NotForked", - "type": "error" - }, - { - "inputs": [], - "name": "NotOrigin", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "NotOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "rollup", - "type": "address" - }, - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "NotRollupOrOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "l2CallValue", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deposit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxSubmissionCost", - "type": "uint256" - }, - { - "internalType": "address", - "name": "excessFeeRefundAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "callValueRefundAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "RetryableData", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "val", - "type": "bool" - } - ], - "name": "AllowListAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bool", - "name": "isEnabled", - "type": "bool" - } - ], - "name": "AllowListEnabledUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "messageNum", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "InboxMessageDelivered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "messageNum", - "type": "uint256" - } - ], - "name": "InboxMessageDeliveredFromOrigin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "inputs": [], - "name": "allowListEnabled", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "bridge", - "outputs": [ - { - "internalType": "contract IBridge", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "dataLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "baseFee", - "type": "uint256" - } - ], - "name": "calculateRetryableSubmissionFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "l2CallValue", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxSubmissionCost", - "type": "uint256" - }, - { - "internalType": "address", - "name": "excessFeeRefundAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "callValueRefundAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "createRetryableTicket", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "l2CallValue", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxSubmissionCost", - "type": "uint256" - }, - { - "internalType": "address", - "name": "excessFeeRefundAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "callValueRefundAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "createRetryableTicketNoRefundAliasRewrite", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "depositEth", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "depositEth", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IBridge", - "name": "_bridge", - "type": "address" - }, - { - "internalType": "contract ISequencerInbox", - "name": "_sequencerInbox", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isAllowed", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IBridge", - "name": "", - "type": "address" - } - ], - "name": "postUpgradeInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "sendContractTransaction", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "sendL1FundedContractTransaction", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "sendL1FundedUnsignedTransaction", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "sendL1FundedUnsignedTransactionToFork", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "messageData", - "type": "bytes" - } - ], - "name": "sendL2Message", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "messageData", - "type": "bytes" - } - ], - "name": "sendL2MessageFromOrigin", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "sendUnsignedTransaction", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "sendUnsignedTransactionToFork", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "address", - "name": "withdrawTo", - "type": "address" - } - ], - "name": "sendWithdrawEthToFork", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "sequencerInbox", - "outputs": [ - { - "internalType": "contract ISequencerInbox", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "user", - "type": "address[]" - }, - { - "internalType": "bool[]", - "name": "val", - "type": "bool[]" - } - ], - "name": "setAllowList", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_allowListEnabled", - "type": "bool" - } - ], - "name": "setAllowListEnabled", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "l2CallValue", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxSubmissionCost", - "type": "uint256" - }, - { - "internalType": "address", - "name": "excessFeeRefundAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "callValueRefundAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "uniswapCreateRetryableTicket", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "l2CallValue", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxSubmissionCost", - "type": "uint256" - }, - { - "internalType": "address", - "name": "excessFeeRefundAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "callValueRefundAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "unsafeCreateRetryableTicket", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/governance/proposals/010-arbitrum-l1-l2-messaging.js b/governance/proposals/010-arbitrum-l1-l2-messaging.js index 974aeff8ac4..b889d8a97a8 100644 --- a/governance/proposals/010-arbitrum-l1-l2-messaging.js +++ b/governance/proposals/010-arbitrum-l1-l2-messaging.js @@ -10,8 +10,107 @@ const { } = require('@arbitrum/sdk') const { getBaseFee } = require('@arbitrum/sdk/dist/lib/utils/lib') -const ERC20_ABI = require('../helpers/abi/erc20-abi.json') -const INBOX_ABI = require('../helpers/abi/inbox-abi.json') +const ERC20_ABI = [ + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'balanceOf', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'transfer', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, +] +const INBOX_ABI = [ + { + inputs: [ + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'l2CallValue', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'maxSubmissionCost', + type: 'uint256', + }, + { + internalType: 'address', + name: 'excessFeeRefundAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'callValueRefundAddress', + type: 'address', + }, + { + internalType: 'uint256', + name: 'gasLimit', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'maxFeePerGas', + type: 'uint256', + }, + { + internalType: 'bytes', + name: 'data', + type: 'bytes', + }, + ], + name: 'createRetryableTicket', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'payable', + type: 'function', + }, +] /** * Set up: instantiate L1 / L2 wallets connected to providers @@ -19,7 +118,7 @@ const INBOX_ABI = require('../helpers/abi/inbox-abi.json') const walletPrivateKey = process.env.DEVNET_PRIVKEY const l1Provider = new ethers.JsonRpcProvider(process.env.L1RPC) const l2Provider = new ethers.JsonRpcProvider(process.env.L2RPC) -const l1Wallet = new ethers.Wallet(walletPrivateKey, l1Provider) +// const l1Wallet = new ethers.Wallet(walletPrivateKey, l1Provider) const l2Wallet = new ethers.Wallet(walletPrivateKey, l2Provider) module.exports = async () => { @@ -36,7 +135,7 @@ module.exports = async () => { const L2TokenContract = new ethers.Contract( ARBTokenAddressOnL2, - ERC20_ABI.abi, + ERC20_ABI, l2Wallet ).connect(l2Wallet) @@ -46,8 +145,8 @@ module.exports = async () => { const tokenAmount = ethers.parseEther('1') // Create an instance of the Interface from the ABIs - const iface_erc20 = new ethers.Interface(ERC20_ABI.abi) - const iface_inbox = new ethers.Interface(INBOX_ABI.abi) + const iface_erc20 = new ethers.Interface(ERC20_ABI) + const iface_inbox = new ethers.Interface(INBOX_ABI) // Encode the ERC20 Token transfer calldata const transfer_calldata = iface_erc20.encodeFunctionData('transfer', [ @@ -140,7 +239,7 @@ module.exports = async () => { const calls = [ { - contractNameOrAbi: INBOX_ABI.abi, + contractNameOrAbi: INBOX_ABI, contractAddress: inboxAddress, functionName: 'createRetryableTicket', functionArgs: [ From 2f0608fec98f3fe4945b52193a1a9e2b17a0cf14 Mon Sep 17 00:00:00 2001 From: DannyThomx Date: Mon, 25 Mar 2024 16:42:10 +0200 Subject: [PATCH 04/35] signed Contributor License Agreement --- .clabot | 3 +- governance/.gitignore | 1 + yarn.lock | 444 +++++++++++++++++++++++++++++++++++++----- 3 files changed, 398 insertions(+), 50 deletions(-) diff --git a/.clabot b/.clabot index 8d5dafae9ed..21ee40099a9 100644 --- a/.clabot +++ b/.clabot @@ -62,7 +62,8 @@ "0xTxbi", "FedericoCaruso", "njokuScript", - "Calla-Ji" + "Calla-Ji", + "blahkheart" ], "message": "Thank you for your pull request and welcome to Unlock! We require contributors to sign our [Contributor License Agreement](https://github.com/unlock-protocol/unlock/blob/master/CLA.txt), and we don't seem to have the users {{usersWithoutCLA}} on file. \nIn order for us to review and merge your code, please open _another_ pull request with a single modification: your github username added to the file `.clabot`.\nThank you! " } diff --git a/governance/.gitignore b/governance/.gitignore index 2e5682418b9..1ea30610786 100644 --- a/governance/.gitignore +++ b/governance/.gitignore @@ -2,6 +2,7 @@ cache contracts artifacts +.env # zksync zk-artifacts diff --git a/yarn.lock b/yarn.lock index dfeeee690bd..065a0e583ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -26,6 +26,13 @@ __metadata: languageName: node linkType: hard +"@aduh95/viz.js@npm:^3.7.0": + version: 3.7.0 + resolution: "@aduh95/viz.js@npm:3.7.0" + checksum: 10/4b1aac92e7a6ea783b1ad33220163dd8623dbcd3bf947deb6a8637ee8a3b59137e76d87638a479e96df04c929dcdddc8bb3432b065642b11f75d944b431e2f9c + languageName: node + linkType: hard + "@algolia/autocomplete-core@npm:1.9.3": version: 1.9.3 resolution: "@algolia/autocomplete-core@npm:1.9.3" @@ -257,6 +264,34 @@ __metadata: languageName: node linkType: hard +"@arbitrum/nitro-contracts@npm:v1.0.2": + version: 1.0.2 + resolution: "@arbitrum/nitro-contracts@npm:1.0.2" + dependencies: + "@openzeppelin/contracts": "npm:4.5.0" + "@openzeppelin/contracts-upgradeable": "npm:4.5.2" + patch-package: "npm:^6.4.7" + sol2uml: "npm:2.2.0" + dependenciesMeta: + sol2uml: + optional: true + checksum: 10/242119c32a6d58dc394c8f2f407d304643b41e0996fd0650fd34800b170660da3ab5c0e1c1aeede193ff3fda5402a375e21efaefcb48199fc962052de4b3a78e + languageName: node + linkType: hard + +"@arbitrum/sdk@npm:^v3.1.9": + version: 3.3.3 + resolution: "@arbitrum/sdk@npm:3.3.3" + dependencies: + "@ethersproject/address": "npm:^5.0.8" + "@ethersproject/bignumber": "npm:^5.1.1" + "@ethersproject/bytes": "npm:^5.0.8" + async-mutex: "npm:^0.4.0" + ethers: "npm:^5.1.0" + checksum: 10/cf21a8750191beaa588bbe350853118d6142ac70aebcdb38306ff5144cbbb89a7ac2680b03537f218bdad9eb528cfe85ba97834794bcbe397ce7d817f2a010c8 + languageName: node + linkType: hard + "@ardatan/relay-compiler@npm:12.0.0": version: 12.0.0 resolution: "@ardatan/relay-compiler@npm:12.0.0" @@ -7615,7 +7650,7 @@ __metadata: languageName: node linkType: hard -"@ethersproject/address@npm:5.7.0, @ethersproject/address@npm:^5.0.0, @ethersproject/address@npm:^5.0.2, @ethersproject/address@npm:^5.0.4, @ethersproject/address@npm:^5.7.0": +"@ethersproject/address@npm:5.7.0, @ethersproject/address@npm:^5.0.0, @ethersproject/address@npm:^5.0.2, @ethersproject/address@npm:^5.0.4, @ethersproject/address@npm:^5.0.8, @ethersproject/address@npm:^5.7.0": version: 5.7.0 resolution: "@ethersproject/address@npm:5.7.0" dependencies: @@ -7647,7 +7682,7 @@ __metadata: languageName: node linkType: hard -"@ethersproject/bignumber@npm:5.7.0, @ethersproject/bignumber@npm:^5.0.7, @ethersproject/bignumber@npm:^5.7.0": +"@ethersproject/bignumber@npm:5.7.0, @ethersproject/bignumber@npm:^5.0.7, @ethersproject/bignumber@npm:^5.1.1, @ethersproject/bignumber@npm:^5.7.0": version: 5.7.0 resolution: "@ethersproject/bignumber@npm:5.7.0" dependencies: @@ -7658,7 +7693,7 @@ __metadata: languageName: node linkType: hard -"@ethersproject/bytes@npm:5.7.0, @ethersproject/bytes@npm:^5.0.4, @ethersproject/bytes@npm:^5.7.0": +"@ethersproject/bytes@npm:5.7.0, @ethersproject/bytes@npm:^5.0.4, @ethersproject/bytes@npm:^5.0.8, @ethersproject/bytes@npm:^5.7.0": version: 5.7.0 resolution: "@ethersproject/bytes@npm:5.7.0" dependencies: @@ -11782,6 +11817,13 @@ __metadata: languageName: node linkType: hard +"@openzeppelin/contracts-upgradeable@npm:4.5.2": + version: 4.5.2 + resolution: "@openzeppelin/contracts-upgradeable@npm:4.5.2" + checksum: 10/5e246da7a44bb982a312ebf79978735712140692d46273566e490159b98b9041ca72cc08c3d05172137a389be4caad5afc001480bc5557f3d47162f4626e3723 + languageName: node + linkType: hard + "@openzeppelin/contracts-upgradeable@npm:4.9.5": version: 4.9.5 resolution: "@openzeppelin/contracts-upgradeable@npm:4.9.5" @@ -11803,6 +11845,13 @@ __metadata: languageName: node linkType: hard +"@openzeppelin/contracts@npm:4.5.0": + version: 4.5.0 + resolution: "@openzeppelin/contracts@npm:4.5.0" + checksum: 10/8bfa1733732420331728cedd7f1f5f4e4ae0700b32c9e5def19b2d42dbb0b246709e8e22abd457e8269d743012ff2aed4e3f100a942f45d9507cb78d5dbd435b + languageName: node + linkType: hard + "@openzeppelin/contracts@npm:4.7.0": version: 4.7.0 resolution: "@openzeppelin/contracts@npm:4.7.0" @@ -15325,7 +15374,7 @@ __metadata: languageName: node linkType: hard -"@solidity-parser/parser@npm:^0.14.0, @solidity-parser/parser@npm:^0.14.1": +"@solidity-parser/parser@npm:^0.14.0, @solidity-parser/parser@npm:^0.14.1, @solidity-parser/parser@npm:^0.14.3": version: 0.14.5 resolution: "@solidity-parser/parser@npm:0.14.5" dependencies: @@ -19883,6 +19932,8 @@ __metadata: version: 0.0.0-use.local resolution: "@unlock-protocol/governance@workspace:governance" dependencies: + "@arbitrum/nitro-contracts": "npm:v1.0.2" + "@arbitrum/sdk": "npm:^v3.1.9" "@matterlabs/hardhat-zksync-deploy": "npm:1.1.2" "@matterlabs/hardhat-zksync-solc": "npm:1.1.0" "@matterlabs/hardhat-zksync-upgradable": "npm:1.2.4" @@ -19901,8 +19952,9 @@ __metadata: "@unlock-protocol/hardhat-helpers": "workspace:^" "@unlock-protocol/hardhat-plugin": "workspace:^" "@unlock-protocol/networks": "workspace:./packages/networks" + arb-shared-dependencies: "npm:^1.0.0" eslint: "npm:8.54.0" - ethers: "npm:6.10.0" + ethers: "npm:6.11.1" fs-extra: "npm:11.2.0" hardhat: "npm:2.20.1" solhint: "npm:4.1.1" @@ -21720,6 +21772,13 @@ __metadata: languageName: node linkType: hard +"@yarnpkg/lockfile@npm:^1.1.0": + version: 1.1.0 + resolution: "@yarnpkg/lockfile@npm:1.1.0" + checksum: 10/cd19e1114aaf10a05126aeea8833ef4ca8af8a46e88e12884f8359d19333fd19711036dbc2698dbe937f81f037070cf9a8da45c2e8c6ca19cafd7d15659094ed + languageName: node + linkType: hard + "@yr/monotone-cubic-spline@npm:^1.0.3": version: 1.0.3 resolution: "@yr/monotone-cubic-spline@npm:1.0.3" @@ -22519,6 +22578,16 @@ __metadata: languageName: node linkType: hard +"arb-shared-dependencies@npm:^1.0.0": + version: 1.0.0 + resolution: "arb-shared-dependencies@npm:1.0.0" + dependencies: + dotenv: "npm:^8.2.0" + eslint-plugin-prettier: "npm:^3.4.0" + checksum: 10/1a658de6423e14ef1020673ad8a07188054dc4bf24a9780b5d46cff12de4c40521c233b2cbc0d09e37d10b96b5ad0b476eebea3fa9f2de0c47dcca84b6f956e1 + languageName: node + linkType: hard + "archiver-utils@npm:^2.1.0": version: 2.1.0 resolution: "archiver-utils@npm:2.1.0" @@ -23088,6 +23157,15 @@ __metadata: languageName: node linkType: hard +"async-mutex@npm:^0.4.0": + version: 0.4.1 + resolution: "async-mutex@npm:0.4.1" + dependencies: + tslib: "npm:^2.4.0" + checksum: 10/7e9f77b112b8545beb6612493fae4a8d9d1d6c3f24fc22f4d6d05ce96d1e8d326ac3e743a804cc6d7bf24e7ef0267afb65bb127f99b2e433609684b38933ff1c + languageName: node + linkType: hard + "async-retry@npm:^1.3.1, async-retry@npm:^1.3.3": version: 1.3.3 resolution: "async-retry@npm:1.3.3" @@ -25544,7 +25622,7 @@ __metadata: languageName: node linkType: hard -"cheerio@npm:^1.0.0-rc.12": +"cheerio@npm:^1.0.0-rc.11, cheerio@npm:^1.0.0-rc.12": version: 1.0.0-rc.12 resolution: "cheerio@npm:1.0.0-rc.12" dependencies: @@ -26309,7 +26387,7 @@ __metadata: languageName: node linkType: hard -"commander@npm:^9.0.0, commander@npm:^9.3.0, commander@npm:^9.4.0": +"commander@npm:^9.0.0, commander@npm:^9.2.0, commander@npm:^9.3.0, commander@npm:^9.4.0": version: 9.5.0 resolution: "commander@npm:9.5.0" checksum: 10/41c49b3d0f94a1fbeb0463c85b13f15aa15a9e0b4d5e10a49c0a1d58d4489b549d62262b052ae0aa6cfda53299bee487bfe337825df15e342114dde543f82906 @@ -26635,6 +26713,36 @@ __metadata: languageName: node linkType: hard +"convert-svg-core@npm:^0.6.4": + version: 0.6.4 + resolution: "convert-svg-core@npm:0.6.4" + dependencies: + chalk: "npm:^4.1.2" + cheerio: "npm:^1.0.0-rc.11" + commander: "npm:^9.2.0" + file-url: "npm:^3.0.0" + get-stdin: "npm:^8.0.0" + glob: "npm:^8.0.1" + lodash.omit: "npm:^4.5.0" + lodash.pick: "npm:^4.4.0" + pollock: "npm:^0.2.0" + puppeteer: "npm:^13.7.0" + tmp: "npm:^0.2.1" + checksum: 10/0d07df05f5f4d0080ce1f35bbec3457a4954ffa4d7dee13c6394cba0b11a20d2855e2e028318845e2004c5e8cafba431ca647a225e63cdaf592ef78f96c4fa5b + languageName: node + linkType: hard + +"convert-svg-to-png@npm:^0.6.4": + version: 0.6.4 + resolution: "convert-svg-to-png@npm:0.6.4" + dependencies: + convert-svg-core: "npm:^0.6.4" + bin: + convert-svg-to-png: bin/convert-svg-to-png + checksum: 10/272712cfb04c7e68470745f6455abc58c11e21d8806d3265ff844da7877387e212ff9d729922692aa108f19c3a4fd32c231ca35f6d22c90463f3e47d9994dc84 + languageName: node + linkType: hard + "cookie-es@npm:^1.0.0": version: 1.0.0 resolution: "cookie-es@npm:1.0.0" @@ -27075,6 +27183,15 @@ __metadata: languageName: node linkType: hard +"cross-fetch@npm:3.1.5": + version: 3.1.5 + resolution: "cross-fetch@npm:3.1.5" + dependencies: + node-fetch: "npm:2.6.7" + checksum: 10/5d101a3b1e6cb172f0e5e8168cbc927eeff2ef915f33ceef50fed85441df870e1fdff195b56eca36fae8b78ddba5d8e913b8927f73d11b19d27e96301438cd30 + languageName: node + linkType: hard + "cross-fetch@npm:^3.0.4, cross-fetch@npm:^3.0.6, cross-fetch@npm:^3.1.4, cross-fetch@npm:^3.1.5": version: 3.1.8 resolution: "cross-fetch@npm:3.1.8" @@ -27113,6 +27230,19 @@ __metadata: languageName: node linkType: hard +"cross-spawn@npm:^6.0.5": + version: 6.0.5 + resolution: "cross-spawn@npm:6.0.5" + dependencies: + nice-try: "npm:^1.0.4" + path-key: "npm:^2.0.1" + semver: "npm:^5.5.0" + shebang-command: "npm:^1.2.0" + which: "npm:^1.2.9" + checksum: 10/f07e643b4875f26adffcd7f13bc68d9dff20cf395f8ed6f43a23f3ee24fc3a80a870a32b246fd074e514c8fd7da5f978ac6a7668346eec57aa87bac89c1ed3a1 + languageName: node + linkType: hard + "crossws@npm:^0.2.0, crossws@npm:^0.2.2": version: 0.2.4 resolution: "crossws@npm:0.2.4" @@ -28219,6 +28349,13 @@ __metadata: languageName: node linkType: hard +"devtools-protocol@npm:0.0.981744": + version: 0.0.981744 + resolution: "devtools-protocol@npm:0.0.981744" + checksum: 10/ec502af20a8806f46d03f5dffaec126e9487c9100cc3a05dfc3159af476484a8589dcea306e121698338c4991d47738af0d621d694bc0758f5f9ebba7b85e562 + languageName: node + linkType: hard + "dezalgo@npm:^1.0.4": version: 1.0.4 resolution: "dezalgo@npm:1.0.4" @@ -28712,6 +28849,13 @@ __metadata: languageName: node linkType: hard +"dotenv@npm:^8.2.0": + version: 8.6.0 + resolution: "dotenv@npm:8.6.0" + checksum: 10/31d7b5c010cebb80046ba6853d703f9573369b00b15129536494f04b0af4ea0060ce8646e3af58b455af2f6f1237879dd261a5831656410ec92561ae1ea44508 + languageName: node + linkType: hard + "dottie@npm:^2.0.4": version: 2.0.6 resolution: "dottie@npm:2.0.6" @@ -30105,6 +30249,21 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-prettier@npm:^3.4.0": + version: 3.4.1 + resolution: "eslint-plugin-prettier@npm:3.4.1" + dependencies: + prettier-linter-helpers: "npm:^1.0.0" + peerDependencies: + eslint: ">=5.0.0" + prettier: ">=1.13.0" + peerDependenciesMeta: + eslint-config-prettier: + optional: true + checksum: 10/d7ab93df9a93f0afb9fa9c9c3cf30479075e1b56303c82ed6efbfff30c2d3d3741537b490c2b517d501bfa97a3d8d0269a1ab4b6fa741a6e966e5811efbfe8b8 + languageName: node + linkType: hard + "eslint-plugin-react-hooks@npm:^4.5.0 || 5.0.0-canary-7118f5dd7-20230705": version: 5.0.0-canary-7118f5dd7-20230705 resolution: "eslint-plugin-react-hooks@npm:5.0.0-canary-7118f5dd7-20230705" @@ -30939,7 +31098,7 @@ __metadata: languageName: node linkType: hard -"ethers@npm:5.7.2, ethers@npm:^5.3.1, ethers@npm:^5.5.4, ethers@npm:^5.6.1, ethers@npm:^5.7.0, ethers@npm:^5.7.1, ethers@npm:^5.7.2": +"ethers@npm:5.7.2, ethers@npm:^5.1.0, ethers@npm:^5.3.1, ethers@npm:^5.5.4, ethers@npm:^5.6.1, ethers@npm:^5.6.9, ethers@npm:^5.7.0, ethers@npm:^5.7.1, ethers@npm:^5.7.2": version: 5.7.2 resolution: "ethers@npm:5.7.2" dependencies: @@ -30992,6 +31151,21 @@ __metadata: languageName: node linkType: hard +"ethers@npm:6.11.1, ethers@npm:^6.7.1, ethers@npm:^6.8.1": + version: 6.11.1 + resolution: "ethers@npm:6.11.1" + dependencies: + "@adraffy/ens-normalize": "npm:1.10.1" + "@noble/curves": "npm:1.2.0" + "@noble/hashes": "npm:1.3.2" + "@types/node": "npm:18.15.13" + aes-js: "npm:4.0.0-beta.5" + tslib: "npm:2.4.0" + ws: "npm:8.5.0" + checksum: 10/bfeba2670dbfdac3951a66ab2d5bbc18dd7e1be69da9142ad4fe3859a30891e7bb048ecbb6ab542b67df777ada1860445bb3dd83536219c0d3639fe05e74df8e + languageName: node + linkType: hard + "ethers@npm:^4.0.40": version: 4.0.49 resolution: "ethers@npm:4.0.49" @@ -31009,21 +31183,6 @@ __metadata: languageName: node linkType: hard -"ethers@npm:^6.7.1, ethers@npm:^6.8.1": - version: 6.11.1 - resolution: "ethers@npm:6.11.1" - dependencies: - "@adraffy/ens-normalize": "npm:1.10.1" - "@noble/curves": "npm:1.2.0" - "@noble/hashes": "npm:1.3.2" - "@types/node": "npm:18.15.13" - aes-js: "npm:4.0.0-beta.5" - tslib: "npm:2.4.0" - ws: "npm:8.5.0" - checksum: 10/bfeba2670dbfdac3951a66ab2d5bbc18dd7e1be69da9142ad4fe3859a30891e7bb048ecbb6ab542b67df777ada1860445bb3dd83536219c0d3639fe05e74df8e - languageName: node - linkType: hard - "ethjs-unit@npm:0.1.6": version: 0.1.6 resolution: "ethjs-unit@npm:0.1.6" @@ -31992,6 +32151,13 @@ __metadata: languageName: node linkType: hard +"file-url@npm:^3.0.0": + version: 3.0.0 + resolution: "file-url@npm:3.0.0" + checksum: 10/f15c1bdd81df1a09238f3411f877274d7849703df837ec327c4d1df631314f60036cb700a59d826d8c96b79ff66429d3c758480005e1899c00961541b98d5bfe + languageName: node + linkType: hard + "filelist@npm:^1.0.4": version: 1.0.4 resolution: "filelist@npm:1.0.4" @@ -32205,6 +32371,15 @@ __metadata: languageName: node linkType: hard +"find-yarn-workspace-root@npm:^2.0.0": + version: 2.0.0 + resolution: "find-yarn-workspace-root@npm:2.0.0" + dependencies: + micromatch: "npm:^4.0.2" + checksum: 10/7fa7942849eef4d5385ee96a0a9a5a9afe885836fd72ed6a4280312a38690afea275e7d09b343fe97daf0412d833f8ac4b78c17fc756386d9ebebf0759d707a7 + languageName: node + linkType: hard + "flat-cache@npm:^3.0.4": version: 3.2.0 resolution: "flat-cache@npm:3.2.0" @@ -32950,6 +33125,13 @@ __metadata: languageName: node linkType: hard +"get-stdin@npm:^8.0.0": + version: 8.0.0 + resolution: "get-stdin@npm:8.0.0" + checksum: 10/40128b6cd25781ddbd233344f1a1e4006d4284906191ed0a7d55ec2c1a3e44d650f280b2c9eeab79c03ac3037da80257476c0e4e5af38ddfb902d6ff06282d77 + languageName: node + linkType: hard + "get-stream@npm:^5.1.0": version: 5.2.0 resolution: "get-stream@npm:5.2.0" @@ -35847,6 +36029,17 @@ __metadata: languageName: node linkType: hard +"is-ci@npm:^2.0.0": + version: 2.0.0 + resolution: "is-ci@npm:2.0.0" + dependencies: + ci-info: "npm:^2.0.0" + bin: + is-ci: bin.js + checksum: 10/77b869057510f3efa439bbb36e9be429d53b3f51abd4776eeea79ab3b221337fe1753d1e50058a9e2c650d38246108beffb15ccfd443929d77748d8c0cc90144 + languageName: node + linkType: hard + "is-ci@npm:^3.0.1": version: 3.0.1 resolution: "is-ci@npm:3.0.1" @@ -37054,6 +37247,15 @@ __metadata: languageName: node linkType: hard +"js-graph-algorithms@npm:^1.0.18": + version: 1.0.18 + resolution: "js-graph-algorithms@npm:1.0.18" + bin: + js-graphs: ./src/jsgraphs.js + checksum: 10/84914d2dc3caacee043f42cf22e156ea9c4c98ce52588a576e33267433853f744894c4ca4b87085a613d6e197898a4eba6e9de7127e277ca1abeba96cc384b81 + languageName: node + linkType: hard + "js-sdsl@npm:^4.1.4": version: 4.4.2 resolution: "js-sdsl@npm:4.4.2" @@ -37844,6 +38046,15 @@ __metadata: languageName: node linkType: hard +"klaw-sync@npm:^6.0.0": + version: 6.0.0 + resolution: "klaw-sync@npm:6.0.0" + dependencies: + graceful-fs: "npm:^4.1.11" + checksum: 10/0da397f8961313c3ef8f79fb63af9002cde5a8fb2aeb1a37351feff0dd6006129c790400c3f5c3b4e757bedcabb13d21ec0a5eaef5a593d59515d4f2c291e475 + languageName: node + linkType: hard + "klaw@npm:^1.0.0": version: 1.3.1 resolution: "klaw@npm:1.3.1" @@ -37856,6 +38067,13 @@ __metadata: languageName: node linkType: hard +"klaw@npm:^4.0.1": + version: 4.1.0 + resolution: "klaw@npm:4.1.0" + checksum: 10/d3ac625e40a917633d89e8079b16d737dfca670d3ac92631a2d0b9005c02ed77721fa39e589d1572695b86331e516876b72fbe805438664e629177cac6c0790e + languageName: node + linkType: hard + "kleur@npm:^3.0.3": version: 3.0.3 resolution: "kleur@npm:3.0.3" @@ -38494,6 +38712,13 @@ __metadata: languageName: node linkType: hard +"lodash.omit@npm:^4.5.0": + version: 4.5.0 + resolution: "lodash.omit@npm:4.5.0" + checksum: 10/f5c67cd1df11f1275662060febb629a4d4e7b547c4bea66454508b5e6096162c2af882aab1ff8cb5dcf2b328f22252416de6ca9c1334588f6310edfac525e511 + languageName: node + linkType: hard + "lodash.pad@npm:^4.5.1": version: 4.5.1 resolution: "lodash.pad@npm:4.5.1" @@ -38515,6 +38740,13 @@ __metadata: languageName: node linkType: hard +"lodash.pick@npm:^4.4.0": + version: 4.4.0 + resolution: "lodash.pick@npm:4.4.0" + checksum: 10/5a76778aa1c245ce081d19c5a625a44cdf4853f421c8789ec962cb5d73dd21be7cf11ae3bc2123ff5f432326ed0176d674d22ca6e0e8f9eaba5b74b00f632c12 + languageName: node + linkType: hard + "lodash.repeat@npm:4.1.0, lodash.repeat@npm:^4.1.0": version: 4.1.0 resolution: "lodash.repeat@npm:4.1.0" @@ -42005,6 +42237,13 @@ __metadata: languageName: node linkType: hard +"nice-try@npm:^1.0.4": + version: 1.0.5 + resolution: "nice-try@npm:1.0.5" + checksum: 10/0b4af3b5bb5d86c289f7a026303d192a7eb4417231fe47245c460baeabae7277bcd8fd9c728fb6bd62c30b3e15cd6620373e2cf33353b095d8b403d3e8a15aff + languageName: node + linkType: hard + "nise@npm:^5.1.4, nise@npm:^5.1.5": version: 5.1.9 resolution: "nise@npm:5.1.9" @@ -42143,6 +42382,20 @@ __metadata: languageName: node linkType: hard +"node-fetch@npm:2.6.7": + version: 2.6.7 + resolution: "node-fetch@npm:2.6.7" + dependencies: + whatwg-url: "npm:^5.0.0" + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + checksum: 10/4bc9245383db92c35601a798c9a992fdf38d99920ceac11e0e6512ef3014d188b3807ccb060bc6c4bdb57a145030c73f5b5fd6730f665979f9264bc43ca3afea + languageName: node + linkType: hard + "node-fetch@npm:^2.0.0, node-fetch@npm:^2.6.0, node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.12, node-fetch@npm:^2.6.6, node-fetch@npm:^2.6.7, node-fetch@npm:^2.6.8, node-fetch@npm:^2.7.0": version: 2.7.0 resolution: "node-fetch@npm:2.7.0" @@ -42916,7 +43169,7 @@ __metadata: languageName: node linkType: hard -"open@npm:^7.0.3": +"open@npm:^7.0.3, open@npm:^7.4.2": version: 7.4.2 resolution: "open@npm:7.4.2" dependencies: @@ -43641,6 +43894,30 @@ __metadata: languageName: node linkType: hard +"patch-package@npm:^6.4.7": + version: 6.5.1 + resolution: "patch-package@npm:6.5.1" + dependencies: + "@yarnpkg/lockfile": "npm:^1.1.0" + chalk: "npm:^4.1.2" + cross-spawn: "npm:^6.0.5" + find-yarn-workspace-root: "npm:^2.0.0" + fs-extra: "npm:^9.0.0" + is-ci: "npm:^2.0.0" + klaw-sync: "npm:^6.0.0" + minimist: "npm:^1.2.6" + open: "npm:^7.4.2" + rimraf: "npm:^2.6.3" + semver: "npm:^5.6.0" + slash: "npm:^2.0.0" + tmp: "npm:^0.0.33" + yaml: "npm:^1.10.2" + bin: + patch-package: index.js + checksum: 10/e15b3848f008da2cc659abd6d84dfeab6ed25a999ba25692071c13409f198dad28b6e451ecfebc2139a0847ad8e608575d6724bcc887c56169df8a733b849e79 + languageName: node + linkType: hard + "path-browserify@npm:1.0.1, path-browserify@npm:^1.0.1": version: 1.0.1 resolution: "path-browserify@npm:1.0.1" @@ -43700,6 +43977,13 @@ __metadata: languageName: node linkType: hard +"path-key@npm:^2.0.1": + version: 2.0.1 + resolution: "path-key@npm:2.0.1" + checksum: 10/6e654864e34386a2a8e6bf72cf664dcabb76574dd54013add770b374384d438aca95f4357bb26935b514a4e4c2c9b19e191f2200b282422a76ee038b9258c5e7 + languageName: node + linkType: hard + "path-key@npm:^3.0.0, path-key@npm:^3.1.0": version: 3.1.1 resolution: "path-key@npm:3.1.1" @@ -44185,6 +44469,15 @@ __metadata: languageName: node linkType: hard +"pkg-dir@npm:4.2.0, pkg-dir@npm:^4.1.0": + version: 4.2.0 + resolution: "pkg-dir@npm:4.2.0" + dependencies: + find-up: "npm:^4.0.0" + checksum: 10/9863e3f35132bf99ae1636d31ff1e1e3501251d480336edb1c211133c8d58906bed80f154a1d723652df1fda91e01c7442c2eeaf9dc83157c7ae89087e43c8d6 + languageName: node + linkType: hard + "pkg-dir@npm:^3.0.0": version: 3.0.0 resolution: "pkg-dir@npm:3.0.0" @@ -44194,15 +44487,6 @@ __metadata: languageName: node linkType: hard -"pkg-dir@npm:^4.1.0": - version: 4.2.0 - resolution: "pkg-dir@npm:4.2.0" - dependencies: - find-up: "npm:^4.0.0" - checksum: 10/9863e3f35132bf99ae1636d31ff1e1e3501251d480336edb1c211133c8d58906bed80f154a1d723652df1fda91e01c7442c2eeaf9dc83157c7ae89087e43c8d6 - languageName: node - linkType: hard - "pkg-dir@npm:^5.0.0": version: 5.0.0 resolution: "pkg-dir@npm:5.0.0" @@ -44273,6 +44557,13 @@ __metadata: languageName: node linkType: hard +"pollock@npm:^0.2.0": + version: 0.2.1 + resolution: "pollock@npm:0.2.1" + checksum: 10/cd95df0878619c9de87d2f4d9685fa2ee983a38ecd7f8f8dea6163b8b6da4c0ba9c58c40712fd301412ef69d2685cb39f3f4a05114160eea673b4c879922b581 + languageName: node + linkType: hard + "posix-character-classes@npm:^0.1.0": version: 0.1.1 resolution: "posix-character-classes@npm:0.1.1" @@ -45399,7 +45690,7 @@ __metadata: languageName: node linkType: hard -"progress@npm:^2.0.1, progress@npm:^2.0.3": +"progress@npm:2.0.3, progress@npm:^2.0.1, progress@npm:^2.0.3": version: 2.0.3 resolution: "progress@npm:2.0.3" checksum: 10/e6f0bcb71f716eee9dfac0fe8a2606e3704d6a64dd93baaf49fbadbc8499989a610fe14cf1bc6f61b6d6653c49408d94f4a94e124538084efd8e4cf525e0293d @@ -45570,7 +45861,7 @@ __metadata: languageName: node linkType: hard -"proxy-from-env@npm:^1.0.0, proxy-from-env@npm:^1.1.0": +"proxy-from-env@npm:1.1.0, proxy-from-env@npm:^1.0.0, proxy-from-env@npm:^1.1.0": version: 1.1.0 resolution: "proxy-from-env@npm:1.1.0" checksum: 10/f0bb4a87cfd18f77bc2fba23ae49c3b378fb35143af16cc478171c623eebe181678f09439707ad80081d340d1593cd54a33a0113f3ccb3f4bc9451488780ee23 @@ -45694,6 +45985,26 @@ __metadata: languageName: node linkType: hard +"puppeteer@npm:^13.7.0": + version: 13.7.0 + resolution: "puppeteer@npm:13.7.0" + dependencies: + cross-fetch: "npm:3.1.5" + debug: "npm:4.3.4" + devtools-protocol: "npm:0.0.981744" + extract-zip: "npm:2.0.1" + https-proxy-agent: "npm:5.0.1" + pkg-dir: "npm:4.2.0" + progress: "npm:2.0.3" + proxy-from-env: "npm:1.1.0" + rimraf: "npm:3.0.2" + tar-fs: "npm:2.1.1" + unbzip2-stream: "npm:1.4.3" + ws: "npm:8.5.0" + checksum: 10/ffdcfb2ad118c8e39563701dfe903b925f6c57068c9e55a7d239be6acf8f9d210638dffa1f727e0f200914afacfad9e9e6a311515c6a3e1b9c9291f83118ee1c + languageName: node + linkType: hard + "pvtsutils@npm:^1.3.2, pvtsutils@npm:^1.3.5": version: 1.3.5 resolution: "pvtsutils@npm:1.3.5" @@ -47796,25 +48107,25 @@ __metadata: languageName: node linkType: hard -"rimraf@npm:^2.2.8, rimraf@npm:^2.6.1, rimraf@npm:^2.6.2, rimraf@npm:^2.6.3, rimraf@npm:^2.7.1": - version: 2.7.1 - resolution: "rimraf@npm:2.7.1" +"rimraf@npm:3.0.2, rimraf@npm:^3.0.2": + version: 3.0.2 + resolution: "rimraf@npm:3.0.2" dependencies: glob: "npm:^7.1.3" bin: - rimraf: ./bin.js - checksum: 10/4586c296c736483e297da7cffd19475e4a3e41d07b1ae124aad5d687c79e4ffa716bdac8732ed1db942caf65271cee9dd39f8b639611de161a2753e2112ffe1d + rimraf: bin.js + checksum: 10/063ffaccaaaca2cfd0ef3beafb12d6a03dd7ff1260d752d62a6077b5dfff6ae81bea571f655bb6b589d366930ec1bdd285d40d560c0dae9b12f125e54eb743d5 languageName: node linkType: hard -"rimraf@npm:^3.0.2": - version: 3.0.2 - resolution: "rimraf@npm:3.0.2" +"rimraf@npm:^2.2.8, rimraf@npm:^2.6.1, rimraf@npm:^2.6.2, rimraf@npm:^2.6.3, rimraf@npm:^2.7.1": + version: 2.7.1 + resolution: "rimraf@npm:2.7.1" dependencies: glob: "npm:^7.1.3" bin: - rimraf: bin.js - checksum: 10/063ffaccaaaca2cfd0ef3beafb12d6a03dd7ff1260d752d62a6077b5dfff6ae81bea571f655bb6b589d366930ec1bdd285d40d560c0dae9b12f125e54eb743d5 + rimraf: ./bin.js + checksum: 10/4586c296c736483e297da7cffd19475e4a3e41d07b1ae124aad5d687c79e4ffa716bdac8732ed1db942caf65271cee9dd39f8b639611de161a2753e2112ffe1d languageName: node linkType: hard @@ -48943,6 +49254,15 @@ __metadata: languageName: node linkType: hard +"shebang-command@npm:^1.2.0": + version: 1.2.0 + resolution: "shebang-command@npm:1.2.0" + dependencies: + shebang-regex: "npm:^1.0.0" + checksum: 10/9eed1750301e622961ba5d588af2212505e96770ec376a37ab678f965795e995ade7ed44910f5d3d3cb5e10165a1847f52d3348c64e146b8be922f7707958908 + languageName: node + linkType: hard + "shebang-command@npm:^2.0.0": version: 2.0.0 resolution: "shebang-command@npm:2.0.0" @@ -48952,6 +49272,13 @@ __metadata: languageName: node linkType: hard +"shebang-regex@npm:^1.0.0": + version: 1.0.0 + resolution: "shebang-regex@npm:1.0.0" + checksum: 10/404c5a752cd40f94591dfd9346da40a735a05139dac890ffc229afba610854d8799aaa52f87f7e0c94c5007f2c6af55bdcaeb584b56691926c5eaf41dc8f1372 + languageName: node + linkType: hard + "shebang-regex@npm:^3.0.0": version: 3.0.0 resolution: "shebang-regex@npm:3.0.0" @@ -49349,6 +49676,25 @@ __metadata: languageName: node linkType: hard +"sol2uml@npm:2.2.0": + version: 2.2.0 + resolution: "sol2uml@npm:2.2.0" + dependencies: + "@aduh95/viz.js": "npm:^3.7.0" + "@solidity-parser/parser": "npm:^0.14.3" + axios: "npm:^0.27.2" + commander: "npm:^9.4.0" + convert-svg-to-png: "npm:^0.6.4" + debug: "npm:^4.3.4" + ethers: "npm:^5.6.9" + js-graph-algorithms: "npm:^1.0.18" + klaw: "npm:^4.0.1" + bin: + sol2uml: lib/sol2uml.js + checksum: 10/d6d860e9a9db0e7034a6f1e5b188ef7ddb7b1b4dda2174322e82b4d7bb5c0d6f95de9d26ee056956fab293253ae43bd68759b88e8ef530ac791c8903d16d7d79 + languageName: node + linkType: hard + "solc@npm:0.7.3": version: 0.7.3 resolution: "solc@npm:0.7.3" @@ -51045,7 +51391,7 @@ __metadata: languageName: node linkType: hard -"tar-fs@npm:^2.1.1": +"tar-fs@npm:2.1.1, tar-fs@npm:^2.1.1": version: 2.1.1 resolution: "tar-fs@npm:2.1.1" dependencies: @@ -51599,7 +51945,7 @@ __metadata: languageName: node linkType: hard -"tmp@npm:^0.2.0": +"tmp@npm:^0.2.0, tmp@npm:^0.2.1": version: 0.2.3 resolution: "tmp@npm:0.2.3" checksum: 10/7b13696787f159c9754793a83aa79a24f1522d47b87462ddb57c18ee93ff26c74cbb2b8d9138f571d2e0e765c728fb2739863a672b280528512c6d83d511c6fa @@ -52644,7 +52990,7 @@ __metadata: languageName: node linkType: hard -"unbzip2-stream@npm:^1.4.3": +"unbzip2-stream@npm:1.4.3, unbzip2-stream@npm:^1.4.3": version: 1.4.3 resolution: "unbzip2-stream@npm:1.4.3" dependencies: @@ -55251,7 +55597,7 @@ __metadata: languageName: node linkType: hard -"which@npm:1.3.1, which@npm:^1.1.1, which@npm:^1.3.1": +"which@npm:1.3.1, which@npm:^1.1.1, which@npm:^1.2.9, which@npm:^1.3.1": version: 1.3.1 resolution: "which@npm:1.3.1" dependencies: From b9c34672c8e312e2de35bc67f7bb292113ab5e05 Mon Sep 17 00:00:00 2001 From: DannyThomx Date: Tue, 26 Mar 2024 13:02:35 +0200 Subject: [PATCH 05/35] removed console logs, and .env file --- governance/.env | 27 ---------- .../proposals/010-arbitrum-l1-l2-messaging.js | 54 +++---------------- 2 files changed, 8 insertions(+), 73 deletions(-) delete mode 100644 governance/.env diff --git a/governance/.env b/governance/.env deleted file mode 100644 index 9da7350d6f7..00000000000 --- a/governance/.env +++ /dev/null @@ -1,27 +0,0 @@ -# private key of the signer that will deploy the contract -export DEPLOYER_PRIVATE_KEY="0x14e1a3103ce06d0348acf19df3df1965ee55f9cdb16708c0bb8cd3d843ab8805" - -# block explorers API keys -export ETHERSCAN_API_KEY="988a82bfe0a540ad84aa1a5d534c2bc6" -export POLYGONSCAN_API_KEY= -export OPTIMISTIC_ETHERSCAN_API_KEY= -export BSCSCAN_API_KEY= -export SNOWTRACE_API_KEY= -export ARBISCAN_API_KEY= -export CELO_API_KEY= -export GNOSISSCAN_API_KEY= - -# This is a sample .env file for use in local development. - -# Duplicate this file as .env - -# Your Private key -DEVNET_PRIVKEY="0x14e1a3103ce06d0348acf19df3df1965ee55f9cdb16708c0bb8cd3d843ab8805" - -# Hosted Aggregator Node (JSON-RPC Endpoint). This is Arbitrum Sepolia Testnet, can use any Arbitrum chain - -L2RPC="https://arbitrum-mainnet.infura.io/v3/988a82bfe0a540ad84aa1a5d534c2bc6" - -# Ethereum RPC; i.e., for Sepolia https://sepolia.infura.io/v3/ - -L1RPC="https://mainnet.infura.io/v3/988a82bfe0a540ad84aa1a5d534c2bc6" diff --git a/governance/proposals/010-arbitrum-l1-l2-messaging.js b/governance/proposals/010-arbitrum-l1-l2-messaging.js index b889d8a97a8..68e1454d977 100644 --- a/governance/proposals/010-arbitrum-l1-l2-messaging.js +++ b/governance/proposals/010-arbitrum-l1-l2-messaging.js @@ -115,9 +115,11 @@ const INBOX_ABI = [ /** * Set up: instantiate L1 / L2 wallets connected to providers */ -const walletPrivateKey = process.env.DEVNET_PRIVKEY -const l1Provider = new ethers.JsonRpcProvider(process.env.L1RPC) -const l2Provider = new ethers.JsonRpcProvider(process.env.L2RPC) +const walletPrivateKey = 'Your_Private_key' +const L1RPC = 'https://mainnet.infura.io/v3/' +const L2RPC = 'https://arbitrum-mainnet.infura.io/v3/' +const l1Provider = new ethers.JsonRpcProvider(L1RPC) +const l2Provider = new ethers.JsonRpcProvider(L2RPC) // const l1Wallet = new ethers.Wallet(walletPrivateKey, l1Provider) const l2Wallet = new ethers.Wallet(walletPrivateKey, l2Provider) @@ -130,7 +132,7 @@ module.exports = async () => { const inboxAddress = ethBridger.l2Network.ethBridge.inbox const ARBTokenAddressOnL2 = '0x912CE59144191C1204E64559FE8253a0e49E6548' // ARB TOKEN ADDRESS ON ARBITRUM ONE const grantsContractAddress = '0x00D5E0d31d37cc13C645D86410aB4cB7Cb428ccA' - const L2Alias = '0x28ffDfB0A6e6E06E95B3A1f928Dc4024240bD87c' // Timelock Alias Address on L2 + const timelockL2Alias = '0x28ffDfB0A6e6E06E95B3A1f928Dc4024240bD87c' // Timelock Alias Address on L2 const L1TimelockContract = '0x17EEDFb0a6E6e06E95B3A1F928dc4024240BC76B' // Timelock Address mainnet const L2TokenContract = new ethers.Contract( @@ -139,9 +141,7 @@ module.exports = async () => { l2Wallet ).connect(l2Wallet) - const balanceOf = await L2TokenContract.balanceOf(L2Alias) - console.log('ARB BALANCE::', ethers.formatEther(await balanceOf)) - + const balanceOf = await L2TokenContract.balanceOf(timelockL2Alias) const tokenAmount = ethers.parseEther('1') // Create an instance of the Interface from the ABIs @@ -176,27 +176,7 @@ module.exports = async () => { await getBaseFee(l1Provider), l1Provider ) - console.log(':::::::::L1ToL2MessageGasParams::::::::::') - console.log( - 'GasParams::::gasLimit', - L1ToL2MessageGasParams.gasLimit.toNumber() - ) - console.log( - 'GasParams::::maxSubmissionCost', - L1ToL2MessageGasParams.maxSubmissionCost.toNumber() - ) - console.log( - 'GasParams::::maxGas', - L1ToL2MessageGasParams.maxFeePerGas.toNumber() - ) - console.log('GasParams::::deposit', L1ToL2MessageGasParams.deposit.toNumber()) - - console.log( - `Current retryable base submission price is: ${L1ToL2MessageGasParams.maxSubmissionCost.toString()}` - ) - const gasPriceBid = await l2Provider.getGasPrice() - console.log(`L2 gas price: ${gasPriceBid.toString()}`) const inbox_calldata = iface_inbox.encodeFunctionData( 'createRetryableTicket', @@ -213,29 +193,11 @@ module.exports = async () => { ) const proposalName = `# Test Transaction before 7k ARB Transfer To Fund Unlock Protocol’s Ecosystem via Grants Stack This proposal requests to use 1 ARB from the tokens given to Unlock Protocol DAO by ArbitrumDAO to run a test transaction to de-risk the transfer of 7k ARB tokens to fund the retroQF round on Grants Stack.` - console.log(proposalName) // Proposal ARGS i.e Call Governor.propose() directly with these values - // targets: Inbox contract - // values: depost * 10 - // calldatas: inbox_calldata - // description const targets = [inboxAddress] const values = [L1ToL2MessageGasParams.deposit.toNumber() * 10] // I Multiply by 10 to add extra in case gas changes const calldatas = [inbox_calldata] - console.log( - '______________________________________________________________________\n' - ) - console.log( - 'PROPOSAL ARGS - Can Call Propose function on Governor with the following::' - ) - console.log( - '______________________________________________________________________\n' - ) - - console.log('TARGETS:: ', targets) - console.log('VALUES:: ', values) - console.log('CALLDATAS:: ', calldatas) - console.log('DESCRIPTION:: ', proposalName) + const description = proposalName const calls = [ { From 506fdc6f12004be1b6364859e73fd626caedae55 Mon Sep 17 00:00:00 2001 From: DannyThomx Date: Thu, 28 Mar 2024 14:24:25 +0200 Subject: [PATCH 06/35] used fixed version numbers for arbitrum packages, added config.js file --- governance/.env.copy | 15 --------------- governance/package.json | 6 +++--- .../proposals/010-arbitrum-l1-l2-messaging.js | 14 ++++++++------ governance/proposals/config.js | 11 +++++++++++ 4 files changed, 22 insertions(+), 24 deletions(-) create mode 100644 governance/proposals/config.js diff --git a/governance/.env.copy b/governance/.env.copy index 97cbc1f3c23..c2b665f92da 100644 --- a/governance/.env.copy +++ b/governance/.env.copy @@ -10,18 +10,3 @@ export SNOWTRACE_API_KEY= export ARBISCAN_API_KEY= export CELO_API_KEY= export GNOSISSCAN_API_KEY= - -# This is a sample .env file for use in local development. - -# Duplicate this file as .env - -# Your Private key -DEVNET_PRIVKEY="0x your key here" - -# Hosted Aggregator Node (JSON-RPC Endpoint). This is Arbitrum Sepolia Testnet, can use any Arbitrum chain - -L2RPC="https://sepolia-rollup.arbitrum.io/rpc" - -# Ethereum RPC; i.e., for Sepolia https://sepolia.infura.io/v3/ - -L1RPC="" diff --git a/governance/package.json b/governance/package.json index 5c186949f4b..aaa29324737 100644 --- a/governance/package.json +++ b/governance/package.json @@ -3,8 +3,8 @@ "description": "Scripts for the management of the Unlock Protocol", "private": true, "dependencies": { - "@arbitrum/nitro-contracts": "v1.0.2", - "@arbitrum/sdk": "^v3.1.9", + "@arbitrum/nitro-contracts": "1.0.2", + "@arbitrum/sdk": "3.1.9", "@matterlabs/hardhat-zksync-deploy": "1.1.2", "@matterlabs/hardhat-zksync-solc": "1.1.0", "@matterlabs/hardhat-zksync-upgradable": "1.2.4", @@ -23,7 +23,7 @@ "@unlock-protocol/hardhat-helpers": "workspace:^", "@unlock-protocol/hardhat-plugin": "workspace:^", "@unlock-protocol/networks": "workspace:./packages/networks", - "arb-shared-dependencies": "^1.0.0", + "arb-shared-dependencies": "1.0.0", "eslint": "8.54.0", "ethers": "6.11.1", "fs-extra": "11.2.0", diff --git a/governance/proposals/010-arbitrum-l1-l2-messaging.js b/governance/proposals/010-arbitrum-l1-l2-messaging.js index 68e1454d977..2a7204a2cff 100644 --- a/governance/proposals/010-arbitrum-l1-l2-messaging.js +++ b/governance/proposals/010-arbitrum-l1-l2-messaging.js @@ -9,6 +9,12 @@ const { addDefaultLocalNetwork, } = require('@arbitrum/sdk') const { getBaseFee } = require('@arbitrum/sdk/dist/lib/utils/lib') +const { + ARBTokenAddressOnL2, + grantsContractAddress, + timelockL2Alias, + L1TimelockContract, +} = require('./config') const ERC20_ABI = [ { @@ -115,8 +121,8 @@ const INBOX_ABI = [ /** * Set up: instantiate L1 / L2 wallets connected to providers */ -const walletPrivateKey = 'Your_Private_key' -const L1RPC = 'https://mainnet.infura.io/v3/' +const walletPrivateKey = process.env.PRIVATE_KEY +const L1RPC = 'https://rpc.unlock-protocol.com/1' const L2RPC = 'https://arbitrum-mainnet.infura.io/v3/' const l1Provider = new ethers.JsonRpcProvider(L1RPC) const l2Provider = new ethers.JsonRpcProvider(L2RPC) @@ -130,10 +136,6 @@ module.exports = async () => { const l2Network = await getL2Network(l2Provider) const ethBridger = new EthBridger(l2Network) const inboxAddress = ethBridger.l2Network.ethBridge.inbox - const ARBTokenAddressOnL2 = '0x912CE59144191C1204E64559FE8253a0e49E6548' // ARB TOKEN ADDRESS ON ARBITRUM ONE - const grantsContractAddress = '0x00D5E0d31d37cc13C645D86410aB4cB7Cb428ccA' - const timelockL2Alias = '0x28ffDfB0A6e6E06E95B3A1f928Dc4024240bD87c' // Timelock Alias Address on L2 - const L1TimelockContract = '0x17EEDFb0a6E6e06E95B3A1F928dc4024240BC76B' // Timelock Address mainnet const L2TokenContract = new ethers.Contract( ARBTokenAddressOnL2, diff --git a/governance/proposals/config.js b/governance/proposals/config.js new file mode 100644 index 00000000000..99cecfc08f2 --- /dev/null +++ b/governance/proposals/config.js @@ -0,0 +1,11 @@ +const ARBTokenAddressOnL2 = '0x912CE59144191C1204E64559FE8253a0e49E6548' // ARB TOKEN ADDRESS ON ARBITRUM ONE +const grantsContractAddress = '0x00D5E0d31d37cc13C645D86410aB4cB7Cb428ccA' +const timelockL2Alias = '0x28ffDfB0A6e6E06E95B3A1f928Dc4024240bD87c' // Timelock Alias Address on L2 +const L1TimelockContract = '0x17EEDFb0a6E6e06E95B3A1F928dc4024240BC76B' // Timelock Address mainnet + +export default { + ARBTokenAddressOnL2, + grantsContractAddress, + timelockL2Alias, + L1TimelockContract, +} From 09aada2ed3305db3e46757b1b54f4fcb3d545b27 Mon Sep 17 00:00:00 2001 From: DannyThomx Date: Thu, 28 Mar 2024 14:32:25 +0200 Subject: [PATCH 07/35] changed excessFeeRefundAddress to the dao's address --- governance/proposals/010-arbitrum-l1-l2-messaging.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/governance/proposals/010-arbitrum-l1-l2-messaging.js b/governance/proposals/010-arbitrum-l1-l2-messaging.js index 2a7204a2cff..b326a28c6f9 100644 --- a/governance/proposals/010-arbitrum-l1-l2-messaging.js +++ b/governance/proposals/010-arbitrum-l1-l2-messaging.js @@ -171,8 +171,8 @@ module.exports = async () => { from: L1TimelockContract, to: ARBTokenAddressOnL2, l2CallValue: 0, - excessFeeRefundAddress: l2Wallet.address, - callValueRefundAddress: l2Wallet.address, + excessFeeRefundAddress: L1TimelockContract, + callValueRefundAddress: L1TimelockContract, data: transfer_calldata, }, await getBaseFee(l1Provider), @@ -186,8 +186,8 @@ module.exports = async () => { ARBTokenAddressOnL2, 0, L1ToL2MessageGasParams.maxSubmissionCost, - l2Wallet.address, - l2Wallet.address, + L1TimelockContract, + L1TimelockContract, L1ToL2MessageGasParams.gasLimit, gasPriceBid, transfer_calldata, From 6cd79c2cea059dd7bc71f7431c4df4b622abf24d Mon Sep 17 00:00:00 2001 From: DannyThomx Date: Thu, 28 Mar 2024 21:20:19 +0200 Subject: [PATCH 08/35] added comments in front of params to provide their names --- .../proposals/010-arbitrum-l1-l2-messaging.js | 48 +++++++++---------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/governance/proposals/010-arbitrum-l1-l2-messaging.js b/governance/proposals/010-arbitrum-l1-l2-messaging.js index b326a28c6f9..c2ee8f50efb 100644 --- a/governance/proposals/010-arbitrum-l1-l2-messaging.js +++ b/governance/proposals/010-arbitrum-l1-l2-messaging.js @@ -2,12 +2,7 @@ const ethers = require('ethers') const { L1ToL2MessageGasEstimator, } = require('@arbitrum/sdk/dist/lib/message/L1ToL2MessageGasEstimator') -const { arbLog } = require('arb-shared-dependencies') -const { - EthBridger, - getL2Network, - addDefaultLocalNetwork, -} = require('@arbitrum/sdk') +const { EthBridger, getL2Network } = require('@arbitrum/sdk') const { getBaseFee } = require('@arbitrum/sdk/dist/lib/utils/lib') const { ARBTokenAddressOnL2, @@ -123,15 +118,14 @@ const INBOX_ABI = [ */ const walletPrivateKey = process.env.PRIVATE_KEY const L1RPC = 'https://rpc.unlock-protocol.com/1' -const L2RPC = 'https://arbitrum-mainnet.infura.io/v3/' +const L2RPC = `https://arbitrum-mainnet.infura.io/v3/${process.env.ETHERSCAN_API_KEY}` const l1Provider = new ethers.JsonRpcProvider(L1RPC) const l2Provider = new ethers.JsonRpcProvider(L2RPC) // const l1Wallet = new ethers.Wallet(walletPrivateKey, l1Provider) const l2Wallet = new ethers.Wallet(walletPrivateKey, l2Provider) module.exports = async () => { - await arbLog('Cross-chain Proposer') - addDefaultLocalNetwork() + console.log('Cross-chain Proposer') const l2Network = await getL2Network(l2Provider) const ethBridger = new EthBridger(l2Network) @@ -183,18 +177,20 @@ module.exports = async () => { const inbox_calldata = iface_inbox.encodeFunctionData( 'createRetryableTicket', [ - ARBTokenAddressOnL2, - 0, - L1ToL2MessageGasParams.maxSubmissionCost, - L1TimelockContract, - L1TimelockContract, - L1ToL2MessageGasParams.gasLimit, - gasPriceBid, - transfer_calldata, + ARBTokenAddressOnL2, // to + 0, // l2CallValue + L1ToL2MessageGasParams.maxSubmissionCost, // maxSubmissionCost + L1TimelockContract, // excessFeeRefundAddress + L1TimelockContract, // callValueRefundAddress + L1ToL2MessageGasParams.gasLimit, // gasLimit + gasPriceBid, // maxFeePerGas + transfer_calldata, // data ] ) - const proposalName = `# Test Transaction before 7k ARB Transfer To Fund Unlock Protocol’s Ecosystem via Grants Stack This proposal requests to use 1 ARB from the tokens given to Unlock Protocol DAO by ArbitrumDAO to run a test transaction to de-risk the transfer of 7k ARB tokens to fund the retroQF round on Grants Stack.` + const proposalName = ` + # Test Transaction before 7k ARB Transfer To Fund Unlock Protocol’s Ecosystem via Grants Stack + This proposal requests to use 1 ARB from the tokens given to Unlock Protocol DAO by ArbitrumDAO to run a test transaction to de-risk the transfer of 7k ARB tokens to fund the retroQF round on Grants Stack.` // Proposal ARGS i.e Call Governor.propose() directly with these values const targets = [inboxAddress] const values = [L1ToL2MessageGasParams.deposit.toNumber() * 10] // I Multiply by 10 to add extra in case gas changes @@ -207,14 +203,14 @@ module.exports = async () => { contractAddress: inboxAddress, functionName: 'createRetryableTicket', functionArgs: [ - ARBTokenAddressOnL2, - 0, - L1ToL2MessageGasParams.maxSubmissionCost, - l2Wallet.address, - l2Wallet.address, - L1ToL2MessageGasParams.gasLimit, - gasPriceBid, - transfer_calldata, + ARBTokenAddressOnL2, // to + 0, // l2CallValue + L1ToL2MessageGasParams.maxSubmissionCost, // maxSubmissionCost + l2Wallet.address, // excessFeeRefundAddress + l2Wallet.address, // callValueRefundAddress + L1ToL2MessageGasParams.gasLimit, // gasLimit + gasPriceBid, // maxFeePerGas + transfer_calldata, // data ], value: L1ToL2MessageGasParams.deposit.toNumber() * 10, // I Multiply by 10 to add extra in case gas changes due to proposal delay }, From cd41637973fd6f5fc48ac39511f00c3b3de36241 Mon Sep 17 00:00:00 2001 From: DannyThomx Date: Thu, 28 Mar 2024 22:44:03 +0200 Subject: [PATCH 09/35] formated proposal description correctly --- .../proposals/010-arbitrum-l1-l2-messaging.js | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/governance/proposals/010-arbitrum-l1-l2-messaging.js b/governance/proposals/010-arbitrum-l1-l2-messaging.js index c2ee8f50efb..99923ae91a2 100644 --- a/governance/proposals/010-arbitrum-l1-l2-messaging.js +++ b/governance/proposals/010-arbitrum-l1-l2-messaging.js @@ -189,8 +189,31 @@ module.exports = async () => { ) const proposalName = ` - # Test Transaction before 7k ARB Transfer To Fund Unlock Protocol’s Ecosystem via Grants Stack - This proposal requests to use 1 ARB from the tokens given to Unlock Protocol DAO by ArbitrumDAO to run a test transaction to de-risk the transfer of 7k ARB tokens to fund the retroQF round on Grants Stack.` + # Test Transaction before 7k ARB Transfer To Fund Unlock Protocol’s Ecosystem via Grants Stack + + ### Goal of the proposal + This proposal requests to use 1 ARB from the tokens given to Unlock Protocol DAO by ArbitrumDAO to run a test transaction to de-risk the transfer of 7k ARB tokens to fund the retroQF round on Grants Stack. + + #### Current situation of DAO's ARB Tokens + - total: ${ethers.formatEther(balanceOf).toString()} ARB. + - DAO ALIAS Address (On Arbitrum): [${timelockL2Alias}](https://arbiscan.io/address/${timelockL2Alias}) + + For Reference + [Snapshot temperature check for 7k ARBs](https://snapshot.org/#/unlock-protocol.eth/proposal/0xaa142e599d981f0b58c3ac1a51af9f9a52fb5307f27d791ecc18c4da69eeacc3) + + #### About the proposal + The proposal contains a single call to the Arbitrum Delayed Inbox Contract's \`createRetryableTicket\` function on mainnet to create a \`Retryable Ticket\` that will attempt to execute an L2 request to the ARB token contract to transfer ${ethers + .formatEther(tokenAmount) + .toString()} of tokens to the grants contract - \`transfer(${grantsContractAddress},${ethers + .formatEther(tokenAmount) + .toString()})\`. + + Once approved and executed, the request will be sent to the Delayed Inbox contract and a ticket is created. + + Note that, this function forces the sender to provide a reasonable amount of funds (at least enough to submitting, and attempting to executing the ticket), but that doesn't guarantee a successful auto-redemption. [Checkout arbitrum docs for more info.](https://docs.arbitrum.io/arbos/l1-to-l2-messaging). + + Thank you! + ` // Proposal ARGS i.e Call Governor.propose() directly with these values const targets = [inboxAddress] const values = [L1ToL2MessageGasParams.deposit.toNumber() * 10] // I Multiply by 10 to add extra in case gas changes From 80b6fe6d5a9fef59ca15b854e69fcebf5adb69ac Mon Sep 17 00:00:00 2001 From: Julien Genestoux Date: Tue, 26 Mar 2024 18:26:05 -0400 Subject: [PATCH 10/35] feat(locksmith): better fatal error handling with a logging statement --- locksmith/src/controllers/purchaseController.ts | 1 - locksmith/src/controllers/userController.ts | 2 -- locksmith/src/fulfillment/dispatcher.ts | 2 +- locksmith/src/server.ts | 7 +++++++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/locksmith/src/controllers/purchaseController.ts b/locksmith/src/controllers/purchaseController.ts index fb525b0eebc..0f0b9bcbc25 100644 --- a/locksmith/src/controllers/purchaseController.ts +++ b/locksmith/src/controllers/purchaseController.ts @@ -219,7 +219,6 @@ export class PurchaseController { ) logger.info(`Subscription updated for id: ${subscription?.id}`) } catch (error) { - console.log(error) if (response.headersSent) { return } diff --git a/locksmith/src/controllers/userController.ts b/locksmith/src/controllers/userController.ts index e2ddd8198ca..b358086a0fe 100644 --- a/locksmith/src/controllers/userController.ts +++ b/locksmith/src/controllers/userController.ts @@ -63,8 +63,6 @@ export const retrieveEncryptedPrivatekey = async ( const result = await ethers.Wallet.createRandom().encrypt( (Math.random() + 1).toString(36) ) - console.log(result) - return res.json({ passwordEncryptedPrivateKey: result, }) diff --git a/locksmith/src/fulfillment/dispatcher.ts b/locksmith/src/fulfillment/dispatcher.ts index e77a1b6918c..ece765b34c1 100644 --- a/locksmith/src/fulfillment/dispatcher.ts +++ b/locksmith/src/fulfillment/dispatcher.ts @@ -216,7 +216,7 @@ export default class Dispatcher { new Promise( (resolve) => (timeout = setTimeout(() => { - console.log( + logger.error( `Timeout while retrieving balance on network ${network.name} (${network.id})` ) resolve(0) diff --git a/locksmith/src/server.ts b/locksmith/src/server.ts index 22f969bccf4..26efa44482e 100644 --- a/locksmith/src/server.ts +++ b/locksmith/src/server.ts @@ -3,6 +3,13 @@ import logger from './logger' logger.info('Starting Locksmith...') +process.on('uncaughtException', function (error, origin) { + logger.error('Fatal error:', origin) + logger.error(error.toString()) + logger.error(error.stack) + process.exit(1) +}) + const port = process.env.PORT || 8080 // in prod, we start immediately From 14273ca20489c5c8dc36e725097a2ea96edca903 Mon Sep 17 00:00:00 2001 From: Julien Genestoux Date: Tue, 26 Mar 2024 19:02:53 -0400 Subject: [PATCH 11/35] feat(locksmith): adding cache for decoy users --- locksmith/src/controllers/userController.ts | 31 ++++++++++++++++++--- locksmith/src/operations/userOperations.ts | 1 + 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/locksmith/src/controllers/userController.ts b/locksmith/src/controllers/userController.ts index b358086a0fe..f8b26d85dd9 100644 --- a/locksmith/src/controllers/userController.ts +++ b/locksmith/src/controllers/userController.ts @@ -4,6 +4,11 @@ import * as Normalizer from '../utils/normalizer' import UserOperations from '../operations/userOperations' import logger from '../logger' import { ethers } from 'ethers' +import { MemoryCache } from 'memory-cache-node' + +// Decoy users are cached for 15 minutes +const cacheDuration = 60 * 15 +const decoyUserCache = new MemoryCache(cacheDuration / 5, 1000) export const createUser = async (req: Request, res: Response): Promise => { try { @@ -53,6 +58,7 @@ export const retrieveEncryptedPrivatekey = async ( if (ejected) { return res.sendStatus(404) } + const result = await UserOperations.getUserPrivateKeyByEmailAddress( emailAddress ) @@ -60,11 +66,28 @@ export const retrieveEncryptedPrivatekey = async ( if (result) { return res.json({ passwordEncryptedPrivateKey: result }) } else { - const result = await ethers.Wallet.createRandom().encrypt( - (Math.random() + 1).toString(36) - ) + let passwordEncryptedPrivateKey = + decoyUserCache.retrieveItemValue(emailAddress) + if (!passwordEncryptedPrivateKey) { + passwordEncryptedPrivateKey = await ethers.Wallet.createRandom().encrypt( + (Math.random() + 1).toString(36), + { + scrypt: { + // web3 used 1 << 5, ethers default is 1 << 18. We want speedy encryption here since this is not a real account anyway. + // eslint-disable-next-line no-bitwise + N: 1 << 5, + }, + } + ) + decoyUserCache.storeExpiringItem( + emailAddress, + passwordEncryptedPrivateKey, + cacheDuration + ) + } + return res.json({ - passwordEncryptedPrivateKey: result, + passwordEncryptedPrivateKey, }) } } diff --git a/locksmith/src/operations/userOperations.ts b/locksmith/src/operations/userOperations.ts index cf3be268a82..9f21ba50f7c 100644 --- a/locksmith/src/operations/userOperations.ts +++ b/locksmith/src/operations/userOperations.ts @@ -163,6 +163,7 @@ export const getCards = async (emailAddress: string): Promise => { } return [] } + export const getCardDetailsFromStripe = async ( customer_id: any ): Promise => { From 6709e11f41a474db1ece1d391f7f73714787100e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 07:26:17 -0400 Subject: [PATCH 12/35] fix(deps): update dependency express [security] (#13524) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- locksmith/package.json | 2 +- packages/unlock-express/example/package.json | 2 +- yarn.lock | 261 ++++++++++--------- 3 files changed, 139 insertions(+), 126 deletions(-) diff --git a/locksmith/package.json b/locksmith/package.json index 56dab08e8ba..516a1d6fbe7 100644 --- a/locksmith/package.json +++ b/locksmith/package.json @@ -57,7 +57,7 @@ "dayjs": "1.11.10", "dotenv": "16.1.3", "ethers": "5.7.2", - "express": "5.0.0-beta.1", + "express": "5.0.0-beta.3", "express-winston": "4.2.0", "fuse.js": "6.6.2", "geoip-country": "4.1.59", diff --git a/packages/unlock-express/example/package.json b/packages/unlock-express/example/package.json index b55e93fe3f5..a9618952b93 100644 --- a/packages/unlock-express/example/package.json +++ b/packages/unlock-express/example/package.json @@ -11,7 +11,7 @@ "license": "ISC", "dependencies": { "@unlock-protocol/unlock-express": "workspace:^", - "express": "4.18.3", + "express": "4.19.2", "express-session": "1.18.0", "passport": "0.7.0" } diff --git a/yarn.lock b/yarn.lock index cb1ae795ce4..2e492f7d532 100644 --- a/yarn.lock +++ b/yarn.lock @@ -20063,7 +20063,7 @@ __metadata: eslint: "npm:8.41.0" eslint-config-standard: "npm:17.1.0" ethers: "npm:5.7.2" - express: "npm:5.0.0-beta.1" + express: "npm:5.0.0-beta.3" express-winston: "npm:4.2.0" fuse.js: "npm:6.6.2" geoip-country: "npm:4.1.59" @@ -21905,7 +21905,7 @@ __metadata: languageName: node linkType: hard -"accepts@npm:^1.3.7, accepts@npm:~1.3.4, accepts@npm:~1.3.5, accepts@npm:~1.3.7, accepts@npm:~1.3.8": +"accepts@npm:^1.3.7, accepts@npm:~1.3.4, accepts@npm:~1.3.5, accepts@npm:~1.3.8": version: 1.3.8 resolution: "accepts@npm:1.3.8" dependencies: @@ -24304,21 +24304,22 @@ __metadata: languageName: node linkType: hard -"body-parser@npm:2.0.0-beta.1": - version: 2.0.0-beta.1 - resolution: "body-parser@npm:2.0.0-beta.1" +"body-parser@npm:2.0.0-beta.2": + version: 2.0.0-beta.2 + resolution: "body-parser@npm:2.0.0-beta.2" dependencies: - bytes: "npm:3.1.1" - content-type: "npm:~1.0.4" - debug: "npm:2.6.9" - depd: "npm:~1.1.2" - http-errors: "npm:1.8.1" - iconv-lite: "npm:0.4.24" - on-finished: "npm:~2.3.0" - qs: "npm:6.9.6" - raw-body: "npm:2.4.2" + bytes: "npm:3.1.2" + content-type: "npm:~1.0.5" + debug: "npm:3.1.0" + destroy: "npm:1.2.0" + http-errors: "npm:2.0.0" + iconv-lite: "npm:0.5.2" + on-finished: "npm:2.4.1" + qs: "npm:6.11.0" + raw-body: "npm:3.0.0-beta.1" type-is: "npm:~1.6.18" - checksum: 10/433a29df84da901e277da207c7e280019c0dd428e56a3b0b99c95bedd740fab1e483bebc605bac1615d7244e22b8fbb7602aaf82acdd1bed92af93bc11b42243 + unpipe: "npm:1.0.0" + checksum: 10/f6e38fd7f5f33fbc248babd6b46cf2b22f9c425609d5c68a6949673286a51511726c7828dcb4997505b7b8fab8587dad00a64dc6c5f67a4116e9153ff68cf04c languageName: node linkType: hard @@ -24946,13 +24947,6 @@ __metadata: languageName: node linkType: hard -"bytes@npm:3.1.1": - version: 3.1.1 - resolution: "bytes@npm:3.1.1" - checksum: 10/397b49e01c43a4a23670f9a3cac792660664de4bbe307b8a4bc73977c71f86d9ee7e11ed8de072937c2e7753907c9c4fa0e4823b5cff668e55b6afb577604168 - languageName: node - linkType: hard - "bytes@npm:3.1.2": version: 3.1.2 resolution: "bytes@npm:3.1.2" @@ -28154,13 +28148,6 @@ __metadata: languageName: node linkType: hard -"destroy@npm:~1.0.4": - version: 1.0.4 - resolution: "destroy@npm:1.0.4" - checksum: 10/da9ab4961dc61677c709da0c25ef01733042614453924d65636a7db37308fef8a24cd1e07172e61173d471ca175371295fbc984b0af5b2b4ff47cd57bd784c03 - languageName: node - linkType: hard - "detect-browser@npm:5.2.0": version: 5.2.0 resolution: "detect-browser@npm:5.2.0" @@ -31425,16 +31412,16 @@ __metadata: languageName: node linkType: hard -"express@npm:4.18.3, express@npm:^4.14.0, express@npm:^4.17.3": - version: 4.18.3 - resolution: "express@npm:4.18.3" +"express@npm:4.19.2": + version: 4.19.2 + resolution: "express@npm:4.19.2" dependencies: accepts: "npm:~1.3.8" array-flatten: "npm:1.1.1" body-parser: "npm:1.20.2" content-disposition: "npm:0.5.4" content-type: "npm:~1.0.4" - cookie: "npm:0.5.0" + cookie: "npm:0.6.0" cookie-signature: "npm:1.0.6" debug: "npm:2.6.9" depd: "npm:2.0.0" @@ -31460,47 +31447,87 @@ __metadata: type-is: "npm:~1.6.18" utils-merge: "npm:1.0.1" vary: "npm:~1.1.2" - checksum: 10/0bf4656d0020cdc477aec884c6245dceea78992f6c747c899c87dbb0598474658d4130a29c80f02c99d1f0d6ebef706e7131c70c5454c3e07aba761c5bd3d627 + checksum: 10/3fcd792536f802c059789ef48db3851b87e78fba103423e524144d79af37da7952a2b8d4e1a007f423329c7377d686d9476ac42e7d9ea413b80345d495e30a3a languageName: node linkType: hard -"express@npm:5.0.0-beta.1": - version: 5.0.0-beta.1 - resolution: "express@npm:5.0.0-beta.1" +"express@npm:5.0.0-beta.3": + version: 5.0.0-beta.3 + resolution: "express@npm:5.0.0-beta.3" dependencies: - accepts: "npm:~1.3.7" + accepts: "npm:~1.3.8" array-flatten: "npm:3.0.0" - body-parser: "npm:2.0.0-beta.1" + body-parser: "npm:2.0.0-beta.2" content-disposition: "npm:0.5.4" content-type: "npm:~1.0.4" - cookie: "npm:0.4.1" + cookie: "npm:0.6.0" cookie-signature: "npm:1.0.6" debug: "npm:3.1.0" - depd: "npm:~1.1.2" + depd: "npm:2.0.0" encodeurl: "npm:~1.0.2" escape-html: "npm:~1.0.3" etag: "npm:~1.8.1" - finalhandler: "npm:~1.1.2" + finalhandler: "npm:1.2.0" fresh: "npm:0.5.2" + http-errors: "npm:2.0.0" merge-descriptors: "npm:1.0.1" methods: "npm:~1.1.2" mime-types: "npm:~2.1.34" - on-finished: "npm:~2.3.0" + on-finished: "npm:2.4.1" parseurl: "npm:~1.3.3" path-is-absolute: "npm:1.0.1" proxy-addr: "npm:~2.0.7" - qs: "npm:6.9.6" + qs: "npm:6.11.0" range-parser: "npm:~1.2.1" - router: "npm:2.0.0-beta.1" + router: "npm:2.0.0-beta.2" safe-buffer: "npm:5.2.1" - send: "npm:1.0.0-beta.1" - serve-static: "npm:2.0.0-beta.1" + send: "npm:1.0.0-beta.2" + serve-static: "npm:2.0.0-beta.2" setprototypeof: "npm:1.2.0" - statuses: "npm:~1.5.0" + statuses: "npm:2.0.1" type-is: "npm:~1.6.18" utils-merge: "npm:1.0.1" vary: "npm:~1.1.2" - checksum: 10/5ac4bad8b645a854b9b43ffe7e59722745c1d735779f8551595dc1b191fb96cc76482cf313fef2150b60ed9196bf057c8cc5fad99fdd68bcf54292c3bb262ae9 + checksum: 10/96e332a389a81069c48b96e103f9c000a3c5b15ce03427bcee12156b0d33a383a5f1dc099703a4dec3ee0e7caf8d9d3654e12771a9e5bbab39674c10a6f46e5d + languageName: node + linkType: hard + +"express@npm:^4.14.0, express@npm:^4.17.3": + version: 4.18.3 + resolution: "express@npm:4.18.3" + dependencies: + accepts: "npm:~1.3.8" + array-flatten: "npm:1.1.1" + body-parser: "npm:1.20.2" + content-disposition: "npm:0.5.4" + content-type: "npm:~1.0.4" + cookie: "npm:0.5.0" + cookie-signature: "npm:1.0.6" + debug: "npm:2.6.9" + depd: "npm:2.0.0" + encodeurl: "npm:~1.0.2" + escape-html: "npm:~1.0.3" + etag: "npm:~1.8.1" + finalhandler: "npm:1.2.0" + fresh: "npm:0.5.2" + http-errors: "npm:2.0.0" + merge-descriptors: "npm:1.0.1" + methods: "npm:~1.1.2" + on-finished: "npm:2.4.1" + parseurl: "npm:~1.3.3" + path-to-regexp: "npm:0.1.7" + proxy-addr: "npm:~2.0.7" + qs: "npm:6.11.0" + range-parser: "npm:~1.2.1" + safe-buffer: "npm:5.2.1" + send: "npm:0.18.0" + serve-static: "npm:1.15.0" + setprototypeof: "npm:1.2.0" + statuses: "npm:2.0.1" + type-is: "npm:~1.6.18" + utils-merge: "npm:1.0.1" + vary: "npm:~1.1.2" + checksum: 10/0bf4656d0020cdc477aec884c6245dceea78992f6c747c899c87dbb0598474658d4130a29c80f02c99d1f0d6ebef706e7131c70c5454c3e07aba761c5bd3d627 languageName: node linkType: hard @@ -32256,21 +32283,6 @@ __metadata: languageName: node linkType: hard -"finalhandler@npm:~1.1.2": - version: 1.1.2 - resolution: "finalhandler@npm:1.1.2" - dependencies: - debug: "npm:2.6.9" - encodeurl: "npm:~1.0.2" - escape-html: "npm:~1.0.3" - on-finished: "npm:~2.3.0" - parseurl: "npm:~1.3.3" - statuses: "npm:~1.5.0" - unpipe: "npm:~1.0.0" - checksum: 10/351e99a889abf149eb3edb24568586469feeb3019f5eafb9b31e632a5ad886f12a5595a221508245e6a37da69ae866c9fb411eb541a844238e2c900f63ac1576 - languageName: node - linkType: hard - "find-cache-dir@npm:^2.0.0": version: 2.1.0 resolution: "find-cache-dir@npm:2.1.0" @@ -35029,19 +35041,6 @@ __metadata: languageName: node linkType: hard -"http-errors@npm:1.8.1, http-errors@npm:~1.8.1": - version: 1.8.1 - resolution: "http-errors@npm:1.8.1" - dependencies: - depd: "npm:~1.1.2" - inherits: "npm:2.0.4" - setprototypeof: "npm:1.2.0" - statuses: "npm:>= 1.5.0 < 2" - toidentifier: "npm:1.0.1" - checksum: 10/76fc491bd8df2251e21978e080d5dae20d9736cfb29bb72b5b76ec1bcebb1c14f0f58a3a128dd89288934379d2173cfb0421c571d54103e93dd65ef6243d64d8 - languageName: node - linkType: hard - "http-errors@npm:2.0.0": version: 2.0.0 resolution: "http-errors@npm:2.0.0" @@ -35077,6 +35076,19 @@ __metadata: languageName: node linkType: hard +"http-errors@npm:~1.8.1": + version: 1.8.1 + resolution: "http-errors@npm:1.8.1" + dependencies: + depd: "npm:~1.1.2" + inherits: "npm:2.0.4" + setprototypeof: "npm:1.2.0" + statuses: "npm:>= 1.5.0 < 2" + toidentifier: "npm:1.0.1" + checksum: 10/76fc491bd8df2251e21978e080d5dae20d9736cfb29bb72b5b76ec1bcebb1c14f0f58a3a128dd89288934379d2173cfb0421c571d54103e93dd65ef6243d64d8 + languageName: node + linkType: hard + "http-https@npm:^1.0.0": version: 1.0.0 resolution: "http-https@npm:1.0.0" @@ -35290,6 +35302,15 @@ __metadata: languageName: node linkType: hard +"iconv-lite@npm:0.5.2, iconv-lite@npm:^0.5.2": + version: 0.5.2 + resolution: "iconv-lite@npm:0.5.2" + dependencies: + safer-buffer: "npm:>= 2.1.2 < 3" + checksum: 10/b48a1c8a173b638cb3d9a21674acbfed1c1fd8e81f6dc52e63cf44d3b56f37fd48f8ff81d93a71c8b60b4dfb464d3e87f606df5f8a0f0247c21737665059565c + languageName: node + linkType: hard + "iconv-lite@npm:0.6.2": version: 0.6.2 resolution: "iconv-lite@npm:0.6.2" @@ -35308,15 +35329,6 @@ __metadata: languageName: node linkType: hard -"iconv-lite@npm:^0.5.2": - version: 0.5.2 - resolution: "iconv-lite@npm:0.5.2" - dependencies: - safer-buffer: "npm:>= 2.1.2 < 3" - checksum: 10/b48a1c8a173b638cb3d9a21674acbfed1c1fd8e81f6dc52e63cf44d3b56f37fd48f8ff81d93a71c8b60b4dfb464d3e87f606df5f8a0f0247c21737665059565c - languageName: node - linkType: hard - "ics@npm:3.1.0": version: 3.1.0 resolution: "ics@npm:3.1.0" @@ -36488,6 +36500,13 @@ __metadata: languageName: node linkType: hard +"is-promise@npm:4.0.0": + version: 4.0.0 + resolution: "is-promise@npm:4.0.0" + checksum: 10/0b46517ad47b00b6358fd6553c83ec1f6ba9acd7ffb3d30a0bf519c5c69e7147c132430452351b8a9fc198f8dd6c4f76f8e6f5a7f100f8c77d57d9e0f4261a8a + languageName: node + linkType: hard + "is-promise@npm:^2.1.0, is-promise@npm:^2.2.2": version: 2.2.2 resolution: "is-promise@npm:2.2.2" @@ -46062,13 +46081,6 @@ __metadata: languageName: node linkType: hard -"qs@npm:6.9.6": - version: 6.9.6 - resolution: "qs@npm:6.9.6" - checksum: 10/08f80bd2089dcab302689ab0f8e29d1e9134dccb4a9151da8fd6914aca54b3664f059850dcba1d689fb3c2652661ef20b16e879cb618af004b8ad0daa5eda5fb - languageName: node - linkType: hard - "qs@npm:^6.10.0, qs@npm:^6.10.3, qs@npm:^6.11.0, qs@npm:^6.11.2, qs@npm:^6.4.0, qs@npm:^6.9.4, qs@npm:^6.9.6": version: 6.11.2 resolution: "qs@npm:6.11.2" @@ -46257,18 +46269,6 @@ __metadata: languageName: node linkType: hard -"raw-body@npm:2.4.2": - version: 2.4.2 - resolution: "raw-body@npm:2.4.2" - dependencies: - bytes: "npm:3.1.1" - http-errors: "npm:1.8.1" - iconv-lite: "npm:0.4.24" - unpipe: "npm:1.0.0" - checksum: 10/b8d059e37d44c686d036f447f46fe084c0a0555138fb667cff98974a3cd880571de5ee47fb69b672ca711a6e2f5e1cb4598d305612a75d9ca0ae661dac9702af - languageName: node - linkType: hard - "raw-body@npm:2.5.1": version: 2.5.1 resolution: "raw-body@npm:2.5.1" @@ -46293,6 +46293,18 @@ __metadata: languageName: node linkType: hard +"raw-body@npm:3.0.0-beta.1": + version: 3.0.0-beta.1 + resolution: "raw-body@npm:3.0.0-beta.1" + dependencies: + bytes: "npm:3.1.2" + http-errors: "npm:2.0.0" + iconv-lite: "npm:0.5.2" + unpipe: "npm:1.0.0" + checksum: 10/7bbaa05b3745c8482029a2995aaa75f3626a65433ce88354b5b0875766b6cfa891e5e6a5adccf6bd6e0746c8b535a3e6703d959ab03bb69ad770945a8c936b1b + languageName: node + linkType: hard + "raw-loader@npm:4.0.2": version: 4.0.2 resolution: "raw-loader@npm:4.0.2" @@ -48283,17 +48295,18 @@ __metadata: languageName: node linkType: hard -"router@npm:2.0.0-beta.1": - version: 2.0.0-beta.1 - resolution: "router@npm:2.0.0-beta.1" +"router@npm:2.0.0-beta.2": + version: 2.0.0-beta.2 + resolution: "router@npm:2.0.0-beta.2" dependencies: array-flatten: "npm:3.0.0" + is-promise: "npm:4.0.0" methods: "npm:~1.1.2" parseurl: "npm:~1.3.3" path-to-regexp: "npm:3.2.0" setprototypeof: "npm:1.2.0" utils-merge: "npm:1.0.1" - checksum: 10/134517b0238b86cfdc7849bb48ebf67afbb5060915017780fe80042dd3e78babdb35e0d9d36691088d37224a7d6af5b77352ecdeea2ddc4bcc73bc9e12148e2d + checksum: 10/3c8cb6b4655d19a7e6545d2812ea33d71fc1d20ba145936a1acf798aa17541105038c107cd2f1ad482ebd48f9699f25b4c6cf93068c24644715234b81e414685 languageName: node linkType: hard @@ -48903,23 +48916,23 @@ __metadata: languageName: node linkType: hard -"send@npm:1.0.0-beta.1": - version: 1.0.0-beta.1 - resolution: "send@npm:1.0.0-beta.1" +"send@npm:1.0.0-beta.2, send@npm:^1.0.0-beta.2": + version: 1.0.0-beta.2 + resolution: "send@npm:1.0.0-beta.2" dependencies: debug: "npm:3.1.0" - destroy: "npm:~1.0.4" + destroy: "npm:1.2.0" encodeurl: "npm:~1.0.2" escape-html: "npm:~1.0.3" etag: "npm:~1.8.1" fresh: "npm:0.5.2" - http-errors: "npm:1.8.1" + http-errors: "npm:2.0.0" mime-types: "npm:~2.1.34" ms: "npm:2.1.3" - on-finished: "npm:~2.3.0" + on-finished: "npm:2.4.1" range-parser: "npm:~1.2.1" - statuses: "npm:~1.5.0" - checksum: 10/5f3d74379811e37b06ea4cdecff4e9310939482a04954aa985dd4e4ce532160ccce99a650657e83732bf7ce937b826c1e738e8a287a28f8bd3c5d95a814fac70 + statuses: "npm:2.0.1" + checksum: 10/83a40d7efdcb93da855a5dbfa51728b9fe73b561ee6ec6c1681bdabfec5c8982287705265bc060a21cbbedbf8eb68a56a55d92d6572f9de7e2b6dbe26ee48428 languageName: node linkType: hard @@ -49085,15 +49098,15 @@ __metadata: languageName: node linkType: hard -"serve-static@npm:2.0.0-beta.1": - version: 2.0.0-beta.1 - resolution: "serve-static@npm:2.0.0-beta.1" +"serve-static@npm:2.0.0-beta.2": + version: 2.0.0-beta.2 + resolution: "serve-static@npm:2.0.0-beta.2" dependencies: encodeurl: "npm:~1.0.2" escape-html: "npm:~1.0.3" parseurl: "npm:~1.3.3" - send: "npm:1.0.0-beta.1" - checksum: 10/1d98c37ed30576ecc4f5449c3ec61bffe1519c150036e0673ca7e41b978dc73aabc4aaa9783495517108decf55c5d036dcbfcb0d57c23a8611c83e8ca1f98147 + send: "npm:^1.0.0-beta.2" + checksum: 10/50c07803adba1478ca7ca6e86755b0ab3bdd694bfbbbe28a0b408665192d141190b1d9414a93dda642e96f750c1b1b295bc6c2ef0fd3160636a1f3d8233e1769 languageName: node linkType: hard @@ -50339,7 +50352,7 @@ __metadata: languageName: node linkType: hard -"statuses@npm:>= 1.2.1 < 2, statuses@npm:>= 1.4.0 < 2, statuses@npm:>= 1.5.0 < 2, statuses@npm:~1.5.0": +"statuses@npm:>= 1.2.1 < 2, statuses@npm:>= 1.4.0 < 2, statuses@npm:>= 1.5.0 < 2": version: 1.5.0 resolution: "statuses@npm:1.5.0" checksum: 10/c469b9519de16a4bb19600205cffb39ee471a5f17b82589757ca7bd40a8d92ebb6ed9f98b5a540c5d302ccbc78f15dc03cc0280dd6e00df1335568a5d5758a5c @@ -53386,7 +53399,7 @@ __metadata: resolution: "unlock-express-example@workspace:packages/unlock-express/example" dependencies: "@unlock-protocol/unlock-express": "workspace:^" - express: "npm:4.18.3" + express: "npm:4.19.2" express-session: "npm:1.18.0" passport: "npm:0.7.0" languageName: unknown From a6942e4bec4b3983434b67f02314ee614e20f67b Mon Sep 17 00:00:00 2001 From: Viacheslav Date: Wed, 27 Mar 2024 22:11:54 +0200 Subject: [PATCH 13/35] fix(deps): update dependency unified to v11, remark-html to v15, remark-parse to v11 (#13531) * Updated unified & related dependencies * Updated remark --- locksmith/package.json | 6 +- unlock-protocol-com/package.json | 4 +- yarn.lock | 247 +++++++++---------------------- 3 files changed, 72 insertions(+), 185 deletions(-) diff --git a/locksmith/package.json b/locksmith/package.json index 516a1d6fbe7..e1ead6dfd4e 100644 --- a/locksmith/package.json +++ b/locksmith/package.json @@ -76,8 +76,8 @@ "pg": "8.11.3", "rate-limiter-flexible": "5.0.0", "react": "18.2.0", - "remark-html": "15.0.2", - "remark-parse": "10.0.2", + "remark-html": "16.0.1", + "remark-parse": "11.0.0", "request": "2.88.2", "request-promise-native": "1.0.9", "satori": "0.9.1", @@ -85,7 +85,7 @@ "sequelize-cli": "6.6.2", "siwe": "2.1.4", "stripe": "12.8.0", - "unified": "10.1.2", + "unified": "11.0.4", "unlock-abi-1-1": "1.1.1", "vitest-fetch-mock": "0.2.2", "winston": "3.9.0", diff --git a/unlock-protocol-com/package.json b/unlock-protocol-com/package.json index 8feae07579c..e7965333cfc 100644 --- a/unlock-protocol-com/package.json +++ b/unlock-protocol-com/package.json @@ -53,8 +53,8 @@ "next-transpile-modules": "10.0.1", "postcss": "8.4.35", "prettier": "3.0.0", - "remark": "14.0.3", - "remark-html": "15.0.2", + "remark": "15.0.1", + "remark-html": "16.0.1", "tailwindcss": "3.4.1", "vitest": "0.34.6" }, diff --git a/yarn.lock b/yarn.lock index 2e492f7d532..3c349b1b5ed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18750,13 +18750,6 @@ __metadata: languageName: node linkType: hard -"@types/parse5@npm:^6.0.0": - version: 6.0.3 - resolution: "@types/parse5@npm:6.0.3" - checksum: 10/834d40c9b1a8a99a9574b0b3f6629cf48adcff2eda01a35d701f1de5dcf46ce24223684647890aba9f985d6c801b233f878168683de0ae425940403c383fba8f - languageName: node - linkType: hard - "@types/pbkdf2@npm:^3.0.0": version: 3.1.2 resolution: "@types/pbkdf2@npm:3.1.2" @@ -20085,8 +20078,8 @@ __metadata: pg: "npm:8.11.3" rate-limiter-flexible: "npm:5.0.0" react: "npm:18.2.0" - remark-html: "npm:15.0.2" - remark-parse: "npm:10.0.2" + remark-html: "npm:16.0.1" + remark-parse: "npm:11.0.0" request: "npm:2.88.2" request-promise-native: "npm:1.0.9" run-script-os: "npm:1.1.6" @@ -20098,7 +20091,7 @@ __metadata: supertest: "npm:6.3.4" tsx: "npm:4.7.1" typescript: "npm:5.3.3" - unified: "npm:10.1.2" + unified: "npm:11.0.4" unlock-abi-1-1: "npm:1.1.1" vitest: "npm:0.31.4" vitest-fetch-mock: "npm:0.2.2" @@ -20485,8 +20478,8 @@ __metadata: react-gtm-module: "npm:2.0.11" react-showdown: "npm:2.3.1" react-test-renderer: "npm:18.2.0" - remark: "npm:14.0.3" - remark-html: "npm:15.0.2" + remark: "npm:15.0.1" + remark-html: "npm:16.0.1" rss: "npm:1.2.2" showdown-highlight: "npm:3.1.0" tailwind-merge: "npm:2.2.1" @@ -34462,21 +34455,6 @@ __metadata: languageName: node linkType: hard -"hast-util-from-parse5@npm:^7.0.0": - version: 7.1.2 - resolution: "hast-util-from-parse5@npm:7.1.2" - dependencies: - "@types/hast": "npm:^2.0.0" - "@types/unist": "npm:^2.0.0" - hastscript: "npm:^7.0.0" - property-information: "npm:^6.0.0" - vfile: "npm:^5.0.0" - vfile-location: "npm:^4.0.0" - web-namespaces: "npm:^2.0.0" - checksum: 10/7a90a16430a1482ed1be5c2f8b182e8b12aee8834781245b101700b5a04cea8b569cf40ef08214e1eb333249432e861b17e6fe46d0447b5281827c8798e86f1a - languageName: node - linkType: hard - "hast-util-from-parse5@npm:^8.0.0": version: 8.0.1 resolution: "hast-util-from-parse5@npm:8.0.1" @@ -34511,25 +34489,6 @@ __metadata: languageName: node linkType: hard -"hast-util-raw@npm:^7.0.0": - version: 7.2.3 - resolution: "hast-util-raw@npm:7.2.3" - dependencies: - "@types/hast": "npm:^2.0.0" - "@types/parse5": "npm:^6.0.0" - hast-util-from-parse5: "npm:^7.0.0" - hast-util-to-parse5: "npm:^7.0.0" - html-void-elements: "npm:^2.0.0" - parse5: "npm:^6.0.0" - unist-util-position: "npm:^4.0.0" - unist-util-visit: "npm:^4.0.0" - vfile: "npm:^5.0.0" - web-namespaces: "npm:^2.0.0" - zwitch: "npm:^2.0.0" - checksum: 10/fe39d4b9e68de7131ec61e9abe887cc0579dc7491f738735150c6021565fc998e37c9d096e97fc35c769e986e04b721d4724835ee82fcc22076d778acf6c4832 - languageName: node - linkType: hard - "hast-util-raw@npm:^9.0.0": version: 9.0.2 resolution: "hast-util-raw@npm:9.0.2" @@ -34551,12 +34510,14 @@ __metadata: languageName: node linkType: hard -"hast-util-sanitize@npm:^4.0.0": - version: 4.1.0 - resolution: "hast-util-sanitize@npm:4.1.0" +"hast-util-sanitize@npm:^5.0.0": + version: 5.0.1 + resolution: "hast-util-sanitize@npm:5.0.1" dependencies: - "@types/hast": "npm:^2.0.0" - checksum: 10/8258ba32be9e57e871f894d3c6b3187dd98e0682bf1382cd1306c20045cd5dc209589919817dc079803d9a259b420d9cd88771535088c9fe0eea122028c348eb + "@types/hast": "npm:^3.0.0" + "@ungap/structured-clone": "npm:^1.2.0" + unist-util-position: "npm:^5.0.0" + checksum: 10/bdffc06f587e79f25048dcf60da6731d5a91b057190ef59ce6d3b72501855b6ae7b79e44ff9d68801c2c5b11de9e4834df90a6ba658eafa3a7c6ba06d6d0c19e languageName: node linkType: hard @@ -34584,22 +34545,23 @@ __metadata: languageName: node linkType: hard -"hast-util-to-html@npm:^8.0.0": - version: 8.0.4 - resolution: "hast-util-to-html@npm:8.0.4" +"hast-util-to-html@npm:^9.0.0": + version: 9.0.0 + resolution: "hast-util-to-html@npm:9.0.0" dependencies: - "@types/hast": "npm:^2.0.0" - "@types/unist": "npm:^2.0.0" + "@types/hast": "npm:^3.0.0" + "@types/unist": "npm:^3.0.0" ccount: "npm:^2.0.0" comma-separated-tokens: "npm:^2.0.0" - hast-util-raw: "npm:^7.0.0" - hast-util-whitespace: "npm:^2.0.0" - html-void-elements: "npm:^2.0.0" + hast-util-raw: "npm:^9.0.0" + hast-util-whitespace: "npm:^3.0.0" + html-void-elements: "npm:^3.0.0" + mdast-util-to-hast: "npm:^13.0.0" property-information: "npm:^6.0.0" space-separated-tokens: "npm:^2.0.0" stringify-entities: "npm:^4.0.0" zwitch: "npm:^2.0.4" - checksum: 10/cb37233a21dae417957b4c13aadb577d98fb81dd0050c6807bfc8afdb892880570a904cd1c6b18e4717c7169face2a60d58b34156ef80c82fa7dbeaebe4c2427 + checksum: 10/4bfa78b681135b9303743b34d7139328ff5dc412a1f6bd372e83192413fd86a5d7e8d55eab4eeb2cd561878218eec07a57df1f92cf0f3272756830738611708a languageName: node linkType: hard @@ -34626,20 +34588,6 @@ __metadata: languageName: node linkType: hard -"hast-util-to-parse5@npm:^7.0.0": - version: 7.1.0 - resolution: "hast-util-to-parse5@npm:7.1.0" - dependencies: - "@types/hast": "npm:^2.0.0" - comma-separated-tokens: "npm:^2.0.0" - property-information: "npm:^6.0.0" - space-separated-tokens: "npm:^2.0.0" - web-namespaces: "npm:^2.0.0" - zwitch: "npm:^2.0.0" - checksum: 10/695539881431f9713ca4a0be7d06bf3e57ae4d9f930eccba371534c50cff11855d345f8ec30099d04482637ad82e3c70d480269bfa4c109f37993536e8ea690d - languageName: node - linkType: hard - "hast-util-to-parse5@npm:^8.0.0": version: 8.0.0 resolution: "hast-util-to-parse5@npm:8.0.0" @@ -34942,13 +34890,6 @@ __metadata: languageName: node linkType: hard -"html-void-elements@npm:^2.0.0": - version: 2.0.1 - resolution: "html-void-elements@npm:2.0.1" - checksum: 10/06d41f13b9d5d6e0f39861c4bec9a9196fa4906d56cd5cf6cf54ad2e52a85bf960cca2bf9600026bde16c8331db171bedba5e5a35e2e43630c8f1d497b2fb658 - languageName: node - linkType: hard - "html-void-elements@npm:^3.0.0": version: 3.0.0 resolution: "html-void-elements@npm:3.0.0" @@ -39649,16 +39590,6 @@ __metadata: languageName: node linkType: hard -"mdast-util-phrasing@npm:^3.0.0": - version: 3.0.1 - resolution: "mdast-util-phrasing@npm:3.0.1" - dependencies: - "@types/mdast": "npm:^3.0.0" - unist-util-is: "npm:^5.0.0" - checksum: 10/c5b616d9b1eb76a6b351d195d94318494722525a12a89d9c8a3b091af7db3dd1fc55d294f9d29266d8159a8267b0df4a7a133bda8a3909d5331c383e1e1ff328 - languageName: node - linkType: hard - "mdast-util-phrasing@npm:^4.0.0": version: 4.1.0 resolution: "mdast-util-phrasing@npm:4.1.0" @@ -39669,7 +39600,7 @@ __metadata: languageName: node linkType: hard -"mdast-util-to-hast@npm:^12.0.0, mdast-util-to-hast@npm:^12.1.0": +"mdast-util-to-hast@npm:^12.1.0": version: 12.3.0 resolution: "mdast-util-to-hast@npm:12.3.0" dependencies: @@ -39702,22 +39633,6 @@ __metadata: languageName: node linkType: hard -"mdast-util-to-markdown@npm:^1.0.0": - version: 1.5.0 - resolution: "mdast-util-to-markdown@npm:1.5.0" - dependencies: - "@types/mdast": "npm:^3.0.0" - "@types/unist": "npm:^2.0.0" - longest-streak: "npm:^3.0.0" - mdast-util-phrasing: "npm:^3.0.0" - mdast-util-to-string: "npm:^3.0.0" - micromark-util-decode-string: "npm:^1.0.0" - unist-util-visit: "npm:^4.0.0" - zwitch: "npm:^2.0.0" - checksum: 10/713f674588a01969a2ce524a69985bd57e507377eea2c4ba69800fb305414468b30144ae9b837fbdde8c609877673140e4f56f6cabe9e0e2bc1487291e3c5144 - languageName: node - linkType: hard - "mdast-util-to-markdown@npm:^2.0.0": version: 2.1.0 resolution: "mdast-util-to-markdown@npm:2.1.0" @@ -39741,7 +39656,7 @@ __metadata: languageName: node linkType: hard -"mdast-util-to-string@npm:^3.0.0, mdast-util-to-string@npm:^3.1.0": +"mdast-util-to-string@npm:^3.1.0": version: 3.2.0 resolution: "mdast-util-to-string@npm:3.2.0" dependencies: @@ -43836,13 +43751,6 @@ __metadata: languageName: node linkType: hard -"parse5@npm:^6.0.0": - version: 6.0.1 - resolution: "parse5@npm:6.0.1" - checksum: 10/dfb110581f62bd1425725a7c784ae022a24669bd0efc24b58c71fc731c4d868193e2ebd85b74cde2dbb965e4dcf07059b1e651adbec1b3b5267531bd132fdb75 - languageName: node - linkType: hard - "parse5@npm:^7.0.0, parse5@npm:^7.1.2": version: 7.1.2 resolution: "parse5@npm:7.1.2" @@ -47543,16 +47451,16 @@ __metadata: languageName: node linkType: hard -"remark-html@npm:15.0.2": - version: 15.0.2 - resolution: "remark-html@npm:15.0.2" +"remark-html@npm:16.0.1": + version: 16.0.1 + resolution: "remark-html@npm:16.0.1" dependencies: - "@types/mdast": "npm:^3.0.0" - hast-util-sanitize: "npm:^4.0.0" - hast-util-to-html: "npm:^8.0.0" - mdast-util-to-hast: "npm:^12.0.0" - unified: "npm:^10.0.0" - checksum: 10/46c76eb6a3bd25c41ed2535d285c5b676c81c4752b697627596ddcfec4992da02763b9838f47f2a6eb03147b9b8d1e978612a8fd4e57667c05b02a32961dcab3 + "@types/mdast": "npm:^4.0.0" + hast-util-sanitize: "npm:^5.0.0" + hast-util-to-html: "npm:^9.0.0" + mdast-util-to-hast: "npm:^13.0.0" + unified: "npm:^11.0.0" + checksum: 10/eeae58299929d506b770db6e461f57e551f5502f33b6ae64bd770ab3b1d6ece5c7fe45b254636ff12e5bb2006f4e713dfa8084752e0fa627c79e7decea8a91cc languageName: node linkType: hard @@ -47566,18 +47474,7 @@ __metadata: languageName: node linkType: hard -"remark-parse@npm:10.0.2, remark-parse@npm:^10.0.0": - version: 10.0.2 - resolution: "remark-parse@npm:10.0.2" - dependencies: - "@types/mdast": "npm:^3.0.0" - mdast-util-from-markdown: "npm:^1.0.0" - unified: "npm:^10.0.0" - checksum: 10/184f48956734a58a7e157d83233e532ea289697f5ecebd1fb082cce79e6d9f5b1d3da72462356b2b3b5843643cee890280ffe3d21c9d4ad2d7d5e20bb5de7f14 - languageName: node - linkType: hard - -"remark-parse@npm:^11.0.0": +"remark-parse@npm:11.0.0, remark-parse@npm:^11.0.0": version: 11.0.0 resolution: "remark-parse@npm:11.0.0" dependencies: @@ -47589,6 +47486,17 @@ __metadata: languageName: node linkType: hard +"remark-parse@npm:^10.0.0": + version: 10.0.2 + resolution: "remark-parse@npm:10.0.2" + dependencies: + "@types/mdast": "npm:^3.0.0" + mdast-util-from-markdown: "npm:^1.0.0" + unified: "npm:^10.0.0" + checksum: 10/184f48956734a58a7e157d83233e532ea289697f5ecebd1fb082cce79e6d9f5b1d3da72462356b2b3b5843643cee890280ffe3d21c9d4ad2d7d5e20bb5de7f14 + languageName: node + linkType: hard + "remark-rehype@npm:^10.0.0": version: 10.1.0 resolution: "remark-rehype@npm:10.1.0" @@ -47625,17 +47533,6 @@ __metadata: languageName: node linkType: hard -"remark-stringify@npm:^10.0.0": - version: 10.0.3 - resolution: "remark-stringify@npm:10.0.3" - dependencies: - "@types/mdast": "npm:^3.0.0" - mdast-util-to-markdown: "npm:^1.0.0" - unified: "npm:^10.0.0" - checksum: 10/9fc5545b7cfd14f77196742e474db1a3863d5435324b381ae2097730870c74338feda99c12b172edadf9fe478ce96a3b9e6abc29cb42774da279c86664e5d869 - languageName: node - linkType: hard - "remark-stringify@npm:^11.0.0": version: 11.0.0 resolution: "remark-stringify@npm:11.0.0" @@ -47647,15 +47544,15 @@ __metadata: languageName: node linkType: hard -"remark@npm:14.0.3": - version: 14.0.3 - resolution: "remark@npm:14.0.3" +"remark@npm:15.0.1": + version: 15.0.1 + resolution: "remark@npm:15.0.1" dependencies: - "@types/mdast": "npm:^3.0.0" - remark-parse: "npm:^10.0.0" - remark-stringify: "npm:^10.0.0" - unified: "npm:^10.0.0" - checksum: 10/425ed19401aa09d9d5b26f19c173e63a05b57d047393bb698898a09de4ec99a840a2405e28bd1410ccb124368fdd9a825e850a531f524dbc2e52ae005e026a4f + "@types/mdast": "npm:^4.0.0" + remark-parse: "npm:^11.0.0" + remark-stringify: "npm:^11.0.0" + unified: "npm:^11.0.0" + checksum: 10/671eae3a4482377373cbbae956e2dbc0f8c40df1c3e5e2e1e82efa248b310ef5989340e1a5a8ebe94ff14fcf9c72612f40a29d002ffc0a465e3d6d50de973839 languageName: node linkType: hard @@ -53111,33 +53008,33 @@ __metadata: languageName: node linkType: hard -"unified@npm:10.1.2, unified@npm:^10.0.0": - version: 10.1.2 - resolution: "unified@npm:10.1.2" +"unified@npm:11.0.4, unified@npm:^11.0.0, unified@npm:^11.0.3, unified@npm:^11.0.4": + version: 11.0.4 + resolution: "unified@npm:11.0.4" dependencies: - "@types/unist": "npm:^2.0.0" + "@types/unist": "npm:^3.0.0" bail: "npm:^2.0.0" + devlop: "npm:^1.0.0" extend: "npm:^3.0.0" - is-buffer: "npm:^2.0.0" is-plain-obj: "npm:^4.0.0" trough: "npm:^2.0.0" - vfile: "npm:^5.0.0" - checksum: 10/6cffebcefc3290be26d25a58ba714cda943142782baf320fddf374ca3a319bdaabb006f96df4be17b8b367f5e6f6e113b1027c52ef66154846a7a110550f6688 + vfile: "npm:^6.0.0" + checksum: 10/425f0618d6f5e5d2ae64ec206cb6fd11f4b86fec7a785cfe2fc3a334191a91bf837eecb32858c70bcc2c08e76ce9d6a38457319f70f77399c8f496fb8e486817 languageName: node linkType: hard -"unified@npm:^11.0.0, unified@npm:^11.0.3, unified@npm:^11.0.4": - version: 11.0.4 - resolution: "unified@npm:11.0.4" +"unified@npm:^10.0.0": + version: 10.1.2 + resolution: "unified@npm:10.1.2" dependencies: - "@types/unist": "npm:^3.0.0" + "@types/unist": "npm:^2.0.0" bail: "npm:^2.0.0" - devlop: "npm:^1.0.0" extend: "npm:^3.0.0" + is-buffer: "npm:^2.0.0" is-plain-obj: "npm:^4.0.0" trough: "npm:^2.0.0" - vfile: "npm:^6.0.0" - checksum: 10/425f0618d6f5e5d2ae64ec206cb6fd11f4b86fec7a785cfe2fc3a334191a91bf837eecb32858c70bcc2c08e76ce9d6a38457319f70f77399c8f496fb8e486817 + vfile: "npm:^5.0.0" + checksum: 10/6cffebcefc3290be26d25a58ba714cda943142782baf320fddf374ca3a319bdaabb006f96df4be17b8b367f5e6f6e113b1027c52ef66154846a7a110550f6688 languageName: node linkType: hard @@ -54046,16 +53943,6 @@ __metadata: languageName: node linkType: hard -"vfile-location@npm:^4.0.0": - version: 4.1.0 - resolution: "vfile-location@npm:4.1.0" - dependencies: - "@types/unist": "npm:^2.0.0" - vfile: "npm:^5.0.0" - checksum: 10/c894e8e5224170d1f85288f4a1d1ebcee0780823ea2b49d881648ab360ebf01b37ecb09b1c4439a75f9a51f31a9f9742cd045e987763e367c352a1ef7c50d446 - languageName: node - linkType: hard - "vfile-location@npm:^5.0.0": version: 5.0.2 resolution: "vfile-location@npm:5.0.2" From b54ffa4c94edbe04564b6f9bae37d23be18dfcf4 Mon Sep 17 00:00:00 2001 From: Julien Genestoux Date: Wed, 27 Mar 2024 19:00:55 -0400 Subject: [PATCH 14/35] Revert "fix(deps): update dependency unified to v11, remark-html to v15, remark-parse to v11" (#13532) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Revert "fix(deps): update dependency unified to v11, remark-html to v15, rema…" This reverts commit 80969a66ec97384ca34c805e6de713241d48c952. --- locksmith/package.json | 6 +- unlock-protocol-com/package.json | 4 +- yarn.lock | 247 ++++++++++++++++++++++--------- 3 files changed, 185 insertions(+), 72 deletions(-) diff --git a/locksmith/package.json b/locksmith/package.json index e1ead6dfd4e..516a1d6fbe7 100644 --- a/locksmith/package.json +++ b/locksmith/package.json @@ -76,8 +76,8 @@ "pg": "8.11.3", "rate-limiter-flexible": "5.0.0", "react": "18.2.0", - "remark-html": "16.0.1", - "remark-parse": "11.0.0", + "remark-html": "15.0.2", + "remark-parse": "10.0.2", "request": "2.88.2", "request-promise-native": "1.0.9", "satori": "0.9.1", @@ -85,7 +85,7 @@ "sequelize-cli": "6.6.2", "siwe": "2.1.4", "stripe": "12.8.0", - "unified": "11.0.4", + "unified": "10.1.2", "unlock-abi-1-1": "1.1.1", "vitest-fetch-mock": "0.2.2", "winston": "3.9.0", diff --git a/unlock-protocol-com/package.json b/unlock-protocol-com/package.json index e7965333cfc..8feae07579c 100644 --- a/unlock-protocol-com/package.json +++ b/unlock-protocol-com/package.json @@ -53,8 +53,8 @@ "next-transpile-modules": "10.0.1", "postcss": "8.4.35", "prettier": "3.0.0", - "remark": "15.0.1", - "remark-html": "16.0.1", + "remark": "14.0.3", + "remark-html": "15.0.2", "tailwindcss": "3.4.1", "vitest": "0.34.6" }, diff --git a/yarn.lock b/yarn.lock index 3c349b1b5ed..2e492f7d532 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18750,6 +18750,13 @@ __metadata: languageName: node linkType: hard +"@types/parse5@npm:^6.0.0": + version: 6.0.3 + resolution: "@types/parse5@npm:6.0.3" + checksum: 10/834d40c9b1a8a99a9574b0b3f6629cf48adcff2eda01a35d701f1de5dcf46ce24223684647890aba9f985d6c801b233f878168683de0ae425940403c383fba8f + languageName: node + linkType: hard + "@types/pbkdf2@npm:^3.0.0": version: 3.1.2 resolution: "@types/pbkdf2@npm:3.1.2" @@ -20078,8 +20085,8 @@ __metadata: pg: "npm:8.11.3" rate-limiter-flexible: "npm:5.0.0" react: "npm:18.2.0" - remark-html: "npm:16.0.1" - remark-parse: "npm:11.0.0" + remark-html: "npm:15.0.2" + remark-parse: "npm:10.0.2" request: "npm:2.88.2" request-promise-native: "npm:1.0.9" run-script-os: "npm:1.1.6" @@ -20091,7 +20098,7 @@ __metadata: supertest: "npm:6.3.4" tsx: "npm:4.7.1" typescript: "npm:5.3.3" - unified: "npm:11.0.4" + unified: "npm:10.1.2" unlock-abi-1-1: "npm:1.1.1" vitest: "npm:0.31.4" vitest-fetch-mock: "npm:0.2.2" @@ -20478,8 +20485,8 @@ __metadata: react-gtm-module: "npm:2.0.11" react-showdown: "npm:2.3.1" react-test-renderer: "npm:18.2.0" - remark: "npm:15.0.1" - remark-html: "npm:16.0.1" + remark: "npm:14.0.3" + remark-html: "npm:15.0.2" rss: "npm:1.2.2" showdown-highlight: "npm:3.1.0" tailwind-merge: "npm:2.2.1" @@ -34455,6 +34462,21 @@ __metadata: languageName: node linkType: hard +"hast-util-from-parse5@npm:^7.0.0": + version: 7.1.2 + resolution: "hast-util-from-parse5@npm:7.1.2" + dependencies: + "@types/hast": "npm:^2.0.0" + "@types/unist": "npm:^2.0.0" + hastscript: "npm:^7.0.0" + property-information: "npm:^6.0.0" + vfile: "npm:^5.0.0" + vfile-location: "npm:^4.0.0" + web-namespaces: "npm:^2.0.0" + checksum: 10/7a90a16430a1482ed1be5c2f8b182e8b12aee8834781245b101700b5a04cea8b569cf40ef08214e1eb333249432e861b17e6fe46d0447b5281827c8798e86f1a + languageName: node + linkType: hard + "hast-util-from-parse5@npm:^8.0.0": version: 8.0.1 resolution: "hast-util-from-parse5@npm:8.0.1" @@ -34489,6 +34511,25 @@ __metadata: languageName: node linkType: hard +"hast-util-raw@npm:^7.0.0": + version: 7.2.3 + resolution: "hast-util-raw@npm:7.2.3" + dependencies: + "@types/hast": "npm:^2.0.0" + "@types/parse5": "npm:^6.0.0" + hast-util-from-parse5: "npm:^7.0.0" + hast-util-to-parse5: "npm:^7.0.0" + html-void-elements: "npm:^2.0.0" + parse5: "npm:^6.0.0" + unist-util-position: "npm:^4.0.0" + unist-util-visit: "npm:^4.0.0" + vfile: "npm:^5.0.0" + web-namespaces: "npm:^2.0.0" + zwitch: "npm:^2.0.0" + checksum: 10/fe39d4b9e68de7131ec61e9abe887cc0579dc7491f738735150c6021565fc998e37c9d096e97fc35c769e986e04b721d4724835ee82fcc22076d778acf6c4832 + languageName: node + linkType: hard + "hast-util-raw@npm:^9.0.0": version: 9.0.2 resolution: "hast-util-raw@npm:9.0.2" @@ -34510,14 +34551,12 @@ __metadata: languageName: node linkType: hard -"hast-util-sanitize@npm:^5.0.0": - version: 5.0.1 - resolution: "hast-util-sanitize@npm:5.0.1" +"hast-util-sanitize@npm:^4.0.0": + version: 4.1.0 + resolution: "hast-util-sanitize@npm:4.1.0" dependencies: - "@types/hast": "npm:^3.0.0" - "@ungap/structured-clone": "npm:^1.2.0" - unist-util-position: "npm:^5.0.0" - checksum: 10/bdffc06f587e79f25048dcf60da6731d5a91b057190ef59ce6d3b72501855b6ae7b79e44ff9d68801c2c5b11de9e4834df90a6ba658eafa3a7c6ba06d6d0c19e + "@types/hast": "npm:^2.0.0" + checksum: 10/8258ba32be9e57e871f894d3c6b3187dd98e0682bf1382cd1306c20045cd5dc209589919817dc079803d9a259b420d9cd88771535088c9fe0eea122028c348eb languageName: node linkType: hard @@ -34545,23 +34584,22 @@ __metadata: languageName: node linkType: hard -"hast-util-to-html@npm:^9.0.0": - version: 9.0.0 - resolution: "hast-util-to-html@npm:9.0.0" +"hast-util-to-html@npm:^8.0.0": + version: 8.0.4 + resolution: "hast-util-to-html@npm:8.0.4" dependencies: - "@types/hast": "npm:^3.0.0" - "@types/unist": "npm:^3.0.0" + "@types/hast": "npm:^2.0.0" + "@types/unist": "npm:^2.0.0" ccount: "npm:^2.0.0" comma-separated-tokens: "npm:^2.0.0" - hast-util-raw: "npm:^9.0.0" - hast-util-whitespace: "npm:^3.0.0" - html-void-elements: "npm:^3.0.0" - mdast-util-to-hast: "npm:^13.0.0" + hast-util-raw: "npm:^7.0.0" + hast-util-whitespace: "npm:^2.0.0" + html-void-elements: "npm:^2.0.0" property-information: "npm:^6.0.0" space-separated-tokens: "npm:^2.0.0" stringify-entities: "npm:^4.0.0" zwitch: "npm:^2.0.4" - checksum: 10/4bfa78b681135b9303743b34d7139328ff5dc412a1f6bd372e83192413fd86a5d7e8d55eab4eeb2cd561878218eec07a57df1f92cf0f3272756830738611708a + checksum: 10/cb37233a21dae417957b4c13aadb577d98fb81dd0050c6807bfc8afdb892880570a904cd1c6b18e4717c7169face2a60d58b34156ef80c82fa7dbeaebe4c2427 languageName: node linkType: hard @@ -34588,6 +34626,20 @@ __metadata: languageName: node linkType: hard +"hast-util-to-parse5@npm:^7.0.0": + version: 7.1.0 + resolution: "hast-util-to-parse5@npm:7.1.0" + dependencies: + "@types/hast": "npm:^2.0.0" + comma-separated-tokens: "npm:^2.0.0" + property-information: "npm:^6.0.0" + space-separated-tokens: "npm:^2.0.0" + web-namespaces: "npm:^2.0.0" + zwitch: "npm:^2.0.0" + checksum: 10/695539881431f9713ca4a0be7d06bf3e57ae4d9f930eccba371534c50cff11855d345f8ec30099d04482637ad82e3c70d480269bfa4c109f37993536e8ea690d + languageName: node + linkType: hard + "hast-util-to-parse5@npm:^8.0.0": version: 8.0.0 resolution: "hast-util-to-parse5@npm:8.0.0" @@ -34890,6 +34942,13 @@ __metadata: languageName: node linkType: hard +"html-void-elements@npm:^2.0.0": + version: 2.0.1 + resolution: "html-void-elements@npm:2.0.1" + checksum: 10/06d41f13b9d5d6e0f39861c4bec9a9196fa4906d56cd5cf6cf54ad2e52a85bf960cca2bf9600026bde16c8331db171bedba5e5a35e2e43630c8f1d497b2fb658 + languageName: node + linkType: hard + "html-void-elements@npm:^3.0.0": version: 3.0.0 resolution: "html-void-elements@npm:3.0.0" @@ -39590,6 +39649,16 @@ __metadata: languageName: node linkType: hard +"mdast-util-phrasing@npm:^3.0.0": + version: 3.0.1 + resolution: "mdast-util-phrasing@npm:3.0.1" + dependencies: + "@types/mdast": "npm:^3.0.0" + unist-util-is: "npm:^5.0.0" + checksum: 10/c5b616d9b1eb76a6b351d195d94318494722525a12a89d9c8a3b091af7db3dd1fc55d294f9d29266d8159a8267b0df4a7a133bda8a3909d5331c383e1e1ff328 + languageName: node + linkType: hard + "mdast-util-phrasing@npm:^4.0.0": version: 4.1.0 resolution: "mdast-util-phrasing@npm:4.1.0" @@ -39600,7 +39669,7 @@ __metadata: languageName: node linkType: hard -"mdast-util-to-hast@npm:^12.1.0": +"mdast-util-to-hast@npm:^12.0.0, mdast-util-to-hast@npm:^12.1.0": version: 12.3.0 resolution: "mdast-util-to-hast@npm:12.3.0" dependencies: @@ -39633,6 +39702,22 @@ __metadata: languageName: node linkType: hard +"mdast-util-to-markdown@npm:^1.0.0": + version: 1.5.0 + resolution: "mdast-util-to-markdown@npm:1.5.0" + dependencies: + "@types/mdast": "npm:^3.0.0" + "@types/unist": "npm:^2.0.0" + longest-streak: "npm:^3.0.0" + mdast-util-phrasing: "npm:^3.0.0" + mdast-util-to-string: "npm:^3.0.0" + micromark-util-decode-string: "npm:^1.0.0" + unist-util-visit: "npm:^4.0.0" + zwitch: "npm:^2.0.0" + checksum: 10/713f674588a01969a2ce524a69985bd57e507377eea2c4ba69800fb305414468b30144ae9b837fbdde8c609877673140e4f56f6cabe9e0e2bc1487291e3c5144 + languageName: node + linkType: hard + "mdast-util-to-markdown@npm:^2.0.0": version: 2.1.0 resolution: "mdast-util-to-markdown@npm:2.1.0" @@ -39656,7 +39741,7 @@ __metadata: languageName: node linkType: hard -"mdast-util-to-string@npm:^3.1.0": +"mdast-util-to-string@npm:^3.0.0, mdast-util-to-string@npm:^3.1.0": version: 3.2.0 resolution: "mdast-util-to-string@npm:3.2.0" dependencies: @@ -43751,6 +43836,13 @@ __metadata: languageName: node linkType: hard +"parse5@npm:^6.0.0": + version: 6.0.1 + resolution: "parse5@npm:6.0.1" + checksum: 10/dfb110581f62bd1425725a7c784ae022a24669bd0efc24b58c71fc731c4d868193e2ebd85b74cde2dbb965e4dcf07059b1e651adbec1b3b5267531bd132fdb75 + languageName: node + linkType: hard + "parse5@npm:^7.0.0, parse5@npm:^7.1.2": version: 7.1.2 resolution: "parse5@npm:7.1.2" @@ -47451,16 +47543,16 @@ __metadata: languageName: node linkType: hard -"remark-html@npm:16.0.1": - version: 16.0.1 - resolution: "remark-html@npm:16.0.1" +"remark-html@npm:15.0.2": + version: 15.0.2 + resolution: "remark-html@npm:15.0.2" dependencies: - "@types/mdast": "npm:^4.0.0" - hast-util-sanitize: "npm:^5.0.0" - hast-util-to-html: "npm:^9.0.0" - mdast-util-to-hast: "npm:^13.0.0" - unified: "npm:^11.0.0" - checksum: 10/eeae58299929d506b770db6e461f57e551f5502f33b6ae64bd770ab3b1d6ece5c7fe45b254636ff12e5bb2006f4e713dfa8084752e0fa627c79e7decea8a91cc + "@types/mdast": "npm:^3.0.0" + hast-util-sanitize: "npm:^4.0.0" + hast-util-to-html: "npm:^8.0.0" + mdast-util-to-hast: "npm:^12.0.0" + unified: "npm:^10.0.0" + checksum: 10/46c76eb6a3bd25c41ed2535d285c5b676c81c4752b697627596ddcfec4992da02763b9838f47f2a6eb03147b9b8d1e978612a8fd4e57667c05b02a32961dcab3 languageName: node linkType: hard @@ -47474,7 +47566,18 @@ __metadata: languageName: node linkType: hard -"remark-parse@npm:11.0.0, remark-parse@npm:^11.0.0": +"remark-parse@npm:10.0.2, remark-parse@npm:^10.0.0": + version: 10.0.2 + resolution: "remark-parse@npm:10.0.2" + dependencies: + "@types/mdast": "npm:^3.0.0" + mdast-util-from-markdown: "npm:^1.0.0" + unified: "npm:^10.0.0" + checksum: 10/184f48956734a58a7e157d83233e532ea289697f5ecebd1fb082cce79e6d9f5b1d3da72462356b2b3b5843643cee890280ffe3d21c9d4ad2d7d5e20bb5de7f14 + languageName: node + linkType: hard + +"remark-parse@npm:^11.0.0": version: 11.0.0 resolution: "remark-parse@npm:11.0.0" dependencies: @@ -47486,17 +47589,6 @@ __metadata: languageName: node linkType: hard -"remark-parse@npm:^10.0.0": - version: 10.0.2 - resolution: "remark-parse@npm:10.0.2" - dependencies: - "@types/mdast": "npm:^3.0.0" - mdast-util-from-markdown: "npm:^1.0.0" - unified: "npm:^10.0.0" - checksum: 10/184f48956734a58a7e157d83233e532ea289697f5ecebd1fb082cce79e6d9f5b1d3da72462356b2b3b5843643cee890280ffe3d21c9d4ad2d7d5e20bb5de7f14 - languageName: node - linkType: hard - "remark-rehype@npm:^10.0.0": version: 10.1.0 resolution: "remark-rehype@npm:10.1.0" @@ -47533,6 +47625,17 @@ __metadata: languageName: node linkType: hard +"remark-stringify@npm:^10.0.0": + version: 10.0.3 + resolution: "remark-stringify@npm:10.0.3" + dependencies: + "@types/mdast": "npm:^3.0.0" + mdast-util-to-markdown: "npm:^1.0.0" + unified: "npm:^10.0.0" + checksum: 10/9fc5545b7cfd14f77196742e474db1a3863d5435324b381ae2097730870c74338feda99c12b172edadf9fe478ce96a3b9e6abc29cb42774da279c86664e5d869 + languageName: node + linkType: hard + "remark-stringify@npm:^11.0.0": version: 11.0.0 resolution: "remark-stringify@npm:11.0.0" @@ -47544,15 +47647,15 @@ __metadata: languageName: node linkType: hard -"remark@npm:15.0.1": - version: 15.0.1 - resolution: "remark@npm:15.0.1" +"remark@npm:14.0.3": + version: 14.0.3 + resolution: "remark@npm:14.0.3" dependencies: - "@types/mdast": "npm:^4.0.0" - remark-parse: "npm:^11.0.0" - remark-stringify: "npm:^11.0.0" - unified: "npm:^11.0.0" - checksum: 10/671eae3a4482377373cbbae956e2dbc0f8c40df1c3e5e2e1e82efa248b310ef5989340e1a5a8ebe94ff14fcf9c72612f40a29d002ffc0a465e3d6d50de973839 + "@types/mdast": "npm:^3.0.0" + remark-parse: "npm:^10.0.0" + remark-stringify: "npm:^10.0.0" + unified: "npm:^10.0.0" + checksum: 10/425ed19401aa09d9d5b26f19c173e63a05b57d047393bb698898a09de4ec99a840a2405e28bd1410ccb124368fdd9a825e850a531f524dbc2e52ae005e026a4f languageName: node linkType: hard @@ -53008,33 +53111,33 @@ __metadata: languageName: node linkType: hard -"unified@npm:11.0.4, unified@npm:^11.0.0, unified@npm:^11.0.3, unified@npm:^11.0.4": - version: 11.0.4 - resolution: "unified@npm:11.0.4" +"unified@npm:10.1.2, unified@npm:^10.0.0": + version: 10.1.2 + resolution: "unified@npm:10.1.2" dependencies: - "@types/unist": "npm:^3.0.0" + "@types/unist": "npm:^2.0.0" bail: "npm:^2.0.0" - devlop: "npm:^1.0.0" extend: "npm:^3.0.0" + is-buffer: "npm:^2.0.0" is-plain-obj: "npm:^4.0.0" trough: "npm:^2.0.0" - vfile: "npm:^6.0.0" - checksum: 10/425f0618d6f5e5d2ae64ec206cb6fd11f4b86fec7a785cfe2fc3a334191a91bf837eecb32858c70bcc2c08e76ce9d6a38457319f70f77399c8f496fb8e486817 + vfile: "npm:^5.0.0" + checksum: 10/6cffebcefc3290be26d25a58ba714cda943142782baf320fddf374ca3a319bdaabb006f96df4be17b8b367f5e6f6e113b1027c52ef66154846a7a110550f6688 languageName: node linkType: hard -"unified@npm:^10.0.0": - version: 10.1.2 - resolution: "unified@npm:10.1.2" +"unified@npm:^11.0.0, unified@npm:^11.0.3, unified@npm:^11.0.4": + version: 11.0.4 + resolution: "unified@npm:11.0.4" dependencies: - "@types/unist": "npm:^2.0.0" + "@types/unist": "npm:^3.0.0" bail: "npm:^2.0.0" + devlop: "npm:^1.0.0" extend: "npm:^3.0.0" - is-buffer: "npm:^2.0.0" is-plain-obj: "npm:^4.0.0" trough: "npm:^2.0.0" - vfile: "npm:^5.0.0" - checksum: 10/6cffebcefc3290be26d25a58ba714cda943142782baf320fddf374ca3a319bdaabb006f96df4be17b8b367f5e6f6e113b1027c52ef66154846a7a110550f6688 + vfile: "npm:^6.0.0" + checksum: 10/425f0618d6f5e5d2ae64ec206cb6fd11f4b86fec7a785cfe2fc3a334191a91bf837eecb32858c70bcc2c08e76ce9d6a38457319f70f77399c8f496fb8e486817 languageName: node linkType: hard @@ -53943,6 +54046,16 @@ __metadata: languageName: node linkType: hard +"vfile-location@npm:^4.0.0": + version: 4.1.0 + resolution: "vfile-location@npm:4.1.0" + dependencies: + "@types/unist": "npm:^2.0.0" + vfile: "npm:^5.0.0" + checksum: 10/c894e8e5224170d1f85288f4a1d1ebcee0780823ea2b49d881648ab360ebf01b37ecb09b1c4439a75f9a51f31a9f9742cd045e987763e367c352a1ef7c50d446 + languageName: node + linkType: hard + "vfile-location@npm:^5.0.0": version: 5.0.2 resolution: "vfile-location@npm:5.0.2" From 347d6bf4647c9bbaf8d3f4bc698d0291db3b8b25 Mon Sep 17 00:00:00 2001 From: Julien Genestoux Date: Wed, 27 Mar 2024 19:48:52 -0400 Subject: [PATCH 15/35] feat(unlock-app): changed the UI for refunds per Dappcon Team requests (#13528) * changed the UI for refunds per Gnosis * refactored receipt number --- .../Receipts/elements/ReceiptBox.tsx | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/unlock-app/src/components/interface/Receipts/elements/ReceiptBox.tsx b/unlock-app/src/components/interface/Receipts/elements/ReceiptBox.tsx index d9a15358269..b352e028f27 100644 --- a/unlock-app/src/components/interface/Receipts/elements/ReceiptBox.tsx +++ b/unlock-app/src/components/interface/Receipts/elements/ReceiptBox.tsx @@ -97,8 +97,6 @@ export const ReceiptBox = ({ lockAddress, hash, network }: ReceiptBoxProps) => { } ) - const receiptPrefix = supplier?.prefix ? supplier.prefix + '-' : '' - // enable edit of purchaser only if purchaser match the account const isPurchaser = receiptDetails?.payer?.toLowerCase() === account?.toLowerCase() @@ -114,7 +112,14 @@ export const ReceiptBox = ({ lockAddress, hash, network }: ReceiptBoxProps) => { receiptDetails && receiptDetails.timestamp ? dayjs.unix(receiptDetails.timestamp).format('D MMM YYYY') // example: 20 Jan 1977 : '' - const receiptNumber = receiptPrefix + (receiptDetails?.receiptNumber || '') + + const receiptNumber = [ + supplier?.prefix, + receiptDetails?.receiptNumber || '', + isCancelReceipt ? 'REFUND' : '', + ] + .filter((z: string) => !!z) + .join('-') const PurchaseDetails = () => { return ( @@ -135,9 +140,11 @@ export const ReceiptBox = ({ lockAddress, hash, network }: ReceiptBoxProps) => { currencyContractAddress: receiptDetails?.tokenAddress, hash, }) + const multiplier = isCancelReceipt ? -1 : 1 const vatRatePercentage = (supplier?.vatBasisPointsRate ?? 0) / 100 - const subtotal = receiptPrice?.total / (1 + vatRatePercentage / 100) + const subtotal = + (multiplier * receiptPrice?.total) / (1 + vatRatePercentage / 100) const vatTotalInAmount = Number((subtotal * vatRatePercentage) / 100) return ( @@ -168,7 +175,8 @@ export const ReceiptBox = ({ lockAddress, hash, network }: ReceiptBoxProps) => { )} - {parseFloat(receiptPrice?.total).toFixed(2)} {symbol} + {(multiplier * parseFloat(receiptPrice?.total)).toFixed(2)}{' '} + {symbol} @@ -272,9 +280,7 @@ export const ReceiptBox = ({ lockAddress, hash, network }: ReceiptBoxProps) => {
Date: Wed, 27 Mar 2024 19:48:17 -0400 Subject: [PATCH 16/35] fix(unlock-protocol-com): removed distDir from next config --- unlock-protocol-com/next.config.js | 1 - 1 file changed, 1 deletion(-) diff --git a/unlock-protocol-com/next.config.js b/unlock-protocol-com/next.config.js index 5aa81c2d853..feac4e82c8b 100644 --- a/unlock-protocol-com/next.config.js +++ b/unlock-protocol-com/next.config.js @@ -70,7 +70,6 @@ Object.keys(requiredConfigVariables).forEach((configVariableName) => { const nextConfig = { output: 'export', - distDir: 'out', images: { unoptimized: true, }, From e98703b705131471897f1d959425914e7f3cac73 Mon Sep 17 00:00:00 2001 From: Christopher Carfi Date: Thu, 28 Mar 2024 07:58:23 -0700 Subject: [PATCH 17/35] Ccarfi microcopy fixes on referrals and refunds (#13536) * Update Referrals.tsx microcopy fix * Update CancellationForm.tsx microcopy update * Update UpdateReferralFee.tsx microcopy update --- unlock-app/src/components/content/event/Settings/Referrals.tsx | 2 +- .../interface/locks/Settings/forms/CancellationForm.tsx | 2 +- .../interface/locks/Settings/forms/UpdateReferralFee.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/unlock-app/src/components/content/event/Settings/Referrals.tsx b/unlock-app/src/components/content/event/Settings/Referrals.tsx index 2011e3c86ae..9be7a78c0f1 100644 --- a/unlock-app/src/components/content/event/Settings/Referrals.tsx +++ b/unlock-app/src/components/content/event/Settings/Referrals.tsx @@ -175,7 +175,7 @@ export const ReferralsForLock = ({ placeholder="Referrer fee (%)" error={ errors?.referralFeePercentage && - 'This field accept percentage value between 1 and 100.' + 'This field accepts percentage values between 1 and 100.' } /> diff --git a/unlock-app/src/components/interface/locks/Settings/forms/CancellationForm.tsx b/unlock-app/src/components/interface/locks/Settings/forms/CancellationForm.tsx index 377f1c33114..5ae25b4d338 100644 --- a/unlock-app/src/components/interface/locks/Settings/forms/CancellationForm.tsx +++ b/unlock-app/src/components/interface/locks/Settings/forms/CancellationForm.tsx @@ -219,7 +219,7 @@ export const CancellationForm = ({ step={1} error={ errors?.refundPenaltyPercentage && - 'This field accept percentage value between 0 and 100.' + 'This field accepts percentage values between 0 and 100.' } {...register('refundPenaltyPercentage', { valueAsNumber: true, diff --git a/unlock-app/src/components/interface/locks/Settings/forms/UpdateReferralFee.tsx b/unlock-app/src/components/interface/locks/Settings/forms/UpdateReferralFee.tsx index e6b2d09c207..a3f1e108401 100644 --- a/unlock-app/src/components/interface/locks/Settings/forms/UpdateReferralFee.tsx +++ b/unlock-app/src/components/interface/locks/Settings/forms/UpdateReferralFee.tsx @@ -125,7 +125,7 @@ export const UpdateReferralFee = ({ })} error={ errors?.referralFeePercentage && - 'This field accept percentage value between 1 and 100.' + 'This field accepts percentage values between 1 and 100.' } disabled={isDisabledReferrerInput} /> From 6c9f33a462a10f321676fecf886d5c1f8d946d6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renaud?= Date: Thu, 28 Mar 2024 17:47:51 +0100 Subject: [PATCH 18/35] feat(docs): add changelog for Unlock 13 and PublicLock 14 (#13534) * add publicLock changelog * add Unlock changelog --- docs/docs/core-protocol/public-lock/README.md | 21 ++++++++++++++++++- docs/docs/core-protocol/unlock/README.md | 16 ++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/docs/docs/core-protocol/public-lock/README.md b/docs/docs/core-protocol/public-lock/README.md index e12d12967e5..a1417cfef07 100644 --- a/docs/docs/core-protocol/public-lock/README.md +++ b/docs/docs/core-protocol/public-lock/README.md @@ -47,11 +47,30 @@ Lock managers can also alter the behavior of their locks thru the use of [hooks] Changelogs can be found here for the last two versions. +### Version 14 + +**Released:**: Jan 2024 + +The version 14 introduces several changes in user-facing features : + +- Introduces `setKeyExpiration` to allow a lock manager to update the timestamp of any existing keys freely +- Modifies `getHasValidKey` so a hook has a final say while determining the validity of a key +- Allows a lock manager to always transfer keys, even when transfers are disabled +- Disables fees for lock managers when transferring or sharing a key + +For advanced users and developers, the lower level changes below are noteworthy: + +- Replace `UnlockUtils` dependencies by optimized Open Zeppelin implementation +- Remove dev reward/cut when purchasing a key +- Add unchecked scopes on math operations (gas optimisation) +- New Solidity version 0.8.21 (creating issues on some chains that wont support new `PUSH0` evm opcode) +- Fix potential overflow when merging keys + ### Version 13 **Released**: April 2023 -This new version improved gas consumption of most functions (by using Solidity custom errors instead of require statements). It solves issues that were appearing when canceling or burning membership keys. +This new version improved gas consumption of most functions (by using Solidity custom errors instead of require statements). It solves issues that were appearing when canceling or burning membership keys. The helpers functions `addKeyGranter` and `isKeyGranter` have been removed to reduce the size of the contract. The features are still accessible by calling directly `grantRole` and `hasRole` with `keccak256('KEY_GRANTER_ROLE')` as role. diff --git a/docs/docs/core-protocol/unlock/README.md b/docs/docs/core-protocol/unlock/README.md index 63670eac277..31287caae6a 100644 --- a/docs/docs/core-protocol/unlock/README.md +++ b/docs/docs/core-protocol/unlock/README.md @@ -11,3 +11,19 @@ This is our "factory" contract **(Unlock.sol)** and has several roles. As of summer 2021, the unlock contract is **owned** by a multi-sig wallet managed by Unlock Inc. Our goal is to move toward decentralization by transferring ownership of the Unlock contact to [the Unlock DAO](../../governance/unlock-dao/). This contract is upgradable using OpenZeppelin's upgradability framework. As of now, the ProxyAdmin is **owned** by a multi-sig wallet managed by Unlock Inc. Our goal is to move toward decentralization by transferring ownership of the Unlock contact to the [Unlock DAO](../../governance/unlock-dao/). Each implementation is versioned. The method `unlockVersion()` will yield the current version. + +# Changelog + +## Version 13 + +**Released**: Feb 2024 + +The main novelty in the version 13 of Unlock is a “swap and burn” feature that allow fees collected by the protocol to directly decrease the supply of UDT in circulation. + +### **How it works** + +- Fees are collected by the Unlock contract when a membership or subscription key is purchased or extended +- Fees are kept by the main Unlock contract, and can be denominated in any native or ERC20 currencies +- By calling the `swapAndBurn` function, the collected fees are sent from the Unlock contract to a contract that will 1) convert the tokens for the collected protocol fees to UDT (using Uniswap) and 2) send those UDT tokens to a burn address + +In earlier versions of the protocol, UDT governance tokens were distributed by the Unlock contract using a developer reward. This is now deprecated and should be replaced by the protocol fee. The protocol fee is not enabled by default, and it will be up to the DAO to enable it now that the tools are in place. From 3e817b701f7c39938976aa47f4524886b9fea24e Mon Sep 17 00:00:00 2001 From: Tyler Sehr Date: Thu, 28 Mar 2024 13:19:37 -0700 Subject: [PATCH 19/35] add contributors to .clabot (#13537) --- .clabot | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.clabot b/.clabot index 21ee40099a9..2e7a35c0488 100644 --- a/.clabot +++ b/.clabot @@ -63,7 +63,9 @@ "FedericoCaruso", "njokuScript", "Calla-Ji", - "blahkheart" + "blahkheart", + "TylerSehr", + "ClockRide" ], "message": "Thank you for your pull request and welcome to Unlock! We require contributors to sign our [Contributor License Agreement](https://github.com/unlock-protocol/unlock/blob/master/CLA.txt), and we don't seem to have the users {{usersWithoutCLA}} on file. \nIn order for us to review and merge your code, please open _another_ pull request with a single modification: your github username added to the file `.clabot`.\nThank you! " } From 39b4e79cfa63703fa811c88d18cfe6f22bbb6693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renaud?= Date: Fri, 29 Mar 2024 10:31:14 +0100 Subject: [PATCH 20/35] feat(governance): allow test execution of proposal from tx id (#13509) * allow test execution of proposal from tx id * parse and pass correctly tx args * add unlock addresses in whales * allow proposal id only for votes * pass odwn tx receipt * herlpes for gov contract * log events after proposal execution * Update governance/scripts/gov/index.js --------- Co-authored-by: Julien Genestoux --- governance/helpers/gov.js | 228 ++++++++++-------- governance/helpers/tx.js | 26 ++ governance/proposals/000-example.js | 2 - .../proposals/001-example-w-calldata.js | 4 - governance/scripts/bridge/_lib.js | 18 +- governance/scripts/bridge/execTx.js | 8 +- governance/scripts/gov/execute.js | 20 +- governance/scripts/gov/index.js | 32 ++- governance/scripts/gov/queue.js | 18 +- governance/scripts/gov/submit.js | 18 +- governance/tasks/gov.js | 133 +++++++--- .../test/fixtures/proposal-000-example.js | 2 - governance/test/gov.test.js | 42 ++-- packages/hardhat-helpers/src/fork.js | 7 +- 14 files changed, 359 insertions(+), 199 deletions(-) create mode 100644 governance/helpers/tx.js diff --git a/governance/helpers/gov.js b/governance/helpers/gov.js index a007f26c916..44d5bb514c0 100644 --- a/governance/helpers/gov.js +++ b/governance/helpers/gov.js @@ -1,6 +1,7 @@ const { ethers } = require('hardhat') const { ADDRESS_ZERO } = require('@unlock-protocol/hardhat-helpers') const { GovernorUnlockProtocol } = require('@unlock-protocol/contracts') +const { fetchDataFromTx } = require('./tx') /** * Helper to parse a DAO proposal from an object @@ -15,10 +16,28 @@ const { GovernorUnlockProtocol } = require('@unlock-protocol/contracts') * @returns a formatted proposal in the form of an array of 3 arrays and a string * ex. [ [ to (address) ], [ value (in ETH) ], [ calldata (as string) ], "name of the proposal"] */ - const parseProposal = async ({ calls, // should be an array. If present will bypass functionName / functionArgs logic proposalName, + txId, + govAddress = ADDRESS_ZERO, +}) => { + let proposal + const gov = await getGovContract(govAddress) + if (calls && proposalName) { + proposal = await parseProposalFromFile({ + calls, + proposalName, + }) + } else { + proposal = await getProposalArgsFromTx({ txId, gov }) + } + return { ...proposal, gov } +} + +const parseProposalFromFile = async ({ + calls, // should be an array. If present will bypass functionName / functionArgs logic + proposalName, }) => { // parse an array of contract calls if (!calls || !calls.length) { @@ -37,6 +56,7 @@ const parseProposal = async ({ contractAddress, functionName, functionArgs, + value = 0, }) => { if (!calldata) { calldata = await encodeProposalArgs({ @@ -45,41 +65,77 @@ const parseProposal = async ({ functionArgs, }) } - return { calldata, contractAddress, value: 0 } + return { calldata, contractAddress, value } } ) ) - const parsed = encodedCalls.reduce( - (arr, { calldata, contractAddress, value }) => { - return !arr.length - ? [[contractAddress], [value], [calldata]] - : [ - [...arr[0], contractAddress], // contracts to send the proposal to - [...arr[1], value], // value in ETH, default to 0 - [...arr[2], calldata], // encoded func calls - ] - }, - [] + const { targets, values, calldatas } = encodedCalls.reduce( + ({ targets, values, calldatas }, { calldata, contractAddress, value }) => ({ + targets: [...targets, contractAddress], // contracts to send the proposal to + values: [...values, value], // value in ETH, default to 0 + calldatas: [...calldatas, calldata], // encoded func calls + }), + { + targets: [], + values: [], + calldatas: [], + } ) + const descriptionHash = ethers.keccak256(ethers.toUtf8Bytes(proposalName)) + return { + targets, + values, + calldatas, + descriptionHash, + description: proposalName, + } +} - return [...parsed, proposalName] +const getProposalArgsFromTx = async ({ gov, txId }) => { + const [proposalId, , _targets, _values, , _calldatas, , , description] = + await fetchDataFromTx({ + txHash: txId, + eventName: 'ProposalCreated', + abi: GovernorUnlockProtocol.abi, + }) + // make sure values are correct + const descriptionHash = ethers.keccak256(ethers.toUtf8Bytes(description)) + const targets = _targets.toArray() + const values = _values.toArray() + const calldatas = _calldatas.toArray() + const proposalIdFromFetchedValues = await gov.hashProposal( + targets, + values, + calldatas, + descriptionHash + ) + if (proposalIdFromFetchedValues !== proposalId) { + throw new Error('proposalId mismatch') + } + return { + targets, + values, + calldatas, + descriptionHash, + } } +/** + * HELPERS + */ const getProposalId = async (proposal) => { - const [targets, values, calldata, description] = await parseProposal({ + const { targets, values, calldatas, descriptionHash } = await parseProposal({ ...proposal, }) - const descriptionHash = ethers.keccak256(ethers.toUtf8Bytes(description)) - // solidityKeccak256 const encoder = ethers.AbiCoder.defaultAbiCoder() const proposalId = BigInt( ethers.keccak256( encoder.encode( ['address[]', 'uint256[]', 'bytes[]', 'bytes32'], - [targets, values, calldata, descriptionHash] + [targets, values, calldatas, descriptionHash] ) ) ) @@ -87,40 +143,14 @@ const getProposalId = async (proposal) => { return proposalId } -const getProposalIdFromContract = async (proposal, govAddress) => { - const { proposerAddress } = proposal - const [to, value, calldata, description] = await parseProposal({ - ...proposal, - }) - - const [defaultSigner] = await ethers.getSigners() - const proposerWallet = proposerAddress - ? defaultSigner - : await ethers.getSigner(proposerAddress) - - const gov = await ethers.getContractAt( - GovernorUnlockProtocol.abi, - govAddress, - proposerWallet - ) - - const descriptionHash = ethers.keccak256(ethers.toUtf8Bytes(description)) - - const proposalId = await gov.hashProposal( - to, - value, - calldata, - descriptionHash - ) - - return proposalId -} - -const validateProposalCall = (proposal) => { +const validateProposalCall = (call) => { // proposal contains a single contract call - if (!proposal.calldata && !proposal.functionArgs) { + if (!call.calldata && !call.functionArgs) { throw new Error('Missing calldata or function args.') } + if (!call.contractAddress) { + throw new Error('Missing target (to) in proposal call.') + } } const encodeProposalArgs = async ({ @@ -153,80 +183,87 @@ const decodeProposalArgs = async ({ return decoded } -const queueProposal = async ({ proposal, govAddress }) => { - const [targets, values, calldatas, description] = await parseProposal({ +const getProposalIdFromContract = async ({ proposal, govAddress, txId }) => { + const { targets, values, calldatas, descriptionHash } = await parseProposal({ ...proposal, + govAddress, + txId, }) - const descriptionHash = ethers.keccak256(ethers.toUtf8Bytes(description)) - const { proposerAddress } = proposal - let voterWallet - if (!proposerAddress) { - ;[voterWallet] = await ethers.getSigners() - } else { - voterWallet = await ethers.getSigner(proposerAddress) - } - console.log({ targets, values, calldatas, description }) - - const gov = await ethers.getContractAt(GovernorUnlockProtocol.abi, govAddress) + const gov = await getGovContract(govAddress) + const proposalId = await gov.hashProposal( + targets, + values, + calldatas, + descriptionHash + ) - return await gov - .connect(voterWallet) - .queue(targets, values, calldatas, descriptionHash) + return proposalId } -const executeProposal = async ({ proposal, govAddress }) => { - const { proposerAddress } = proposal - const [targets, values, calldatas, description] = await parseProposal({ - ...proposal, - }) - const descriptionHash = ethers.keccak256(ethers.toUtf8Bytes(description)) - let voterWallet - if (!proposerAddress) { - ;[voterWallet] = await ethers.getSigners() - } else { - voterWallet = await ethers.getSigner(proposerAddress) - } +const queueProposal = async ({ proposal, govAddress, proposalId, txId }) => { + const { targets, values, calldatas, descriptionHash, gov } = + await parseProposal({ + ...proposal, + govAddress, + txId, + }) + return await gov.queue(targets, values, calldatas, descriptionHash) +} - const gov = await ethers.getContractAt(GovernorUnlockProtocol.abi, govAddress) - return await gov - .connect(voterWallet) - .execute(targets, values, calldatas, descriptionHash) +const executeProposal = async ({ proposal, govAddress, proposalId, txId }) => { + const { gov, targets, values, calldatas, descriptionHash } = + await parseProposal({ + ...proposal, + proposalId, + govAddress, + txId, + }) + return await gov.execute(targets, values, calldatas, descriptionHash) } /** * Submits a proposal */ -const submitProposal = async ({ proposerAddress, proposal, govAddress }) => { +const submitProposal = async ({ proposal, govAddress, proposalId, txId }) => { + const gov = await getGovContract(govAddress) + const { targets, values, calldatas, description } = await parseProposal({ + ...proposal, + govAddress, + proposalId, + txId, + }) + return await gov.propose(targets, values, calldatas, description) +} + +const getGovContract = async (govAddress) => { const gov = await ethers.getContractAt(GovernorUnlockProtocol.abi, govAddress) - let proposer - if (!proposerAddress) { - ;[proposer] = await ethers.getSigners() - } else { - proposer = await ethers.getSigner(proposerAddress) - } - const parsed = await parseProposal(proposal) - return await gov.connect(proposer).propose(...parsed) + return gov } const getProposalVotes = async (proposalId, govAddress) => { - const gov = await ethers.getContractAt(GovernorUnlockProtocol.abi, govAddress) + const gov = await getGovContract(govAddress) const votes = await gov.proposalVotes(proposalId) return votes } const getQuorum = async (govAddress) => { - const gov = await ethers.getContractAt(GovernorUnlockProtocol.abi, govAddress) + const gov = await getGovContract(govAddress) const currentBlock = await ethers.provider.getBlockNumber() return await gov.quorum(currentBlock - 1) } const getGovTokenAddress = async (govAddress) => { - const gov = await ethers.getContractAt(GovernorUnlockProtocol.abi, govAddress) + const gov = await getGovContract(govAddress) return await gov.token() } +const getTimelockAddress = async (govAddress) => { + const gov = await getGovContract(govAddress) + return await gov.timelock() +} + const getProposalState = async (proposalId, govAddress) => { const states = [ 'Pending', @@ -239,7 +276,7 @@ const getProposalState = async (proposalId, govAddress) => { 'Executed', ] - const gov = await ethers.getContractAt(GovernorUnlockProtocol.abi, govAddress) + const gov = await getGovContract(govAddress) const state = await gov.state(proposalId) return states[state] } @@ -261,7 +298,9 @@ module.exports = { loadProposal, getProposalVotes, getQuorum, + getGovContract, getGovTokenAddress, + getTimelockAddress, getProposalState, getProposalId, getProposalIdFromContract, @@ -273,4 +312,5 @@ module.exports = { executeProposal, etaToDate, isAlreadyPast, + getProposalArgsFromTx, } diff --git a/governance/helpers/tx.js b/governance/helpers/tx.js new file mode 100644 index 00000000000..70c1560a35c --- /dev/null +++ b/governance/helpers/tx.js @@ -0,0 +1,26 @@ +const { ethers } = require('hardhat') +const { ADDRESS_ZERO } = require('@unlock-protocol/hardhat-helpers') + +const fetchDataFromTx = async ({ + txHash, + abi, + eventName = 'TransactionAdded', +}) => { + const { interface } = await ethers.getContractAt(abi, ADDRESS_ZERO) + + // fetch data from tx + const { logs } = await ethers.provider.getTransactionReceipt(txHash) + const parsedLogs = logs.map((log) => { + try { + return interface.parseLog(log) + } catch (error) { + return {} + } + }) + const { args } = parsedLogs.find(({ name }) => name === eventName) + return args +} + +module.exports = { + fetchDataFromTx, +} diff --git a/governance/proposals/000-example.js b/governance/proposals/000-example.js index 66d31b8c612..ff6040bb1e1 100644 --- a/governance/proposals/000-example.js +++ b/governance/proposals/000-example.js @@ -2,7 +2,6 @@ const ethers = require('ethers') const { UnlockDiscountTokenV2 } = require('@unlock-protocol/contracts') const tokenRecipientAddress = '0x70997970C51812dc3A010C7d01b50e0d17dc79C8' -const proposerAddress = '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' module.exports = { proposalName: '#000 This is just an example!', @@ -14,6 +13,5 @@ module.exports = { functionArgs: [tokenRecipientAddress, ethers.parseEther('0.01')], }, ], - proposerAddress, // no payable value specified default to 0 } diff --git a/governance/proposals/001-example-w-calldata.js b/governance/proposals/001-example-w-calldata.js index f3a2605b02e..73ff7596715 100644 --- a/governance/proposals/001-example-w-calldata.js +++ b/governance/proposals/001-example-w-calldata.js @@ -1,15 +1,11 @@ const { UnlockDiscountTokenV2 } = require('@unlock-protocol/contracts') -// use hardhat default local address for testing -const proposerAddress = '0x9dED35Aef86F3c826Ff8fe9240f9e7a9Fb2094e5' - module.exports = { proposalName: 'Marketing unlock - david moderator', calls: [ { contractNameOrAbi: UnlockDiscountTokenV2.abi, functionName: 'transfer', - proposerAddress, calldata: '0xa9059cbb0000000000000000000000000235545f679b133543607c66988d60d772c10d4f000000000000000000000000000000000000000000000028a857425466f80000', }, diff --git a/governance/scripts/bridge/_lib.js b/governance/scripts/bridge/_lib.js index d5cb1ee5f8b..f6653e05d42 100644 --- a/governance/scripts/bridge/_lib.js +++ b/governance/scripts/bridge/_lib.js @@ -698,22 +698,6 @@ const getDelayModule = async (delayModuleAddress) => { return { delayMod, currentNonce, queueNonce } } -const fetchDataFromTx = async ({ txHash }) => { - const { interface } = await ethers.getContractAt(delayABI, ADDRESS_ZERO) - - // fetch data from tx - const { logs } = await ethers.provider.getTransactionReceipt(txHash) - const parsedLogs = logs.map((log) => { - try { - return interface.parseLog(log) - } catch (error) { - return {} - } - }) - const { args } = parsedLogs.find(({ name }) => name === 'TransactionAdded') - return args -} - const logStatus = (transferId, status) => { const { origin, dest } = status const { explorer, name, id } = networks[dest.chainId] @@ -731,11 +715,11 @@ const logStatus = (transferId, status) => { } module.exports = { + delayABI, getXCalledEvents, fetchOriginXCall, fetchDestinationXCall, getSupportedChainsByDomainId, getDelayModule, - fetchDataFromTx, logStatus, } diff --git a/governance/scripts/bridge/execTx.js b/governance/scripts/bridge/execTx.js index e2e6577ee4a..a0123721287 100644 --- a/governance/scripts/bridge/execTx.js +++ b/governance/scripts/bridge/execTx.js @@ -7,7 +7,8 @@ * */ -const { getDelayModule, fetchDataFromTx, logStatus } = require('./_lib') +const { getDelayModule, logStatus, delayABI } = require('./_lib') +const { fetchDataFromTx } = require('../../helpers/tx') const fs = require('fs-extra') const { getNetwork } = require('@unlock-protocol/hardhat-helpers') @@ -18,7 +19,10 @@ const bigIntToDate = (num) => new Date(parseInt((num * 1000n).toString())) const getTxStatus = async ({ delayMod, txHash, nextNonce } = {}) => { const currentNonce = nextNonce - 1n - const { to, value, data, operation } = await fetchDataFromTx({ txHash }) + const { to, value, data, operation } = await fetchDataFromTx({ + txHash, + abi: delayABI, + }) // make sure tx is scheduled correctly const txHashExec = await delayMod.getTransactionHash( diff --git a/governance/scripts/gov/execute.js b/governance/scripts/gov/execute.js index fd0c9ba588e..8cfa391a965 100644 --- a/governance/scripts/gov/execute.js +++ b/governance/scripts/gov/execute.js @@ -10,16 +10,23 @@ const { isAlreadyPast, } = require('../../helpers/gov') -async function main({ proposal, govAddress }) { +async function main({ proposal, proposalId, txId, govAddress }) { // env settings const { chainId } = await ethers.provider.getNetwork() const isDev = chainId === 31337 || process.env.RUN_FORK - if (!proposal) { - throw new Error('GOV EXEC > Missing proposal.') + if (!proposal && !proposalId) { + throw new Error('GOV EXEC > Missing proposal or proposalId.') + } + if (proposalId && !txId) { + throw new Error( + 'GOV EXEC > The tx id of the proposal creation is required to execute the proposal.' + ) + } + + if (!proposalId) { + proposalId = proposal.proposalId || (await getProposalId(proposal)) } - console.log(proposal) - const proposalId = proposal.proposalId || (await getProposalId(proposal)) // contract instance etc let state = await getProposalState(proposalId, govAddress) @@ -52,13 +59,14 @@ async function main({ proposal, govAddress }) { } // execute the tx - const tx = await executeProposal({ proposal, govAddress }) + const tx = await executeProposal({ proposal, govAddress, txId }) const receipt = await tx.wait() const { event, hash } = await getEvent(receipt, 'ProposalExecuted') if (event) { // eslint-disable-next-line no-console console.log(`GOV EXEC > Proposal executed successfully (txid: ${hash})`) } + return receipt } else if (state === 'Executed') { console.log('GOV EXEC > Proposal has already been executed') } else { diff --git a/governance/scripts/gov/index.js b/governance/scripts/gov/index.js index 6b2f11d3911..be0e6106d3b 100644 --- a/governance/scripts/gov/index.js +++ b/governance/scripts/gov/index.js @@ -10,7 +10,7 @@ const vote = require('./vote') const queue = require('./queue') const execute = require('./execute') -async function main({ proposal, govAddress }) { +async function main({ proposal, proposalId, govAddress, txId }) { const [signer] = await ethers.getSigners() const { chainId } = await ethers.provider.getNetwork() @@ -52,11 +52,33 @@ async function main({ proposal, govAddress }) { await mine(10) } - // Run the gov workflow - const proposalId = await submit({ proposal, govAddress }) + // Submit the proposal if necessary + if (!proposalId) { + proposalId = await submit({ proposal, govAddress }) + } + + // votes await vote({ proposalId, govAddress, voterAddress: signer.address }) - await queue({ proposal, govAddress }) - await execute({ proposal, govAddress }) + + const udtWhales = [ + '0xa39b44c4AFfbb56b76a1BF1d19Eb93a5DfC2EBA9', // Unlock Labs + '0xF5C28ce24Acf47849988f147d5C75787c0103534', // unlock-protocol.eth + '0xc0948A2f0B48A2AA8474f3DF54FD7C364225AD7d', // @_Cryptosmonitor + '0xD2BC5cb641aE6f7A880c3dD5Aee0450b5210BE23', // stellaachenbach.eth + '0xCA7632327567796e51920F6b16373e92c7823854', // dannithomx.eth + ] + await Promise.all( + udtWhales.map((voterAddress) => + vote({ proposalId, govAddress, voterAddress }) + ) + ) + + // Run the gov workflow + await queue({ proposalId, govAddress, txId }) + const { logs } = await execute({ proposalId, txId, proposal, govAddress }) + + // log all events + console.log(logs) } // execute as standalone diff --git a/governance/scripts/gov/queue.js b/governance/scripts/gov/queue.js index c001e2809b7..79f545ddceb 100644 --- a/governance/scripts/gov/queue.js +++ b/governance/scripts/gov/queue.js @@ -1,5 +1,6 @@ const { ethers } = require('hardhat') const { mineUpTo } = require('@nomicfoundation/hardhat-network-helpers') +const { getProposalArgsFromTx } = require('../../helpers/gov') const { queueProposal, @@ -12,11 +13,22 @@ const { const { GovernorUnlockProtocol } = require('@unlock-protocol/contracts') const { getEvent } = require('@unlock-protocol/hardhat-helpers') -async function main({ proposal, govAddress }) { +async function main({ proposalId, txId, proposal, govAddress }) { + if (!proposal && !proposalId) { + throw new Error('GOV QUEUE > Missing proposal or proposalId.') + } + if (proposalId && !txId) { + throw new Error( + 'GOV QUEUE > The tx id of the proposal creation is required to execute the proposal.' + ) + } + // env settings const { chainId } = await ethers.provider.getNetwork() const isDev = chainId === 31337 || process.env.RUN_FORK - const proposalId = proposal.proposalId || (await getProposalId(proposal)) + if (!proposalId) { + proposalId = proposal.proposalId || (await getProposalId(proposal)) + } if (!proposalId) { throw new Error('GOV QUEUE > Missing proposal ID.') @@ -46,7 +58,7 @@ async function main({ proposal, govAddress }) { // queue proposal if (state === 'Succeeded') { - const tx = await queueProposal({ proposal, govAddress }) + const tx = await queueProposal({ proposal, govAddress, txId, proposalId }) const receipt = await tx.wait() const { event, hash } = await getEvent(receipt, 'ProposalQueued') const { eta } = event.args diff --git a/governance/scripts/gov/submit.js b/governance/scripts/gov/submit.js index 0241bd7271d..822b815d0f9 100644 --- a/governance/scripts/gov/submit.js +++ b/governance/scripts/gov/submit.js @@ -1,12 +1,8 @@ const { ethers } = require('hardhat') const { submitProposal } = require('../../helpers/gov') -const { impersonate, getEvent } = require('@unlock-protocol/hardhat-helpers') - -async function main({ proposal, proposerAddress, govAddress }) { - // env settings - const { chainId } = await ethers.provider.getNetwork() - const isDev = chainId === 31337 +const { getEvent } = require('@unlock-protocol/hardhat-helpers') +async function main({ proposal, govAddress }) { // log what is happening console.log( `GOV SUBMIT > Proposed (${proposal.calls.length} calls):\n${proposal.calls @@ -18,18 +14,10 @@ async function main({ proposal, proposerAddress, govAddress }) { ) // submit the proposal - if (isDev || process.env.RUN_MAINNET_FORK) { - // eslint-disable-next-line no-console - console.log('GOV SUBMIT (dev) > Impersonate proposer ') - await impersonate(proposerAddress) - } - const proposalTx = await submitProposal({ - proposerAddress, proposal, govAddress, }) - const receipt = await proposalTx.wait() const { event, hash } = await getEvent(receipt, 'ProposalCreated') @@ -46,7 +34,7 @@ async function main({ proposal, proposerAddress, govAddress }) { `GOV SUBMIT > proposal submitted: ${await proposalId.toString()} (txid: ${hash}, block: ${currentBlock})` ) - return proposalId + return proposalId, hash } // execute as standalone diff --git a/governance/tasks/gov.js b/governance/tasks/gov.js index 8dffa7815a2..7f37242e123 100644 --- a/governance/tasks/gov.js +++ b/governance/tasks/gov.js @@ -2,19 +2,32 @@ const { task } = require('hardhat/config') const { resolve } = require('path') -task('gov', 'Submit (and validate) a proposal to UDT Governor contract') - .addParam('proposal', 'The file containing the proposal') +task('gov', 'Test execution of the entire proposal lifecycle') + .addOptionalParam('proposal', 'The file containing the proposal') + .addOptionalParam('proposalId', 'The id of an existing proposal') + .addOptionalParam('txId', 'The id of the tx where the proposal was submitted') .addParam('govAddress', 'The address of the Governor contract') .addOptionalVariadicPositionalParam( 'params', 'List of params to pass to the proposal function' ) - .setAction(async ({ proposal: proposalPath, govAddress, params }) => { - const { loadProposal } = require('../helpers/gov') - const proposal = await loadProposal(resolve(proposalPath), params) - const processProposal = require('../scripts/gov') - return await processProposal({ proposal, govAddress }) - }) + .setAction( + async ({ + proposal: proposalPath, + txId, + proposalId, + govAddress, + params, + }) => { + let proposal + if (!proposalId) { + const { loadProposal } = require('../helpers/gov') + proposal = await loadProposal(resolve(proposalPath), params) + } + const processProposal = require('../scripts/gov') + return await processProposal({ proposal, govAddress, proposalId, txId }) + } + ) /** * Governor Workflow @@ -69,55 +82,93 @@ task('gov:vote', 'Vote for a proposal on UDT Governor contract') ) task('gov:queue', 'Queue proposal in timelock') - .addParam('proposal', 'The file containing the proposal') .addParam('govAddress', 'The address of the Governor contract') + .addOptionalParam('proposal', 'The file containing the proposal') + .addOptionalParam('proposalId', 'The id of an existing proposal') + .addOptionalParam('txId', 'The id of the tx where the proposal was submitted') .addOptionalVariadicPositionalParam( 'params', 'List of params to pass to the proposal function' ) - .setAction(async ({ proposal: proposalPath, govAddress, params }) => { - const queueProposal = require('../scripts/gov/queue') - const { loadProposal } = require('../helpers/gov') - const proposal = await loadProposal(resolve(proposalPath), params) - return await queueProposal({ proposal, govAddress }) - }) + .setAction( + async ({ + proposal: proposalPath, + govAddress, + params, + proposalId, + txId, + }) => { + const queueProposal = require('../scripts/gov/queue') + let proposal + if (!proposalId) { + const { loadProposal } = require('../helpers/gov') + proposal = await loadProposal(resolve(proposalPath), params) + } + return await queueProposal({ proposal, govAddress, proposalId, txId }) + } + ) task('gov:execute', 'Closing vote period and execute a proposal (local only)') - .addParam('proposal', 'The file containing the proposal') + .addOptionalParam('proposal', 'The file containing the proposal') + .addOptionalParam('proposalId', 'The id of an existing proposal') + .addOptionalParam('txId', 'The id of the tx where the proposal was submitted') .addParam('govAddress', 'The address of the Governor contract') .addOptionalVariadicPositionalParam( 'params', 'List of params to pass to the proposal function' ) - .setAction(async ({ proposal: proposalPath, govAddress, params }) => { - const executeProposal = require('../scripts/gov/execute') - const { loadProposal } = require('../helpers/gov') - const proposal = await loadProposal(resolve(proposalPath), params) - return await executeProposal({ proposal, govAddress, params }) - }) + .setAction( + async ({ + proposal: proposalPath, + govAddress, + params, + proposalId, + txId, + }) => { + const executeProposal = require('../scripts/gov/execute') + let proposal + if (!proposalId) { + const { loadProposal } = require('../helpers/gov') + proposal = await loadProposal(resolve(proposalPath), params) + } + return await executeProposal({ + proposal, + govAddress, + params, + txId, + proposalId, + }) + } + ) /** * Governor Utils */ task('gov:votes', 'Show votes for a specific proposal') - .addParam('proposal', 'The file containing the proposal') + .addOptionalParam('proposal', 'The file containing the proposal') + .addOptionalParam('proposalId', 'The id of the proposal') .addParam('govAddress', 'The address of the Governor contract') .addOptionalVariadicPositionalParam( 'params', 'List of params to pass to the proposal function' ) .setAction( - async ({ proposal: proposalPath, govAddress, params }, { ethers }) => { + async ( + { proposal: proposalPath, proposalId, govAddress, params }, + { ethers } + ) => { const { getProposalVotes, getProposalId, getQuorum, } = require('../helpers/gov') - const { loadProposal } = require('../helpers/gov') - const proposal = await loadProposal(resolve(proposalPath), params) - const proposalId = - proposal.proposalId || (await getProposalId(proposal, govAddress)) + if (!proposalId) { + const { loadProposal } = require('../helpers/gov') + const proposal = await loadProposal(resolve(proposalPath), params) + proposalId = + proposal.proposalId || (await getProposalId(proposal, govAddress)) + } const { againstVotes, forVotes, abstainVotes } = await getProposalVotes( proposalId, govAddress @@ -191,3 +242,29 @@ task('gov:delegate', 'Delagate voting power') govAddress, }) }) + +task('gov:show', 'Show content of proposal') + .addParam('govAddress', 'The address of the Governor contract') + .addOptionalParam('proposal', 'The file containing the proposal') + .addOptionalParam('proposalId', 'The id of an existing proposal') + .addOptionalParam('txId', 'The id of the tx where the proposal was submitted') + .setAction( + async ({ + proposal: proposalPath, + govAddress, + params, + proposalId, + txId, + }) => { + const { loadProposal, parseProposal } = require('../helpers/gov') + let proposal + if (!proposalId) { + const { loadProposal } = require('../helpers/gov') + proposal = await loadProposal(resolve(proposalPath), params) + } else { + console.log('load from tx') + proposal = await parseProposal({ txId, govAddress }) + } + console.log(proposal) + } + ) diff --git a/governance/test/fixtures/proposal-000-example.js b/governance/test/fixtures/proposal-000-example.js index c232cd8f7aa..df3cd95ed47 100644 --- a/governance/test/fixtures/proposal-000-example.js +++ b/governance/test/fixtures/proposal-000-example.js @@ -1,7 +1,6 @@ const ethers = require('ethers') const { UnlockDiscountTokenV2 } = require('@unlock-protocol/contracts') const tokenRecipientAddress = '0x70997970C51812dc3A010C7d01b50e0d17dc79C8' -const proposerAddress = '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' module.exports = { proposalName: '#000 This is just an example!', @@ -13,6 +12,5 @@ module.exports = { functionArgs: [tokenRecipientAddress, ethers.parseEther('0.01')], }, ], - proposerAddress, // no payable value specified default to 0 } diff --git a/governance/test/gov.test.js b/governance/test/gov.test.js index 61aaf63e524..992a4580fd4 100644 --- a/governance/test/gov.test.js +++ b/governance/test/gov.test.js @@ -1,4 +1,7 @@ -const { GovernorUnlockProtocol } = require('@unlock-protocol/contracts') +const { + GovernorUnlockProtocol, + GovernorUnlockProtocolTimelock, +} = require('@unlock-protocol/contracts') const { ethers } = require('hardhat') const { assert } = require('chai') const { @@ -8,10 +11,12 @@ const { parseProposal, getProposalId, getProposalIdFromContract, + submitProposal, + getProposalArgsFromTx, } = require('../helpers/gov') const tokenRecipientAddress = '0x8d533d1A48b0D5ddDEF513A0B0a3677E991F3915' // ramdomly generated but deterministic for tests -const { ADRESS_ZERO } = require('@unlock-protocol/hardhat-helpers') +const { ADDRESS_ZERO } = require('@unlock-protocol/hardhat-helpers') const contractNameOrAbi = require('@unlock-protocol/hardhat-helpers/dist/ABIs/erc20.json') const functionName = 'transfer' @@ -47,7 +52,7 @@ describe('Proposal Helper', () => { describe('parseProposal', () => { it('parse gov args correctly', async () => { - const contractAddress = ADRESS_ZERO + const contractAddress = ADDRESS_ZERO const proposalName = 'Send some tokens to a grantee' const encoded = await encodeProposalArgs({ @@ -56,20 +61,25 @@ describe('Proposal Helper', () => { functionArgs, }) - const [to, value, calldata, proposalNameParsed] = await parseProposal({ - calls: [{ contractNameOrAbi, contractAddress, calldata: encoded }], - proposalName, - }) + const { targets, values, calldatas, descriptionHash } = + await parseProposal({ + calls: [{ contractNameOrAbi, contractAddress, calldata: encoded }], + proposalName, + }) + + const proposalNameHashed = ethers.keccak256( + ethers.toUtf8Bytes(proposalName) + ) - assert.equal(to[0], contractAddress) - assert.equal(value[0], 0) - assert.equal(calldata[0], [calldataEncoded]) - assert.equal(proposalNameParsed, proposalName) + assert.equal(targets[0], ADDRESS_ZERO) + assert.equal(values[0], 0) + assert.equal(calldatas[0], [calldataEncoded]) + assert.equal(descriptionHash, proposalNameHashed) }) }) describe('proposal ID', () => { - it('can be retrieved', async () => { + it('can be retrieved from chain', async () => { const proposalExample = await loadProposal( '../test/fixtures/proposal-000-example.js' ) @@ -77,10 +87,10 @@ describe('Proposal Helper', () => { const { abi, bytecode } = GovernorUnlockProtocol const Gov = await ethers.getContractFactory(abi, bytecode) const gov = await Gov.deploy() - const proposalIdFromContract = await getProposalIdFromContract( - proposalExample, - await gov.getAddress() - ) + const proposalIdFromContract = await getProposalIdFromContract({ + proposal: proposalExample, + govAddress: await gov.getAddress(), + }) assert.equal(proposalId.toString(), proposalIdFromContract.toString()) }) }) diff --git a/packages/hardhat-helpers/src/fork.js b/packages/hardhat-helpers/src/fork.js index c6d925491a8..f1cf16759fe 100644 --- a/packages/hardhat-helpers/src/fork.js +++ b/packages/hardhat-helpers/src/fork.js @@ -78,7 +78,7 @@ const parseForkUrl = (networks) => { } const resetNodeState = async () => { - const { ethers, network, config } = require('hardhat') + const { network, config } = require('hardhat') // reset fork const { forking } = config.networks.hardhat await network.provider.request({ @@ -94,10 +94,7 @@ const resetNodeState = async () => { }) } -const addSomeETH = async ( - address, - amount = ethers.utils.parseEther('1000') -) => { +const addSomeETH = async (address, amount = ethers.parseEther('1000')) => { const { network } = require('hardhat') const balance = `0x${BigInt(amount.toString()).toString(16)}` await network.provider.send('hardhat_setBalance', [address, balance]) From 24d81c330dc405bc85859cef6e6d781706828eb0 Mon Sep 17 00:00:00 2001 From: Viacheslav Date: Fri, 29 Mar 2024 20:28:31 +0200 Subject: [PATCH 21/35] fix(deps): update dependency @nuintun/qrcode to v4 (#13541) * Updated nuintun/qrcode * Update qrcode.ts --- locksmith/package.json | 2 +- locksmith/src/utils/qrcode.ts | 11 ++++++----- yarn.lock | 19 ++++++------------- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/locksmith/package.json b/locksmith/package.json index 516a1d6fbe7..c3ea0b90fe2 100644 --- a/locksmith/package.json +++ b/locksmith/package.json @@ -37,7 +37,7 @@ "@aws-sdk/client-s3": "3.525.0", "@logtail/node": "0.4.19", "@logtail/winston": "0.4.12", - "@nuintun/qrcode": "3.3.5", + "@nuintun/qrcode": "4.1.2", "@openzeppelin/defender-relay-client": "1.54.1", "@resvg/resvg-js": "2.4.1", "@sentry/node": "7.54.0", diff --git a/locksmith/src/utils/qrcode.ts b/locksmith/src/utils/qrcode.ts index e1e642c221c..49165e7a041 100644 --- a/locksmith/src/utils/qrcode.ts +++ b/locksmith/src/utils/qrcode.ts @@ -1,6 +1,6 @@ -import { Encoder, ErrorCorrectionLevel } from '@nuintun/qrcode' import Dispatcher from '../fulfillment/dispatcher' import config from '../config/config' +import { Encoder, Byte } from '@nuintun/qrcode' interface GenerateQrCodeProps { network: number @@ -44,10 +44,11 @@ export const generateQrCode = async ({ tokenId, account, }) - const qrcode = new Encoder() - qrcode.setErrorCorrectionLevel(ErrorCorrectionLevel.L) - qrcode.write(url) - qrcode.make() + const encoder = new Encoder({ + level: 'L', + }) + const qrcode = encoder.encode(new Byte(url)) + // this will return a base64 image return qrcode.toDataURL(5) } diff --git a/yarn.lock b/yarn.lock index 2e492f7d532..86ee6634bdf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11506,12 +11506,12 @@ __metadata: languageName: node linkType: hard -"@nuintun/qrcode@npm:3.3.5": - version: 3.3.5 - resolution: "@nuintun/qrcode@npm:3.3.5" +"@nuintun/qrcode@npm:4.1.2": + version: 4.1.2 + resolution: "@nuintun/qrcode@npm:4.1.2" dependencies: - tslib: "npm:^2.5.2" - checksum: 10/4f51f37f66d34c673425fa7bf8e3a5942477d65a2b73f4c12ef3ccbbe3864d2e43875c85aead0fe5b506d372f0f1b15aee870eb2d7a71bb2e608fda596f971a6 + tslib: "npm:^2.6.2" + checksum: 10/97c6eeb0815db29e542ff537fdcedab38022dbc9a76caa861bcd677751bbd52accce5b81b24c35e87f02774feec80dcd32175f14723157adfa28e36ef3161b72 languageName: node linkType: hard @@ -20026,7 +20026,7 @@ __metadata: "@aws-sdk/client-s3": "npm:3.525.0" "@logtail/node": "npm:0.4.19" "@logtail/winston": "npm:0.4.12" - "@nuintun/qrcode": "npm:3.3.5" + "@nuintun/qrcode": "npm:4.1.2" "@openzeppelin/defender-relay-client": "npm:1.54.1" "@resvg/resvg-js": "npm:2.4.1" "@sentry/node": "npm:7.54.0" @@ -52461,13 +52461,6 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^2.5.2": - version: 2.5.2 - resolution: "tslib@npm:2.5.2" - checksum: 10/263607d3f0e1913eb7f1f0f02489f47d11717b8662176b60690adceb2ed64529f369998b967a0bed920a5b809300f882a9340d278701d62439e4ce35af0d5a1f - languageName: node - linkType: hard - "tslib@npm:~2.4.0": version: 2.4.1 resolution: "tslib@npm:2.4.1" From eabfe4dce592a07ad49bd73c14a26a1a5fba9794 Mon Sep 17 00:00:00 2001 From: Viacheslav Date: Fri, 29 Mar 2024 20:30:10 +0200 Subject: [PATCH 22/35] fix(deps): update dependency unified to v11, remark-html to v16, remark-parse to v11 (#13535) * Updated unified & related dependencies * Updated remark * Fixed dependencies in unlock-app --- locksmith/package.json | 6 +- unlock-app/package.json | 3 + unlock-app/src/hooks/useEmailPreview.ts | 2 +- unlock-protocol-com/package.json | 4 +- yarn.lock | 250 +++++++----------------- 5 files changed, 79 insertions(+), 186 deletions(-) diff --git a/locksmith/package.json b/locksmith/package.json index c3ea0b90fe2..18876e9eb2d 100644 --- a/locksmith/package.json +++ b/locksmith/package.json @@ -76,8 +76,8 @@ "pg": "8.11.3", "rate-limiter-flexible": "5.0.0", "react": "18.2.0", - "remark-html": "15.0.2", - "remark-parse": "10.0.2", + "remark-html": "16.0.1", + "remark-parse": "11.0.0", "request": "2.88.2", "request-promise-native": "1.0.9", "satori": "0.9.1", @@ -85,7 +85,7 @@ "sequelize-cli": "6.6.2", "siwe": "2.1.4", "stripe": "12.8.0", - "unified": "10.1.2", + "unified": "11.0.4", "unlock-abi-1-1": "1.1.1", "vitest-fetch-mock": "0.2.2", "winston": "3.9.0", diff --git a/unlock-app/package.json b/unlock-app/package.json index 2ccc61c9436..eec9cd292c6 100644 --- a/unlock-app/package.json +++ b/unlock-app/package.json @@ -66,9 +66,12 @@ "react-markdown": "8.0.7", "react-use": "17.4.1", "react-use-clipboard": "1.0.9", + "remark-html": "16.0.1", + "remark-parse": "11.0.0", "siwe": "2.1.4", "tailwind-merge": "2.2.1", "typescript": "5.3.3", + "unified": "11.0.4", "validator": "13.9.0", "walletlink": "2.5.0", "xstate": "4.38.3", diff --git a/unlock-app/src/hooks/useEmailPreview.ts b/unlock-app/src/hooks/useEmailPreview.ts index 16df1d353d5..728464dd869 100644 --- a/unlock-app/src/hooks/useEmailPreview.ts +++ b/unlock-app/src/hooks/useEmailPreview.ts @@ -1,9 +1,9 @@ import { useQuery } from '@tanstack/react-query' import { config } from '~/config/app' import { storage } from '~/config/storage' -import { unified } from 'unified' import remarkParse from 'remark-parse' import remarkHtml from 'remark-html' +import { unified } from 'unified' export const useCustomContentForEmail = ({ network, diff --git a/unlock-protocol-com/package.json b/unlock-protocol-com/package.json index 8feae07579c..e7965333cfc 100644 --- a/unlock-protocol-com/package.json +++ b/unlock-protocol-com/package.json @@ -53,8 +53,8 @@ "next-transpile-modules": "10.0.1", "postcss": "8.4.35", "prettier": "3.0.0", - "remark": "14.0.3", - "remark-html": "15.0.2", + "remark": "15.0.1", + "remark-html": "16.0.1", "tailwindcss": "3.4.1", "vitest": "0.34.6" }, diff --git a/yarn.lock b/yarn.lock index 86ee6634bdf..9016890ad37 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18750,13 +18750,6 @@ __metadata: languageName: node linkType: hard -"@types/parse5@npm:^6.0.0": - version: 6.0.3 - resolution: "@types/parse5@npm:6.0.3" - checksum: 10/834d40c9b1a8a99a9574b0b3f6629cf48adcff2eda01a35d701f1de5dcf46ce24223684647890aba9f985d6c801b233f878168683de0ae425940403c383fba8f - languageName: node - linkType: hard - "@types/pbkdf2@npm:^3.0.0": version: 3.1.2 resolution: "@types/pbkdf2@npm:3.1.2" @@ -20085,8 +20078,8 @@ __metadata: pg: "npm:8.11.3" rate-limiter-flexible: "npm:5.0.0" react: "npm:18.2.0" - remark-html: "npm:15.0.2" - remark-parse: "npm:10.0.2" + remark-html: "npm:16.0.1" + remark-parse: "npm:11.0.0" request: "npm:2.88.2" request-promise-native: "npm:1.0.9" run-script-os: "npm:1.1.6" @@ -20098,7 +20091,7 @@ __metadata: supertest: "npm:6.3.4" tsx: "npm:4.7.1" typescript: "npm:5.3.3" - unified: "npm:10.1.2" + unified: "npm:11.0.4" unlock-abi-1-1: "npm:1.1.1" vitest: "npm:0.31.4" vitest-fetch-mock: "npm:0.2.2" @@ -20377,10 +20370,13 @@ __metadata: react-test-renderer: "npm:18.2.0" react-use: "npm:17.4.1" react-use-clipboard: "npm:1.0.9" + remark-html: "npm:16.0.1" + remark-parse: "npm:11.0.0" siwe: "npm:2.1.4" tailwind-merge: "npm:2.2.1" tailwindcss: "npm:3.3.5" typescript: "npm:5.3.3" + unified: "npm:11.0.4" validator: "npm:13.9.0" vitest: "npm:0.33.0" vitest-fetch-mock: "npm:0.2.2" @@ -20485,8 +20481,8 @@ __metadata: react-gtm-module: "npm:2.0.11" react-showdown: "npm:2.3.1" react-test-renderer: "npm:18.2.0" - remark: "npm:14.0.3" - remark-html: "npm:15.0.2" + remark: "npm:15.0.1" + remark-html: "npm:16.0.1" rss: "npm:1.2.2" showdown-highlight: "npm:3.1.0" tailwind-merge: "npm:2.2.1" @@ -34462,21 +34458,6 @@ __metadata: languageName: node linkType: hard -"hast-util-from-parse5@npm:^7.0.0": - version: 7.1.2 - resolution: "hast-util-from-parse5@npm:7.1.2" - dependencies: - "@types/hast": "npm:^2.0.0" - "@types/unist": "npm:^2.0.0" - hastscript: "npm:^7.0.0" - property-information: "npm:^6.0.0" - vfile: "npm:^5.0.0" - vfile-location: "npm:^4.0.0" - web-namespaces: "npm:^2.0.0" - checksum: 10/7a90a16430a1482ed1be5c2f8b182e8b12aee8834781245b101700b5a04cea8b569cf40ef08214e1eb333249432e861b17e6fe46d0447b5281827c8798e86f1a - languageName: node - linkType: hard - "hast-util-from-parse5@npm:^8.0.0": version: 8.0.1 resolution: "hast-util-from-parse5@npm:8.0.1" @@ -34511,25 +34492,6 @@ __metadata: languageName: node linkType: hard -"hast-util-raw@npm:^7.0.0": - version: 7.2.3 - resolution: "hast-util-raw@npm:7.2.3" - dependencies: - "@types/hast": "npm:^2.0.0" - "@types/parse5": "npm:^6.0.0" - hast-util-from-parse5: "npm:^7.0.0" - hast-util-to-parse5: "npm:^7.0.0" - html-void-elements: "npm:^2.0.0" - parse5: "npm:^6.0.0" - unist-util-position: "npm:^4.0.0" - unist-util-visit: "npm:^4.0.0" - vfile: "npm:^5.0.0" - web-namespaces: "npm:^2.0.0" - zwitch: "npm:^2.0.0" - checksum: 10/fe39d4b9e68de7131ec61e9abe887cc0579dc7491f738735150c6021565fc998e37c9d096e97fc35c769e986e04b721d4724835ee82fcc22076d778acf6c4832 - languageName: node - linkType: hard - "hast-util-raw@npm:^9.0.0": version: 9.0.2 resolution: "hast-util-raw@npm:9.0.2" @@ -34551,12 +34513,14 @@ __metadata: languageName: node linkType: hard -"hast-util-sanitize@npm:^4.0.0": - version: 4.1.0 - resolution: "hast-util-sanitize@npm:4.1.0" +"hast-util-sanitize@npm:^5.0.0": + version: 5.0.1 + resolution: "hast-util-sanitize@npm:5.0.1" dependencies: - "@types/hast": "npm:^2.0.0" - checksum: 10/8258ba32be9e57e871f894d3c6b3187dd98e0682bf1382cd1306c20045cd5dc209589919817dc079803d9a259b420d9cd88771535088c9fe0eea122028c348eb + "@types/hast": "npm:^3.0.0" + "@ungap/structured-clone": "npm:^1.2.0" + unist-util-position: "npm:^5.0.0" + checksum: 10/bdffc06f587e79f25048dcf60da6731d5a91b057190ef59ce6d3b72501855b6ae7b79e44ff9d68801c2c5b11de9e4834df90a6ba658eafa3a7c6ba06d6d0c19e languageName: node linkType: hard @@ -34584,22 +34548,23 @@ __metadata: languageName: node linkType: hard -"hast-util-to-html@npm:^8.0.0": - version: 8.0.4 - resolution: "hast-util-to-html@npm:8.0.4" +"hast-util-to-html@npm:^9.0.0": + version: 9.0.0 + resolution: "hast-util-to-html@npm:9.0.0" dependencies: - "@types/hast": "npm:^2.0.0" - "@types/unist": "npm:^2.0.0" + "@types/hast": "npm:^3.0.0" + "@types/unist": "npm:^3.0.0" ccount: "npm:^2.0.0" comma-separated-tokens: "npm:^2.0.0" - hast-util-raw: "npm:^7.0.0" - hast-util-whitespace: "npm:^2.0.0" - html-void-elements: "npm:^2.0.0" + hast-util-raw: "npm:^9.0.0" + hast-util-whitespace: "npm:^3.0.0" + html-void-elements: "npm:^3.0.0" + mdast-util-to-hast: "npm:^13.0.0" property-information: "npm:^6.0.0" space-separated-tokens: "npm:^2.0.0" stringify-entities: "npm:^4.0.0" zwitch: "npm:^2.0.4" - checksum: 10/cb37233a21dae417957b4c13aadb577d98fb81dd0050c6807bfc8afdb892880570a904cd1c6b18e4717c7169face2a60d58b34156ef80c82fa7dbeaebe4c2427 + checksum: 10/4bfa78b681135b9303743b34d7139328ff5dc412a1f6bd372e83192413fd86a5d7e8d55eab4eeb2cd561878218eec07a57df1f92cf0f3272756830738611708a languageName: node linkType: hard @@ -34626,20 +34591,6 @@ __metadata: languageName: node linkType: hard -"hast-util-to-parse5@npm:^7.0.0": - version: 7.1.0 - resolution: "hast-util-to-parse5@npm:7.1.0" - dependencies: - "@types/hast": "npm:^2.0.0" - comma-separated-tokens: "npm:^2.0.0" - property-information: "npm:^6.0.0" - space-separated-tokens: "npm:^2.0.0" - web-namespaces: "npm:^2.0.0" - zwitch: "npm:^2.0.0" - checksum: 10/695539881431f9713ca4a0be7d06bf3e57ae4d9f930eccba371534c50cff11855d345f8ec30099d04482637ad82e3c70d480269bfa4c109f37993536e8ea690d - languageName: node - linkType: hard - "hast-util-to-parse5@npm:^8.0.0": version: 8.0.0 resolution: "hast-util-to-parse5@npm:8.0.0" @@ -34942,13 +34893,6 @@ __metadata: languageName: node linkType: hard -"html-void-elements@npm:^2.0.0": - version: 2.0.1 - resolution: "html-void-elements@npm:2.0.1" - checksum: 10/06d41f13b9d5d6e0f39861c4bec9a9196fa4906d56cd5cf6cf54ad2e52a85bf960cca2bf9600026bde16c8331db171bedba5e5a35e2e43630c8f1d497b2fb658 - languageName: node - linkType: hard - "html-void-elements@npm:^3.0.0": version: 3.0.0 resolution: "html-void-elements@npm:3.0.0" @@ -39649,16 +39593,6 @@ __metadata: languageName: node linkType: hard -"mdast-util-phrasing@npm:^3.0.0": - version: 3.0.1 - resolution: "mdast-util-phrasing@npm:3.0.1" - dependencies: - "@types/mdast": "npm:^3.0.0" - unist-util-is: "npm:^5.0.0" - checksum: 10/c5b616d9b1eb76a6b351d195d94318494722525a12a89d9c8a3b091af7db3dd1fc55d294f9d29266d8159a8267b0df4a7a133bda8a3909d5331c383e1e1ff328 - languageName: node - linkType: hard - "mdast-util-phrasing@npm:^4.0.0": version: 4.1.0 resolution: "mdast-util-phrasing@npm:4.1.0" @@ -39669,7 +39603,7 @@ __metadata: languageName: node linkType: hard -"mdast-util-to-hast@npm:^12.0.0, mdast-util-to-hast@npm:^12.1.0": +"mdast-util-to-hast@npm:^12.1.0": version: 12.3.0 resolution: "mdast-util-to-hast@npm:12.3.0" dependencies: @@ -39702,22 +39636,6 @@ __metadata: languageName: node linkType: hard -"mdast-util-to-markdown@npm:^1.0.0": - version: 1.5.0 - resolution: "mdast-util-to-markdown@npm:1.5.0" - dependencies: - "@types/mdast": "npm:^3.0.0" - "@types/unist": "npm:^2.0.0" - longest-streak: "npm:^3.0.0" - mdast-util-phrasing: "npm:^3.0.0" - mdast-util-to-string: "npm:^3.0.0" - micromark-util-decode-string: "npm:^1.0.0" - unist-util-visit: "npm:^4.0.0" - zwitch: "npm:^2.0.0" - checksum: 10/713f674588a01969a2ce524a69985bd57e507377eea2c4ba69800fb305414468b30144ae9b837fbdde8c609877673140e4f56f6cabe9e0e2bc1487291e3c5144 - languageName: node - linkType: hard - "mdast-util-to-markdown@npm:^2.0.0": version: 2.1.0 resolution: "mdast-util-to-markdown@npm:2.1.0" @@ -39741,7 +39659,7 @@ __metadata: languageName: node linkType: hard -"mdast-util-to-string@npm:^3.0.0, mdast-util-to-string@npm:^3.1.0": +"mdast-util-to-string@npm:^3.1.0": version: 3.2.0 resolution: "mdast-util-to-string@npm:3.2.0" dependencies: @@ -43836,13 +43754,6 @@ __metadata: languageName: node linkType: hard -"parse5@npm:^6.0.0": - version: 6.0.1 - resolution: "parse5@npm:6.0.1" - checksum: 10/dfb110581f62bd1425725a7c784ae022a24669bd0efc24b58c71fc731c4d868193e2ebd85b74cde2dbb965e4dcf07059b1e651adbec1b3b5267531bd132fdb75 - languageName: node - linkType: hard - "parse5@npm:^7.0.0, parse5@npm:^7.1.2": version: 7.1.2 resolution: "parse5@npm:7.1.2" @@ -47543,16 +47454,16 @@ __metadata: languageName: node linkType: hard -"remark-html@npm:15.0.2": - version: 15.0.2 - resolution: "remark-html@npm:15.0.2" +"remark-html@npm:16.0.1": + version: 16.0.1 + resolution: "remark-html@npm:16.0.1" dependencies: - "@types/mdast": "npm:^3.0.0" - hast-util-sanitize: "npm:^4.0.0" - hast-util-to-html: "npm:^8.0.0" - mdast-util-to-hast: "npm:^12.0.0" - unified: "npm:^10.0.0" - checksum: 10/46c76eb6a3bd25c41ed2535d285c5b676c81c4752b697627596ddcfec4992da02763b9838f47f2a6eb03147b9b8d1e978612a8fd4e57667c05b02a32961dcab3 + "@types/mdast": "npm:^4.0.0" + hast-util-sanitize: "npm:^5.0.0" + hast-util-to-html: "npm:^9.0.0" + mdast-util-to-hast: "npm:^13.0.0" + unified: "npm:^11.0.0" + checksum: 10/eeae58299929d506b770db6e461f57e551f5502f33b6ae64bd770ab3b1d6ece5c7fe45b254636ff12e5bb2006f4e713dfa8084752e0fa627c79e7decea8a91cc languageName: node linkType: hard @@ -47566,18 +47477,7 @@ __metadata: languageName: node linkType: hard -"remark-parse@npm:10.0.2, remark-parse@npm:^10.0.0": - version: 10.0.2 - resolution: "remark-parse@npm:10.0.2" - dependencies: - "@types/mdast": "npm:^3.0.0" - mdast-util-from-markdown: "npm:^1.0.0" - unified: "npm:^10.0.0" - checksum: 10/184f48956734a58a7e157d83233e532ea289697f5ecebd1fb082cce79e6d9f5b1d3da72462356b2b3b5843643cee890280ffe3d21c9d4ad2d7d5e20bb5de7f14 - languageName: node - linkType: hard - -"remark-parse@npm:^11.0.0": +"remark-parse@npm:11.0.0, remark-parse@npm:^11.0.0": version: 11.0.0 resolution: "remark-parse@npm:11.0.0" dependencies: @@ -47589,6 +47489,17 @@ __metadata: languageName: node linkType: hard +"remark-parse@npm:^10.0.0": + version: 10.0.2 + resolution: "remark-parse@npm:10.0.2" + dependencies: + "@types/mdast": "npm:^3.0.0" + mdast-util-from-markdown: "npm:^1.0.0" + unified: "npm:^10.0.0" + checksum: 10/184f48956734a58a7e157d83233e532ea289697f5ecebd1fb082cce79e6d9f5b1d3da72462356b2b3b5843643cee890280ffe3d21c9d4ad2d7d5e20bb5de7f14 + languageName: node + linkType: hard + "remark-rehype@npm:^10.0.0": version: 10.1.0 resolution: "remark-rehype@npm:10.1.0" @@ -47625,17 +47536,6 @@ __metadata: languageName: node linkType: hard -"remark-stringify@npm:^10.0.0": - version: 10.0.3 - resolution: "remark-stringify@npm:10.0.3" - dependencies: - "@types/mdast": "npm:^3.0.0" - mdast-util-to-markdown: "npm:^1.0.0" - unified: "npm:^10.0.0" - checksum: 10/9fc5545b7cfd14f77196742e474db1a3863d5435324b381ae2097730870c74338feda99c12b172edadf9fe478ce96a3b9e6abc29cb42774da279c86664e5d869 - languageName: node - linkType: hard - "remark-stringify@npm:^11.0.0": version: 11.0.0 resolution: "remark-stringify@npm:11.0.0" @@ -47647,15 +47547,15 @@ __metadata: languageName: node linkType: hard -"remark@npm:14.0.3": - version: 14.0.3 - resolution: "remark@npm:14.0.3" +"remark@npm:15.0.1": + version: 15.0.1 + resolution: "remark@npm:15.0.1" dependencies: - "@types/mdast": "npm:^3.0.0" - remark-parse: "npm:^10.0.0" - remark-stringify: "npm:^10.0.0" - unified: "npm:^10.0.0" - checksum: 10/425ed19401aa09d9d5b26f19c173e63a05b57d047393bb698898a09de4ec99a840a2405e28bd1410ccb124368fdd9a825e850a531f524dbc2e52ae005e026a4f + "@types/mdast": "npm:^4.0.0" + remark-parse: "npm:^11.0.0" + remark-stringify: "npm:^11.0.0" + unified: "npm:^11.0.0" + checksum: 10/671eae3a4482377373cbbae956e2dbc0f8c40df1c3e5e2e1e82efa248b310ef5989340e1a5a8ebe94ff14fcf9c72612f40a29d002ffc0a465e3d6d50de973839 languageName: node linkType: hard @@ -53104,33 +53004,33 @@ __metadata: languageName: node linkType: hard -"unified@npm:10.1.2, unified@npm:^10.0.0": - version: 10.1.2 - resolution: "unified@npm:10.1.2" +"unified@npm:11.0.4, unified@npm:^11.0.0, unified@npm:^11.0.3, unified@npm:^11.0.4": + version: 11.0.4 + resolution: "unified@npm:11.0.4" dependencies: - "@types/unist": "npm:^2.0.0" + "@types/unist": "npm:^3.0.0" bail: "npm:^2.0.0" + devlop: "npm:^1.0.0" extend: "npm:^3.0.0" - is-buffer: "npm:^2.0.0" is-plain-obj: "npm:^4.0.0" trough: "npm:^2.0.0" - vfile: "npm:^5.0.0" - checksum: 10/6cffebcefc3290be26d25a58ba714cda943142782baf320fddf374ca3a319bdaabb006f96df4be17b8b367f5e6f6e113b1027c52ef66154846a7a110550f6688 + vfile: "npm:^6.0.0" + checksum: 10/425f0618d6f5e5d2ae64ec206cb6fd11f4b86fec7a785cfe2fc3a334191a91bf837eecb32858c70bcc2c08e76ce9d6a38457319f70f77399c8f496fb8e486817 languageName: node linkType: hard -"unified@npm:^11.0.0, unified@npm:^11.0.3, unified@npm:^11.0.4": - version: 11.0.4 - resolution: "unified@npm:11.0.4" +"unified@npm:^10.0.0": + version: 10.1.2 + resolution: "unified@npm:10.1.2" dependencies: - "@types/unist": "npm:^3.0.0" + "@types/unist": "npm:^2.0.0" bail: "npm:^2.0.0" - devlop: "npm:^1.0.0" extend: "npm:^3.0.0" + is-buffer: "npm:^2.0.0" is-plain-obj: "npm:^4.0.0" trough: "npm:^2.0.0" - vfile: "npm:^6.0.0" - checksum: 10/425f0618d6f5e5d2ae64ec206cb6fd11f4b86fec7a785cfe2fc3a334191a91bf837eecb32858c70bcc2c08e76ce9d6a38457319f70f77399c8f496fb8e486817 + vfile: "npm:^5.0.0" + checksum: 10/6cffebcefc3290be26d25a58ba714cda943142782baf320fddf374ca3a319bdaabb006f96df4be17b8b367f5e6f6e113b1027c52ef66154846a7a110550f6688 languageName: node linkType: hard @@ -54039,16 +53939,6 @@ __metadata: languageName: node linkType: hard -"vfile-location@npm:^4.0.0": - version: 4.1.0 - resolution: "vfile-location@npm:4.1.0" - dependencies: - "@types/unist": "npm:^2.0.0" - vfile: "npm:^5.0.0" - checksum: 10/c894e8e5224170d1f85288f4a1d1ebcee0780823ea2b49d881648ab360ebf01b37ecb09b1c4439a75f9a51f31a9f9742cd045e987763e367c352a1ef7c50d446 - languageName: node - linkType: hard - "vfile-location@npm:^5.0.0": version: 5.0.2 resolution: "vfile-location@npm:5.0.2" From cbdfb95bcbb06e1fd6b9aeff9e5140429491c8be Mon Sep 17 00:00:00 2001 From: Julien Genestoux Date: Fri, 29 Mar 2024 14:46:41 -0400 Subject: [PATCH 23/35] fix(locksmith) fixing export (#13542) fixing export --- locksmith/src/graphql/datasource/keysByQuery.ts | 9 +++++++++ locksmith/src/worker/tasks/exportKeysJob.ts | 7 ++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/locksmith/src/graphql/datasource/keysByQuery.ts b/locksmith/src/graphql/datasource/keysByQuery.ts index 667262eced7..5b92d64f12f 100644 --- a/locksmith/src/graphql/datasource/keysByQuery.ts +++ b/locksmith/src/graphql/datasource/keysByQuery.ts @@ -21,6 +21,7 @@ interface KeyByFilterProps { tokenId?: number owners?: string[] transactionHash?: string[] + after?: string } const locksByFilter = async ({ @@ -33,6 +34,7 @@ const locksByFilter = async ({ addresses = [], owners = [], transactionHash = [], + after = '', }: KeyByFilterProps): Promise => { const subgraph = new SubgraphService() @@ -44,6 +46,10 @@ const locksByFilter = async ({ tokenId, } + if (after) { + keyFilter.tokenId_gt = after + } + if (filter === 'expired') { keyFilter.expiration_lt = expireTimestamp // all expired keys } else { @@ -87,6 +93,7 @@ interface KeyGetProps { page: number expiration: KeyFilter max: number + after: string } network: number } @@ -100,6 +107,7 @@ export const keysByQuery = async ({ expiration = 'active', page = 0, max = 10000, + after = '', }, }: KeyGetProps): Promise => { try { @@ -134,6 +142,7 @@ export const keysByQuery = async ({ expireTimestamp, filter: expiration, transactionHash, + after, }) } diff --git a/locksmith/src/worker/tasks/exportKeysJob.ts b/locksmith/src/worker/tasks/exportKeysJob.ts index a72cca015e7..f83f0a92d16 100644 --- a/locksmith/src/worker/tasks/exportKeysJob.ts +++ b/locksmith/src/worker/tasks/exportKeysJob.ts @@ -15,7 +15,8 @@ export const ExportKeysJobPayload = z.object({ approval: z.string(), loggedInUserAddress: z.string(), }) - +// TODO: add progress status +// For this we would probably need to add a new model in which we would store the progress! const exportKeysJob: Task = async (payload) => { const parsed = await ExportKeysJobPayload.parse(payload) @@ -28,11 +29,11 @@ const exportKeysJob: Task = async (payload) => { while (page < totalPages) { const filters = { query: parsed.query, - page, filterKey: parsed.filterKey, expiration: parsed.expiration, approval: parsed.approval, max, + after: allKeys[allKeys.length - 1]?.token, } const { keys, total } = await keysOperations.getKeysWithMetadata({ @@ -42,7 +43,7 @@ const exportKeysJob: Task = async (payload) => { loggedInUserAddress: parsed.loggedInUserAddress, }) - allKeys = [...allKeys, ...keys] + allKeys = [...allKeys, ...keys].sort((k, l) => k.token - l.token) totalFetched += keys.length page++ From fa63c3df1025ec297013331fc54d4518f01ec4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renaud?= Date: Fri, 29 Mar 2024 20:00:10 +0100 Subject: [PATCH 24/35] feat(networks): add support for Base sepolia (#13529) * add basic network file * readme typo * add verification * remove unused param * unlock deploymeny * etherscan api key * update base scan api key again * correct unlock address * use actual proxy address * add subgraph * update readme * add multisig * add provider * Update packages/networks/src/networks/base-sepolia.ts * use unlock provider --------- Co-authored-by: Julien Genestoux --- governance/.openzeppelin/unknown-84532.json | 280 +++++++++++++ governance/README.md | 26 +- packages/hardhat-helpers/src/etherscan.js | 10 +- .../networks/src/networks/base-sepolia.ts | 75 ++++ packages/networks/src/networks/index.ts | 1 + provider/src/supportedNetworks.ts | 2 +- provider/src/types.ts | 2 +- subgraph/introspection.json | 370 +++++++++++++++++- 8 files changed, 749 insertions(+), 17 deletions(-) create mode 100644 governance/.openzeppelin/unknown-84532.json create mode 100644 packages/networks/src/networks/base-sepolia.ts diff --git a/governance/.openzeppelin/unknown-84532.json b/governance/.openzeppelin/unknown-84532.json new file mode 100644 index 00000000000..f0b6292b426 --- /dev/null +++ b/governance/.openzeppelin/unknown-84532.json @@ -0,0 +1,280 @@ +{ + "manifestVersion": "3.2", + "proxies": [ + { + "address": "0x259813B665C8f6074391028ef782e27B65840d89", + "txHash": "0x00676bcbd95a7de923bb7ada6008a6863a05d9602721c9d355a82274a30be36f", + "kind": "transparent" + } + ], + "impls": { + "c6d805c82f3f300da2425695b00fbf12dfe20f45dc8ffdf35ed30d444ccd6d60": { + "address": "0xf98D7ADA874D53a75BbDfB05D2A96C1525d426A7", + "txHash": "0x91d7ba08318d557ee0d725745322ee818f2199c91bd694a64171b296d739320e", + "layout": { + "solcVersion": "0.8.21", + "storage": [ + { + "label": "initialized", + "offset": 0, + "slot": "0", + "type": "t_bool", + "contract": "UnlockInitializable", + "src": "contracts/past-versions/UnlockV13.sol:1327" + }, + { + "label": "initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "UnlockInitializable", + "src": "contracts/past-versions/UnlockV13.sol:1332" + }, + { + "label": "______gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "UnlockContextUpgradeable", + "src": "contracts/past-versions/UnlockV13.sol:1406" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "UnlockOwnable", + "src": "contracts/past-versions/UnlockV13.sol:1435" + }, + { + "label": "______gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)50_storage", + "contract": "UnlockOwnable", + "src": "contracts/past-versions/UnlockV13.sol:1501" + }, + { + "label": "grossNetworkProduct", + "offset": 0, + "slot": "102", + "type": "t_uint256", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2786" + }, + { + "label": "totalDiscountGranted", + "offset": 0, + "slot": "103", + "type": "t_uint256", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2788" + }, + { + "label": "locks", + "offset": 0, + "slot": "104", + "type": "t_mapping(t_address,t_struct(LockBalances)3109_storage)", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2791" + }, + { + "label": "globalBaseTokenURI", + "offset": 0, + "slot": "105", + "type": "t_string_storage", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2795" + }, + { + "label": "globalTokenSymbol", + "offset": 0, + "slot": "106", + "type": "t_string_storage", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2799" + }, + { + "label": "publicLockAddress", + "offset": 0, + "slot": "107", + "type": "t_address", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2802" + }, + { + "label": "uniswapOracles", + "offset": 0, + "slot": "108", + "type": "t_mapping(t_address,t_contract(IUniswapOracleV3)757)", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2806" + }, + { + "label": "weth", + "offset": 0, + "slot": "109", + "type": "t_address", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2809" + }, + { + "label": "udt", + "offset": 0, + "slot": "110", + "type": "t_address", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2812" + }, + { + "label": "estimatedGasForPurchase", + "offset": 0, + "slot": "111", + "type": "t_uint256", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2815" + }, + { + "label": "chainId", + "offset": 0, + "slot": "112", + "type": "t_uint256", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2818" + }, + { + "label": "proxyAdminAddress", + "offset": 0, + "slot": "113", + "type": "t_address", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2821" + }, + { + "label": "proxyAdmin", + "offset": 0, + "slot": "114", + "type": "t_contract(ProxyAdmin)3095", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2822" + }, + { + "label": "_publicLockVersions", + "offset": 0, + "slot": "115", + "type": "t_mapping(t_address,t_uint16)", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2825" + }, + { + "label": "_publicLockImpls", + "offset": 0, + "slot": "116", + "type": "t_mapping(t_uint16,t_address)", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2826" + }, + { + "label": "publicLockLatestVersion", + "offset": 0, + "slot": "117", + "type": "t_uint16", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2827" + }, + { + "label": "protocolFee", + "offset": 0, + "slot": "118", + "type": "t_uint256", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2830" + }, + { + "label": "swapBurnerAddress", + "offset": 0, + "slot": "119", + "type": "t_address", + "contract": "Unlock", + "src": "contracts/past-versions/UnlockV13.sol:2833" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IUniswapOracleV3)757": { + "label": "contract IUniswapOracleV3", + "numberOfBytes": "20" + }, + "t_contract(ProxyAdmin)3095": { + "label": "contract ProxyAdmin", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_contract(IUniswapOracleV3)757)": { + "label": "mapping(address => contract IUniswapOracleV3)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_struct(LockBalances)3109_storage)": { + "label": "mapping(address => struct Unlock.LockBalances)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint16)": { + "label": "mapping(address => uint16)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint16,t_address)": { + "label": "mapping(uint16 => address)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(LockBalances)3109_storage": { + "label": "struct Unlock.LockBalances", + "members": [ + { + "label": "deployed", + "type": "t_bool", + "offset": 0, + "slot": "0" + }, + { + "label": "totalSales", + "type": "t_uint256", + "offset": 0, + "slot": "1" + }, + { + "label": "yieldedDiscountTokens", + "type": "t_uint256", + "offset": 0, + "slot": "2" + } + ], + "numberOfBytes": "96" + }, + "t_uint16": { + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + } + }, + "namespaces": {} + } + } + } +} diff --git a/governance/README.md b/governance/README.md index 201fe432990..aa8f451c74c 100644 --- a/governance/README.md +++ b/governance/README.md @@ -23,7 +23,7 @@ yarn workspace @unlock-protocol/networks build ## Add block explorer verification -- add a `` key to the `apiKey` object in [`packages/hardhat-helpers/etherscan.js`](/packages/hardhat-helpers/src/etherscan.js) +- add a `` key to the `apiKey` object in [`packages/hardhat-helpers/src/etherscan.js`](/packages/hardhat-helpers/src/etherscan.js) - optionally can add support for env variable When you are done, rebuild the helpers package with @@ -74,9 +74,25 @@ yarn hardhat set:unlock-config ### Deploy the subgraph -First you will need to create a new graph on [The Graph](https://thegraph.com) studio. +1. First you will need to create a new graph on [The Graph studio](https://thegraph.com/studio). -Then the following commands +2. In the `packages/networks/src/.ts` config file, fill the `subgraph` object as follow: + +```js +subgraph: { + endpoint: '<>', // this is given to you by the graph after deploying + networkName: 'base-sepolia', // the graph name of the network see https://thegraph.com/docs/en/developing/supported-networks/ + studioName: 'unlock-protocol-', // the name of the graph + }, +``` + +3. Rebuild the networks package + +``` +yarn workspace @unlock-protocol/networks build +``` + +4. Deploy the graph by using the following commands ```shell # got to the subgraph folder @@ -85,10 +101,10 @@ cd subgraph # create the subgraph.yaml and generate the files yarn build -yarn deploy:studio +yarn deploy ``` -The graph will now sync. In the `packages/networks/src/.ts` config file, fill the `subgraph` object with a name in `studioEndpoint` and the API url in `endpoint`. +The graph is now deployed. Add the URL that is shown to the network file. ### Verify contracts diff --git a/packages/hardhat-helpers/src/etherscan.js b/packages/hardhat-helpers/src/etherscan.js index 7697f69f144..3b97dc97765 100644 --- a/packages/hardhat-helpers/src/etherscan.js +++ b/packages/hardhat-helpers/src/etherscan.js @@ -16,8 +16,8 @@ const etherscan = { polygonMumbai: 'W9TVEYKW2CDTQ94T3A2V93IX6U3IHQN5Y3', avalanche: 'N4AF8AYN8PXY2MFPUT8PAFSZNVJX5Q814X', celo: '6KBKUFYV3NQR4Y1BQN3Q34S2U7NTZBBPQZ', - baseGoerli: 'YourApiKeyToken', base: 'F9E5R4E8HIJQZMRE9U9IZMP7NVZ2IAXNB8', + baseSepolia: 'F9E5R4E8HIJQZMRE9U9IZMP7NVZ2IAXNB8', linea: 'S66J314Q7PICPB4RP2G117KDFQRBEUYIFX', polygonZkEVM: '8H4ZB9SQBMQ7WA1TCIXFQVCHTVX8DXTY9Y', scroll: 'BZEXNPN6KKKJQ8VIMNXZDZNEX7QQZWZQ3P', @@ -33,11 +33,11 @@ const etherscan = { }, }, { - network: 'baseGoerli', - chainId: 84531, + network: 'baseSepolia', + chainId: 84532, urls: { - apiURL: 'https://api-goerli.basescan.org/api', - browserURL: 'https://goerli.basescan.org/', + apiURL: 'https://api-sepolia.basescan.org/api', + browserURL: 'https://sepolia.basescan.org/', }, }, { diff --git a/packages/networks/src/networks/base-sepolia.ts b/packages/networks/src/networks/base-sepolia.ts new file mode 100644 index 00000000000..d2d6318ce6c --- /dev/null +++ b/packages/networks/src/networks/base-sepolia.ts @@ -0,0 +1,75 @@ +import { NetworkConfig } from '@unlock-protocol/types' + +export const baseSepolia: NetworkConfig = { + blockScan: { + url: (address: string) => `https://blockscan.com/address/${address}`, + }, + chain: 'base-sepolia', + description: 'A public testnet for Base.', + explorer: { + name: 'Base Sepolia Etherscan', + urls: { + address: (address: string) => + `https://sepolia.basescan.org/address/${address}`, + base: `https://sepolia.basescan.org/`, + token: (address: string, holder: string) => + `https://sepolia.basescan.org/token/${address}?a=${holder}`, + transaction: (hash: string) => `https://sepolia.basescan.org/tx/${hash}`, + }, + }, + featured: false, + fullySubsidizedGas: true, + hooks: {}, + id: 84532, + isTestNetwork: true, + keyManagerAddress: '', + maxFreeClaimCost: 1000, + multisig: '0x68F2c5D9009dc4d553f814D689102a53B2b349Cc', + name: 'Base Sepolia', + nativeCurrency: { + coingecko: 'ethereum', + decimals: 18, + name: 'ETH', + symbol: 'ETH', + }, + + previousDeploys: [], + + provider: 'https://rpc.unlock-protocol.com/84532', + + publicLockVersionToDeploy: 14, + + publicProvider: 'https://sepolia.base.org', + + startBlock: 7889118, + subgraph: { + endpoint: + 'https://api.studio.thegraph.com/query/65299/unlock-protocol-base-sepolia/version/latest', + networkName: 'base-sepolia', + studioName: 'unlock-protocol-base-sepolia', + }, + swapPurchaser: '', + tokens: [ + { + address: '0x4200000000000000000000000000000000000006', + decimals: 18, + featured: true, + mainnetAddress: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + name: 'Wrapped Ether', + symbol: 'WETH', + }, + { + address: '0x036CbD53842c5426634e7929541eC2318f3dCF7e', + decimals: 6, + featured: true, + name: 'USDC', + symbol: 'USDC', + }, + ], + unlockAddress: '0x259813B665C8f6074391028ef782e27B65840d89', + unlockDaoToken: { + address: '', + }, +} + +export default baseSepolia diff --git a/packages/networks/src/networks/index.ts b/packages/networks/src/networks/index.ts index 3208f9d0dd4..40ff37960be 100644 --- a/packages/networks/src/networks/index.ts +++ b/packages/networks/src/networks/index.ts @@ -14,3 +14,4 @@ export * from './sepolia' export * from './zkevm' export * from './scroll' export * from './zksync' +export * from './base-sepolia' diff --git a/provider/src/supportedNetworks.ts b/provider/src/supportedNetworks.ts index 89bbb754510..336ab32c102 100644 --- a/provider/src/supportedNetworks.ts +++ b/provider/src/supportedNetworks.ts @@ -15,7 +15,7 @@ const supportedNetworks = (env: Env, networkId: string): string | undefined => { '42220': env.CELO_PROVIDER, '43114': env.AVALANCHE_PROVIDER, '80001': env.MUMBAI_PROVIDER, - '84531': env.BASE_GOERLI_PROVIDER, + '84532': env.BASE_SEPOLIA_PROVIDER, '8453': env.BASE_PROVIDER, '11155111': env.SEPOLIA_PROVIDER, '59144': env.LINEA_PROVIDER, diff --git a/provider/src/types.ts b/provider/src/types.ts index 3635dd482d4..fe60d1e410e 100644 --- a/provider/src/types.ts +++ b/provider/src/types.ts @@ -11,7 +11,7 @@ export interface Env { OPTIMISM_PROVIDER: string POLYGON_PROVIDER: string ZKSYNC_PROVIDER: string - BASE_GOERLI_PROVIDER: string + BASE_SEPOLIA_PROVIDER: string BASE_PROVIDER: string SEPOLIA_PROVIDER: string LINEA_PROVIDER: string diff --git a/subgraph/introspection.json b/subgraph/introspection.json index 5456443f286..dfbf9ad0f86 100644 --- a/subgraph/introspection.json +++ b/subgraph/introspection.json @@ -1834,6 +1834,12 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "lock__numberOfCancelReceipts", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "tokenId", "description": null, @@ -4589,6 +4595,102 @@ }, "defaultValue": null }, + { + "name": "numberOfCancelReceipts", + "description": null, + "type": { + "kind": "SCALAR", + "name": "BigInt", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "numberOfCancelReceipts_not", + "description": null, + "type": { + "kind": "SCALAR", + "name": "BigInt", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "numberOfCancelReceipts_gt", + "description": null, + "type": { + "kind": "SCALAR", + "name": "BigInt", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "numberOfCancelReceipts_lt", + "description": null, + "type": { + "kind": "SCALAR", + "name": "BigInt", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "numberOfCancelReceipts_gte", + "description": null, + "type": { + "kind": "SCALAR", + "name": "BigInt", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "numberOfCancelReceipts_lte", + "description": null, + "type": { + "kind": "SCALAR", + "name": "BigInt", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "numberOfCancelReceipts_in", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "BigInt", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "numberOfCancelReceipts_not_in", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "BigInt", + "ofType": null + } + } + }, + "defaultValue": null + }, { "name": "referrerFees_", "description": null, @@ -4752,6 +4854,12 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "numberOfCancelReceipts", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "referrerFees", "description": null, @@ -6661,6 +6769,222 @@ }, "defaultValue": null }, + { + "name": "recipient", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "recipient_not", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "recipient_gt", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "recipient_lt", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "recipient_gte", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "recipient_lte", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "recipient_in", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "recipient_not_in", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "recipient_contains", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "recipient_contains_nocase", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "recipient_not_contains", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "recipient_not_contains_nocase", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "recipient_starts_with", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "recipient_starts_with_nocase", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "recipient_not_starts_with", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "recipient_not_starts_with_nocase", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "recipient_ends_with", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "recipient_ends_with_nocase", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "recipient_not_ends_with", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "recipient_not_ends_with_nocase", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, { "name": "lockAddress", "description": null, @@ -7456,6 +7780,12 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "recipient", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "lockAddress", "description": null, @@ -8268,6 +8598,12 @@ "description": null, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "lock__numberOfCancelReceipts", + "description": null, + "isDeprecated": false, + "deprecationReason": null } ], "possibleTypes": null @@ -9366,6 +9702,16 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "SCALAR", + "name": "Timestamp", + "description": "A string representation of microseconds UNIX timestamp (16 digits)\n", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "UnlockDailyData", @@ -10972,7 +11318,11 @@ { "name": "skip", "description": null, - "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], + "locations": [ + "FIELD", + "FRAGMENT_SPREAD", + "INLINE_FRAGMENT" + ], "args": [ { "name": "if", @@ -10993,7 +11343,11 @@ { "name": "include", "description": null, - "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], + "locations": [ + "FIELD", + "FRAGMENT_SPREAD", + "INLINE_FRAGMENT" + ], "args": [ { "name": "if", @@ -11014,13 +11368,17 @@ { "name": "entity", "description": "Marks the GraphQL type as indexable entity. Each type that should be an entity is required to be annotated with this directive.", - "locations": ["OBJECT"], + "locations": [ + "OBJECT" + ], "args": [] }, { "name": "subgraphId", "description": "Defined a Subgraph ID for an object type", - "locations": ["OBJECT"], + "locations": [ + "OBJECT" + ], "args": [ { "name": "id", @@ -11041,7 +11399,9 @@ { "name": "derivedFrom", "description": "creates a virtual field on the entity that may be queried but cannot be set manually through the mappings API.", - "locations": ["FIELD_DEFINITION"], + "locations": [ + "FIELD_DEFINITION" + ], "args": [ { "name": "field", From 0f7ec3651a5111c2a6f565d64a1496f6aec542e2 Mon Sep 17 00:00:00 2001 From: Julien Genestoux Date: Fri, 29 Mar 2024 21:00:26 -0400 Subject: [PATCH 25/35] cleanup: removed goerli (#13540) * removed goerli * removed stale include * linting * using op instead of goerli in tests * fixing tests --- locksmith/.op.env.production | 6 - .../v2/certificateController.test.ts | 2 +- .../v2/customEmailController.test.ts | 2 +- .../v2/receiptBaseController.test.ts | 2 +- .../controllers/v2/receiptController.test.ts | 2 +- .../controllers/v2/rsvpController.test.ts | 4 +- .../controllers/v2/ticketsController.test.ts | 2 +- .../operations/lockSettingsOperations.test.ts | 4 +- .../operations/pricingOperations.test.ts | 2 +- .../operations/wedlocksOperations.test.ts | 4 +- .../utils/certificationHelper.test.ts | 2 +- locksmith/__tests__/utils/pricing.test.ts | 2 +- .../src/controllers/v2/contractsController.ts | 4 +- packages/hardhat-helpers/src/etherscan.js | 3 +- packages/networks/src/networks/goerli.ts | 131 ------------------ packages/networks/src/networks/index.ts | 1 - .../src/__tests__/web3Service.test.js | 26 +++- packages/unlock-js/src/web3Service.ts | 2 + provider/src/supportedNetworks.ts | 1 - provider/src/types.ts | 1 - .../scripts/upgrade/submitLockVersion.js | 2 +- .../locks/Create/elements/BalanceWarning.tsx | 5 - unlock-app/src/config/app.ts | 1 - 23 files changed, 42 insertions(+), 169 deletions(-) delete mode 100644 packages/networks/src/networks/goerli.ts diff --git a/locksmith/.op.env.production b/locksmith/.op.env.production index 1cbcd841abd..40ec3743c9c 100644 --- a/locksmith/.op.env.production +++ b/locksmith/.op.env.production @@ -14,9 +14,6 @@ ON_HEROKU=true DEFENDER_RELAY_KEY_1=op://secrets/open-zeppelin-relay/ethereum-key DEFENDER_RELAY_SECRET_1=op://secrets/open-zeppelin-relay/ethereum-secret -DEFENDER_RELAY_KEY_5=op://secrets/open-zeppelin-relay/goerli-key -DEFENDER_RELAY_SECRET_5=op://secrets/open-zeppelin-relay/goerli-secret - DEFENDER_RELAY_KEY_10=op://secrets/open-zeppelin-relay/optimism-key DEFENDER_RELAY_SECRET_10=op://secrets/open-zeppelin-relay/optimism-secret @@ -44,9 +41,6 @@ DEFENDER_RELAY_SECRET_43114=op://secrets/open-zeppelin-relay/avalanche-secret DEFENDER_RELAY_KEY_80001=op://secrets/open-zeppelin-relay/mumbai-key DEFENDER_RELAY_SECRET_80001=op://secrets/open-zeppelin-relay/mumbai-secret -DEFENDER_RELAY_KEY_84531=op://secrets/open-zeppelin-relay/base-goerli-key -DEFENDER_RELAY_SECRET_84531=op://secrets/open-zeppelin-relay/base-goerli-secret - DEFENDER_RELAY_KEY_11155111=op://secrets/open-zeppelin-relay/sepolia-key DEFENDER_RELAY_SECRET_11155111=op://secrets/open-zeppelin-relay/sepolia-secret diff --git a/locksmith/__tests__/controllers/v2/certificateController.test.ts b/locksmith/__tests__/controllers/v2/certificateController.test.ts index eb85b2fb800..66ecb0bc575 100644 --- a/locksmith/__tests__/controllers/v2/certificateController.test.ts +++ b/locksmith/__tests__/controllers/v2/certificateController.test.ts @@ -5,7 +5,7 @@ import { vi, describe, expect } from 'vitest' const lockAddress = '0x3F09aD349a693bB62a162ff2ff3e097bD1cE9a8C' const wrongLockAddress = '0x70997970C51812dc3A010C7d01b50e0d17dc79C8' -const network = 5 +const network = 10 const tokenId = 147 const wrongTokenId = '666' const owner = `0x00192fb10df37c9fb26829eb2cc623cd1bf599e8` diff --git a/locksmith/__tests__/controllers/v2/customEmailController.test.ts b/locksmith/__tests__/controllers/v2/customEmailController.test.ts index 3a39cfda31b..89ffb4e30cb 100644 --- a/locksmith/__tests__/controllers/v2/customEmailController.test.ts +++ b/locksmith/__tests__/controllers/v2/customEmailController.test.ts @@ -6,7 +6,7 @@ import { vi } from 'vitest' let lockAddress = '0x62CcB13A72E6F991dE53b9B7AC42885151588Cd2' const template = 'keyMinded' -const network = 5 +const network = 10 const customEmailContent = `Custom Email Content` vi.mock('@unlock-protocol/unlock-js', () => { diff --git a/locksmith/__tests__/controllers/v2/receiptBaseController.test.ts b/locksmith/__tests__/controllers/v2/receiptBaseController.test.ts index eb164a188a8..7c51ab057e5 100644 --- a/locksmith/__tests__/controllers/v2/receiptBaseController.test.ts +++ b/locksmith/__tests__/controllers/v2/receiptBaseController.test.ts @@ -7,7 +7,7 @@ import { vi, expect } from 'vitest' import { SupplierBody } from '../../../src/controllers/v2/receiptBaseController' const lockAddress = '0x62CcB13A72E6F991dE53b9B7AC42885151588Cd2' -const network = 5 +const network = 10 const supplier: z.infer = { supplierName: 'Monkey D. Luffy', diff --git a/locksmith/__tests__/controllers/v2/receiptController.test.ts b/locksmith/__tests__/controllers/v2/receiptController.test.ts index d02db3a97fd..4ab7c840676 100644 --- a/locksmith/__tests__/controllers/v2/receiptController.test.ts +++ b/locksmith/__tests__/controllers/v2/receiptController.test.ts @@ -13,7 +13,7 @@ const lockManager = `0x00192fb10df37c9fb26829eb2cc623cd1bf599e8` const hash = '0x68bd005bd3fba4c467f3289afdb773a797d3f5fe63ca13fd3ec7f16794b3858b' const payer = '0xE91efB608747f8f99CBB7d77020B80ECaEc16E26' -const network = 5 +const network = 10 const purchaser: z.infer = { fullname: 'Mario Rossi', diff --git a/locksmith/__tests__/controllers/v2/rsvpController.test.ts b/locksmith/__tests__/controllers/v2/rsvpController.test.ts index 228fbfb9147..e5a593783e5 100644 --- a/locksmith/__tests__/controllers/v2/rsvpController.test.ts +++ b/locksmith/__tests__/controllers/v2/rsvpController.test.ts @@ -8,7 +8,7 @@ import { vi } from 'vitest' const lockAddress = '0x62CcB13A72E6F991dE53b9B7AC42885151588Cd2' const userAddress = '0x81Dd955D02D337DB81BA6c9C5F6213E647672052' -const network = 5 +const network = 10 // eslint-disable-next-line var mockWeb3Service = { @@ -51,7 +51,7 @@ describe('RSVP', () => { '0x81Dd955D02D337DB81BA6c9C5F6213E647672052' ) expect(response.body.approval).toEqual('pending') - expect(response.body.network).toEqual(5) + expect(response.body.network).toEqual(10) }) it('stores the RSVP in the right table even if there is no wallet', async () => { diff --git a/locksmith/__tests__/controllers/v2/ticketsController.test.ts b/locksmith/__tests__/controllers/v2/ticketsController.test.ts index 4cfe592d89d..ec9495d70c1 100644 --- a/locksmith/__tests__/controllers/v2/ticketsController.test.ts +++ b/locksmith/__tests__/controllers/v2/ticketsController.test.ts @@ -16,7 +16,7 @@ function* keyIdGen() { const lockAddress = '0x3F09aD349a693bB62a162ff2ff3e097bD1cE9a8C' const wrongLockAddress = '0x70997970C51812dc3A010C7d01b50e0d17dc79C8' -const network = 5 +const network = 10 const keyGen = keyIdGen() const tokenId = keyGen.next().value! const wrongTokenId = '666' diff --git a/locksmith/__tests__/operations/lockSettingsOperations.test.ts b/locksmith/__tests__/operations/lockSettingsOperations.test.ts index 5923a8bda49..60f26909d06 100644 --- a/locksmith/__tests__/operations/lockSettingsOperations.test.ts +++ b/locksmith/__tests__/operations/lockSettingsOperations.test.ts @@ -8,7 +8,7 @@ describe('lockSettingsOperations', () => { it('should save and retrieve lock settings with protected data', async () => { expect.assertions(2) const lockAddress = '0x95de5F777A3e283bFf0c47374998E10D8A2183C7' - const network = 5 + const network = 10 await saveSettings({ lockAddress, @@ -30,7 +30,7 @@ describe('lockSettingsOperations', () => { it('correctly save and retrieve lock settings without protected data', async () => { expect.assertions(2) const lockAddress = '0xAaAdEED4c0B861cB36f4cE006a9C90BA2E43fdc2' - const network = 5 + const network = 10 await saveSettings({ lockAddress, diff --git a/locksmith/__tests__/operations/pricingOperations.test.ts b/locksmith/__tests__/operations/pricingOperations.test.ts index f75d119c02b..d9d503e17fe 100644 --- a/locksmith/__tests__/operations/pricingOperations.test.ts +++ b/locksmith/__tests__/operations/pricingOperations.test.ts @@ -8,7 +8,7 @@ const lockAddressErc20 = '0x8D33b257bce083eE0c7504C7635D1840b3858AFD' const lockAddressWithSettings = '0xBd55144A3A30907E080595cabF652Bc079728B2f' const lockAddressWithoutSettings = '0x0dDf835Dc0C326c4A677a807b21Af1d7a521F275' const lockWithEurCurrency = '0x1a1D8b22555521D9E664981Af56438e8aCe2134E' -const network = 5 +const network = 10 const decimals = 18 const currencyContractAddress = '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6' const keyPrice = 40000 diff --git a/locksmith/__tests__/operations/wedlocksOperations.test.ts b/locksmith/__tests__/operations/wedlocksOperations.test.ts index 5336ecf837d..0ced197bf82 100644 --- a/locksmith/__tests__/operations/wedlocksOperations.test.ts +++ b/locksmith/__tests__/operations/wedlocksOperations.test.ts @@ -201,7 +201,7 @@ describe('Wedlocks operations', () => { it('Correctly save and retrieve', async () => { expect.assertions(2) - const network = 5 + const network = 10 const template = 'keyMined' const { loginResponse } = await loginRandomUser(app) @@ -225,7 +225,7 @@ describe('Wedlocks operations', () => { it('Custom content can not be retrieved when is not stored', async () => { expect.assertions(3) - const network = 5 + const network = 10 const template = 'RandomTemplate' const { loginResponse } = await loginRandomUser(app) diff --git a/locksmith/__tests__/utils/certificationHelper.test.ts b/locksmith/__tests__/utils/certificationHelper.test.ts index c138fb19e67..cc7904894fb 100644 --- a/locksmith/__tests__/utils/certificationHelper.test.ts +++ b/locksmith/__tests__/utils/certificationHelper.test.ts @@ -2,7 +2,7 @@ import { it, expect } from 'vitest' import { getCertificateLinkedinShareUrl } from '../../src/utils/certificationHelpers' const lockAddress = '0xDd4356111193f7B28A20b5FC2Dc7750c249E55d2' -const network = 5 +const network = 10 const tokenId = '2' const metadata = { diff --git a/locksmith/__tests__/utils/pricing.test.ts b/locksmith/__tests__/utils/pricing.test.ts index 22de55d6ccf..72ce50517de 100644 --- a/locksmith/__tests__/utils/pricing.test.ts +++ b/locksmith/__tests__/utils/pricing.test.ts @@ -18,7 +18,7 @@ const currencyContractAddress = '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6' const cabinDaoLock = '0x45aCCac0E5C953009cDa713a3b722F87F2907F86' const lockAddress = '0x551c6ecdf819Dc90c5287971072B4651119accD3' -const network = 5 +const network = 10 const keyPrice = 9000000000000000 const gasPrice = 12.4 vi.mock('../../src/operations/lockSettingOperations', () => { diff --git a/locksmith/src/controllers/v2/contractsController.ts b/locksmith/src/controllers/v2/contractsController.ts index c2eac1483d0..1df9c83e334 100644 --- a/locksmith/src/controllers/v2/contractsController.ts +++ b/locksmith/src/controllers/v2/contractsController.ts @@ -20,8 +20,8 @@ const LockContractOptions = z.object({ export class ContractsController { async createLockContract(request: Request, response: Response) { const network = Number(request.params.network) - // Only supported on goerli, polygon, and gnosis. - if (![5, 137, 100].includes(network)) { + // Only supported on polygon, and gnosis. + if (![137, 100].includes(network)) { return response.status(404).send({ message: `Network ${ networks[network]?.name || network diff --git a/packages/hardhat-helpers/src/etherscan.js b/packages/hardhat-helpers/src/etherscan.js index 3b97dc97765..b4be913d342 100644 --- a/packages/hardhat-helpers/src/etherscan.js +++ b/packages/hardhat-helpers/src/etherscan.js @@ -6,7 +6,6 @@ const etherscan = { // xdai requires only placeholder api key xdai: 'api-key', polygon: 'W9TVEYKW2CDTQ94T3A2V93IX6U3IHQN5Y3', - goerli: 'HPSH1KQDPJTNAPU3335G931SC6Y3ZYK3BF', mainnet: 'HPSH1KQDPJTNAPU3335G931SC6Y3ZYK3BF', sepolia: 'HPSH1KQDPJTNAPU3335G931SC6Y3ZYK3BF', bsc: '6YUDRP3TFPQNRGGZQNYAEI1UI17NK96XGK', @@ -68,7 +67,7 @@ const etherscan = { } if (process.env.ETHERSCAN_API_KEY) { - ;['mainnet', 'goerli', 'sepolia'].forEach( + ;['mainnet', 'sepolia'].forEach( // eslint-disable-next-line no-return-assign (netName) => (etherscan.apiKey[netName] = process.env.ETHERSCAN_API_KEY) ) diff --git a/packages/networks/src/networks/goerli.ts b/packages/networks/src/networks/goerli.ts deleted file mode 100644 index 3373daa8843..00000000000 --- a/packages/networks/src/networks/goerli.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { HookType, NetworkConfig } from '@unlock-protocol/types' - -export const goerli: NetworkConfig = { - blockScan: { - url: (address: string) => `https://blockscan.com/address/${address}`, - }, - chain: 'goerli', - description: 'Main Ethereum test network. Do not use for production.', - explorer: { - name: 'Goerli', - urls: { - address: (address) => `https://goerli.etherscan.io/address/${address}`, - base: `https://goerli.etherscan.io/`, - token: (address, holder) => - `https://goerli.etherscan.io/token/${address}?a=${holder}`, - transaction: (hash) => `https://goerli.etherscan.io/tx/${hash}`, - }, - }, - faucet: 'https://goerlifaucet.com/', - featured: false, - fullySubsidizedGas: true, - governanceBridge: { - connext: '0xFCa08024A6D4bCc87275b1E4A1E22B71fAD7f649', - domainId: 1735353714, - modules: { - connextMod: '0xce58DB94DE48A8a9Ea47cBe4376F19724D154DF2', - delayMod: '0x46FdC1d73486E20406D1C6dAcDD22b6599AEA32d', - }, - }, - hooks: { - onKeyPurchaseHook: [ - { - address: '0xCa837900f7DaB40787b608b6738d1B730f1d2759', - id: HookType.PASSWORD, - name: 'Password required', - }, - { - address: '0xDF2A7C8be199C0e9e825750586be7F331F30dC29', - id: HookType.CAPTCHA, - name: 'Captcha', - }, - { - address: '0x1AC9271D271b8E50537CAd54b330424C52A84822', - id: HookType.GUILD, - name: 'Guild', - }, - { - address: '0x850c015A6A88756a59Dc025fca988494fF90DBB7', - id: HookType.PROMOCODE, - name: 'Discount code', - }, - { - address: '0x6d1571813c8fEB24856594d23b323234B1adEfE1', - id: HookType.PROMO_CODE_CAPPED, - name: 'Discount code with caps', - }, - ], - }, - id: 5, - isTestNetwork: true, - keyManagerAddress: '0xc328aE7fc36f975BE120aaa99f2d96C3E732e5b6', - maxFreeClaimCost: 100000, - multisig: '0x95C06469e557d8645966077891B4aeDe8D55A755', - name: 'Goerli', - nativeCurrency: { - coingecko: 'ethereum', - decimals: 18, - name: 'ETH', - symbol: 'ETH', - wrapped: '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', - }, - opensea: { - collectionUrl: (lockAddress) => - `https://testnets.opensea.io/assets/goerli/${lockAddress}`, - tokenUrl: (lockAddress, tokenId) => - `https://testnets.opensea.io/assets/goerli/${lockAddress}/${tokenId}`, - }, - previousDeploys: [], - provider: 'https://rpc.unlock-protocol.com/5', - publicLockVersionToDeploy: 13, - publicProvider: - 'https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161', - startBlock: 7179039, - subgraph: { - endpoint: - 'https://api.studio.thegraph.com/query/65299/unlock-protocol-goerli/version/latest', - studioName: 'unlock-protocol-goerli', - }, - tokens: [ - { - address: '0x07865c6E87B9F70255377e024ace6630C1Eaa37F', - decimals: 6, - featured: true, - mainnetAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', - name: 'USD Coin', - symbol: 'USDC', - }, - { - address: '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', - decimals: 18, - featured: true, - mainnetAddress: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', - name: 'Wrapped Ether', - symbol: 'WETH', - }, - { - address: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', - decimals: 18, - featured: true, - mainnetAddress: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', - name: 'Uniswap', - symbol: 'UNI', - }, - ], - uniswapV3: { - factoryAddress: '0x1F98431c8aD98523631AE4a59f267346ea31F984', - oracle: '0x25197CaCDE16500032EF4B35d60c6f7aEd4a38a5', - positionManager: '0xC36442b4a4522E871399CD717aBDD847Ab11FE88', - universalRouterAddress: '0x4648a43B2C14Da09FdF82B161150d3F634f40491', - }, - universalCard: { - cardPurchaserAddress: '0x061Bfda0446c5f71Da760BC31371CB95808f5d82', - stripeDestinationCurrency: 'usdc', - stripeDestinationNetwork: 'ethereum', - }, - unlockAddress: '0x627118a4fB747016911e5cDA82e2E77C531e8206', - unlockOwner: '0x6E74DC46EbF2cDB75B72Ab1dCAe3C98c7E9d28a1', - url: 'https://goerli.net/', -} - -export default goerli diff --git a/packages/networks/src/networks/index.ts b/packages/networks/src/networks/index.ts index 40ff37960be..eb05f13bbb4 100644 --- a/packages/networks/src/networks/index.ts +++ b/packages/networks/src/networks/index.ts @@ -4,7 +4,6 @@ export * from './polygon' export * from './bsc' export * from './optimism' export * from './mumbai' -export * from './goerli' export * from './celo' export * from './arbitrum' export * from './avalanche' diff --git a/packages/unlock-js/src/__tests__/web3Service.test.js b/packages/unlock-js/src/__tests__/web3Service.test.js index 7626bd38700..18e074f082c 100644 --- a/packages/unlock-js/src/__tests__/web3Service.test.js +++ b/packages/unlock-js/src/__tests__/web3Service.test.js @@ -6,7 +6,7 @@ import { describe, it, expect, vi } from 'vitest' var web3Service = new Web3Service(networks) const lock = { address: '0xe6A85e67905d41A479A32FF59892861351c825E8', - network: 5, + network: 10, } describe('Web3Service', () => { @@ -28,6 +28,9 @@ describe('Web3Service', () => { return result }, } + web3Service.getUnlockContract = vi.fn(() => ({ + locks: vi.fn(() => ({ deployed: true })), + })) web3Service.lockContractAbiVersion = vi.fn(() => version) const r = await web3Service[method](...args) expect(r).toBe(result) @@ -53,13 +56,28 @@ describe('Web3Service', () => { async () => { expect.assertions(2) const service = new Web3Service(networks) - const response = await service.getLock(lock.address, 5) + service.getUnlockContract = vi.fn(() => ({ + locks: vi.fn(() => ({ deployed: true })), + })) + // Fake implementation of getLock + const version = { + getLock: (_args) => { + return { + unlockContractAddress: networks[lock.network].unlockAddress, + } + }, + } + service.lockContractAbiVersion = vi.fn(() => version) + + const response = await service.getLock(lock.address, 10) expect(response.address).toBe(lock.address) const notFromUnlockFactoryContract = async () => { - // Fake generated address + service.getUnlockContract = vi.fn(() => ({ + locks: vi.fn(() => ({ deployed: false })), + })) const response = await service.getLock( '0xAfC5356c67853fC8045586722fE6a253023039eB', - 5 + 10 ) return response } diff --git a/packages/unlock-js/src/web3Service.ts b/packages/unlock-js/src/web3Service.ts index cd9a7ce2f29..53bd666510e 100644 --- a/packages/unlock-js/src/web3Service.ts +++ b/packages/unlock-js/src/web3Service.ts @@ -147,10 +147,12 @@ export default class Web3Service extends UnlockService { // Add the lock address lock.address = address + // Add the unlock address lock.unlockContractAddress = ethers.utils.getAddress( lock.unlockContractAddress ) + // Check that the Unlock address matches an "official one" const previousDeployAddresses = (networkConfig.previousDeploys || []).map( (d: any) => ethers.utils.getAddress(d.unlockAddress) ) diff --git a/provider/src/supportedNetworks.ts b/provider/src/supportedNetworks.ts index 336ab32c102..f06cdf2dbf1 100644 --- a/provider/src/supportedNetworks.ts +++ b/provider/src/supportedNetworks.ts @@ -4,7 +4,6 @@ import { Env } from './types' const supportedNetworks = (env: Env, networkId: string): string | undefined => { return { '1': env.MAINNET_PROVIDER, - '5': env.GOERLI_PROVIDER, '10': env.OPTIMISM_PROVIDER, '56': env.BSC_PROVIDER, '100': env.GNOSIS_PROVIDER, diff --git a/provider/src/types.ts b/provider/src/types.ts index fe60d1e410e..37500e1af1f 100644 --- a/provider/src/types.ts +++ b/provider/src/types.ts @@ -5,7 +5,6 @@ export interface Env { BSC_PROVIDER: string CELO_PROVIDER: string GNOSIS_PROVIDER: string - GOERLI_PROVIDER: string MAINNET_PROVIDER: string MUMBAI_PROVIDER: string OPTIMISM_PROVIDER: string diff --git a/smart-contracts/scripts/upgrade/submitLockVersion.js b/smart-contracts/scripts/upgrade/submitLockVersion.js index c06534f8535..66c2a361838 100644 --- a/smart-contracts/scripts/upgrade/submitLockVersion.js +++ b/smart-contracts/scripts/upgrade/submitLockVersion.js @@ -7,7 +7,7 @@ * yarn hardhat submit:version * * # with an existing address, contract gets deployed and specified - * yarn hardhat submit:version --network goerli --public-lock-address + * yarn hardhat submit:version --network optimism --public-lock-address * ``` * NB: You can first test on mainnet to make sure the template is deploying correctly * : * diff --git a/unlock-app/src/components/interface/locks/Create/elements/BalanceWarning.tsx b/unlock-app/src/components/interface/locks/Create/elements/BalanceWarning.tsx index 13af2b7ec80..6ae663200ea 100644 --- a/unlock-app/src/components/interface/locks/Create/elements/BalanceWarning.tsx +++ b/unlock-app/src/components/interface/locks/Create/elements/BalanceWarning.tsx @@ -13,11 +13,6 @@ const CALL_TO_ACTION_MAPPING: Record = { link: 'https://www.coinbase.com/', ref: 'Coinbase', }, - 5: { - label: 'Get some test ETH from ', - link: 'https://goerlifaucet.com/', - ref: 'the faucet.', - }, 10: { label: 'Transfer some ETH from ', link: 'https://app.optimism.io/bridge/deposit', diff --git a/unlock-app/src/config/app.ts b/unlock-app/src/config/app.ts index 53d16f214da..a924affc247 100644 --- a/unlock-app/src/config/app.ts +++ b/unlock-app/src/config/app.ts @@ -56,7 +56,6 @@ export const config = { locksmithSigners: [ '0x58b5CeDE554a39666091F96C8058920dF5906581', '0x22c095c69c38b66afAad4eFd4280D94Ec9D12f4C', - '0xC7C6759C2Cf2AD209F7AebD2C7012543F7BB5db4', // Goerli OZ Relay '0xd851fe9ba8EfA66e65d7865690bD2B9522C6E99f', // OZ Relay ], // TODO: cleanup? We should use config from networks package! networks: Object.keys(networksConfig).reduce( From ce0e9704f5599676a4ab1cad6d5029d6123681a0 Mon Sep 17 00:00:00 2001 From: DannyThomx Date: Sat, 30 Mar 2024 18:43:14 +0200 Subject: [PATCH 26/35] Updated PR to address comments * Replaced arbLog with regular console log * Removed changes in .env.copy * Used fixed version numbers for arbitrum sdk packages * Used env variables place holder for privateKey and API keys * Move addresses to separate config file `config.js` * Changed excessFeeRefundAddress to timelock address * Added comments in front of function params to provide their names * Formated Proposal description correctly --- governance/proposals/010-arbitrum-l1-l2-messaging.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/governance/proposals/010-arbitrum-l1-l2-messaging.js b/governance/proposals/010-arbitrum-l1-l2-messaging.js index 99923ae91a2..dda3676383f 100644 --- a/governance/proposals/010-arbitrum-l1-l2-messaging.js +++ b/governance/proposals/010-arbitrum-l1-l2-messaging.js @@ -117,7 +117,7 @@ const INBOX_ABI = [ * Set up: instantiate L1 / L2 wallets connected to providers */ const walletPrivateKey = process.env.PRIVATE_KEY -const L1RPC = 'https://rpc.unlock-protocol.com/1' +const L1RPC = 'https://rpc.unlock-protocol.com/1' // mainnet RPC const L2RPC = `https://arbitrum-mainnet.infura.io/v3/${process.env.ETHERSCAN_API_KEY}` const l1Provider = new ethers.JsonRpcProvider(L1RPC) const l2Provider = new ethers.JsonRpcProvider(L2RPC) @@ -204,7 +204,7 @@ module.exports = async () => { #### About the proposal The proposal contains a single call to the Arbitrum Delayed Inbox Contract's \`createRetryableTicket\` function on mainnet to create a \`Retryable Ticket\` that will attempt to execute an L2 request to the ARB token contract to transfer ${ethers .formatEther(tokenAmount) - .toString()} of tokens to the grants contract - \`transfer(${grantsContractAddress},${ethers + .toString()} of token from the Timelock L2 Alias address \`${timelockL2Alias}\` to the [grants contract](https://arbiscan.io/address/0x00d5e0d31d37cc13c645d86410ab4cb7cb428cca) - \`transfer(${grantsContractAddress},${ethers .formatEther(tokenAmount) .toString()})\`. From 7bced2f4e7759d49d70ff83aa93cd651fef4ba91 Mon Sep 17 00:00:00 2001 From: DannyThomx Date: Mon, 1 Apr 2024 15:35:52 +0200 Subject: [PATCH 27/35] Updated PR * Downgraded to ethers 6.10.0 * Switched L2RPC to Unlock RPC for Arbitrum * Moved createRetyrableTicket Params to variable for consistency * Capitalize constant names --- governance/package.json | 2 +- .../proposals/010-arbitrum-l1-l2-messaging.js | 65 +++++++++---------- governance/proposals/config.js | 16 ++--- 3 files changed, 38 insertions(+), 45 deletions(-) diff --git a/governance/package.json b/governance/package.json index aaa29324737..d0b8219efd0 100644 --- a/governance/package.json +++ b/governance/package.json @@ -25,7 +25,7 @@ "@unlock-protocol/networks": "workspace:./packages/networks", "arb-shared-dependencies": "1.0.0", "eslint": "8.54.0", - "ethers": "6.11.1", + "ethers": "6.10.0", "fs-extra": "11.2.0", "hardhat": "2.20.1", "solhint": "4.1.1", diff --git a/governance/proposals/010-arbitrum-l1-l2-messaging.js b/governance/proposals/010-arbitrum-l1-l2-messaging.js index dda3676383f..4f3633ffeb5 100644 --- a/governance/proposals/010-arbitrum-l1-l2-messaging.js +++ b/governance/proposals/010-arbitrum-l1-l2-messaging.js @@ -5,10 +5,10 @@ const { const { EthBridger, getL2Network } = require('@arbitrum/sdk') const { getBaseFee } = require('@arbitrum/sdk/dist/lib/utils/lib') const { - ARBTokenAddressOnL2, - grantsContractAddress, - timelockL2Alias, - L1TimelockContract, + ARB_TOKEN_ADRESS_ON_L2, + GRANTS_CONTRACT_ADDRESS, + TIMELOCK_L2_ALIAS, + L1_TIMELOCK_CONTRACT, } = require('./config') const ERC20_ABI = [ @@ -118,7 +118,7 @@ const INBOX_ABI = [ */ const walletPrivateKey = process.env.PRIVATE_KEY const L1RPC = 'https://rpc.unlock-protocol.com/1' // mainnet RPC -const L2RPC = `https://arbitrum-mainnet.infura.io/v3/${process.env.ETHERSCAN_API_KEY}` +const L2RPC = 'https://rpc.unlock-protocol.com/42161' // Arbitrum RPC const l1Provider = new ethers.JsonRpcProvider(L1RPC) const l2Provider = new ethers.JsonRpcProvider(L2RPC) // const l1Wallet = new ethers.Wallet(walletPrivateKey, l1Provider) @@ -132,12 +132,12 @@ module.exports = async () => { const inboxAddress = ethBridger.l2Network.ethBridge.inbox const L2TokenContract = new ethers.Contract( - ARBTokenAddressOnL2, + ARB_TOKEN_ADRESS_ON_L2, ERC20_ABI, l2Wallet ).connect(l2Wallet) - const balanceOf = await L2TokenContract.balanceOf(timelockL2Alias) + const balanceOf = await L2TokenContract.balanceOf(TIMELOCK_L2_ALIAS) const tokenAmount = ethers.parseEther('1') // Create an instance of the Interface from the ABIs @@ -146,7 +146,7 @@ module.exports = async () => { // Encode the ERC20 Token transfer calldata const transfer_calldata = iface_erc20.encodeFunctionData('transfer', [ - grantsContractAddress, + GRANTS_CONTRACT_ADDRESS, tokenAmount, ]) /** @@ -162,30 +162,32 @@ module.exports = async () => { */ const L1ToL2MessageGasParams = await l1ToL2MessageGasEstimate.estimateAll( { - from: L1TimelockContract, - to: ARBTokenAddressOnL2, + from: L1_TIMELOCK_CONTRACT, + to: ARB_TOKEN_ADRESS_ON_L2, l2CallValue: 0, - excessFeeRefundAddress: L1TimelockContract, - callValueRefundAddress: L1TimelockContract, + excessFeeRefundAddress: L1_TIMELOCK_CONTRACT, + callValueRefundAddress: L1_TIMELOCK_CONTRACT, data: transfer_calldata, }, await getBaseFee(l1Provider), l1Provider ) const gasPriceBid = await l2Provider.getGasPrice() + const ETHDeposit = L1ToL2MessageGasParams.deposit.toNumber() * 10 // I Multiply by 10 to add extra in case gas changes due to proposal delay + const params = [ + ARB_TOKEN_ADRESS_ON_L2, // to + 0, // l2CallValue + L1ToL2MessageGasParams.maxSubmissionCost, // maxSubmissionCost + L1_TIMELOCK_CONTRACT, // excessFeeRefundAddress + L1_TIMELOCK_CONTRACT, // callValueRefundAddress + L1ToL2MessageGasParams.gasLimit, // gasLimit + gasPriceBid, // maxFeePerGas + transfer_calldata, // data + ] const inbox_calldata = iface_inbox.encodeFunctionData( 'createRetryableTicket', - [ - ARBTokenAddressOnL2, // to - 0, // l2CallValue - L1ToL2MessageGasParams.maxSubmissionCost, // maxSubmissionCost - L1TimelockContract, // excessFeeRefundAddress - L1TimelockContract, // callValueRefundAddress - L1ToL2MessageGasParams.gasLimit, // gasLimit - gasPriceBid, // maxFeePerGas - transfer_calldata, // data - ] + params ) const proposalName = ` @@ -196,7 +198,7 @@ module.exports = async () => { #### Current situation of DAO's ARB Tokens - total: ${ethers.formatEther(balanceOf).toString()} ARB. - - DAO ALIAS Address (On Arbitrum): [${timelockL2Alias}](https://arbiscan.io/address/${timelockL2Alias}) + - DAO ALIAS Address (On Arbitrum): [${TIMELOCK_L2_ALIAS}](https://arbiscan.io/address/${TIMELOCK_L2_ALIAS}) For Reference [Snapshot temperature check for 7k ARBs](https://snapshot.org/#/unlock-protocol.eth/proposal/0xaa142e599d981f0b58c3ac1a51af9f9a52fb5307f27d791ecc18c4da69eeacc3) @@ -204,7 +206,7 @@ module.exports = async () => { #### About the proposal The proposal contains a single call to the Arbitrum Delayed Inbox Contract's \`createRetryableTicket\` function on mainnet to create a \`Retryable Ticket\` that will attempt to execute an L2 request to the ARB token contract to transfer ${ethers .formatEther(tokenAmount) - .toString()} of token from the Timelock L2 Alias address \`${timelockL2Alias}\` to the [grants contract](https://arbiscan.io/address/0x00d5e0d31d37cc13c645d86410ab4cb7cb428cca) - \`transfer(${grantsContractAddress},${ethers + .toString()} of token from the Timelock L2 Alias address \`${TIMELOCK_L2_ALIAS}\` to the [grants contract](https://arbiscan.io/address/0x00d5e0d31d37cc13c645d86410ab4cb7cb428cca) - \`transfer(${GRANTS_CONTRACT_ADDRESS},${ethers .formatEther(tokenAmount) .toString()})\`. @@ -216,7 +218,7 @@ module.exports = async () => { ` // Proposal ARGS i.e Call Governor.propose() directly with these values const targets = [inboxAddress] - const values = [L1ToL2MessageGasParams.deposit.toNumber() * 10] // I Multiply by 10 to add extra in case gas changes + const values = [ETHDeposit] const calldatas = [inbox_calldata] const description = proposalName @@ -225,17 +227,8 @@ module.exports = async () => { contractNameOrAbi: INBOX_ABI, contractAddress: inboxAddress, functionName: 'createRetryableTicket', - functionArgs: [ - ARBTokenAddressOnL2, // to - 0, // l2CallValue - L1ToL2MessageGasParams.maxSubmissionCost, // maxSubmissionCost - l2Wallet.address, // excessFeeRefundAddress - l2Wallet.address, // callValueRefundAddress - L1ToL2MessageGasParams.gasLimit, // gasLimit - gasPriceBid, // maxFeePerGas - transfer_calldata, // data - ], - value: L1ToL2MessageGasParams.deposit.toNumber() * 10, // I Multiply by 10 to add extra in case gas changes due to proposal delay + functionArgs: params, + value: ETHDeposit, }, ] diff --git a/governance/proposals/config.js b/governance/proposals/config.js index 99cecfc08f2..148016fa684 100644 --- a/governance/proposals/config.js +++ b/governance/proposals/config.js @@ -1,11 +1,11 @@ -const ARBTokenAddressOnL2 = '0x912CE59144191C1204E64559FE8253a0e49E6548' // ARB TOKEN ADDRESS ON ARBITRUM ONE -const grantsContractAddress = '0x00D5E0d31d37cc13C645D86410aB4cB7Cb428ccA' -const timelockL2Alias = '0x28ffDfB0A6e6E06E95B3A1f928Dc4024240bD87c' // Timelock Alias Address on L2 -const L1TimelockContract = '0x17EEDFb0a6E6e06E95B3A1F928dc4024240BC76B' // Timelock Address mainnet +const ARB_TOKEN_ADRESS_ON_L2 = '0x912CE59144191C1204E64559FE8253a0e49E6548' // ARB TOKEN ADDRESS ON ARBITRUM ONE +const GRANTS_CONTRACT_ADDRESS = '0x00D5E0d31d37cc13C645D86410aB4cB7Cb428ccA' +const TIMELOCK_L2_ALIAS = '0x28ffDfB0A6e6E06E95B3A1f928Dc4024240bD87c' // Timelock Alias Address on L2 +const L1_TIMELOCK_CONTRACT = '0x17EEDFb0a6E6e06E95B3A1F928dc4024240BC76B' // Timelock Address mainnet export default { - ARBTokenAddressOnL2, - grantsContractAddress, - timelockL2Alias, - L1TimelockContract, + ARB_TOKEN_ADRESS_ON_L2, + GRANTS_CONTRACT_ADDRESS, + TIMELOCK_L2_ALIAS, + L1_TIMELOCK_CONTRACT, } From 0a993b89c14b628b70e21c9b22b865d52584be7a Mon Sep 17 00:00:00 2001 From: DannyThomx Date: Tue, 2 Apr 2024 13:40:21 +0200 Subject: [PATCH 28/35] Resolved yarn.lock merge conflict --- yarn.lock | 60 +++++++++++++++++++++++-------------------------------- 1 file changed, 25 insertions(+), 35 deletions(-) diff --git a/yarn.lock b/yarn.lock index 9016890ad37..b2dd7cf8070 100644 --- a/yarn.lock +++ b/yarn.lock @@ -264,7 +264,7 @@ __metadata: languageName: node linkType: hard -"@arbitrum/nitro-contracts@npm:v1.0.2": +"@arbitrum/nitro-contracts@npm:1.0.2": version: 1.0.2 resolution: "@arbitrum/nitro-contracts@npm:1.0.2" dependencies: @@ -279,16 +279,15 @@ __metadata: languageName: node linkType: hard -"@arbitrum/sdk@npm:^v3.1.9": - version: 3.3.3 - resolution: "@arbitrum/sdk@npm:3.3.3" +"@arbitrum/sdk@npm:3.1.9": + version: 3.1.9 + resolution: "@arbitrum/sdk@npm:3.1.9" dependencies: "@ethersproject/address": "npm:^5.0.8" "@ethersproject/bignumber": "npm:^5.1.1" "@ethersproject/bytes": "npm:^5.0.8" - async-mutex: "npm:^0.4.0" ethers: "npm:^5.1.0" - checksum: 10/cf21a8750191beaa588bbe350853118d6142ac70aebcdb38306ff5144cbbb89a7ac2680b03537f218bdad9eb528cfe85ba97834794bcbe397ce7d817f2a010c8 + checksum: 10/8d04ccf6b7559d948ecc2da3c53e3a129b85480bb014aab153ca085c912a609aeabe143c5dacdb17a5cf24d1ffcbfdee37a4ee48ddfbd0b85de1b1df19b59865 languageName: node linkType: hard @@ -19925,8 +19924,8 @@ __metadata: version: 0.0.0-use.local resolution: "@unlock-protocol/governance@workspace:governance" dependencies: - "@arbitrum/nitro-contracts": "npm:v1.0.2" - "@arbitrum/sdk": "npm:^v3.1.9" + "@arbitrum/nitro-contracts": "npm:1.0.2" + "@arbitrum/sdk": "npm:3.1.9" "@matterlabs/hardhat-zksync-deploy": "npm:1.1.2" "@matterlabs/hardhat-zksync-solc": "npm:1.1.0" "@matterlabs/hardhat-zksync-upgradable": "npm:1.2.4" @@ -19945,9 +19944,9 @@ __metadata: "@unlock-protocol/hardhat-helpers": "workspace:^" "@unlock-protocol/hardhat-plugin": "workspace:^" "@unlock-protocol/networks": "workspace:./packages/networks" - arb-shared-dependencies: "npm:^1.0.0" + arb-shared-dependencies: "npm:1.0.0" eslint: "npm:8.54.0" - ethers: "npm:6.11.1" + ethers: "npm:6.10.0" fs-extra: "npm:11.2.0" hardhat: "npm:2.20.1" solhint: "npm:4.1.1" @@ -22573,7 +22572,7 @@ __metadata: languageName: node linkType: hard -"arb-shared-dependencies@npm:^1.0.0": +"arb-shared-dependencies@npm:1.0.0": version: 1.0.0 resolution: "arb-shared-dependencies@npm:1.0.0" dependencies: @@ -23152,15 +23151,6 @@ __metadata: languageName: node linkType: hard -"async-mutex@npm:^0.4.0": - version: 0.4.1 - resolution: "async-mutex@npm:0.4.1" - dependencies: - tslib: "npm:^2.4.0" - checksum: 10/7e9f77b112b8545beb6612493fae4a8d9d1d6c3f24fc22f4d6d05ce96d1e8d326ac3e743a804cc6d7bf24e7ef0267afb65bb127f99b2e433609684b38933ff1c - languageName: node - linkType: hard - "async-retry@npm:^1.3.1, async-retry@npm:^1.3.3": version: 1.3.3 resolution: "async-retry@npm:1.3.3" @@ -31134,21 +31124,6 @@ __metadata: languageName: node linkType: hard -"ethers@npm:6.11.1, ethers@npm:^6.7.1, ethers@npm:^6.8.1": - version: 6.11.1 - resolution: "ethers@npm:6.11.1" - dependencies: - "@adraffy/ens-normalize": "npm:1.10.1" - "@noble/curves": "npm:1.2.0" - "@noble/hashes": "npm:1.3.2" - "@types/node": "npm:18.15.13" - aes-js: "npm:4.0.0-beta.5" - tslib: "npm:2.4.0" - ws: "npm:8.5.0" - checksum: 10/bfeba2670dbfdac3951a66ab2d5bbc18dd7e1be69da9142ad4fe3859a30891e7bb048ecbb6ab542b67df777ada1860445bb3dd83536219c0d3639fe05e74df8e - languageName: node - linkType: hard - "ethers@npm:^4.0.40": version: 4.0.49 resolution: "ethers@npm:4.0.49" @@ -31166,6 +31141,21 @@ __metadata: languageName: node linkType: hard +"ethers@npm:^6.7.1, ethers@npm:^6.8.1": + version: 6.11.1 + resolution: "ethers@npm:6.11.1" + dependencies: + "@adraffy/ens-normalize": "npm:1.10.1" + "@noble/curves": "npm:1.2.0" + "@noble/hashes": "npm:1.3.2" + "@types/node": "npm:18.15.13" + aes-js: "npm:4.0.0-beta.5" + tslib: "npm:2.4.0" + ws: "npm:8.5.0" + checksum: 10/bfeba2670dbfdac3951a66ab2d5bbc18dd7e1be69da9142ad4fe3859a30891e7bb048ecbb6ab542b67df777ada1860445bb3dd83536219c0d3639fe05e74df8e + languageName: node + linkType: hard + "ethjs-unit@npm:0.1.6": version: 0.1.6 resolution: "ethjs-unit@npm:0.1.6" From c9a28c10fc62b5fb8ac52b4dabde1c1de1c62f83 Mon Sep 17 00:00:00 2001 From: DannyThomx Date: Wed, 3 Apr 2024 11:27:45 +0200 Subject: [PATCH 29/35] Updated PR: * Used providers, and addresses from networks package * Renamed config.js to constants.js * Used suggested style guide for variable names * More detailed description --- .../proposals/010-arbitrum-l1-l2-messaging.js | 35 ++++++++++--------- governance/proposals/config.js | 11 ------ governance/proposals/constants.js | 19 ++++++++++ 3 files changed, 38 insertions(+), 27 deletions(-) delete mode 100644 governance/proposals/config.js create mode 100644 governance/proposals/constants.js diff --git a/governance/proposals/010-arbitrum-l1-l2-messaging.js b/governance/proposals/010-arbitrum-l1-l2-messaging.js index 4f3633ffeb5..7a93f99ec68 100644 --- a/governance/proposals/010-arbitrum-l1-l2-messaging.js +++ b/governance/proposals/010-arbitrum-l1-l2-messaging.js @@ -5,11 +5,13 @@ const { const { EthBridger, getL2Network } = require('@arbitrum/sdk') const { getBaseFee } = require('@arbitrum/sdk/dist/lib/utils/lib') const { + L1_RPC, + L2_RPC, ARB_TOKEN_ADRESS_ON_L2, GRANTS_CONTRACT_ADDRESS, TIMELOCK_L2_ALIAS, L1_TIMELOCK_CONTRACT, -} = require('./config') +} = require('./constants') const ERC20_ABI = [ { @@ -116,16 +118,17 @@ const INBOX_ABI = [ /** * Set up: instantiate L1 / L2 wallets connected to providers */ + const walletPrivateKey = process.env.PRIVATE_KEY -const L1RPC = 'https://rpc.unlock-protocol.com/1' // mainnet RPC -const L2RPC = 'https://rpc.unlock-protocol.com/42161' // Arbitrum RPC -const l1Provider = new ethers.JsonRpcProvider(L1RPC) -const l2Provider = new ethers.JsonRpcProvider(L2RPC) +const l1Provider = new ethers.JsonRpcProvider(L1_RPC) +const l2Provider = new ethers.JsonRpcProvider(L2_RPC) // const l1Wallet = new ethers.Wallet(walletPrivateKey, l1Provider) const l2Wallet = new ethers.Wallet(walletPrivateKey, l2Provider) module.exports = async () => { - console.log('Cross-chain Proposer') + console.log( + 'Proposal For Executing L1 to L2 Messaging Using Arbitrum Delayed Inbox (Retryable Tickets)' + ) const l2Network = await getL2Network(l2Provider) const ethBridger = new EthBridger(l2Network) @@ -141,14 +144,14 @@ module.exports = async () => { const tokenAmount = ethers.parseEther('1') // Create an instance of the Interface from the ABIs - const iface_erc20 = new ethers.Interface(ERC20_ABI) - const iface_inbox = new ethers.Interface(INBOX_ABI) + const erc20ContractInterface = new ethers.Interface(ERC20_ABI) + const inboxContractInterface = new ethers.Interface(INBOX_ABI) // Encode the ERC20 Token transfer calldata - const transfer_calldata = iface_erc20.encodeFunctionData('transfer', [ - GRANTS_CONTRACT_ADDRESS, - tokenAmount, - ]) + const transferCalldata = erc20ContractInterface.encodeFunctionData( + 'transfer', + [GRANTS_CONTRACT_ADDRESS, tokenAmount] + ) /** * Now we can query the required gas params using the estimateAll method in Arbitrum SDK */ @@ -167,7 +170,7 @@ module.exports = async () => { l2CallValue: 0, excessFeeRefundAddress: L1_TIMELOCK_CONTRACT, callValueRefundAddress: L1_TIMELOCK_CONTRACT, - data: transfer_calldata, + data: transferCalldata, }, await getBaseFee(l1Provider), l1Provider @@ -182,10 +185,10 @@ module.exports = async () => { L1_TIMELOCK_CONTRACT, // callValueRefundAddress L1ToL2MessageGasParams.gasLimit, // gasLimit gasPriceBid, // maxFeePerGas - transfer_calldata, // data + transferCalldata, // data ] - const inbox_calldata = iface_inbox.encodeFunctionData( + const inboxCalldata = inboxContractInterface.encodeFunctionData( 'createRetryableTicket', params ) @@ -219,7 +222,7 @@ module.exports = async () => { // Proposal ARGS i.e Call Governor.propose() directly with these values const targets = [inboxAddress] const values = [ETHDeposit] - const calldatas = [inbox_calldata] + const calldatas = [inboxCalldata] const description = proposalName const calls = [ diff --git a/governance/proposals/config.js b/governance/proposals/config.js deleted file mode 100644 index 148016fa684..00000000000 --- a/governance/proposals/config.js +++ /dev/null @@ -1,11 +0,0 @@ -const ARB_TOKEN_ADRESS_ON_L2 = '0x912CE59144191C1204E64559FE8253a0e49E6548' // ARB TOKEN ADDRESS ON ARBITRUM ONE -const GRANTS_CONTRACT_ADDRESS = '0x00D5E0d31d37cc13C645D86410aB4cB7Cb428ccA' -const TIMELOCK_L2_ALIAS = '0x28ffDfB0A6e6E06E95B3A1f928Dc4024240bD87c' // Timelock Alias Address on L2 -const L1_TIMELOCK_CONTRACT = '0x17EEDFb0a6E6e06E95B3A1F928dc4024240BC76B' // Timelock Address mainnet - -export default { - ARB_TOKEN_ADRESS_ON_L2, - GRANTS_CONTRACT_ADDRESS, - TIMELOCK_L2_ALIAS, - L1_TIMELOCK_CONTRACT, -} diff --git a/governance/proposals/constants.js b/governance/proposals/constants.js new file mode 100644 index 00000000000..4b71d7116c4 --- /dev/null +++ b/governance/proposals/constants.js @@ -0,0 +1,19 @@ +const { mainnet, arbitrum } = require('@unlock-protocol/networks') + +const L1_RPC = mainnet.provider // mainnet RPC +const L2_RPC = arbitrum.provider // Arbitrum RPC +const GRANTS_CONTRACT_ADDRESS = '0x00D5E0d31d37cc13C645D86410aB4cB7Cb428ccA' // Grants contract on Arbitrum +const TIMELOCK_L2_ALIAS = '0x28ffDfB0A6e6E06E95B3A1f928Dc4024240bD87c' // Timelock Alias Address on L2 +const L1_TIMELOCK_CONTRACT = '0x17EEDFb0a6E6e06E95B3A1F928dc4024240BC76B' // Timelock Address mainnet +const ARB_TOKEN_ADRESS_ON_L2 = arbitrum.tokens.filter( + (token) => token.symbol === 'ARB' +)[0].address // ARB TOKEN ADDRESS ON ARBITRUM ONE + +module.exports = { + L1_RPC, + L2_RPC, + ARB_TOKEN_ADRESS_ON_L2, + GRANTS_CONTRACT_ADDRESS, + TIMELOCK_L2_ALIAS, + L1_TIMELOCK_CONTRACT, +} From 4d42172c70a62a3555ce478226639a8cc983c229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renaud?= Date: Wed, 3 Apr 2024 15:05:13 +0200 Subject: [PATCH 30/35] Update governance/proposals/constants.js --- governance/proposals/constants.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/governance/proposals/constants.js b/governance/proposals/constants.js index 4b71d7116c4..2c8d8c285dc 100644 --- a/governance/proposals/constants.js +++ b/governance/proposals/constants.js @@ -5,9 +5,10 @@ const L2_RPC = arbitrum.provider // Arbitrum RPC const GRANTS_CONTRACT_ADDRESS = '0x00D5E0d31d37cc13C645D86410aB4cB7Cb428ccA' // Grants contract on Arbitrum const TIMELOCK_L2_ALIAS = '0x28ffDfB0A6e6E06E95B3A1f928Dc4024240bD87c' // Timelock Alias Address on L2 const L1_TIMELOCK_CONTRACT = '0x17EEDFb0a6E6e06E95B3A1F928dc4024240BC76B' // Timelock Address mainnet -const ARB_TOKEN_ADRESS_ON_L2 = arbitrum.tokens.filter( - (token) => token.symbol === 'ARB' -)[0].address // ARB TOKEN ADDRESS ON ARBITRUM ONE +// ARB TOKEN ADDRESS ON ARBITRUM ONE +const { address : ARB_TOKEN_ADRESS_ON_L2} = arbitrum.tokens.find( + ({ symbol }) => symbol === 'ARB' +) module.exports = { L1_RPC, From c33c977566b99e99138b644340af31a610c71f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renaud?= Date: Wed, 3 Apr 2024 15:05:26 +0200 Subject: [PATCH 31/35] Update governance/proposals/010-arbitrum-l1-l2-messaging.js --- .../proposals/010-arbitrum-l1-l2-messaging.js | 46 +------------------ 1 file changed, 1 insertion(+), 45 deletions(-) diff --git a/governance/proposals/010-arbitrum-l1-l2-messaging.js b/governance/proposals/010-arbitrum-l1-l2-messaging.js index 7a93f99ec68..b963267346f 100644 --- a/governance/proposals/010-arbitrum-l1-l2-messaging.js +++ b/governance/proposals/010-arbitrum-l1-l2-messaging.js @@ -13,51 +13,7 @@ const { L1_TIMELOCK_CONTRACT, } = require('./constants') -const ERC20_ABI = [ - { - inputs: [ - { - internalType: 'address', - name: 'account', - type: 'address', - }, - ], - name: 'balanceOf', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'address', - name: 'to', - type: 'address', - }, - { - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'transfer', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, -] +const ERC20_ABI = require('@unlock-protocol/hardhat-helpers/dist/ABIs/erc20.json') const INBOX_ABI = [ { inputs: [ From 79327c5a1c5b5d923c17cdfdfe83528affdea66b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renaud?= Date: Wed, 3 Apr 2024 16:51:27 +0200 Subject: [PATCH 32/35] use ethers5 --- governance/package.json | 1 + yarn.lock | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/governance/package.json b/governance/package.json index d0b8219efd0..b5e70d53f2d 100644 --- a/governance/package.json +++ b/governance/package.json @@ -26,6 +26,7 @@ "arb-shared-dependencies": "1.0.0", "eslint": "8.54.0", "ethers": "6.10.0", + "ethers5": "npm:ethers@5", "fs-extra": "11.2.0", "hardhat": "2.20.1", "solhint": "4.1.1", diff --git a/yarn.lock b/yarn.lock index b2dd7cf8070..aa9af10d7e7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19947,6 +19947,7 @@ __metadata: arb-shared-dependencies: "npm:1.0.0" eslint: "npm:8.54.0" ethers: "npm:6.10.0" + ethers5: "npm:ethers@5" fs-extra: "npm:11.2.0" hardhat: "npm:2.20.1" solhint: "npm:4.1.1" @@ -31071,7 +31072,7 @@ __metadata: languageName: node linkType: hard -"ethers@npm:5.7.2, ethers@npm:^5.1.0, ethers@npm:^5.3.1, ethers@npm:^5.5.4, ethers@npm:^5.6.1, ethers@npm:^5.6.9, ethers@npm:^5.7.0, ethers@npm:^5.7.1, ethers@npm:^5.7.2": +"ethers5@npm:ethers@5, ethers@npm:5.7.2, ethers@npm:^5.1.0, ethers@npm:^5.3.1, ethers@npm:^5.5.4, ethers@npm:^5.6.1, ethers@npm:^5.6.9, ethers@npm:^5.7.0, ethers@npm:^5.7.1, ethers@npm:^5.7.2": version: 5.7.2 resolution: "ethers@npm:5.7.2" dependencies: From ace2d139c130a487fe1805d2985be149541cef08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renaud?= Date: Wed, 3 Apr 2024 16:51:39 +0200 Subject: [PATCH 33/35] refactor proposal --- .../proposals/010-arbitrum-l1-l2-messaging.js | 106 ++++++++++-------- governance/proposals/constants.js | 20 ---- 2 files changed, 57 insertions(+), 69 deletions(-) delete mode 100644 governance/proposals/constants.js diff --git a/governance/proposals/010-arbitrum-l1-l2-messaging.js b/governance/proposals/010-arbitrum-l1-l2-messaging.js index b963267346f..722ea188b02 100644 --- a/governance/proposals/010-arbitrum-l1-l2-messaging.js +++ b/governance/proposals/010-arbitrum-l1-l2-messaging.js @@ -1,18 +1,19 @@ -const ethers = require('ethers') +const ethers = require('ethers5') const { L1ToL2MessageGasEstimator, } = require('@arbitrum/sdk/dist/lib/message/L1ToL2MessageGasEstimator') const { EthBridger, getL2Network } = require('@arbitrum/sdk') const { getBaseFee } = require('@arbitrum/sdk/dist/lib/utils/lib') -const { - L1_RPC, - L2_RPC, - ARB_TOKEN_ADRESS_ON_L2, - GRANTS_CONTRACT_ADDRESS, - TIMELOCK_L2_ALIAS, - L1_TIMELOCK_CONTRACT, -} = require('./constants') +const { mainnet, arbitrum } = require('@unlock-protocol/networks') + +const GRANTS_CONTRACT_ADDRESS = '0x00D5E0d31d37cc13C645D86410aB4cB7Cb428ccA' // Grants contract on Arbitrum +const TIMELOCK_L2_ALIAS = '0x28ffDfB0A6e6E06E95B3A1f928Dc4024240bD87c' // Timelock Alias Address on L2 +const L1_TIMELOCK_CONTRACT = '0x17EEDFb0a6E6e06E95B3A1F928dc4024240BC76B' // Timelock Address mainnet +// ARB TOKEN ADDRESS ON ARBITRUM ONE +const { address: ARB_TOKEN_ADRESS_ON_L2 } = arbitrum.tokens.find( + ({ symbol }) => symbol === 'ARB' +) const ERC20_ABI = require('@unlock-protocol/hardhat-helpers/dist/ABIs/erc20.json') const INBOX_ABI = [ { @@ -75,13 +76,15 @@ const INBOX_ABI = [ * Set up: instantiate L1 / L2 wallets connected to providers */ -const walletPrivateKey = process.env.PRIVATE_KEY -const l1Provider = new ethers.JsonRpcProvider(L1_RPC) -const l2Provider = new ethers.JsonRpcProvider(L2_RPC) -// const l1Wallet = new ethers.Wallet(walletPrivateKey, l1Provider) -const l2Wallet = new ethers.Wallet(walletPrivateKey, l2Provider) +const l1Provider = new ethers.providers.StaticJsonRpcProvider(mainnet.provider) +const l2Provider = new ethers.providers.StaticJsonRpcProvider(arbitrum.provider) -module.exports = async () => { +module.exports = async ({ + tokenAddressL2 = ARB_TOKEN_ADRESS_ON_L2, + fromL1 = L1_TIMELOCK_CONTRACT, + toL2 = GRANTS_CONTRACT_ADDRESS, + fromL2 = TIMELOCK_L2_ALIAS, +}) => { console.log( 'Proposal For Executing L1 to L2 Messaging Using Arbitrum Delayed Inbox (Retryable Tickets)' ) @@ -90,29 +93,42 @@ module.exports = async () => { const ethBridger = new EthBridger(l2Network) const inboxAddress = ethBridger.l2Network.ethBridge.inbox + // token on L2 const L2TokenContract = new ethers.Contract( - ARB_TOKEN_ADRESS_ON_L2, + tokenAddressL2, ERC20_ABI, - l2Wallet - ).connect(l2Wallet) + l2Provider + ) + const decimals = await L2TokenContract.decimals() - const balanceOf = await L2TokenContract.balanceOf(TIMELOCK_L2_ALIAS) - const tokenAmount = ethers.parseEther('1') + // check balance of sender on L2 + const balanceOf = await L2TokenContract.balanceOf(fromL2) + const tokenAmount = balanceOf // Create an instance of the Interface from the ABIs - const erc20ContractInterface = new ethers.Interface(ERC20_ABI) - const inboxContractInterface = new ethers.Interface(INBOX_ABI) + const erc20ContractInterface = new ethers.utils.Interface(ERC20_ABI) + const inboxContractInterface = new ethers.utils.Interface(INBOX_ABI) // Encode the ERC20 Token transfer calldata const transferCalldata = erc20ContractInterface.encodeFunctionData( 'transfer', - [GRANTS_CONTRACT_ADDRESS, tokenAmount] + [toL2, tokenAmount] ) + /** * Now we can query the required gas params using the estimateAll method in Arbitrum SDK */ const l1ToL2MessageGasEstimate = new L1ToL2MessageGasEstimator(l2Provider) + const estimateAllParams = { + from: fromL1, + to: tokenAddressL2, + l2CallValue: 0, + excessFeeRefundAddress: fromL1, + callValueRefundAddress: fromL1, + data: transferCalldata, + } + /** * The estimateAll method gives us the following values for sending an L1->L2 message * (1) maxSubmissionCost: The maximum cost to be paid for submitting the transaction @@ -120,28 +136,22 @@ module.exports = async () => { * (3) deposit: The total amount to deposit on L1 to cover L2 gas and L2 call value */ const L1ToL2MessageGasParams = await l1ToL2MessageGasEstimate.estimateAll( - { - from: L1_TIMELOCK_CONTRACT, - to: ARB_TOKEN_ADRESS_ON_L2, - l2CallValue: 0, - excessFeeRefundAddress: L1_TIMELOCK_CONTRACT, - callValueRefundAddress: L1_TIMELOCK_CONTRACT, - data: transferCalldata, - }, + estimateAllParams, await getBaseFee(l1Provider), l1Provider ) const gasPriceBid = await l2Provider.getGasPrice() const ETHDeposit = L1ToL2MessageGasParams.deposit.toNumber() * 10 // I Multiply by 10 to add extra in case gas changes due to proposal delay + const params = [ - ARB_TOKEN_ADRESS_ON_L2, // to - 0, // l2CallValue - L1ToL2MessageGasParams.maxSubmissionCost, // maxSubmissionCost - L1_TIMELOCK_CONTRACT, // excessFeeRefundAddress - L1_TIMELOCK_CONTRACT, // callValueRefundAddress - L1ToL2MessageGasParams.gasLimit, // gasLimit - gasPriceBid, // maxFeePerGas - transferCalldata, // data + estimateAllParams.to, + estimateAllParams.l2CallValue, + L1ToL2MessageGasParams.maxSubmissionCost.toString(), // maxSubmissionCost + estimateAllParams.excessFeeRefundAddress, + estimateAllParams.callValueRefundAddress, + L1ToL2MessageGasParams.gasLimit.toString(), // gasLimit + gasPriceBid.toString(), // maxFeePerGas + estimateAllParams.data, ] const inboxCalldata = inboxContractInterface.encodeFunctionData( @@ -156,17 +166,17 @@ module.exports = async () => { This proposal requests to use 1 ARB from the tokens given to Unlock Protocol DAO by ArbitrumDAO to run a test transaction to de-risk the transfer of 7k ARB tokens to fund the retroQF round on Grants Stack. #### Current situation of DAO's ARB Tokens - - total: ${ethers.formatEther(balanceOf).toString()} ARB. - - DAO ALIAS Address (On Arbitrum): [${TIMELOCK_L2_ALIAS}](https://arbiscan.io/address/${TIMELOCK_L2_ALIAS}) + - total: ${ethers.utils.formatUnits(balanceOf, decimals).toString()} ARB. + - DAO ALIAS Address (On Arbitrum): [${fromL2}](https://arbiscan.io/address/${fromL2}) For Reference [Snapshot temperature check for 7k ARBs](https://snapshot.org/#/unlock-protocol.eth/proposal/0xaa142e599d981f0b58c3ac1a51af9f9a52fb5307f27d791ecc18c4da69eeacc3) #### About the proposal - The proposal contains a single call to the Arbitrum Delayed Inbox Contract's \`createRetryableTicket\` function on mainnet to create a \`Retryable Ticket\` that will attempt to execute an L2 request to the ARB token contract to transfer ${ethers - .formatEther(tokenAmount) - .toString()} of token from the Timelock L2 Alias address \`${TIMELOCK_L2_ALIAS}\` to the [grants contract](https://arbiscan.io/address/0x00d5e0d31d37cc13c645d86410ab4cb7cb428cca) - \`transfer(${GRANTS_CONTRACT_ADDRESS},${ethers - .formatEther(tokenAmount) + The proposal contains a single call to the Arbitrum Delayed Inbox Contract's \`createRetryableTicket\` function on mainnet to create a \`Retryable Ticket\` that will attempt to execute an L2 request to the ARB token contract to transfer ${ethers.utils + .formatUnits(tokenAmount, decimals) + .toString()} of token from the Timelock L2 Alias address \`${fromL2}\` to the [grants contract](https://arbiscan.io/address/0x00d5e0d31d37cc13c645d86410ab4cb7cb428cca) - \`transfer(${toL2},${ethers.utils + .formatUnits(tokenAmount, decimals) .toString()})\`. Once approved and executed, the request will be sent to the Delayed Inbox contract and a ticket is created. @@ -183,11 +193,9 @@ module.exports = async () => { const calls = [ { - contractNameOrAbi: INBOX_ABI, contractAddress: inboxAddress, - functionName: 'createRetryableTicket', - functionArgs: params, - value: ETHDeposit, + calldata: inboxCalldata, + value: ETHDeposit.toString(), }, ] diff --git a/governance/proposals/constants.js b/governance/proposals/constants.js deleted file mode 100644 index 2c8d8c285dc..00000000000 --- a/governance/proposals/constants.js +++ /dev/null @@ -1,20 +0,0 @@ -const { mainnet, arbitrum } = require('@unlock-protocol/networks') - -const L1_RPC = mainnet.provider // mainnet RPC -const L2_RPC = arbitrum.provider // Arbitrum RPC -const GRANTS_CONTRACT_ADDRESS = '0x00D5E0d31d37cc13C645D86410aB4cB7Cb428ccA' // Grants contract on Arbitrum -const TIMELOCK_L2_ALIAS = '0x28ffDfB0A6e6E06E95B3A1f928Dc4024240bD87c' // Timelock Alias Address on L2 -const L1_TIMELOCK_CONTRACT = '0x17EEDFb0a6E6e06E95B3A1F928dc4024240BC76B' // Timelock Address mainnet -// ARB TOKEN ADDRESS ON ARBITRUM ONE -const { address : ARB_TOKEN_ADRESS_ON_L2} = arbitrum.tokens.find( - ({ symbol }) => symbol === 'ARB' -) - -module.exports = { - L1_RPC, - L2_RPC, - ARB_TOKEN_ADRESS_ON_L2, - GRANTS_CONTRACT_ADDRESS, - TIMELOCK_L2_ALIAS, - L1_TIMELOCK_CONTRACT, -} From a82a7c07b6d4a0830e02a123d9b1562312e26cad Mon Sep 17 00:00:00 2001 From: DannyThomx Date: Wed, 3 Apr 2024 20:36:05 +0200 Subject: [PATCH 34/35] * Revert change to .gitignore, and .env.copy * Use actual amount of ARB tokens required --- governance/.env.copy | 2 +- governance/.gitignore | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/governance/.env.copy b/governance/.env.copy index c2b665f92da..f1c3af9c2a4 100644 --- a/governance/.env.copy +++ b/governance/.env.copy @@ -9,4 +9,4 @@ export BSCSCAN_API_KEY= export SNOWTRACE_API_KEY= export ARBISCAN_API_KEY= export CELO_API_KEY= -export GNOSISSCAN_API_KEY= +export GNOSISSCAN_API_KEY= \ No newline at end of file diff --git a/governance/.gitignore b/governance/.gitignore index 1ea30610786..2e5682418b9 100644 --- a/governance/.gitignore +++ b/governance/.gitignore @@ -2,7 +2,6 @@ cache contracts artifacts -.env # zksync zk-artifacts From debbbdf4d425fc1ed4ae617e86e30a1ab4cb3462 Mon Sep 17 00:00:00 2001 From: DannyThomx Date: Wed, 3 Apr 2024 21:49:21 +0200 Subject: [PATCH 35/35] * Update proposal description * Use correct proposal amount * Revert .gitignore, and .env.copy changes --- .../proposals/010-arbitrum-l1-l2-messaging.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/governance/proposals/010-arbitrum-l1-l2-messaging.js b/governance/proposals/010-arbitrum-l1-l2-messaging.js index 722ea188b02..0c8da68e7ed 100644 --- a/governance/proposals/010-arbitrum-l1-l2-messaging.js +++ b/governance/proposals/010-arbitrum-l1-l2-messaging.js @@ -103,7 +103,7 @@ module.exports = async ({ // check balance of sender on L2 const balanceOf = await L2TokenContract.balanceOf(fromL2) - const tokenAmount = balanceOf + const tokenAmount = ethers.utils.parseUnits('8200', decimals) // Create an instance of the Interface from the ABIs const erc20ContractInterface = new ethers.utils.Interface(ERC20_ABI) @@ -160,17 +160,26 @@ module.exports = async ({ ) const proposalName = ` - # Test Transaction before 7k ARB Transfer To Fund Unlock Protocol’s Ecosystem via Grants Stack + # Transfer 8200 ARB To Fund Unlock Protocol’s Ecosystem via Grants Stack ### Goal of the proposal - This proposal requests to use 1 ARB from the tokens given to Unlock Protocol DAO by ArbitrumDAO to run a test transaction to de-risk the transfer of 7k ARB tokens to fund the retroQF round on Grants Stack. + This proposal requests to use 8200 ARB from the tokens given to Unlock Protocol DAO by ArbitrumDAO to fund the retroQF round on Grants Stack for projects building on Unlock Protocol. #### Current situation of DAO's ARB Tokens - total: ${ethers.utils.formatUnits(balanceOf, decimals).toString()} ARB. - DAO ALIAS Address (On Arbitrum): [${fromL2}](https://arbiscan.io/address/${fromL2}) For Reference - [Snapshot temperature check for 7k ARBs](https://snapshot.org/#/unlock-protocol.eth/proposal/0xaa142e599d981f0b58c3ac1a51af9f9a52fb5307f27d791ecc18c4da69eeacc3) + [Snapshot temperature check for Retro QF Grants Round](https://snapshot.org/#/unlock-protocol.eth/proposal/0xaa142e599d981f0b58c3ac1a51af9f9a52fb5307f27d791ecc18c4da69eeacc3) + + In addition to the 7k ARB tokens requested for funding Unlock Ecosystem projects, an extra 1200 ARB is requested for compensation for the round management according to the following breakdown: + + 7000 ARB - Matching fund + 700 ARB (10%) of matching fund to the round manager - lanadingwall.eth + 500 ARB for research and technical assistance - dannithomx.eth + Total: 8200 ARB + + [Snapshot temperature check for 8200 ARBs](https://snapshot.org/#/unlock-protocol.eth/proposal/0x4fa320e553e6992506cd31d7c0b2013e1548c646baba02d657f3a7b198140c25) #### About the proposal The proposal contains a single call to the Arbitrum Delayed Inbox Contract's \`createRetryableTicket\` function on mainnet to create a \`Retryable Ticket\` that will attempt to execute an L2 request to the ARB token contract to transfer ${ethers.utils