Skip to content

Commit

Permalink
Q-AJN-8: Old Version of Solidity
Browse files Browse the repository at this point in the history
- update pragmas to 0.8.18
- use preverando instead difficulty (need a version of foundry containing foundry-rs/foundry#4856)
  • Loading branch information
grandizzy committed May 8, 2023
1 parent d10601d commit e3099da
Show file tree
Hide file tree
Showing 30 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/slither.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- name: Analyze GrantFund
run: |
solc-select install 0.8.16 && solc-select use 0.8.16
solc-select install 0.8.18 && solc-select use 0.8.18
slither src/grants/
continue-on-error: true
id: fund_analyzer
2 changes: 1 addition & 1 deletion script/GrantFund.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { Script } from "forge-std/Script.sol";
import { console } from "forge-std/console.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/grants/GrantFund.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { IERC20 } from "@oz/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@oz/token/ERC20/utils/SafeERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/grants/base/ExtraordinaryFunding.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { IERC20 } from "@oz/token/ERC20/IERC20.sol";
import { SafeCast } from "@oz/utils/math/SafeCast.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/grants/base/Funding.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { Address } from "@oz/utils/Address.sol";
import { IVotes } from "@oz/governance/utils/IVotes.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/grants/base/StandardFunding.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { IERC20 } from "@oz/token/ERC20/IERC20.sol";
import { SafeCast } from "@oz/utils/math/SafeCast.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/grants/interfaces/IExtraordinaryFunding.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT

//slither-disable-next-line solc-version
pragma solidity 0.8.16;
pragma solidity 0.8.18;

/**
* @title Ajna Grant Coordination Fund Extraordinary Proposal flow.
Expand Down
2 changes: 1 addition & 1 deletion src/grants/interfaces/IFunding.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT

//slither-disable-next-line solc-version
pragma solidity 0.8.16;
pragma solidity 0.8.18;

/**
* @title Ajna Grant Coordination Fund Extraordinary Proposal flow.
Expand Down
2 changes: 1 addition & 1 deletion src/grants/interfaces/IGrantFund.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { IFunding } from "../interfaces/IFunding.sol";
import { IExtraordinaryFunding } from "../interfaces/IExtraordinaryFunding.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/grants/interfaces/IStandardFunding.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT

//slither-disable-next-line solc-version
pragma solidity 0.8.16;
pragma solidity 0.8.18;

/**
* @title Ajna Grant Coordination Fund Standard Proposal flow.
Expand Down
2 changes: 1 addition & 1 deletion src/grants/libraries/Maths.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
pragma solidity 0.8.18;

library Maths {

Expand Down
2 changes: 1 addition & 1 deletion test/interactions/DrainGrantFund.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { IExtraordinaryFunding } from "src/grants/interfaces/IExtraordinaryFunding.sol";
import { IAjnaToken } from "../utils/IAjnaToken.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/invariants/ExtraordinaryInvariant.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { console } from "@std/console.sol";
import { SafeCast } from "@oz/utils/math/SafeCast.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/invariants/StandardFinalizeInvariant.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { console } from "@std/console.sol";
import { SafeCast } from "@oz/utils/math/SafeCast.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/invariants/StandardFundingInvariant.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { console } from "@std/console.sol";
import { SafeCast } from "@oz/utils/math/SafeCast.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { console } from "@std/console.sol";
import { SafeCast } from "@oz/utils/math/SafeCast.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/invariants/StandardScreeningInvariant.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { console } from "@std/console.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/invariants/base/ExtraordinaryTestBase.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { console } from "@std/console.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/invariants/base/ITestBase.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.16;
pragma solidity 0.8.18;

interface ITestBase {

Expand Down
2 changes: 1 addition & 1 deletion test/invariants/base/StandardTestBase.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { console } from "@std/console.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/invariants/base/TestBase.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { Test } from "@std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/invariants/handlers/ExtraordinaryHandler.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { console } from "@std/console.sol";
import { Test } from "forge-std/Test.sol";
Expand Down
4 changes: 2 additions & 2 deletions test/invariants/handlers/Handler.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { Test } from "forge-std/Test.sol";
import { Strings } from "@oz/utils/Strings.sol";
Expand Down Expand Up @@ -200,7 +200,7 @@ contract Handler is Test, GrantFundTestHelper {

function randomSeed() internal returns (uint256) {
counter++;
return uint256(keccak256(abi.encodePacked(block.number, block.difficulty, counter)));
return uint256(keccak256(abi.encodePacked(block.number, block.prevrandao, counter)));
}

function getActorsCount() public view returns(uint256) {
Expand Down
2 changes: 1 addition & 1 deletion test/invariants/handlers/StandardHandler.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { console } from "@std/console.sol";
import { Test } from "forge-std/Test.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/unit/ExtraordinaryFunding.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { GrantFund } from "../../src/grants/GrantFund.sol";
import { IExtraordinaryFunding } from "../../src/grants/interfaces/IExtraordinaryFunding.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/unit/GrantFund.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { GrantFund } from "../../src/grants/GrantFund.sol";
import { IFunding } from "../../src/grants/interfaces/IFunding.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/unit/Maths.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { Test } from "@std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/unit/StandardFunding.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { SafeCast } from "@oz/utils/math/SafeCast.sol";

Expand Down
8 changes: 4 additions & 4 deletions test/utils/GrantFundTestHelper.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { SafeCast } from "@oz/utils/math/SafeCast.sol";
import { Strings } from "@oz/utils/Strings.sol"; // used for createNProposals
Expand Down Expand Up @@ -367,7 +367,7 @@ abstract contract GrantFundTestHelper is Test {
// Returns a random proposal Index from all proposals
function _getRandomProposal(uint256 noOfProposals_) internal returns(uint256 proposal_) {
// calculate random proposal Index between 0 and noOfProposals_
proposal_ = uint256(keccak256(abi.encodePacked(block.number, block.difficulty))) % noOfProposals_;
proposal_ = uint256(keccak256(abi.encodePacked(block.number, block.prevrandao))) % noOfProposals_;
vm.roll(block.number + 1);
}

Expand Down Expand Up @@ -476,7 +476,7 @@ abstract contract GrantFundTestHelper is Test {
descriptionPartTwo = string.concat(descriptionPartTwo, ", ");

// generate a random nonce to add to the description string to avoid collisions
uint256 randomNonce = uint256(keccak256(abi.encodePacked(block.number, block.difficulty))) % 100;
uint256 randomNonce = uint256(keccak256(abi.encodePacked(block.number, block.prevrandao))) % 100;
descriptionPartTwo = string.concat(descriptionPartTwo, Strings.toString(randomNonce));
}
description_ = string(abi.encodePacked(descriptionPartOne, descriptionPartTwo));
Expand Down Expand Up @@ -661,7 +661,7 @@ abstract contract GrantFundTestHelper is Test {
// Returns random votes for a user
function _randomVote() internal returns (uint256 votes_) {
// calculate random vote between 1 and 1.25 * 1e18
votes_ = 1 + uint256(keccak256(abi.encodePacked(block.number, block.difficulty))) % (1.25 * 1e18);
votes_ = 1 + uint256(keccak256(abi.encodePacked(block.number, block.prevrandao))) % (1.25 * 1e18);
vm.roll(block.number + 1);
}

Expand Down
2 changes: 1 addition & 1 deletion test/utils/IAjnaToken.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.16;
pragma solidity 0.8.18;

import { IVotes } from "@oz/governance/utils/IVotes.sol";
import { IERC20 } from "@oz/token/ERC20/IERC20.sol";
Expand Down

0 comments on commit e3099da

Please sign in to comment.