Skip to content

Commit

Permalink
maint(core): Remove extra CLI tasks (sphinx-labs#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
RPate97 authored Apr 27, 2023
1 parent 93fcda1 commit c69aa51
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 1,558 deletions.
6 changes: 6 additions & 0 deletions .changeset/yellow-wombats-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@chugsplash/plugins': patch
'@chugsplash/core': patch
---

Remove extra CLI tasks
24 changes: 0 additions & 24 deletions docs/foundry/api-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@ This document is a work in progress.
- [Deploy](#Deploy)
- [Register](#Register)
- [Propose](#Propose)
- [Approve](#Approve)
- [Fund](#Fund)
- [Monitor](#Monitor)
- [Withdraw](#Withdraw)
- [List Projects](#List-Projects)
- [List Proposers](#List-Proposers)
- [Add Proposer](#Add-Proposer)
- [Transfer Proxy](#Transfer-Proxy)

## Deploy
Expand All @@ -25,29 +19,11 @@ Todo
## Propose
Todo

## Approve
Todo

## Fund
Todo

## Monitor
Todo

## Cancel
Todo

## Withdraw
Todo

## List Projects
Todo

## List Proposers
Todo

## Add Proposer
Todo

## Transfer Proxy
Todo
125 changes: 0 additions & 125 deletions packages/core/src/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,56 +139,6 @@ export const trackDeployed = async (
)
}

export const trackFund = async (
user_id: string,
organizationID: string,
projectName: string,
networkName: string,
integration: Integration
) => {
if (disableAnalytics) {
return
}
timeout(
await amplitudeClient.logEvent({
event_type: 'chugsplash fund',
user_id,
event_properties: {
organizationID,
projectName,
network: networkName,
integration,
},
}),
10000
)
}

export const trackMonitor = async (
user_id: string,
organizationID: string,
projectName: string,
networkName: string,
integration: Integration
) => {
if (disableAnalytics) {
return
}
timeout(
await amplitudeClient.logEvent({
event_type: 'chugsplash monitor',
user_id,
event_properties: {
organizationID,
projectName,
network: networkName,
integration,
},
}),
10000
)
}

export const trackCancel = async (
user_id: string,
organizationID: string,
Expand All @@ -214,31 +164,6 @@ export const trackCancel = async (
)
}

export const trackWithdraw = async (
user_id: string,
organizationID: string,
projectName: string,
networkName: string,
integration: Integration
) => {
if (disableAnalytics) {
return
}
timeout(
await amplitudeClient.logEvent({
event_type: 'chugsplash withdraw',
user_id,
event_properties: {
organizationID,
projectName,
network: networkName,
integration,
},
}),
10000
)
}

export const trackListProjects = async (
user_id: string,
networkName: string,
Expand All @@ -260,56 +185,6 @@ export const trackListProjects = async (
)
}

export const trackListProposers = async (
user_id: string,
organizationID: string,
projectName: string,
networkName: string,
integration: Integration
) => {
if (disableAnalytics) {
return
}
timeout(
await amplitudeClient.logEvent({
event_type: 'chugsplash list proposers',
user_id,
event_properties: {
organizationID,
projectName,
network: networkName,
integration,
},
}),
10000
)
}

export const trackAddProposers = async (
user_id: string,
organizationID: string,
projectName: string,
networkName: string,
integration: Integration
) => {
if (disableAnalytics) {
return
}
timeout(
await amplitudeClient.logEvent({
event_type: 'chugsplash add proposer',
user_id,
event_properties: {
organizationID,
projectName,
network: networkName,
integration,
},
}),
10000
)
}

export const trackExportProxy = async (
user_id: string,
organizationID: string,
Expand Down
10 changes: 2 additions & 8 deletions packages/core/src/execution/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
writeDeploymentArtifacts,
} from '../actions'
import { ParsedChugSplashConfig } from '../config'
import { EXECUTION_BUFFER_MULTIPLIER, Integration } from '../constants'
import { Integration } from '../constants'
import { getAmountToDeposit } from '../fund'
import { ArtifactPaths } from '../languages'
import {
Expand Down Expand Up @@ -100,13 +100,7 @@ export const monitorExecution = async (
// more funds.
spinner.fail(`Project has insufficient funds to complete the deployment.`)
throw new Error(
`${projectName} has insufficient funds to complete the deployment. Please report this error to improve our deployment cost estimation.
Run the following command to add funds to your deployment so it can be completed:
npx hardhat chugsplash-fund --network <network> --amount ${amountToDeposit.mul(
EXECUTION_BUFFER_MULTIPLIER
)} --config-path <configPath>
`
`${projectName} has insufficient funds to complete the deployment. You'll need to deposit additional funds via the UI.`
)
}

Expand Down
65 changes: 6 additions & 59 deletions packages/core/src/messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,6 @@ chugsplash.claim("${configPath}");
}
}

export const errorProjectCurrentlyActive = (
integration: Integration,
configPath: string
) => {
if (integration === 'hardhat') {
throw new Error(
`Project is currently active. You must cancel the project in order to withdraw funds:
npx hardhat chugsplash-cancel --network <network> --config-path ${configPath}
`
)
} else {
throw new Error(`Project is currently active. You must cancel the project in order to withdraw funds:
chugsplash.cancel("${configPath}");
`)
}
}

export const successfulProposalMessage = async (
provider: ethers.providers.JsonRpcProvider,
amount: BigNumber,
Expand All @@ -66,27 +47,10 @@ export const successfulProposalMessage = async (
): Promise<string> => {
const networkName = await resolveNetworkName(provider, integration)

if (integration === 'hardhat') {
if (amount.gt(0)) {
return `Project successfully proposed on ${networkName}. Fund and approve the deployment using the command:
npx hardhat chugsplash-approve --network <network> --amount ${amount} --config-path ${configPath}`
} else {
return `Project successfully proposed and funded on ${networkName}. Approve the deployment using the command:
npx hardhat chugsplash-approve --network <network> --config-path ${configPath}`
}
if (amount.gt(0)) {
return `Project successfully proposed on ${networkName}. You can now fund and approve the deployment via the UI.`
} else {
if (amount.gt(0)) {
return `Project successfully proposed on ${networkName}. To fund and approve the deployment, call the following functions from your script:
chugsplash.fund(...);
chugsplas.approve(...);`
} else {
return `Project successfully proposed and funded on ${networkName}. To approve the deployment, call the following function from your script:
chugsplas.approve(...);`
}
return `Project successfully proposed and funded on ${networkName}. You can now approve the deployment via the UI.`
}
}

Expand All @@ -98,26 +62,9 @@ export const alreadyProposedMessage = async (
): Promise<string> => {
const networkName = await resolveNetworkName(provider, integration)

if (integration === 'hardhat') {
if (amount.gt(0)) {
return `Project has already been proposed on ${networkName}. Fund and approve the deployment using the command:
npx hardhat chugsplash-approve --network <network> --amount ${amount} --config-path ${configPath}`
} else {
return `Project has already been proposed and funded on ${networkName}. Approve the deployment using the command:
npx hardhat chugsplash-approve --network <network> --config-path ${configPath}`
}
if (amount.gt(0)) {
return `Project has already been proposed on ${networkName}. Fund and approve the deployment via the UI.`
} else {
if (amount.gt(0)) {
return `Project has already been proposed on ${networkName}. To fund and approve the deployment, call the following functions from your script:
chugsplash.fund(...);
chugsplas.approve(...);`
} else {
return `Project has already been proposed and funded on ${networkName}. To approve the deployment, call the following function from your script:
chugsplas.approve(...);`
}
return `Project has already been proposed and funded on ${networkName}. Approve the deployment via the UI.`
}
}
Loading

0 comments on commit c69aa51

Please sign in to comment.