Skip to content

Commit

Permalink
fix: polygon addresses
Browse files Browse the repository at this point in the history
- fix palmera module address in polygon
- fix palmera guard in polygon
- remove unused packages
  • Loading branch information
zach88 committed Oct 21, 2024
1 parent cff67c3 commit 8c04a77
Show file tree
Hide file tree
Showing 4 changed files with 350 additions and 3,155 deletions.
23 changes: 1 addition & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@keyper-labs/palmera-module-sdk",
"version": "0.2.7",
"version": "0.2.9",
"description": "Palmera module sdk",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
Expand Down Expand Up @@ -28,32 +28,11 @@
],
"devDependencies": {
"@eslint/js": "^9.9.1",
"@nomicfoundation/hardhat-chai-matchers": "^2.0.7",
"@nomicfoundation/hardhat-ethers": "^3.0.6",
"@nomicfoundation/hardhat-foundry": "^1.1.2",
"@nomicfoundation/hardhat-ignition": "^0.15.5",
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.5",
"@nomicfoundation/hardhat-network-helpers": "^1.0.11",
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.9",
"@nomicfoundation/ignition-core": "^0.15.5",
"@safe-global/safe-core-sdk-types": "^4.0.2",
"@typechain/ethers-v6": "^0.5.1",
"@typechain/hardhat": "^9.1.0",
"@types/chai": "^4.3.17",
"@types/mocha": "^10.0.7",
"@types/node": "^22.4.1",
"chai": "^4.5.0",
"eslint": "^9.9.1",
"globals": "^15.9.0",
"hardhat": "^2.22.8",
"hardhat-contract-sizer": "^2.10.0",
"hardhat-gas-reporter": "^1.0.10",
"jsdoc-to-markdown": "^9.0.2",
"prettier": "^3.3.3",
"solidity-coverage": "^0.8.12",
"ts-node": "^10.9.2",
"typechain": "^8.3.2",
"typescript": "^5.4.5",
"typescript-eslint": "^8.3.0"
},
Expand Down
20 changes: 14 additions & 6 deletions src/Palmera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
} from '@safe-global/safe-core-sdk-types'
import { decodeFunctionResult, encodeFunctionData, Hex, zeroAddress } from 'viem'
import palmeraModule from './assets/palmeraModule'
import palmeraGuard from './assets/palmeraGuard'
import {
AddOwnerWithThresholdParams,
AddSafeTxParams,
Expand All @@ -34,7 +33,7 @@ import {
UpdateDepthLimitsParams,
UpdateSuperParams,
} from './types'
import { getPalmeraModuleDeploymentNonDeterministic } from './deployments/factory'
import { getPalmeraGuardDeploymentNonDeterministic, getPalmeraModuleDeploymentNonDeterministic } from './deployments/factory'

/**
* The Palmera class provides a set of methods to interact with the Palmera module and guard.
Expand All @@ -46,6 +45,7 @@ class Palmera {
#orgHash!: Hex
#chainId!: bigint
#moduleAddress!: Hex
#guardAddress!: Hex

/**
* Initializes a new instance of the Palmera class.
Expand Down Expand Up @@ -79,14 +79,22 @@ class Palmera {
this.#safeAddress = (await this.#protocolKit.getAddress()) as Hex
this.#chainId = await this.#protocolKit.getChainId()

const deployment = getPalmeraModuleDeploymentNonDeterministic({
const moduleAddress = getPalmeraModuleDeploymentNonDeterministic({
network: this.#chainId.toString(),
released: true,
version: '1',
})
if (!deployment) throw new Error('Palmera module not found for given network')
if (!moduleAddress) throw new Error('Palmera module not found for given network')

this.#moduleAddress = deployment as Hex
const guardAddress = getPalmeraGuardDeploymentNonDeterministic({
network: this.#chainId.toString(),
released: true,
version: '1',
})


this.#moduleAddress = moduleAddress as Hex
this.#guardAddress = guardAddress as Hex
this.#orgHash = await this.getOrgHashBySafe(this.#safeAddress)
}

Expand Down Expand Up @@ -155,7 +163,7 @@ class Palmera {
@returns {Promise<SafeTransaction>} A promise that resolves to a SafeTransaction.
*/
async enableGuardTx(): Promise<SafeTransaction> {
return this.#protocolKit.createEnableGuardTx(palmeraGuard.defaultAddress)
return this.#protocolKit.createEnableGuardTx(this.#guardAddress)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/deployments/v1/palmeraModuleNonDeterministic.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"contractName": "PalmeraModule",
"version": "1.0.0",
"networkAddress": {
"137": "0x0bc93BAe0b12BE14E38a89D23A3f26839172b297",
"137": "0xe442648faF248ceEBb5F090cE1900483BC13ed3F",
"11155111": "0x9380FB80c19C13a654a101C3200e7CA93C8357c3"
}
}
Loading

0 comments on commit 8c04a77

Please sign in to comment.