Skip to content

End-to-end testing with Polkadot.js for Web3 Foundation Open Grant #268 - Quadratic Funding Module and Dapp Application.

License

Notifications You must be signed in to change notification settings

AvaProtocol/quadratic-funding-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploy local chain

  1. clone the repo: git clone https://github.com/OAK-Foundation/quadratic-funding-pallet
  2. into quadratic-funding-pallet folder and build with cargo build --release
  3. start a local node with ./target/release/node-template --dev --tmp

How to test

  1. Install dependencies: yarn
  2. Run all test cases: npm test
  3. Run all Unit Test cases: npm run "test unit"
  4. Run all Functional Test cases: npm run "test functional"

Manual Test

Identity Test
  1. Start local node

    ./target/release/node-template --dev --tmp
    
  2. Config the webapps' setting: Open browser with url "https://polkadot.js.org/apps/", Settings -> Developer, paste the below json code, then save.

    {
      "ProjectIndex": "u32",
      "ProjectOf": "Project",
      "RoundIndex": "u32",
      "RoundOf": "Round",
      "Round": {
        "start": "BlockNumber",
        "end": "BlockNumber",
        "matching_fund": "Balance",
        "grants": "Vec<Grant>",
        "is_canceled": "bool",
        "is_finalized": "bool"
      },
      "Grant": {
        "project_index": "ProjectIndex",
        "contributions": "Vec<Contribution>",
        "is_approved": "bool",
        "is_canceled": "bool",
        "is_withdrawn": "bool",
        "withdrawal_expiration": "BlockNumber",
        "matching_fund": "Balance"
      },
      "Contribution": {
        "account_id": "AccountId",
        "value": "Balance"
      },
      "Project": {
        "name": "Vec<u8>",
        "logo": "Vec<u8>",
        "description": "Vec<u8>",
        "website": "Vec<u8>",
        "owner": "AccountId"
      }
    }
    
  3. Add identity registrar

    Developer -> Sudo, here we use the Sudo account to set Alice to be registrar

    Export

    Then sign and submit transaction

  4. Bob set identity

    Click the "Set on-chain identity"

    Export

    Input identity information

    Export

    Then sign and submit transaction, we can get the Bob identity status

    Export
  5. Bob request Alice to judgement

    Developer -> Extrinsics, here we select Bob to request judgement.

    reg_index is the Registrar Index. Alice registrar index is 0 because Alice is the first registrar.

    max_fee with 100 Unit (means that the maximum fee Bob can pay is 100 Unit).

    Export

    Then sign and submit.

  6. Alice provide judgement

    Developer -> Extrinsics, here we use Alice to provide the Bob's judgement

    Seven types can select:

    1. Unknown: The default value, no judgement made yet.
    2. Reasonable: The data appears reasonable, but no in-depth checks (e.g. formal KYC process) were performed.
    3. Known Good: The registrar has certified that the information is correct.
    4. Out of Date: The information used to be good, but is now out of date.
    5. Low Quality: The information is low quality or imprecise, but can be fixed with an update.
    6. Erroneous: The information is erroneous and may indicate malicious intent.
    7. FeePaid: Is for when a user has requested judgement and it is in progress
    Export

    Information that is in "FeePaid" or "Erroneous" is "sticky" and cannot be modified; it can only be removed by complete removal of the identity.

    1. Set to Unknown:

      Export

      Then sign and submit, we can get Bob's identity with "Unknown" status.

      Export
    2. Set to Reasonable:

      Export

      Then sign and submit, we can get Bob's identity with "Reasonable" status.

      Export
    3. Set to Known Good:

      Export

      Then sign and submit, we can get Bob's identity with "Known Good" status.

      Export
    4. Set to Out of Date:

      Export

      Then sign and submit, we can get Bob's identity with "Out of Date" status.

      Export
    5. Set to Low Quality:

      Export

      Then sign and submit, we can get Bob's identity with "Low Quality" status.

      Export
    6. Set to Erroneous:

      Export

      Then sign and submit, we can get Bob's identity with "Erroneous" status.

      Export
  7. Bob request an error Registrar Index will cause error

    Export
  8. Bob request Alice to judgement twice will cause error

    Export
  9. Alice input the error Registrar Index will cause error

    Export
  10. Others to provide the judgement will cause error

    Export

About

End-to-end testing with Polkadot.js for Web3 Foundation Open Grant #268 - Quadratic Funding Module and Dapp Application.

Topics

Resources

License

Stars

Watchers

Forks