-
Notifications
You must be signed in to change notification settings - Fork 5
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
Showing
2 changed files
with
65 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
//@ts-ignore | ||
import { run, ethers, network } from "hardhat"; | ||
import { | ||
convertFacetAndSelectorsToString, | ||
DeployUpgradeTaskArgs, | ||
FacetsAndAddSelectors, | ||
} from "../../tasks/deployUpgrade"; | ||
import { gasPrice, impersonate } from "../helperFunctions"; | ||
import { maticGBMDiamond, maticGBMDiamondUpgrader } from "../constants"; | ||
|
||
export async function upgradeBuyNowFor() { | ||
const facets: FacetsAndAddSelectors[] = [ | ||
{ | ||
facetName: "GBMFacet", | ||
addSelectors: [ | ||
`function buyNowFor(uint256 _auctionID, address _recepient) public`, | ||
`function _buyNowImplementation(uint256 _auctionID, address _recipient) internal`, | ||
], | ||
removeSelectors: [], | ||
}, | ||
]; | ||
|
||
const joined = convertFacetAndSelectorsToString(facets); | ||
|
||
const args: DeployUpgradeTaskArgs = { | ||
diamondUpgrader: maticGBMDiamondUpgrader, | ||
diamondAddress: maticGBMDiamond, | ||
facetsAndAddSelectors: joined, | ||
useLedger: true, | ||
useMultisig: false, | ||
initAddress: ethers.constants.AddressZero, | ||
initCalldata: "0x", | ||
}; | ||
|
||
await run("deployUpgrade", args); | ||
|
||
let gbmFacet = await ethers.getContractAt("GBMFacet", maticGBMDiamond); | ||
gbmFacet = await impersonate( | ||
maticGBMDiamondUpgrader, | ||
gbmFacet, | ||
ethers, | ||
network | ||
); | ||
const tx = await gbmFacet.setBuyItNowInvalidationThreshold(70, { | ||
gasPrice: gasPrice, | ||
}); | ||
console.log("Preset corrected successfully at hash", tx.hash); | ||
console.log( | ||
"BuyItNowInvalidationThreshold:", | ||
await gbmFacet.getBuyItNowInvalidationThreshold() | ||
); | ||
} | ||
|
||
// We recommend this pattern to be able to use async/await everywhere | ||
// and properly handle errors. | ||
if (require.main === module) { | ||
upgradeBuyNowFor() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); | ||
} |
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