Skip to content

Commit

Permalink
Revert "Send Notification to a URL on proposal created (#877)"
Browse files Browse the repository at this point in the history
This reverts commit 489c5a3.
  • Loading branch information
EightRice authored Dec 16, 2024
1 parent 489c5a3 commit efbf223
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 82 deletions.
21 changes: 0 additions & 21 deletions env.example

This file was deleted.

3 changes: 1 addition & 2 deletions src/services/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ export enum EnvKey {
REACT_APP_BASE_URL = "REACT_APP_BASE_URL",
REACT_APP_DAO_DEPLOYER_API = "REACT_APP_DAO_DEPLOYER_API",
REACT_APP_RPC_NETWORK_GHOSTNET = "REACT_APP_RPC_NETWORK_GHOSTNET",
REACT_APP_RPC_NETWORK_MAINNET = "REACT_APP_RPC_NETWORK_MAINNET",
REACT_APP_PROPOSAL_WEBHOOK_URL = "REACT_APP_PROPOSAL_WEBHOOK_URL"
REACT_APP_RPC_NETWORK_MAINNET = "REACT_APP_RPC_NETWORK_MAINNET"
}

export enum FeatureFlag {
Expand Down
4 changes: 0 additions & 4 deletions src/services/contracts/baseDAO/hooks/useLambdaAddPropose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { useTezos } from "services/beacon/hooks/useTezos"
import mixpanel from "mixpanel-browser"
import { networkNameMap } from "../../../bakingBad"
import { LambdaDAO } from "../lambdaDAO"
import { sendProposalCreatedEvent } from "services/utils/utils"

export const useLambdaAddPropose = () => {
const queryClient = useQueryClient()
Expand Down Expand Up @@ -42,8 +41,6 @@ export const useLambdaAddPropose = () => {
daoType: "Registry"
})

sendProposalCreatedEvent(network, account, dao.data.name, dao.data.address)

await data.confirmation(1)
closeProposalNotification(proposalNotification)
// setProposalDone()
Expand All @@ -56,7 +53,6 @@ export const useLambdaAddPropose = () => {
})

handleClose()

