@safe-global/safe-core-sdk
Advanced tools
Comparing version 3.3.4 to 3.3.5
@@ -20,2 +20,3 @@ "use strict"; | ||
const satisfies_1 = __importDefault(require("semver/functions/satisfies")); | ||
const zksync_web3_1 = require("zksync-web3"); | ||
const config_1 = require("../contracts/config"); | ||
@@ -26,2 +27,17 @@ const safeDeploymentContracts_1 = require("../contracts/safeDeploymentContracts"); | ||
const utils_1 = require("./utils"); | ||
const ZKSYNC_MAINNET = 324; | ||
const ZKSYNC_TESTNET = 280; | ||
// For bundle size efficiency we store SafeProxy.sol/GnosisSafeProxy.sol zksync bytecode hash in hex. | ||
// To get the values below we need to: | ||
// 1. Compile Safe smart contracts for zksync | ||
// 2. Get `deployedBytecode` from SafeProxy.json/GnosisSafeProxy.json | ||
// 3. Use zksync-web3 SDK to get the bytecode hash | ||
// const bytecodeHash = zkSyncUtils.hashBytecode(${deployedBytecode}) | ||
// 4. Use ethers to convert the array into hex | ||
// const deployedBytecodeHash = ethers.utils.hexlify(bytecodeHash) | ||
const ZKSYNC_SAFE_PROXY_DEPLOYED_BYTECODE = { | ||
'1.3.0': { | ||
deployedBytecodeHash: '0x0100004124426fb9ebb25e27d670c068e52f9ba631bd383279a188be47e3f86d' | ||
} | ||
}; | ||
class SafeFactory { | ||
@@ -122,3 +138,12 @@ constructor() { | ||
const proxyCreationCode = await __classPrivateFieldGet(this, _SafeFactory_safeProxyFactoryContract, "f").proxyCreationCode(); | ||
const constructorData = (0, ethereumjs_util_1.toBuffer)(__classPrivateFieldGet(this, _SafeFactory_ethAdapter, "f").encodeParameters(['address'], [__classPrivateFieldGet(this, _SafeFactory_gnosisSafeContract, "f").getAddress()])).toString('hex'); | ||
const input = __classPrivateFieldGet(this, _SafeFactory_ethAdapter, "f").encodeParameters(['address'], [__classPrivateFieldGet(this, _SafeFactory_gnosisSafeContract, "f").getAddress()]); | ||
const chainId = await __classPrivateFieldGet(this, _SafeFactory_ethAdapter, "f").getChainId(); | ||
// zkSync Era counterfactual deployment is calculated differently | ||
// https://era.zksync.io/docs/reference/architecture/differences-with-ethereum.html#create-create2 | ||
if ([ZKSYNC_MAINNET, ZKSYNC_TESTNET].includes(chainId)) { | ||
const safeVersion = await __classPrivateFieldGet(this, _SafeFactory_gnosisSafeContract, "f").getVersion(); | ||
const bytecodeHash = ZKSYNC_SAFE_PROXY_DEPLOYED_BYTECODE[safeVersion].deployedBytecodeHash; | ||
return zksync_web3_1.utils.create2Address(from, bytecodeHash, salt, input); | ||
} | ||
const constructorData = (0, ethereumjs_util_1.toBuffer)(input).toString('hex'); | ||
const initCode = proxyCreationCode + constructorData; | ||
@@ -125,0 +150,0 @@ const proxyAddress = '0x' + (0, ethereumjs_util_1.generateAddress2)((0, ethereumjs_util_1.toBuffer)(from), (0, ethereumjs_util_1.toBuffer)(salt), (0, ethereumjs_util_1.toBuffer)(initCode)).toString('hex'); |
@@ -0,0 +0,0 @@ MIT License |
{ | ||
"name": "@safe-global/safe-core-sdk", | ||
"version": "3.3.4", | ||
"version": "3.3.5", | ||
"description": "Safe Core SDK", | ||
@@ -54,4 +54,4 @@ "main": "dist/src/index.js", | ||
"@nomiclabs/hardhat-web3": "^2.0.0", | ||
"@safe-global/safe-ethers-lib": "^1.9.3", | ||
"@safe-global/safe-web3-lib": "^1.9.3", | ||
"@safe-global/safe-ethers-lib": "^1.9.4", | ||
"@safe-global/safe-web3-lib": "^1.9.4", | ||
"@types/chai": "^4.3.4", | ||
@@ -93,3 +93,4 @@ "@types/chai-as-promised": "^7.1.5", | ||
"semver": "^7.3.8", | ||
"web3-utils": "^1.8.1" | ||
"web3-utils": "^1.8.1", | ||
"zksync-web3": "^0.14.3" | ||
}, | ||
@@ -96,0 +97,0 @@ "lint-staged": { |
@@ -0,0 +0,0 @@ # Safe Core SDK |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
276749
2504
8
1
+ Addedzksync-web3@^0.14.3
+ Added@ethersproject/basex@5.7.0(transitive)
+ Added@ethersproject/hdnode@5.7.0(transitive)
+ Added@ethersproject/json-wallets@5.7.0(transitive)
+ Added@ethersproject/pbkdf2@5.7.0(transitive)
+ Added@ethersproject/providers@5.7.2(transitive)
+ Added@ethersproject/random@5.7.0(transitive)
+ Added@ethersproject/units@5.7.0(transitive)
+ Added@ethersproject/wallet@5.7.0(transitive)
+ Added@ethersproject/wordlists@5.7.0(transitive)
+ Addedaes-js@3.0.0(transitive)
+ Addedbech32@1.1.4(transitive)
+ Addedethers@5.7.2(transitive)
+ Addedws@7.4.6(transitive)
+ Addedzksync-web3@0.14.4(transitive)