-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fd5d37e
commit 62f7390
Showing
4 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules"; | ||
import { contractsInfo } from "../../helpers/constants"; | ||
|
||
export const SponsorPaymentProxyModule = buildModule("SponsorPaymentProxyModule", (m) => { | ||
const proxyAdminOwner = m.getAccount(0); | ||
|
||
// This contract is supposed to be deployed to the same address across many networks, | ||
// so the first implementation address is a dummy contract that does nothing but accepts any calldata. | ||
// Therefore, it is a mechanism to deploy TransparentUpgradeableProxy contract | ||
// with constant constructor arguments, so predictable init bytecode and predictable CREATE2 address. | ||
// Subsequent upgrades are supposed to switch this proxy to the real implementation. | ||
|
||
const proxy = m.contract("TransparentUpgradeableProxy", [ | ||
contractsInfo.CREATE2_ADDRESS_ANCHOR.unifiedAddress, | ||
proxyAdminOwner, | ||
contractsInfo.SPONSOR_PAYMENT.create2Calldata, | ||
]); | ||
const proxyAdminAddress = m.readEventArgument(proxy, "AdminChanged", "newAdmin"); | ||
const proxyAdmin = m.contractAt("ProxyAdmin", proxyAdminAddress); | ||
|
||
return { proxyAdmin, proxy }; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { DeployHelper } from "../../helpers/DeployHelper"; | ||
import { getConfig, verifyContract } from "../../helpers/helperUtils"; | ||
import { contractsInfo } from "../../helpers/constants"; | ||
|
||
async function main() { | ||
const config = getConfig(); | ||
const deployStrategy: "basic" | "create2" = | ||
config.deployStrategy == "create2" ? "create2" : "basic"; | ||
|
||
const deployHelper = await DeployHelper.initialize(null, true); | ||
|
||
const { sponsorPayment } = await deployHelper.deploySponsorPayment( | ||
10, | ||
60 * 60 * 24, // 1 day unix time | ||
deployStrategy, | ||
); | ||
|
||
await verifyContract( | ||
await sponsorPayment.getAddress(), | ||
contractsInfo.SPONSOR_PAYMENT.verificationOpts, | ||
); | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |