@mapprotocol/common-contracts 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/utils/dist/factory.js +4 -2
- package/utils/factory.ts +4 -2
package/package.json
CHANGED
package/utils/dist/factory.js
CHANGED
|
@@ -71,7 +71,8 @@ async function evmDeployByFactory(ethers, salt, bytecode, constructorArgs = "0x"
|
|
|
71
71
|
if (code === "0x")
|
|
72
72
|
throw new Error("factory not deployed on this chain");
|
|
73
73
|
const saltHash = ethers.keccak256(ethers.toUtf8Bytes(salt));
|
|
74
|
-
|
|
74
|
+
// Use getFunction: ethers v6 Contract has a built-in getAddress() that shadows the ABI method
|
|
75
|
+
const predicted = await factory.getFunction("getAddress")(saltHash);
|
|
75
76
|
const existingCode = await ethers.provider.getCode(predicted);
|
|
76
77
|
if (existingCode !== "0x") {
|
|
77
78
|
console.log(`already deployed at ${predicted}`);
|
|
@@ -98,7 +99,8 @@ async function evmDeployByFactory(ethers, salt, bytecode, constructorArgs = "0x"
|
|
|
98
99
|
async function evmGetFactoryAddress(ethers, salt) {
|
|
99
100
|
const factory = new ethers.Contract(EVM_FACTORY, EVM_FACTORY_ABI, await ethers.provider);
|
|
100
101
|
const saltHash = ethers.keccak256(ethers.toUtf8Bytes(salt));
|
|
101
|
-
|
|
102
|
+
// Use getFunction: ethers v6 Contract has a built-in getAddress() that shadows the ABI method
|
|
103
|
+
return factory.getFunction("getAddress")(saltHash);
|
|
102
104
|
}
|
|
103
105
|
// ============================================================
|
|
104
106
|
// Tron Factory (CREATE2, tronweb)
|
package/utils/factory.ts
CHANGED
|
@@ -76,7 +76,8 @@ export async function evmDeployByFactory(
|
|
|
76
76
|
if (code === "0x") throw new Error("factory not deployed on this chain");
|
|
77
77
|
|
|
78
78
|
const saltHash = ethers.keccak256(ethers.toUtf8Bytes(salt));
|
|
79
|
-
|
|
79
|
+
// Use getFunction: ethers v6 Contract has a built-in getAddress() that shadows the ABI method
|
|
80
|
+
const predicted = await factory.getFunction("getAddress")(saltHash);
|
|
80
81
|
|
|
81
82
|
const existingCode = await ethers.provider.getCode(predicted);
|
|
82
83
|
if (existingCode !== "0x") {
|
|
@@ -108,7 +109,8 @@ export async function evmDeployByFactory(
|
|
|
108
109
|
export async function evmGetFactoryAddress(ethers: any, salt: string): Promise<string> {
|
|
109
110
|
const factory = new ethers.Contract(EVM_FACTORY, EVM_FACTORY_ABI, await ethers.provider);
|
|
110
111
|
const saltHash = ethers.keccak256(ethers.toUtf8Bytes(salt));
|
|
111
|
-
|
|
112
|
+
// Use getFunction: ethers v6 Contract has a built-in getAddress() that shadows the ABI method
|
|
113
|
+
return factory.getFunction("getAddress")(saltHash);
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
// ============================================================
|