Skip to content

Commit d555161

Browse files
committed
test
1 parent 0a63dcf commit d555161

File tree

1 file changed

+73
-1
lines changed

1 file changed

+73
-1
lines changed

packages/thirdweb/src/extensions/prebuilts/process-ref-deployments.test.ts

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ describe.runIf(process.env.TW_SECRET_KEY)(
1717
let mintfeeManagerModuleAddress: string;
1818
let mintfeeManagerCoreAddress: string;
1919
let claimableModuleAddress: string;
20+
let wethAddress: string;
21+
let forwarderAddress: string;
22+
let multiwrapAddress: string;
2023

2124
beforeAll(async () => {
2225
multisigAddress = await deployPublishedContract({
@@ -55,9 +58,59 @@ describe.runIf(process.env.TW_SECRET_KEY)(
5558
salt: "tw",
5659
publisher: "0x6453a486d52e0EB6E79Ec4491038E2522a926936",
5760
});
61+
62+
wethAddress = await deployPublishedContract({
63+
client: TEST_CLIENT,
64+
chain: ANVIL_CHAIN,
65+
account: TEST_ACCOUNT_A,
66+
contractId: "WETH9",
67+
version: "0.0.1",
68+
salt: "thirdweb",
69+
publisher: "0x6453a486d52e0EB6E79Ec4491038E2522a926936",
70+
});
71+
forwarderAddress = await deployPublishedContract({
72+
client: TEST_CLIENT,
73+
chain: ANVIL_CHAIN,
74+
account: TEST_ACCOUNT_A,
75+
contractId: "Forwarder",
76+
version: "0.0.1",
77+
salt: "thirdweb",
78+
publisher: "0x6453a486d52e0EB6E79Ec4491038E2522a926936",
79+
});
80+
multiwrapAddress = await deployPublishedContract({
81+
client: TEST_CLIENT,
82+
chain: ANVIL_CHAIN,
83+
account: TEST_ACCOUNT_A,
84+
contractId: "Multiwrap",
85+
version: "0.0.4",
86+
publisher: "0x6453a486d52e0EB6E79Ec4491038E2522a926936",
87+
contractParams: {
88+
_defaultAdmin: TEST_ACCOUNT_A.address,
89+
_name: "test",
90+
_symbol: "test",
91+
_contractURI: "",
92+
_trustedForwarders: {
93+
defaultValue: "",
94+
dynamicValue: {
95+
type: "address[]",
96+
refContracts: [
97+
{
98+
contractId: "Forwarder",
99+
version: "0.0.1",
100+
publisherAddress:
101+
"0x6453a486d52e0EB6E79Ec4491038E2522a926936",
102+
salt: "",
103+
},
104+
],
105+
},
106+
},
107+
_royaltyRecipient: TEST_ACCOUNT_A.address,
108+
_royaltyBps: 500n,
109+
},
110+
});
58111
}, 120000);
59112

60-
it("should set ref contract dependencies", async () => {
113+
it("should set ref contract dependencies for direct deploy contracts", async () => {
61114
const claimableModule = getContract({
62115
client: TEST_CLIENT,
63116
chain: ANVIL_CHAIN,
@@ -99,5 +152,24 @@ describe.runIf(process.env.TW_SECRET_KEY)(
99152
expect(feeRecipient.toLowerCase()).to.eq(multisigAddress);
100153
expect(fee).to.eq(5n);
101154
});
155+
156+
it("should set ref contract dependencies for auto factory contracts", async () => {
157+
const multiwrap = getContract({
158+
client: TEST_CLIENT,
159+
chain: ANVIL_CHAIN,
160+
address: multiwrapAddress,
161+
});
162+
const fetchedWethAddress = await readContract({
163+
contract: multiwrap,
164+
method: "function nativeTokenWrapper() returns (address)",
165+
});
166+
const isTrustedForwarder = await readContract({
167+
contract: multiwrap,
168+
method: "function isTrustedForwarder(address forwarder) returns (bool)",
169+
params: [forwarderAddress],
170+
});
171+
expect(fetchedWethAddress.toLowerCase()).to.eq(wethAddress);
172+
expect(isTrustedForwarder).to.be.true;
173+
});
102174
},
103175
);

0 commit comments

Comments
 (0)