smartcontractkit / smartcontractkit/chainlink

[SMRT] Fix warnings in VRFCoordinatorV2Mock (and all solidity warnings)

Open
#8,971 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

investigating
Dominant language
Go
Stars
8.2k
Forks
2k
Avg merge
1d 23h
Merged PRs (30d)
202

Description

Description
Fix warnings in VRFCoordinatorV2Mock.

Warnings are critical for developers to pay attention to, so cluttering up the solidity compiler output creates headaches for devs. Please fix these warnings. (Most of them are "unused parameter", so either use the parameter or comment them out)

(Note, chainlink-brownie-contracts is a minimal package that includes just the contracts of @chainlink/contracts, so it's quicker and smaller to download)

warning[5667]: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
   --> lib/chainlink-brownie-contracts/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol:306:45:
    |
306 |   function requestSubscriptionOwnerTransfer(uint64 _subId, address _newOwner) external pure override {
    |                                             ^^^^^^^^^^^^^



warning[5667]: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
   --> lib/chainlink-brownie-contracts/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol:306:60:
    |
306 |   function requestSubscriptionOwnerTransfer(uint64 _subId, address _newOwner) external pure override {
    |                                                            ^^^^^^^^^^^^^^^^^



warning[5667]: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
   --> lib/chainlink-brownie-contracts/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol:310:44:
    |
310 |   function acceptSubscriptionOwnerTransfer(uint64 _subId) external pure override {
    |                                            ^^^^^^^^^^^^^



warning[5667]: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
   --> lib/chainlink-brownie-contracts/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol:314:33:
    |
314 |   function pendingRequestExists(uint64 subId) public view override returns (bool) {
    |                                 ^^^^^^^^^^^^



warning[2018]: Warning: Function state mutability can be restricted to pure
   --> lib/chainlink-brownie-contracts/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol:261:3:
    |
261 |   function getConfig()
    |   ^ (Relevant source part starts here and spans across multiple lines).



warning[2018]: Warning: Function state mutability can be restricted to pure
   --> lib/chainlink-brownie-contracts/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol:274:3:
    |
274 |   function getFeeConfig()
    |   ^ (Relevant source part starts here and spans across multiple lines).



warning[2018]: Warning: Function state mutability can be restricted to pure
   --> lib/chainlink-brownie-contracts/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol:302:3:
    |
302 |   function getFallbackWeiPerUnitLink() external view returns (int256) {
    |   ^ (Relevant source part starts here and spans across multiple lines).



warning[2018]: Warning: Function state mutability can be restricted to pure
   --> lib/chainlink-brownie-contracts/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol:314:3:
    |
314 |   function pendingRequestExists(uint64 subId) public view override returns (bool) {
    |   ^ (Relevant source part starts here and spans across multiple lines).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/chainlink-brownie-contracts/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol and inspect the functions at the warning locations in the issue. Run the Solidity compiler to confirm the reported warnings, then verify that the mock and other Solidity contracts produce no warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
solidity
Domain
blockchain
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.