diff --git a/libs/abis/package.json b/libs/abis/package.json index 34dc981e..170aa4d1 100644 --- a/libs/abis/package.json +++ b/libs/abis/package.json @@ -1,5 +1,5 @@ { "name": "@daohaus/abis", - "version": "0.3.1", + "version": "0.3.2", "type": "commonjs" -} \ No newline at end of file +} diff --git a/libs/connect-context/package.json b/libs/connect-context/package.json index 3fe4461a..beaf73a6 100644 --- a/libs/connect-context/package.json +++ b/libs/connect-context/package.json @@ -1,4 +1,4 @@ { "name": "@daohaus/connect-context", - "version": "0.3.1" -} \ No newline at end of file + "version": "0.3.2" +} diff --git a/libs/connect/package.json b/libs/connect/package.json index 6e18255e..ff6fe46c 100644 --- a/libs/connect/package.json +++ b/libs/connect/package.json @@ -1,7 +1,7 @@ { "name": "@daohaus/connect", - "version": "0.3.1", + "version": "0.3.2", "peerDependencies": { "react-router-dom": "^6.4.3" } -} \ No newline at end of file +} diff --git a/libs/contract-utils/package.json b/libs/contract-utils/package.json index da0914d4..b5a5e795 100644 --- a/libs/contract-utils/package.json +++ b/libs/contract-utils/package.json @@ -1,5 +1,5 @@ { "name": "@daohaus/contract-utils", - "version": "0.3.1", + "version": "0.3.2", "type": "commonjs" -} \ No newline at end of file +} diff --git a/libs/data-fetch-utils/package.json b/libs/data-fetch-utils/package.json index bbcf2f3e..4fddf177 100644 --- a/libs/data-fetch-utils/package.json +++ b/libs/data-fetch-utils/package.json @@ -1,5 +1,5 @@ { "name": "@daohaus/data-fetch-utils", - "version": "0.3.1", + "version": "0.3.2", "type": "commonjs" -} \ No newline at end of file +} diff --git a/libs/form-builder-base/package.json b/libs/form-builder-base/package.json index 9789ce24..77b35c0c 100644 --- a/libs/form-builder-base/package.json +++ b/libs/form-builder-base/package.json @@ -1,4 +1,4 @@ { "name": "@daohaus/form-builder-base", - "version": "0.3.1" -} \ No newline at end of file + "version": "0.3.2" +} diff --git a/libs/form-builder/package.json b/libs/form-builder/package.json index ba4f4a22..717f7dd5 100644 --- a/libs/form-builder/package.json +++ b/libs/form-builder/package.json @@ -1,4 +1,4 @@ { "name": "@daohaus/form-builder", - "version": "0.3.1" -} \ No newline at end of file + "version": "0.3.2" +} diff --git a/libs/keychain-utils/package.json b/libs/keychain-utils/package.json index abc7c27c..339699d3 100644 --- a/libs/keychain-utils/package.json +++ b/libs/keychain-utils/package.json @@ -1,4 +1,4 @@ { "name": "@daohaus/keychain-utils", - "version": "0.3.1" -} \ No newline at end of file + "version": "0.3.2" +} diff --git a/libs/moloch-v3-data/package.json b/libs/moloch-v3-data/package.json index 207eb29c..4081dd90 100644 --- a/libs/moloch-v3-data/package.json +++ b/libs/moloch-v3-data/package.json @@ -1,5 +1,5 @@ { "name": "@daohaus/moloch-v3-data", - "version": "0.3.1", + "version": "0.3.2", "type": "commonjs" -} \ No newline at end of file +} diff --git a/libs/moloch-v3-fields/package.json b/libs/moloch-v3-fields/package.json index 62c6c64b..6c0e8bb0 100644 --- a/libs/moloch-v3-fields/package.json +++ b/libs/moloch-v3-fields/package.json @@ -1,4 +1,4 @@ { "name": "@daohaus/moloch-v3-fields", - "version": "0.3.1" -} \ No newline at end of file + "version": "0.3.2" +} diff --git a/libs/moloch-v3-fields/src/fields/MarkdownField.tsx b/libs/moloch-v3-fields/src/fields/MarkdownField.tsx index 01a62b46..4276f7b2 100644 --- a/libs/moloch-v3-fields/src/fields/MarkdownField.tsx +++ b/libs/moloch-v3-fields/src/fields/MarkdownField.tsx @@ -7,8 +7,10 @@ import { DialogContent, Field, Label, + Card, WrappedTextArea, } from '@daohaus/ui'; + import { useFormContext } from 'react-hook-form'; import { BiPencil } from 'react-icons/bi'; import { MdFullscreen, MdFullscreenExit, MdPreview } from 'react-icons/md'; @@ -38,8 +40,6 @@ const MarkDownContainer = styled.div` const DialogMarkDownContainer = styled.div` height: 50rem; - max-width: 100rem; - min-width: 50rem; overflow-y: scroll; padding: 10px; margin-bottom: 5rem; @@ -64,8 +64,12 @@ const LabelContainer = styled(Label)` const DialogWrappedTextArea = styled(WrappedTextArea)` height: 50rem; - max-width: 100rem; - min-width: 70rem; + overflow-y: scroll; + padding: 10px; + margin-bottom: 5rem; + border-radius: 5px; + font-size: 1.5rem; + font-family: inherit; `; const DialogButtonWrapper = styled.div` @@ -75,6 +79,12 @@ const DialogButtonWrapper = styled.div` margin-bottom: -2rem; `; +const ContentWrapper = styled(Card)` + border: none; + min-width: 50vw; + max-width: 90vw; +`; + export const MarkdownField = (props: Buildable) => { const { watch } = useFormContext(); const value = watch(props.id); @@ -132,18 +142,20 @@ export const MarkdownField = (props: Buildable) => { - {edit ? ( - - ) : ( - <> - - - - - {value} - - - )} + + {edit ? ( + + ) : ( + <> + + + + + {value} + + + )} + diff --git a/libs/moloch-v3-hooks/package.json b/libs/moloch-v3-hooks/package.json index a1d8ea13..cdfc09a5 100644 --- a/libs/moloch-v3-hooks/package.json +++ b/libs/moloch-v3-hooks/package.json @@ -1,7 +1,7 @@ { "name": "@daohaus/moloch-v3-hooks", - "version": "0.3.1", + "version": "0.3.2", "peerDependencies": { "react-query": "^3.39.3" } -} \ No newline at end of file +} diff --git a/libs/moloch-v3-legos/package.json b/libs/moloch-v3-legos/package.json index c2ff03f2..f637b485 100644 --- a/libs/moloch-v3-legos/package.json +++ b/libs/moloch-v3-legos/package.json @@ -1,5 +1,5 @@ { "name": "@daohaus/moloch-v3-legos", - "version": "0.3.1", + "version": "0.3.2", "type": "commonjs" -} \ No newline at end of file +} diff --git a/libs/moloch-v3-macro-ui/package.json b/libs/moloch-v3-macro-ui/package.json index 9aa569d9..79eae3b1 100644 --- a/libs/moloch-v3-macro-ui/package.json +++ b/libs/moloch-v3-macro-ui/package.json @@ -1,7 +1,7 @@ { "name": "@daohaus/moloch-v3-macro-ui", - "version": "0.3.1", + "version": "0.3.2", "peerDependencies": { "react-router-dom": "^6.4.3" } -} \ No newline at end of file +} diff --git a/libs/moloch-v3-macro-ui/src/utils/proposalDetailsHelpers.ts b/libs/moloch-v3-macro-ui/src/utils/proposalDetailsHelpers.ts index a615f82b..be5794d2 100644 --- a/libs/moloch-v3-macro-ui/src/utils/proposalDetailsHelpers.ts +++ b/libs/moloch-v3-macro-ui/src/utils/proposalDetailsHelpers.ts @@ -43,17 +43,25 @@ const getValueFromMintOrTransferAction = ( ): string => { if ( actionData.params[0].name !== 'to' && - !['amount', '_value'].includes(actionData.params[1].name) + !['amount', '_value', 'wad'].includes(actionData.params[1].name) ) { return 'decoding error'; } - const value = Array.isArray(actionData.params[1].value) - ? (actionData.params[1].value[0] as bigint) - : (actionData.params[1].value as bigint); + const value = actionData.params[1].type.endsWith('[]') + ? actionData.params[1].value + .toString() + .split(',') + .map((v) => BigInt(v)) + : [BigInt(actionData.params[1].value.toString())]; return formatValueTo({ - value: toWholeUnits(value.toString(), decimals), + value: toWholeUnits( + value + .reduce((val: bigint, accValue: bigint) => accValue + val, BigInt(0)) + .toString(), + decimals + ), decimals: 2, format: 'numberShort', }); @@ -78,7 +86,7 @@ const getRecipientAddressFromMintOrTransferAction = ( ): string => { if ( actionData.params[0].name !== 'to' && - !['amount', '_value'].includes(actionData.params[1].name) + !['amount', '_value', 'wad'].includes(actionData.params[1].name) ) { return 'decoding error'; } diff --git a/libs/profile-data/package.json b/libs/profile-data/package.json index 8a0b95be..b7e2a8cf 100644 --- a/libs/profile-data/package.json +++ b/libs/profile-data/package.json @@ -1,5 +1,5 @@ { "name": "@daohaus/profile-data", - "version": "0.3.1", + "version": "0.3.2", "type": "commonjs" -} \ No newline at end of file +} diff --git a/libs/tx-builder/package.json b/libs/tx-builder/package.json index 2ef3d925..21bcc7c4 100644 --- a/libs/tx-builder/package.json +++ b/libs/tx-builder/package.json @@ -1,4 +1,4 @@ { "name": "@daohaus/tx-builder", - "version": "0.3.1" -} \ No newline at end of file + "version": "0.3.2" +} diff --git a/libs/tx-builder/src/utils/constants.ts b/libs/tx-builder/src/utils/constants.ts index c73cf36a..2d07f88e 100644 --- a/libs/tx-builder/src/utils/constants.ts +++ b/libs/tx-builder/src/utils/constants.ts @@ -4,7 +4,7 @@ import { LOCAL_ABI } from '@daohaus/abis'; export const EXPIRY = '.proposalExpiry'; export const FORM = '.formValues'; export const CURRENT_DAO = '.daoId'; -export const gasBufferMultiplier = 5; +export const gasBufferMultiplier = 1.2; // buffers baalgas estimate export const BaalContractBase = { type: 'local', contractName: 'Baal', diff --git a/libs/tx-builder/src/utils/deepDecoding.ts b/libs/tx-builder/src/utils/deepDecoding.ts index f539d75e..c4d12c87 100644 --- a/libs/tx-builder/src/utils/deepDecoding.ts +++ b/libs/tx-builder/src/utils/deepDecoding.ts @@ -157,7 +157,11 @@ const decodeMethod = (options: { const inputsWithValues = (inputs as any[]).map((input, index) => ({ name: input.name, type: input.type, - value: result.args?.[index]?.toString() || '0x', + value: Array.isArray(result.args?.[index]) + ? (result.args?.[index] as Array).length + ? (result.args?.[index] as Array).toString() + : '[]' + : result.args?.[index]?.toString() || '0x', })); return { diff --git a/libs/tx-builder/src/utils/multicall.ts b/libs/tx-builder/src/utils/multicall.ts index e0cfc4b7..850894ae 100644 --- a/libs/tx-builder/src/utils/multicall.ts +++ b/libs/tx-builder/src/utils/multicall.ts @@ -14,6 +14,7 @@ import { MulticallArg, StringSearch, TXLego, + ACTION_GAS_LIMIT_ADDITION, } from '@daohaus/utils'; import { CONTRACT_KEYCHAINS, @@ -39,14 +40,14 @@ import { createViemClient } from '@daohaus/utils'; export const estimateFunctionalGas = async ({ chainId, - constractAddress, + contractAddress, from, value, data, rpcs = HAUS_RPC, }: { chainId: ValidNetwork; - constractAddress: string; + contractAddress: string; from: string; value: bigint; data: string; @@ -59,11 +60,13 @@ export const estimateFunctionalGas = async ({ const functionGasFees = await client.estimateGas({ account: from as EthAddress, - to: constractAddress as EthAddress, + to: contractAddress as EthAddress, value, data: data as `0x${string}`, }); + console.log('functionGasFees', functionGasFees); + return Number(functionGasFees); }; @@ -284,10 +287,12 @@ export const handleMulticallArg = async ({ export const gasEstimateFromActions = async ({ actions, + actionsCount, chainId, daoId, }: { actions: MetaTransaction[]; + actionsCount: number; chainId: ValidNetwork; daoId: string; safeId: string; // not used at the moment @@ -297,7 +302,7 @@ export const gasEstimateFromActions = async ({ async (action) => await estimateFunctionalGas({ chainId: chainId, - constractAddress: action.to, + contractAddress: action.to, from: daoId, // from value needs to be the safe module (baal) to estimate without revert value: BigInt(Number(action.value)), data: action.data, @@ -310,9 +315,13 @@ export const gasEstimateFromActions = async ({ (a, b) => (a || 0) + (b || 0), 0 ); + + // extra gas overhead when calling the dao from the baal safe + const baalOnlyGas = actionsCount * ACTION_GAS_LIMIT_ADDITION; + console.log('baalOnlyGas addtition', baalOnlyGas); console.log('totalGasEstimate', totalGasEstimate); - return totalGasEstimate; + return (totalGasEstimate || 0) + baalOnlyGas; }; export const handleEncodeMulticallArg = async ({ @@ -386,12 +395,14 @@ export const handleGasEstimate = async ({ } as MetaTransaction; const gasEstimate = await gasEstimateFromActions({ actions: encodeExecFromModule({ safeId, metaTx }), + actionsCount: actions.length, chainId, daoId, safeId, }); if (gasEstimate) { + // adds buffer to baalgas estimate const buffer = arg.bufferPercentage || gasBufferMultiplier; return Math.round(Number(gasEstimate) * Number(buffer)); } else { diff --git a/libs/ui/package.json b/libs/ui/package.json index 5bba2746..96553a1e 100644 --- a/libs/ui/package.json +++ b/libs/ui/package.json @@ -1,4 +1,4 @@ { "name": "@daohaus/ui", - "version": "0.3.1" -} \ No newline at end of file + "version": "0.3.2" +} diff --git a/libs/utils/package.json b/libs/utils/package.json index 53a27970..f6bb4228 100644 --- a/libs/utils/package.json +++ b/libs/utils/package.json @@ -1,4 +1,4 @@ { "name": "@daohaus/utils", - "version": "0.3.1" -} \ No newline at end of file + "version": "0.3.2" +} diff --git a/libs/utils/src/constants/proposals.ts b/libs/utils/src/constants/proposals.ts index 21c578b1..6f025533 100644 --- a/libs/utils/src/constants/proposals.ts +++ b/libs/utils/src/constants/proposals.ts @@ -105,8 +105,11 @@ export const PROPOSAL_FILTERS: Record = { failed: 'Defeated', expired: 'Expired', }; - -export const GAS_BUFFER_MULTIPLIER = 5; +// Processing gas estimate buffer +export const GAS_BUFFER_MULTIPLIER = 2; // Adding to the gas limit to account for cost of processProposal export const PROCESS_PROPOSAL_GAS_LIMIT_ADDITION = 150000; +// Adding to the gas limit to account for cost of each action +export const ACTION_GAS_LIMIT_ADDITION = 150000; + export const L2_ADDITIONAL_GAS = 5000000; diff --git a/libs/utils/src/utils/gas.ts b/libs/utils/src/utils/gas.ts index 8cfd470e..75094790 100644 --- a/libs/utils/src/utils/gas.ts +++ b/libs/utils/src/utils/gas.ts @@ -16,7 +16,6 @@ export const getGasCostEstimate = async ( ): Promise => { const feeDataNew = await fetchFeeData({ chainId: chainId as ValidNetwork }); - console.log('feeDataNew', feeDataNew); return ( Number(getProcessingGasLimit(gasLimit, chainId)) * Number(feeDataNew.maxFeePerGas || 0) diff --git a/libs/wizard-form-builder/package.json b/libs/wizard-form-builder/package.json index fb0e3b89..1454dc8c 100644 --- a/libs/wizard-form-builder/package.json +++ b/libs/wizard-form-builder/package.json @@ -1,4 +1,4 @@ { "name": "@daohaus/wizard-form-builder", - "version": "0.0.2" -} \ No newline at end of file + "version": "0.0.3" +}