return data
} catch (e) {
console.log(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { useTezos } from "services/beacon/hooks/useTezos"
import mixpanel from "mixpanel-browser"
import { networkNameMap } from "../../../bakingBad"
import { LambdaDAO } from "../lambdaDAO"
import { sendProposalCreatedEvent } from "services/utils/utils"

export const useLambdaExecutePropose = () => {
const queryClient = useQueryClient()
Expand Down Expand Up @@ -43,7 +42,6 @@ export const useLambdaExecutePropose = () => {
dao: dao.data.address,
daoType: "Registry"
})
sendProposalCreatedEvent(network, account, dao.data.name, dao.data.address)

await data.confirmation(1)
closeProposalNotification(proposalNotification)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { useTezos } from "services/beacon/hooks/useTezos"
import mixpanel from "mixpanel-browser"
import { networkNameMap } from "../../../bakingBad"
import { LambdaDAO } from "../lambdaDAO"
import { sendProposalCreatedEvent } from "services/utils/utils"

export const useLambdaRemovePropose = () => {
const queryClient = useQueryClient()
Expand Down Expand Up @@ -41,7 +40,6 @@ export const useLambdaRemovePropose = () => {
dao: dao.data.address,
daoType: "Registry"
})
sendProposalCreatedEvent(network, account, dao.data.name, dao.data.address)

await data.confirmation(1)
closeProposalNotification(proposalNotification)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { useTezos } from "services/beacon/hooks/useTezos"
import { BaseDAO } from "../class"
import { ConfigProposalParams } from "../types"
import { networkNameMap } from "../../../bakingBad"
import { sendProposalCreatedEvent } from "services/utils/utils"
import mixpanel from "mixpanel-browser"

export const useProposeConfigChange = () => {
const queryClient = useQueryClient()
Expand All @@ -32,12 +30,6 @@ export const useProposeConfigChange = () => {
}

const data = await dao.proposeConfigChange(args, tezosToolkit)
mixpanel.track("Proposal Created", {
dao: dao.data.address,
daoType: "Registry"
})
sendProposalCreatedEvent(network, account, dao.data.name, dao.data.address)

await data.confirmation(1)
closeProposalNotification(proposalNotification)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { useNotification } from "modules/common/hooks/useNotification"
import { useTezos } from "services/beacon/hooks/useTezos"
import { BaseDAO } from "../class"
import { networkNameMap } from "../../../bakingBad"
import mixpanel from "mixpanel-browser"
import { sendProposalCreatedEvent } from "services/utils/utils"

export const useProposeDelegationChange = () => {
const queryClient = useQueryClient()
Expand All @@ -31,12 +29,6 @@ export const useProposeDelegationChange = () => {
}

const data = await dao.proposeDelegationChange(newDelegationAddress, tezosToolkit)
mixpanel.track("Proposal Created", {
dao: dao.data.address,
daoType: "Registry"
})
sendProposalCreatedEvent(network, account, dao.data.name, dao.data.address)

await data.confirmation(1)
closeProposalNotification(proposalNotification)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { useNotification } from "modules/common/hooks/useNotification"
import { useTezos } from "services/beacon/hooks/useTezos"
import { BaseDAO } from "../class"
import { networkNameMap } from "../../../bakingBad"
import { sendProposalCreatedEvent } from "services/utils/utils"
import mixpanel from "mixpanel-browser"

export const useProposeGuardianChange = () => {
const queryClient = useQueryClient()
Expand All @@ -31,12 +29,6 @@ export const useProposeGuardianChange = () => {
}

const data = await dao.proposeGuardianChange(newGuardianAddress, tezosToolkit)
mixpanel.track("Proposal Created", {
dao: dao.data.address,
daoType: "Registry"
})
sendProposalCreatedEvent(network, account, dao.data.name, dao.data.address)

await data.confirmation(1)
closeProposalNotification(proposalNotification)

Expand Down
2 changes: 0 additions & 2 deletions src/services/contracts/baseDAO/hooks/useRegistryPropose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { useTezos } from "services/beacon/hooks/useTezos"
import { LambdaDAO } from "../lambdaDAO"
import mixpanel from "mixpanel-browser"
import { networkNameMap } from "../../../bakingBad"
import { sendProposalCreatedEvent } from "services/utils/utils"

export const useRegistryPropose = () => {
const queryClient = useQueryClient()
Expand Down Expand Up @@ -37,7 +36,6 @@ export const useRegistryPropose = () => {
dao: dao.data.address,
daoType: "Registry"
})
sendProposalCreatedEvent(network, account, dao.data.name, dao.data.address)

await data.confirmation(1)
closeProposalNotification(proposalNotification)
Expand Down
2 changes: 0 additions & 2 deletions src/services/contracts/baseDAO/hooks/useTreasuryPropose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { RegistryProposeArgs } from "../lambdaDAO/types"
import mixpanel from "mixpanel-browser"
import { networkNameMap } from "../../../bakingBad"
import { LambdaDAO } from "../lambdaDAO"
import { sendProposalCreatedEvent } from "services/utils/utils"

export const useTreasuryPropose = () => {
const queryClient = useQueryClient()
Expand Down Expand Up @@ -38,7 +37,6 @@ export const useTreasuryPropose = () => {
dao: dao.data.address,
daoType: "Treasury"
})
sendProposalCreatedEvent(network, account, dao.data.name, dao.data.address)

await data.confirmation(1)
closeProposalNotification(proposalNotification)
Expand Down
23 changes: 0 additions & 23 deletions src/services/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,26 +250,3 @@ export const validateTokenAddress = (network: Network, tokenAddress: string) =>
if (network.startsWith("etherlink")) return isEtherAddress(tokenAddress) ? 3 : false
return false
}

export const sendProposalCreatedEvent = async (
network: Network,
proposerAddress: string,
daoName: string,
daoAddress: string
) => {
const url = getEnv(EnvKey.REACT_APP_PROPOSAL_WEBHOOK_URL)
const response = await fetch(url, {
method: "POST",
body: JSON.stringify({
network,
proposer: proposerAddress,
dao_name: daoName,
dao_address: daoAddress
})
})
if (!response.ok) {
console.error("Failed to send proposal created event", response)
return false
}
return true
}

0 comments on commit efbf223

Please sign in to comment.