github.com/cgcardona/r-subnet-evm@v0.1.5/contracts/test/fee_manager.ts (about)

     1  // (c) 2019-2022, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  import { expect } from "chai"
     5  import { ethers } from "hardhat"
     6  import { test } from "./utils"
     7  
     8  const ADMIN_ADDRESS: string = "0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC"
     9  const FEE_MANAGER = "0x0200000000000000000000000000000000000003"
    10  
    11  const GENESIS_CONFIG = require('../../tests/precompile/genesis/fee_manager.json')
    12  
    13  describe("ExampleFeeManager", function () {
    14    this.timeout("30s")
    15  
    16    beforeEach("setup DS-Test contract", async function () {
    17      const signer = await ethers.getSigner(ADMIN_ADDRESS)
    18      const feeManagerPromise = ethers.getContractAt("IFeeManager", FEE_MANAGER, signer)
    19  
    20      return ethers.getContractFactory("ExampleFeeManagerTest", { signer })
    21        .then(factory => factory.deploy())
    22        .then(contract => {
    23          this.testContract = contract
    24          return contract.deployed().then(() => contract)
    25        })
    26        .then(contract => contract.setUp())
    27        .then(tx => Promise.all([feeManagerPromise, tx.wait()]))
    28        .then(([feeManager]) => feeManager.setAdmin(this.testContract.address))
    29        .then(tx => tx.wait())
    30    })
    31  
    32    test("should add contract deployer as owner", "step_addContractDeployerAsOwner")
    33  
    34    test("contract should not be able to change fee without enabled", "step_enableWAGMIFeesFailure")
    35  
    36    test("contract should be added to manager list", "step_addContractToManagerList")
    37  
    38    test("admin should be able to enable change fees", "step_changeFees")
    39  
    40    test("should confirm min-fee transaction", "step_minFeeTransaction", {
    41      maxFeePerGas: GENESIS_CONFIG.config.feeConfig.minBaseFee,
    42      maxPriorityFeePerGas: 0,
    43    })
    44  
    45    test("should reject a transaction below the minimum", [
    46      "step_raiseMinFeeByOne",
    47      {
    48        method: "step_minFeeTransaction",
    49        shouldFail: true,
    50        overrides: {
    51          maxFeePerGas: GENESIS_CONFIG.config.feeConfig.minBaseFee,
    52          maxPriorityFeePerGas: 0,
    53        },
    54      },
    55      "step_lowerMinFeeByOne",
    56    ])
    57  })