Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
RodrigoAD committed Feb 18, 2022
1 parent 076a163 commit 45a7bd0
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ DEFAULT_GAS_PRICE=0.5
LINK=terra1fcksmfjncl6m7apvpalvhwv5jxd9djv5lwyu82
BILLING_ACCESS_CONTROLLER=terra1trcufj64y53hxk7g8cra33xw3jkyvlr9lu99eu
REQUESTER_ACCESS_CONTROLLER=terra1s38kfu4qp0ttwxkka9zupaysefl5qruhv5rc0z
MULTISIG_GROUP=terra168lv95kfm49y9zu0409jmplj756ukxdrew7uta
MULTISIG_WALLET=terra1u89pduw4enewduy9qydj925738cyn9juszgj54

CW4_GROUP=terra1edk45cc6rckjszfmr87qfx50pfn2mnhg5mn3vd
CW3_FLEX_MULTISIG=terra1cql0r4csmce0ntf68dmkvu3negs7m662uyg90g
2 changes: 1 addition & 1 deletion packages-ts/gauntlet-terra-contracts/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { executeCLI } from '@chainlink/gauntlet-core'
import { multisigWrapCommand } from '@chainlink/gauntlet-terra-cw20-multisig'
import { multisigWrapCommand } from '@chainlink/gauntlet-terra-cw-plus'
import { existsSync } from 'fs'
import path from 'path'
import { io } from '@chainlink/gauntlet-core/dist/utils'
Expand Down
2 changes: 1 addition & 1 deletion packages-ts/gauntlet-terra-contracts/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const enum CATEGORIES {
DEVIATION_FLAGGING_VALIDATOR = 'Devaiation Flagging Validator',
}

export const DEFAULT_RELEASE_VERSION = 'v0.0.4'
export const DEFAULT_RELEASE_VERSION = 'local'
export const DEFAULT_CWPLUS_VERSION = 'v0.9.1'

export const ORACLES_MAX_LENGTH = 31
Expand Down
1 change: 1 addition & 0 deletions packages-ts/gauntlet-terra-cw-plus/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Gauntlet Terra CW Plus
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@chainlink/gauntlet-terra-cw20-multisig",
"name": "@chainlink/gauntlet-terra-cw-plus",
"version": "0.0.1",
"description": "Gauntlet Terra Cw20 Multisig",
"description": "Gauntlet Terra CW Plus contracts",
"keywords": [
"typescript",
"cli"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ export const wrapCommand = (command) => {

this.command = new command(flags, args)

if (!AccAddress.validate(process.env.MULTISIG_ADDRESS)) throw new Error(`Invalid Multisig wallet address`)
if (!AccAddress.validate(process.env.MULTISIG_GROUP)) throw new Error(`Invalid Multisig group address`)
this.multisig = process.env.MULTISIG_ADDRESS as AccAddress
this.multisigGroup = process.env.MULTISIG_GROUP as AccAddress
if (!AccAddress.validate(process.env.CW3_FLEX_MULTISIG)) throw new Error(`Invalid Multisig wallet address`)
if (!AccAddress.validate(process.env.CW4_GROUP)) throw new Error(`Invalid Multisig group address`)
this.multisig = process.env.CW3_FLEX_MULTISIG as AccAddress
this.multisigGroup = process.env.CW4_GROUP as AccAddress
}

makeRawTransaction = async (signer: AccAddress, state?: State) => {
const message = await this.command.makeRawTransaction(this.multisig)

const operations = {
[Action.CREATE]: this.executePropose,
[Action.APPROVE]: this.executeApproval,
[Action.EXECUTE]: this.executeExecution,
[Action.CREATE]: this.makeProposeTransaction,
[Action.APPROVE]: this.makeAcceptTransaction,
[Action.EXECUTE]: this.makeExecuteTransaction,
[Action.NONE]: () => {
throw new Error('No action needed')
},
Expand Down Expand Up @@ -104,7 +104,7 @@ export const wrapCommand = (command) => {
}
}

executePropose: ProposalAction = async (signer, _, message) => {
makeProposeTransaction: ProposalAction = async (signer, _, message) => {
logger.info('Generating data for creating new proposal')
const proposeInput = {
propose: {
Expand All @@ -118,7 +118,7 @@ export const wrapCommand = (command) => {
return new MsgExecuteContract(signer, this.multisig, proposeInput)
}

executeApproval: ProposalAction = async (signer, proposalId) => {
makeAcceptTransaction: ProposalAction = async (signer, proposalId) => {
logger.info(`Generating data for approving proposal ${proposalId}`)
const approvalInput = {
vote: {
Expand All @@ -129,7 +129,7 @@ export const wrapCommand = (command) => {
return new MsgExecuteContract(signer, this.multisig, approvalInput)
}

executeExecution: ProposalAction = async (signer, proposalId) => {
makeExecuteTransaction: ProposalAction = async (signer, proposalId) => {
logger.info(`Generating data for executing proposal ${proposalId}`)
const executeInput = {
execute: {
Expand Down
1 change: 0 additions & 1 deletion packages-ts/gauntlet-terra-cw20-multisig/README.md

This file was deleted.

8 changes: 2 additions & 6 deletions packages-ts/gauntlet-terra/src/commands/internal/terra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,10 @@ export default abstract class TerraCommand extends WriteCommand<TransactionRespo

logger.loading('Sending transaction...')
const res = await this.provider.tx.broadcast(tx)

logger.debug(res)
return this.wrapResponse(res)
} catch (e) {
const details = e.response.data
throw new Error(details.message)
const message = e?.response?.data?.message || e.message
throw new Error(message)
}
}

Expand All @@ -96,8 +94,6 @@ export default abstract class TerraCommand extends WriteCommand<TransactionRespo
})

const res = await this.provider.tx.broadcast(tx)

logger.debug(res)
return this.wrapResponse(res)
}

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"path": "./packages-ts/gauntlet-terra"
},
{
"path": "./packages-ts/gauntlet-terra-cw20-multisig"
"path": "./packages-ts/gauntlet-terra-cw-plus"
},
{
"path": "./packages-ts/gauntlet-terra-contracts"
Expand Down

0 comments on commit 45a7bd0

Please sign in to comment.