-
Notifications
You must be signed in to change notification settings - Fork 41
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
26a48f9
commit 13e88bf
Showing
5 changed files
with
86 additions
and
8 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,37 @@ | ||
import { confirm } from '@inquirer/prompts'; | ||
import { HardhatRuntimeEnvironment } from 'hardhat/types'; | ||
import { ContractDetails, ERC721CV2_EMPTY_LIST, ERC721CV2_FREEZE_LEVEL, ERC721CV2_VALIDATOR } from './common/constants'; | ||
import { estimateGas } from './utils/helper'; | ||
|
||
export interface IFreezeTrading { | ||
contract: string; | ||
validator?: string; | ||
level?: number; | ||
whitelistid?: number; | ||
permittedreceiverid?: number; | ||
} | ||
|
||
export const freezeTrading = async ( | ||
args: IFreezeTrading, | ||
hre: HardhatRuntimeEnvironment, | ||
) => { | ||
const { ethers } = hre; | ||
const factory = await ethers.getContractFactory(ContractDetails.ERC721CM.name); | ||
const contract = factory.attach(args.contract); | ||
|
||
const validator = args.validator?? ERC721CV2_VALIDATOR; | ||
const level = args.level?? ERC721CV2_FREEZE_LEVEL; | ||
const whitelistid = args.whitelistid?? ERC721CV2_EMPTY_LIST; | ||
const permittedreceiverid = args.permittedreceiverid?? ERC721CV2_EMPTY_LIST; | ||
|
||
const tx = await contract.populateTransaction.setToCustomValidatorAndSecurityPolicy(validator, level, whitelistid, permittedreceiverid); | ||
await estimateGas(hre, tx); | ||
console.log(`Going to freeze contract: ${args.contract}`); | ||
if (!await confirm({ message: 'Continue?' })) return; | ||
|
||
const submittedTx = await contract.setToCustomValidatorAndSecurityPolicy(validator, level, whitelistid, permittedreceiverid); | ||
|
||
console.log(`Submitted tx ${submittedTx.hash}`); | ||
await submittedTx.wait(); | ||
console.log(`Contract ${args.contract} freezed`); | ||
}; |
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,28 @@ | ||
import { confirm } from '@inquirer/prompts'; | ||
import { HardhatRuntimeEnvironment } from 'hardhat/types'; | ||
import { ContractDetails } from './common/constants'; | ||
import { estimateGas } from './utils/helper'; | ||
|
||
export interface IThawTrading { | ||
contract: string; | ||
} | ||
|
||
export const thawTrading = async ( | ||
args: IThawTrading, | ||
hre: HardhatRuntimeEnvironment, | ||
) => { | ||
const { ethers } = hre; | ||
const factory = await ethers.getContractFactory(ContractDetails.ERC721CM.name); | ||
const contract = factory.attach(args.contract); | ||
|
||
const tx = await contract.populateTransaction.setToDefaultSecurityPolicy(); | ||
await estimateGas(hre, tx); | ||
console.log(`Going to thaw contract: ${args.contract}`); | ||
if (!await confirm({ message: 'Continue?' })) return; | ||
|
||
const submittedTx = await contract.setToDefaultSecurityPolicy(); | ||
|
||
console.log(`Submitted tx ${submittedTx.hash}`); | ||
await submittedTx.wait(); | ||
console.log(`Contract ${args.contract} thawed`); | ||
}; |