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

     1  // (c) 2019-2022, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  import { ethers } from "hardhat"
     5  import { test } from "./utils"
     6  
     7  const ADMIN_ADDRESS: string = "0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC"
     8  const OTHER_SIGNER = "0x0Fa8EA536Be85F32724D57A37758761B86416123"
     9  const DEPLOYER_ALLOWLIST_ADDRESS = "0x0200000000000000000000000000000000000000"
    10  
    11  describe("ExampleDeployerList", function () {
    12    beforeEach('Setup DS-Test contract', async function () {
    13      const signer = await ethers.getSigner(ADMIN_ADDRESS)
    14      const allowListPromise = ethers.getContractAt("IAllowList", DEPLOYER_ALLOWLIST_ADDRESS, signer)
    15  
    16      return ethers.getContractFactory("ExampleDeployerListTest", { signer })
    17        .then(factory => factory.deploy())
    18        .then(contract => {
    19          this.testContract = contract
    20          return Promise.all([
    21            contract.deployed().then(() => contract),
    22            allowListPromise.then(allowList => allowList.setAdmin(contract.address)).then(tx => tx.wait()),
    23          ])
    24        })
    25        .then(([contract]) => contract.setUp())
    26        .then(tx => tx.wait())
    27    })
    28  
    29    test("precompile should see owner address has admin role", "step_verifySenderIsAdmin")
    30  
    31    test("precompile should see test address has no role", "step_newAddressHasNoRole")
    32  
    33    test("contract should report test address has no admin role", "step_noRoleIsNotAdmin")
    34  
    35    test("contract should report owner address has admin role", "step_ownerIsAdmin")
    36  
    37    test("should not let test address deploy", {
    38      method: "step_noRoleCannotDeploy",
    39      overrides: { from: OTHER_SIGNER },
    40      shouldFail: false,
    41    })
    42  
    43    test("should allow admin to add contract as admin", "step_adminAddContractAsAdmin")
    44  
    45    test("should allow admin to add deployer address as deployer through contract", "step_addDeployerThroughContract")
    46  
    47    test("should let deployer address to deploy", "step_deployerCanDeploy")
    48  
    49    test("should let admin revoke deployer", "step_adminCanRevokeDeployer")
    50  })