Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit f51a213

Browse files
feat: convert fee manager npm test to go test (#1885)
Co-authored-by: Ceyhun Onur <[email protected]>
1 parent cb45407 commit f51a213

File tree

17 files changed

+1446
-1396
lines changed

17 files changed

+1446
-1396
lines changed

contracts/bindings/gen_examplefeemanager.go

Lines changed: 0 additions & 743 deletions
This file was deleted.

contracts/contracts/ExampleFeeManager.sol

Lines changed: 0 additions & 104 deletions
This file was deleted.

contracts/contracts/test/ExampleFeeManagerTest.sol

Lines changed: 0 additions & 127 deletions
This file was deleted.

contracts/tasks.ts

Lines changed: 0 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -45,42 +45,6 @@ task("balance", "get the balance")
4545
console.log(`balance: ${balanceInCoin} Coin`)
4646
})
4747

48-
// npx hardhat allowList:readRole --network local --address [address]
49-
task("deployerAllowList:readRole", "Gets the network deployer allow list")
50-
.addParam("address", "the address you want to know the allowlist role for")
51-
.setAction(async (args, hre) => {
52-
const allowList = await hre.ethers.getContractAt("IAllowList", CONTRACT_ALLOW_LIST_ADDRESS)
53-
await getRole(allowList, args.address)
54-
})
55-
56-
// npx hardhat allowList:addDeployer --network local --address [address]
57-
task("deployerAllowList:addDeployer", "Adds the deployer on the allow list")
58-
.addParam("address", "the address you want to add as a deployer")
59-
.setAction(async (args, hre) => {
60-
const allowList = await hre.ethers.getContractAt("IAllowList", CONTRACT_ALLOW_LIST_ADDRESS)
61-
// ADD CODE BELOW
62-
await allowList.setEnabled(args.address)
63-
await getRole(allowList, args.address)
64-
})
65-
66-
// npx hardhat allowList:addAdmin --network local --address [address]
67-
task("deployerAllowList:addAdmin", "Adds an admin on the allowlist")
68-
.addParam("address", "the address you want to add as a admin")
69-
.setAction(async (args, hre) => {
70-
const allowList = await hre.ethers.getContractAt("IAllowList", CONTRACT_ALLOW_LIST_ADDRESS)
71-
await allowList.setAdmin(args.address)
72-
await getRole(allowList, args.address)
73-
})
74-
75-
// npx hardhat allowList:revoke --network local --address [address]
76-
task("deployerAllowList:revoke", "Removes the address from the list")
77-
.addParam("address", "the address you want to revoke all permission")
78-
.setAction(async (args, hre) => {
79-
const allowList = await hre.ethers.getContractAt("IAllowList", CONTRACT_ALLOW_LIST_ADDRESS)
80-
await allowList.setNone(args.address)
81-
await getRole(allowList, args.address)
82-
})
83-
8448
// npx hardhat allowList:readRole --network local --address [address]
8549
task("txAllowList:readRole", "Gets the network transaction allow list")
8650
.addParam("address", "the address you want to know the allowlist role for")
@@ -117,112 +81,6 @@ task("txAllowList:revoke", "Removes the address from the transaction allow list"
11781
await getRole(allowList, args.address)
11882
})
11983

