From b0fb6c1504ca5c03774d8025d9e120e00de2775c Mon Sep 17 00:00:00 2001 From: Sam Kuhlmann Date: Tue, 6 Sep 2022 10:47:45 -0600 Subject: [PATCH] Feature/05092022 sweeps (#817) * Publish new lib versions. (#412) * fix/fix-table-types (#354) * removed the any types from hub * renamed Table to DaoTable and DataTable to DaoTable to be more consistent with DaoCard * removed commented out DaoData type * one more comment -- thought i got both before * Fix/355 summon params mixup (#356) * more ignore * fixes bad init params order in summon tx * Feature/tag component (#349) * Created basic tag component * Added dynamic color selections for tags * Bumped versions fixed filer * Added icon support to tag component Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Jonathan Prozzi * Feature/delegate play (#357) * more ignore * fixes bad init params order in summon tx * delegate testing and subgraph field updates * finishes mapping * update dao-data query and transformer * adds delegate tag to list view and hooks up delegate filtering * refactors filter into query helper * Spencer's Summon tooltip suggestions (#370) * Spencer's Summon tooltip suggestions - Summon portion of #365 * Delimiter references #368 For now, just referencing spaces. But if tabs, commas, or other delimiters are also supported, those should be references in the tooltips as well. * Address Jord's comments Co-authored-by: Sam Kuhlmann * Fix/summon poll (#375) * more ignore * fixes bad init params order in summon tx * delegate testing and subgraph field updates * finishes mapping * update dao-data query and transformer * adds delegate tag to list view and hooks up delegate filtering * adds schema field to tx entity * updates poll for tx entity made before dao entity * Feature/alpha baal update (#376) * new abis * updates summoner tx logic and contract addresses * fixes transaction entity creation location; * fixes some test * Feature/unit utils (#380) * create custom d.ts for human-format * type and convert unit fn from V2 * readableNumber util accepts number strings, throws error if string but number string * fix 0 to 1 utils, extend MaxDecimals to shorten decimal places * refine spacer and unit symbol placement * update new card to handle new params * update table * corrections * alter d.ts file * potential solutions to ts bug * implement keating's d.ts fix * fix comment * Fix/network switcher (#381) * better error handling * fix bug * remove log * get react-table TS to stop yelling (#382) Co-authored-by: Sam Kuhlmann * Feature/hub sort (#383) * wip * gets query working on dao entity after lots of subgraph updates * updates front end for sort * fixes type issue * fixes build issue * reviewing v3 monorepo and saw some networks missing (#399) * Feature/public profile (#384) * Add some stuff * Add public profile * Add ens * Get build to pass * Update apps/hub-app/src/pages/PublicProfilePage.tsx Co-authored-by: Rowdy Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy * fixing doc display name from <[object Object]> to displayName (#402) Co-authored-by: Sam Kuhlmann * adds search (#401) * adds search wip * correctly types the onChange for the input * cleans up unsed imports * naming * Feature/public profile (#384) * Add some stuff * Add public profile * Add ens * Get build to pass * Update apps/hub-app/src/pages/PublicProfilePage.tsx Co-authored-by: Rowdy Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy * fixing doc display name from <[object Object]> to displayName (#402) Co-authored-by: Sam Kuhlmann * conflicts * correctly types the onChange for the input * cleans up unsed imports * naming * fix build error Co-authored-by: Alexander Keating Co-authored-by: Rowdy Co-authored-by: Brian Rossetti * Release/12072022 (#411) * adds search wip * correctly types the onChange for the input * cleans up unsed imports * naming * conflicts * correctly types the onChange for the input * cleans up unsed imports * naming * fix build error * feature bump Co-authored-by: Jonathan Prozzi Co-authored-by: Rowdy Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Spencer Graham Co-authored-by: Brian Rossetti Co-authored-by: Alexander Keating * Revert "Publish new lib versions. (#412)" This reverts commit bab7077ded01a2e5e0e4cd8ef59c4fd0fb9e4b96. * develop to master (#482) * UI/layout cleanup (#438) * run generator * import connect, theme libs. Add eindow.global. Ensure main.tsx uses React 17 API. * deletes app test * updates favicon and title * remove nx defaults * rough in layout box, target DH connect nav with class * remove even more css. World's dubest layout component * switches to connect class padding for mobile * extract base layout component to storybook * hook export chain, change name to outerlayout * extract formSegment from summon-app; replace in all instances in summon * extract split-column, replace all instances in summon * document future changes in comments * fix exports * switch core-app to nx default project * fix spacing * Fix/split column bug (#444) - fix bug * Layouts/subnav (#447) * clear out extra app.t.tsx * build sub-nav * style sub-nav * test subnav * extract subNavLink into component * subnavlink story * build subnavlink story * fix broken as prop * add mobile view, icon button trigger * add tsc command to core-app * adds human-format, removes profanity * Fix summon (#446) * Fix summon * clear out extra app.t.tsx * build sub-nav * style sub-nav * test subnav * extract subNavLink into component * subnavlink story * build subnavlink story * fix broken as prop * Fix summon * add mobile view, icon button trigger * add tsc command to core-app * adds human-format, removes profanity * add human-format to dao-data * move dts file Co-authored-by: jordan Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> * Haus layout (#451) * Publish new lib versions. (#412) * fix/fix-table-types (#354) * removed the any types from hub * renamed Table to DaoTable and DataTable to DaoTable to be more consistent with DaoCard * removed commented out DaoData type * one more comment -- thought i got both before * Fix/355 summon params mixup (#356) * more ignore * fixes bad init params order in summon tx * Feature/tag component (#349) * Created basic tag component * Added dynamic color selections for tags * Bumped versions fixed filer * Added icon support to tag component Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Jonathan Prozzi * Feature/delegate play (#357) * more ignore * fixes bad init params order in summon tx * delegate testing and subgraph field updates * finishes mapping * update dao-data query and transformer * adds delegate tag to list view and hooks up delegate filtering * refactors filter into query helper * Spencer's Summon tooltip suggestions (#370) * Spencer's Summon tooltip suggestions - Summon portion of #365 * Delimiter references #368 For now, just referencing spaces. But if tabs, commas, or other delimiters are also supported, those should be references in the tooltips as well. * Address Jord's comments Co-authored-by: Sam Kuhlmann * Fix/summon poll (#375) * more ignore * fixes bad init params order in summon tx * delegate testing and subgraph field updates * finishes mapping * update dao-data query and transformer * adds delegate tag to list view and hooks up delegate filtering * adds schema field to tx entity * updates poll for tx entity made before dao entity * Feature/alpha baal update (#376) * new abis * updates summoner tx logic and contract addresses * fixes transaction entity creation location; * fixes some test * Feature/unit utils (#380) * create custom d.ts for human-format * type and convert unit fn from V2 * readableNumber util accepts number strings, throws error if string but number string * fix 0 to 1 utils, extend MaxDecimals to shorten decimal places * refine spacer and unit symbol placement * update new card to handle new params * update table * corrections * alter d.ts file * potential solutions to ts bug * implement keating's d.ts fix * fix comment * Fix/network switcher (#381) * better error handling * fix bug * remove log * get react-table TS to stop yelling (#382) Co-authored-by: Sam Kuhlmann * Feature/hub sort (#383) * wip * gets query working on dao entity after lots of subgraph updates * updates front end for sort * fixes type issue * fixes build issue * reviewing v3 monorepo and saw some networks missing (#399) * Feature/public profile (#384) * Add some stuff * Add public profile * Add ens * Get build to pass * Update apps/hub-app/src/pages/PublicProfilePage.tsx Co-authored-by: Rowdy Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy * fixing doc display name from <[object Object]> to displayName (#402) Co-authored-by: Sam Kuhlmann * adds search (#401) * adds search wip * correctly types the onChange for the input * cleans up unsed imports * naming * Feature/public profile (#384) * Add some stuff * Add public profile * Add ens * Get build to pass * Update apps/hub-app/src/pages/PublicProfilePage.tsx Co-authored-by: Rowdy Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy * fixing doc display name from <[object Object]> to displayName (#402) Co-authored-by: Sam Kuhlmann * conflicts * correctly types the onChange for the input * cleans up unsed imports * naming * fix build error Co-authored-by: Alexander Keating Co-authored-by: Rowdy Co-authored-by: Brian Rossetti * Release/12072022 (#411) * adds search wip * correctly types the onChange for the input * cleans up unsed imports * naming * conflicts * correctly types the onChange for the input * cleans up unsed imports * naming * fix build error * feature bump Co-authored-by: Jonathan Prozzi Co-authored-by: Rowdy Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Spencer Graham Co-authored-by: Brian Rossetti Co-authored-by: Alexander Keating * Revert "Publish new lib versions. (#412)" This reverts commit bab7077ded01a2e5e0e4cd8ef59c4fd0fb9e4b96. * build formLayout Component * type correction * build formLayout story * rough in bicolumn layout * handle bicolumn mobile switch, finish bicolumn * fix mainlayout naming * build story for bi-column layout * build dh layout one shot? * yes, one shot * fix import * change prop name Co-authored-by: Jonathan Prozzi Co-authored-by: Alexander Keating Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy Co-authored-by: Spencer Graham Co-authored-by: Brian Rossetti * bumping packages that were published pre revert last week - causing fialures with package publishing (#460) * removing period from info content which casues confusing tooltip (#453) Co-authored-by: Sam Kuhlmann * Feature/hub profile menu fix (#480) * fixes profile link and layout * dao list style * adds toast to share link * Readme tables preferred (#483) * adjusting breakdown of apps and libs to tables * adding additoonal app references and libs * adding timestamp and address fields to many events (#468) * adding timestamps and address fields to many events * addressing code review * shortening naming convention on proposals, top level txHash defined as txHash going forward * update version * deploy subgraph and generate query types Co-authored-by: skuhlmann Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Alexander Keating Co-authored-by: jordan Co-authored-by: Jonathan Prozzi Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy Co-authored-by: Spencer Graham * Revert "develop to master (#482)" (#492) This reverts commit 5f7d121f9c49b9559d352bb17fce3c1ec598dfbe. Co-authored-by: Sam Kuhlmann * Develop into master (#577) * Feature/form builder (#553) * Publish new lib versions. (#412) * fix/fix-table-types (#354) * removed the any types from hub * renamed Table to DaoTable and DataTable to DaoTable to be more consistent with DaoCard * removed commented out DaoData type * one more comment -- thought i got both before * Fix/355 summon params mixup (#356) * more ignore * fixes bad init params order in summon tx * Feature/tag component (#349) * Created basic tag component * Added dynamic color selections for tags * Bumped versions fixed filer * Added icon support to tag component Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Jonathan Prozzi * Feature/delegate play (#357) * more ignore * fixes bad init params order in summon tx * delegate testing and subgraph field updates * finishes mapping * update dao-data query and transformer * adds delegate tag to list view and hooks up delegate filtering * refactors filter into query helper * Spencer's Summon tooltip suggestions (#370) * Spencer's Summon tooltip suggestions - Summon portion of #365 * Delimiter references #368 For now, just referencing spaces. But if tabs, commas, or other delimiters are also supported, those should be references in the tooltips as well. * Address Jord's comments Co-authored-by: Sam Kuhlmann * Fix/summon poll (#375) * more ignore * fixes bad init params order in summon tx * delegate testing and subgraph field updates * finishes mapping * update dao-data query and transformer * adds delegate tag to list view and hooks up delegate filtering * adds schema field to tx entity * updates poll for tx entity made before dao entity * Feature/alpha baal update (#376) * new abis * updates summoner tx logic and contract addresses * fixes transaction entity creation location; * fixes some test * Feature/unit utils (#380) * create custom d.ts for human-format * type and convert unit fn from V2 * readableNumber util accepts number strings, throws error if string but number string * fix 0 to 1 utils, extend MaxDecimals to shorten decimal places * refine spacer and unit symbol placement * update new card to handle new params * update table * corrections * alter d.ts file * potential solutions to ts bug * implement keating's d.ts fix * fix comment * Fix/network switcher (#381) * better error handling * fix bug * remove log * get react-table TS to stop yelling (#382) Co-authored-by: Sam Kuhlmann * Feature/hub sort (#383) * wip * gets query working on dao entity after lots of subgraph updates * updates front end for sort * fixes type issue * fixes build issue * reviewing v3 monorepo and saw some networks missing (#399) * Feature/public profile (#384) * Add some stuff * Add public profile * Add ens * Get build to pass * Update apps/hub-app/src/pages/PublicProfilePage.tsx Co-authored-by: Rowdy Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy * fixing doc display name from <[object Object]> to displayName (#402) Co-authored-by: Sam Kuhlmann * adds search (#401) * adds search wip * correctly types the onChange for the input * cleans up unsed imports * naming * Feature/public profile (#384) * Add some stuff * Add public profile * Add ens * Get build to pass * Update apps/hub-app/src/pages/PublicProfilePage.tsx Co-authored-by: Rowdy Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy * fixing doc display name from <[object Object]> to displayName (#402) Co-authored-by: Sam Kuhlmann * conflicts * correctly types the onChange for the input * cleans up unsed imports * naming * fix build error Co-authored-by: Alexander Keating Co-authored-by: Rowdy Co-authored-by: Brian Rossetti * Release/12072022 (#411) * adds search wip * correctly types the onChange for the input * cleans up unsed imports * naming * conflicts * correctly types the onChange for the input * cleans up unsed imports * naming * fix build error * feature bump Co-authored-by: Jonathan Prozzi Co-authored-by: Rowdy Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Spencer Graham Co-authored-by: Brian Rossetti Co-authored-by: Alexander Keating * Revert "Publish new lib versions. (#412)" This reverts commit bab7077ded01a2e5e0e4cd8ef59c4fd0fb9e4b96. * build formLayout Component * type correction * build formLayout story * rough in bicolumn layout * handle bicolumn mobile switch, finish bicolumn * fix mainlayout naming * build story for bi-column layout * scaffold formBuilder library * rough in formBuilder * restructure types * refactor component structure * test render inputs * add core fields to builder enum * add row layout to builder * built logger, fix logger bug * add disable all functionality * handle asynchronous callback as props to form builder * remove some comments * put submit button in form footer * fix code based on review * build validation pipeline * clean form and field types * revise types again, simplify rules API * commit after refactor carnage * roll back to react-hook-form v6, finally get some traction * found source of bug, trying new rhf version * ...and the bug was slain, returned to that cold, miserable shit heap from whence it came. * reintroduce devtool and logger * build metadata form, form segment subForm component * clean, add custom submit btn text * clean * build string validations * derive validation type from function obj * wrestled types into validation system * rebuild form builder as context * build formBuilder hook, use it in the factory * create sample test * update form placement * more post merge corrections * write validation updaters and add to pipeline, test required updaters, test validation, test pipeline * try jest testing * ensure field state updates on formState change * more cleaning * reorg files * build metadata form * tweak button styles, add defaultValues to formBuilder * good place to stop * remove comments * fix Jest errors * fix field wrapper stories, update lock * may have fixed jest errors Co-authored-by: Jonathan Prozzi Co-authored-by: Alexander Keating Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy Co-authored-by: Spencer Graham Co-authored-by: Brian Rossetti * Fix build (#563) * Fix build * Almost * More changes Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Jonathan Prozzi Co-authored-by: Sam Kuhlmann Co-authored-by: Rowdy Co-authored-by: Spencer Graham Co-authored-by: Brian Rossetti * Revert "Develop into master (#577)" This reverts commit b8644d3afa3204e0e4275b62a8e360109aac11cd. * fixes action falied status issue * overrides stuff * gets gas estimate in place * wip overrides * overrides * add a lot more gas * cleanup * change where we add the process proposal gas * image fix * fixes lint errors Co-authored-by: Jonathan Prozzi Co-authored-by: Alexander Keating Co-authored-by: Rowdy Co-authored-by: Jord <53406838+jordanlesich@users.noreply.github.com> Co-authored-by: Spencer Graham Co-authored-by: Brian Rossetti Co-authored-by: jordan --- .../proposalCards/ReadyForProcessing.tsx | 9 +++++++- apps/core-app/src/pages/ProposalDetails.tsx | 2 -- apps/core-app/src/utils/constants.ts | 2 -- apps/v3-subgraph/src/baal-mapping.ts | 1 - .../src/constants/endpoints.ts | 4 +++- libs/common-utilities/src/types/legoTypes.ts | 9 ++++++++ libs/dao-data/src/utils/transformers.ts | 13 ++++++----- libs/tx-builder-feature/src/utils/args.ts | 1 + .../src/utils/contractHelpers.ts | 1 - .../tx-builder-feature/src/utils/multicall.ts | 13 +++++------ .../tx-builder-feature/src/utils/overrides.ts | 16 ++++++++++++++ .../src/utils/txBuilderUtils.ts | 22 ++++++++----------- 12 files changed, 60 insertions(+), 33 deletions(-) create mode 100644 libs/tx-builder-feature/src/utils/overrides.ts diff --git a/apps/core-app/src/components/proposalCards/ReadyForProcessing.tsx b/apps/core-app/src/components/proposalCards/ReadyForProcessing.tsx index 86b8be024..3995012d8 100644 --- a/apps/core-app/src/components/proposalCards/ReadyForProcessing.tsx +++ b/apps/core-app/src/components/proposalCards/ReadyForProcessing.tsx @@ -17,6 +17,9 @@ import { ACTION_TX } from '../../legos/tx'; import { GatedButton } from './GatedButton'; import { VotingBar } from '../VotingBar'; +// Adding to the gas limit to account for cost of processProposal +export const PROCESS_PROPOSAL_GAS_LIMIT_ADDITION = 150000; + const ProcessBox = styled.div` display: flex; justify-content: flex-start; @@ -40,7 +43,10 @@ export const ReadyForProcessing = ({ const [isLoading, setIsLoading] = React.useState(false); const processProposal = async () => { - const { proposalId, proposalData } = proposal; + const { proposalId, proposalData, actionGasEstimate } = proposal; + const processingGasLimit = ( + Number(actionGasEstimate) + PROCESS_PROPOSAL_GAS_LIMIT_ADDITION + ).toFixed(); if (!proposalId) return; setIsLoading(true); @@ -48,6 +54,7 @@ export const ReadyForProcessing = ({ tx: { ...ACTION_TX.PROCESS, staticArgs: [proposalId, proposalData], + overrides: { gasLimit: processingGasLimit }, } as TXLego, lifeCycleFns: { onTxError: (error) => { diff --git a/apps/core-app/src/pages/ProposalDetails.tsx b/apps/core-app/src/pages/ProposalDetails.tsx index 39a182e28..cdae193d7 100644 --- a/apps/core-app/src/pages/ProposalDetails.tsx +++ b/apps/core-app/src/pages/ProposalDetails.tsx @@ -51,8 +51,6 @@ export function ProposalDetails() { >(); const [proposalLoading, setProposalLoading] = useState(false); - console.log('proposal', proposal); - useEffect(() => { let shouldUpdate = true; if (daochain && daoid && proposalId) { diff --git a/apps/core-app/src/utils/constants.ts b/apps/core-app/src/utils/constants.ts index aa4f5b4a7..7597b2f5a 100644 --- a/apps/core-app/src/utils/constants.ts +++ b/apps/core-app/src/utils/constants.ts @@ -1,5 +1,3 @@ -import { Ordering, Proposal_OrderBy } from '@daohaus/dao-data'; - export const PROPOSAL_FILTERS: { [key: string]: string } = { unsponsored: 'Unsponsored', voting: 'In Voting', diff --git a/apps/v3-subgraph/src/baal-mapping.ts b/apps/v3-subgraph/src/baal-mapping.ts index 3c2bcd117..faf0d19dc 100644 --- a/apps/v3-subgraph/src/baal-mapping.ts +++ b/apps/v3-subgraph/src/baal-mapping.ts @@ -188,7 +188,6 @@ export function handleSubmitProposal(event: SubmitProposal): void { proposal.prevProposalId = event.params.selfSponsor ? dao.latestSponsoredProposalId : constants.BIGINT_ZERO; - proposal.prevProposalId = constants.BIGINT_ZERO; proposal.votingStarts = event.params.selfSponsor ? event.block.timestamp : constants.BIGINT_ZERO; diff --git a/libs/common-utilities/src/constants/endpoints.ts b/libs/common-utilities/src/constants/endpoints.ts index 4a6ccd2ea..27105c13e 100644 --- a/libs/common-utilities/src/constants/endpoints.ts +++ b/libs/common-utilities/src/constants/endpoints.ts @@ -29,7 +29,9 @@ export const ENDPOINTS: KeychainList = { }, GAS_ESTIMATE: { '0x5': - 'https://safe-transaction.goerli.gnosis.io/api/v1/safes/0x1A3Bc7b8Df22eC917aB4260a951987D975906843/multisig-transactions/estimations/', + 'https://safe-transaction.goerli.gnosis.io/api/v1/safes/<>/multisig-transactions/estimations/', + '0x64': + 'https://safe-transaction.goerli.gnosis.io/api/v1/safes/<>/multisig-transactions/estimations/', }, GNOSIS_SAFE_UI: { '0x1': 'https://gnosis-safe.io/app/eth', diff --git a/libs/common-utilities/src/types/legoTypes.ts b/libs/common-utilities/src/types/legoTypes.ts index 36469d381..e52653acb 100644 --- a/libs/common-utilities/src/types/legoTypes.ts +++ b/libs/common-utilities/src/types/legoTypes.ts @@ -112,6 +112,14 @@ export type TxStates = | 'failed' | 'success'; +export type TXOverrides = { + gasLimit?: string; + value?: string; + gasPrice?: string; + from?: string; + blockTag?: string; +}; + export type TXLegoBase = { id: string; contract: ContractLego; @@ -120,6 +128,7 @@ export type TXLegoBase = { args?: ValidArgType[]; argCallback?: string; staticArgs?: ArgType[]; + overrides?: TXOverrides; }; export type TXLego = RequireOnlyOne< diff --git a/libs/dao-data/src/utils/transformers.ts b/libs/dao-data/src/utils/transformers.ts index 79d85d9ce..02d77a1fb 100644 --- a/libs/dao-data/src/utils/transformers.ts +++ b/libs/dao-data/src/utils/transformers.ts @@ -105,14 +105,17 @@ export const addDaoProfileFields = ( obj.links && typeof obj.links === 'string' ? JSON.parse(obj.links) : obj.links; + + const avatarUrl = + obj.avatarImg && obj.avatarImg.match(/Qm[a-zA-Z0-9/.]+/) + ? `https://daohaus.mypinata.cloud/ipfs/${obj.avatarImg.match( + /Qm[a-zA-Z0-9/.]+/ + )}` + : obj.avatarImg; return { description: obj.description, longDescription: obj.longDescription, - avatarImg: - obj.avatarImg && - `https://daohaus.mypinata.cloud/ipfs/${obj.avatarImg.match( - /Qm[a-zA-Z0-9/.]+/ - )}`, + avatarImg: avatarUrl, tags: obj.tags, links, }; diff --git a/libs/tx-builder-feature/src/utils/args.ts b/libs/tx-builder-feature/src/utils/args.ts index 92669b81a..d80a3cc31 100644 --- a/libs/tx-builder-feature/src/utils/args.ts +++ b/libs/tx-builder-feature/src/utils/args.ts @@ -120,6 +120,7 @@ export const processArg = async ({ return result; } if (arg?.type === 'estimateGas') { + console.log('********ESTIMATE'); const result = await handleGasEstimate({ arg, chainId, diff --git a/libs/tx-builder-feature/src/utils/contractHelpers.ts b/libs/tx-builder-feature/src/utils/contractHelpers.ts index e1bb92811..ca6b3dccc 100644 --- a/libs/tx-builder-feature/src/utils/contractHelpers.ts +++ b/libs/tx-builder-feature/src/utils/contractHelpers.ts @@ -25,7 +25,6 @@ const findTargetAddress = ({ targetAddress: StringSearch | Keychain; chainId: ValidNetwork; }) => { - console.log('targetAddress', targetAddress, chainId, appState); if (typeof targetAddress === 'string' && isSearchArg(targetAddress)) { return searchArg({ searchString: targetAddress, diff --git a/libs/tx-builder-feature/src/utils/multicall.ts b/libs/tx-builder-feature/src/utils/multicall.ts index 8db21769b..1064be3b7 100644 --- a/libs/tx-builder-feature/src/utils/multicall.ts +++ b/libs/tx-builder-feature/src/utils/multicall.ts @@ -194,13 +194,16 @@ export const handleGasEstimate = async ({ actions: arg.actions, }, }); + const estimate = await estimateGas({ chainId, safeId, data: proposalData, }); + + console.log('estimate', estimate); if (estimate.safeTxGas) { - const buffer = arg.bufferPercentage ? `1.${arg.bufferPercentage}` : 1.3; + const buffer = arg.bufferPercentage ? `1.${arg.bufferPercentage}` : 1.6; return Math.round(Number(estimate.safeTxGas) * Number(buffer)); } else { throw new Error(`Failed to estimate gas: `); @@ -242,13 +245,9 @@ export const buildMultiCallTX = ({ fallback: 0, }, { - type: 'static', - value: 0, + type: 'estimateGas', + actions, }, - // { - // type: 'estimateGas', - // actions, - // }, JSONDetails, ], }; diff --git a/libs/tx-builder-feature/src/utils/overrides.ts b/libs/tx-builder-feature/src/utils/overrides.ts new file mode 100644 index 000000000..5fcead373 --- /dev/null +++ b/libs/tx-builder-feature/src/utils/overrides.ts @@ -0,0 +1,16 @@ +import { ArbitraryState, TXOverrides } from '@daohaus/common-utilities'; + +export const processOverrides = ({ + overrideArgs, + appState, +}: { + overrideArgs?: TXOverrides; + appState: ArbitraryState; +}): TXOverrides => { + return { + value: appState['formValues']?.proposalOffering + ? Number(appState['formValues']?.proposalOffering).toFixed() + : '0', + ...overrideArgs, + }; +}; diff --git a/libs/tx-builder-feature/src/utils/txBuilderUtils.ts b/libs/tx-builder-feature/src/utils/txBuilderUtils.ts index 0efe68f51..5a3173a32 100644 --- a/libs/tx-builder-feature/src/utils/txBuilderUtils.ts +++ b/libs/tx-builder-feature/src/utils/txBuilderUtils.ts @@ -12,6 +12,7 @@ import { pollLastTX, standardGraphPoll, testLastTX } from './polling'; import { processArgs } from './args'; import { processContractLego } from './contractHelpers'; import { ArgCallback, TXLifeCycleFns } from '../TXBuilder'; +import { processOverrides } from './overrides'; export type TxRecord = Record; export type MassState = { @@ -141,14 +142,10 @@ export async function prepareTX(args: { console.log('**PROCESSED ARGS**', processedArgs); - // TODO for gasLimit and value - // const processOverrides = await - // looks in the lego and gets value and/or gasLimit - // returns {} or { - // value: '1000000000', - // gasLimit: '1000000', - // } - // add new overrides to tx lego and it can use the process args stuff and all current arg types + const overrides = processOverrides({ + overrideArgs: tx.overrides, + appState, + }); const contract = new ethers.Contract( address, @@ -157,12 +154,11 @@ export async function prepareTX(args: { ); lifeCycleFns?.onRequestSign?.(); - // const ethersTx = await contract.functions[method](...processedArgs, { - // value: '1000000000', - // gasLimit: '1000000', - // }); - const ethersTx = await contract.functions[method](...processedArgs); + const ethersTx = await contract.functions[method]( + ...processedArgs, + overrides + ); executeTx({ ...args, ethersTx }); } catch (error) { console.log('**TX Error (Pre-Fire)**');