Skip to content

Commit

Permalink
Merge pull request #251 from skalenetwork/merge-stable
Browse files Browse the repository at this point in the history
Merge stable
  • Loading branch information
DimaStebaev authored Jan 12, 2024
2 parents 6d01a7e + e91d7f2 commit f35d069
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- beta
- develop
env:
NODE_VERSION: 18
NODE_VERSION: 20

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@
"@openzeppelin/upgrades-core": "^1.27.1",
"@types/mocha": "^9.1.0",
"ethers": "^5.7.2",
"hardhat": "2.8.3 - 2.16.1"
"hardhat": "^2.16.1"
}
}
22 changes: 1 addition & 21 deletions src/gnosis-safe.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import chalk from "chalk";
import { ethers } from "hardhat";
import { UnsignedTransaction } from "ethers";
import SafeApiKit from '@safe-global/api-kit'
import Safe, { EthersAdapter } from '@safe-global/protocol-kit'
import { MetaTransactionData, SafeTransactionDataPartial, SafeTransaction } from '@safe-global/safe-core-sdk-types'
import { MetaTransactionData, SafeTransaction } from '@safe-global/safe-core-sdk-types'


enum Network {
Expand Down Expand Up @@ -53,30 +52,11 @@ export async function createMultiSendTransaction(safeAddress: string, transactio
safeSdk = await Safe.create({ ethAdapter, safeAddress }),
safeTransaction = await safeSdk.createTransaction({ safeTransactionData, options });

await estimateSafeTransaction(safeAddress, safeTransactionData);

await proposeTransaction(safeAddress, safeTransaction);
}

// private functions

async function estimateSafeTransaction(safeAddress: string, safeTransactionData: SafeTransactionDataPartial | MetaTransactionData[]) {
console.log("Estimate gas");
const safeService = await getSafeService();
for (const transaction of safeTransactionData as MetaTransactionData[]) {
const estimateResponse = await safeService.estimateSafeTransaction(
safeAddress,
{
to: transaction.to,
value: transaction.value,
data: transaction.data,
operation: transaction.operation || 0,
}
);
console.log(chalk.cyan(`Recommend to set gas limit to ${parseInt(estimateResponse.safeTxGas, 10)}`));
}
console.log(chalk.green("Send transaction to gnosis safe"));
}

async function proposeTransaction(safeAddress: string, safeTransaction: SafeTransaction) {
const
Expand Down

0 comments on commit f35d069

Please sign in to comment.