120-
// npx hardhat minter:readRole --network local --address [address]
121-
task("minter:readRole", "Gets the network deployer minter list")
122-
.addParam("address", "the address you want to know the minter role for")
123-
.setAction(async (args, hre) => {
124-
const allowList = await hre.ethers.getContractAt("INativeMinter", MINT_ADDRESS)
125-
await getRole(allowList, args.address)
126-
})
127-
128-
129-
// npx hardhat minter:addMinter --network local --address [address]
130-
task("minter:addMinter", "Adds the address on the minter list")
131-
.addParam("address", "the address you want to add as a minter")
132-
.setAction(async (args, hre) => {
133-
const allowList = await hre.ethers.getContractAt("INativeMinter", MINT_ADDRESS)
134-
await allowList.setEnabled(args.address)
135-
await getRole(allowList, args.address)
136-
})
137-
138-
// npx hardhat minter:addAdmin --network local --address [address]
139-
task("minter:addAdmin", "Adds an admin on the minter list")
140-
.addParam("address", "the address you want to add as a admin")
141-
.setAction(async (args, hre) => {
142-
const allowList = await hre.ethers.getContractAt("INativeMinter", MINT_ADDRESS)
143-
await allowList.setAdmin(args.address)
144-
await getRole(allowList, args.address)
145-
})
146-
147-
// npx hardhat minter:revoke --network local --address [address]
148-
task("minter:revoke", "Removes the address from the list")
149-
.addParam("address", "the address you want to revoke all permission")
150-
.setAction(async (args, hre) => {
151-
const allowList = await hre.ethers.getContractAt("INativeMinter", MINT_ADDRESS)
152-
await allowList.setNone(args.address)
153-
await getRole(allowList, args.address)
154-
})
155-
156-
// npx hardhat minter:mint --network local --address [address]
157-
task("minter:mint", "Mints native tokens")
158-
.addParam("address", "the address you want to mint for")
159-
.addParam("amount", "the amount you want to mint")
160-
.setAction(async (args, hre) => {
161-
const minter = await hre.ethers.getContractAt("INativeMinter", MINT_ADDRESS)
162-
await minter.mintNativeCoin(args.address, args.amount)
163-
})
164-
165-
// npx hardhat minter:burn --network local --address [address]
166-
task("minter:burn", "Burns native tokens")
167-
.addParam("amount", "the amount you want to burn (in AVAX unit)")
168-
.setAction(async (args, hre) => {
169-
const [owner] = await hre.ethers.getSigners()
170-
const transactionHash = await owner.sendTransaction({
171-
to: BLACKHOLE_ADDRESS,
172-
value: hre.ethers.parseEther(args.amount),
173-
})
174-
console.log(transactionHash)
175-
})
176-
177-
// npx hardhat feeManager:set --network local --address [address]
178-
task("feeManager:set", "Sets the provided fee config")
179-
.addParam("gaslimit", "", undefined, undefined, false)
180-
.addParam("targetblockrate", "", undefined, undefined, false)
181-
.addParam("minbasefee", "", undefined, undefined, false)
182-
.addParam("targetgas", "", undefined, undefined, false)
183-
.addParam("basefeechangedenominator", "", undefined, undefined, false)
184-
.addParam("minblockgascost", "", undefined, undefined, false)
185-
.addParam("maxblockgascost", "", undefined, undefined, false)
186-
.addParam("blockgascoststep", "", undefined, undefined, false)
187-
188-
.setAction(async (args, hre) => {
189-
const feeManager = await hre.ethers.getContractAt("IFeeManager", FEE_MANAGER_ADDRESS)
190-
await feeManager.setFeeConfig(
191-
args.gaslimit,
192-
args.targetblockrate,
193-
args.minbasefee,
194-
args.targetgas,
195-
args.basefeechangedenominator,
196-
args.minblockgascost,
197-
args.maxblockgascost,
198-
args.blockgascoststep)
199-
})
200-
201-
task("feeManager:get", "Gets the fee config")
202-
.setAction(async (_, hre) => {
203-
const feeManager = await hre.ethers.getContractAt("IFeeManager", FEE_MANAGER_ADDRESS)
204-
const result = await feeManager.getFeeConfig()
205-
console.log(`Fee Manager Precompile Config is set to:
206-
gasLimit: ${result[0]}
207-
targetBlockRate: ${result[1]}
208-
minBaseFee: ${result[2]}
209-
targetGas: ${result[3]}
210-
baseFeeChangeDenominator: ${result[4]}
211-
minBlockGasCost: ${result[5]}
212-
maxBlockGasCost: ${result[6]}
213-
blockGasCostStep: ${result[7]}`)
214-
})
215-
216-
217-
// npx hardhat feeManager:readRole --network local --address [address]
218-
task("feeManager:readRole", "Gets the network deployer minter list")
219-
.addParam("address", "the address you want to know the minter role for")
220-
.setAction(async (args, hre) => {
221-
const allowList = await hre.ethers.getContractAt("IFeeManager", FEE_MANAGER_ADDRESS)
222-
await getRole(allowList, args.address)
223-
})
224-
225-
22684
// npx hardhat rewardManager:currentRewardAddress --network local
22785
task("rewardManager:currentRewardAddress", "Gets the current configured rewarding address")
22886
.setAction(async (_, hre) => {

0 commit comments

Comments
 (0)