Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: deploy to Base mainnet #4

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "solhint:recommended",
"rules": {
"code-complexity": ["error", 8],
"compiler-version": ["error", ">=0.8.25"],
"compiler-version": ["error", ">=0.8.27"],
"func-name-mixedcase": "off",
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["error", 120],
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
optimizer_runs = 10_000
out = "out"
script = "script"
solc = "0.8.25"
solc = "0.8.27"
src = "src"
test = "test"
extra_output = ['storageLayout']
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
"test:coverage:report": "forge coverage --report lcov && genhtml lcov.info --branch-coverage --output-dir coverage"
},
"dependencies": {
"@chainlink/contracts": "^1.1.0",
"@chainlink/contracts": "^1.2.0",
"@openzeppelin/contracts": "^5.0.2",
"@openzeppelin/contracts-upgradeable": "^5.0.2"
},
"devDependencies": {
"forge-std": "github:foundry-rs/forge-std#v1.8.1",
"prettier": "^3.2.5",
"solhint": "^4.5.4"
"prettier": "^3.3.3",
"solhint": "^5.0.3"
}
}
2 changes: 1 addition & 1 deletion script/Base.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Script } from "forge-std/src/Script.sol";

Expand Down
13 changes: 12 additions & 1 deletion script/ChainlinkConfig.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { VRFCoordinatorV2PlusMock } from "../test/mocks/VRFCoordinatorV2PlusMock.sol";

Expand All @@ -14,6 +14,7 @@ contract ChainlinkConfig {

function getActiveNetworkChainlinkConfig() public returns (NetworkConfig memory activeNetworkConfig) {
chainIdToNetworkConfig[137] = getPolygonConfig();
chainIdToNetworkConfig[8453] = getBaseConfig();
chainIdToNetworkConfig[42_161] = getArbitrumConfig();
chainIdToNetworkConfig[31_337] = getAnvilEthConfig();
chainIdToNetworkConfig[11_155_111] = getSepoliaEthConfig();
Expand Down Expand Up @@ -53,6 +54,16 @@ contract ChainlinkConfig {
});
}

function getBaseConfig() internal pure returns (NetworkConfig memory networkConfig) {
networkConfig = NetworkConfig({
// solhint-disable-next-line max-line-length
subscriptionId: 81_329_362_586_917_986_816_753_857_554_443_823_328_068_912_955_405_746_084_377_039_695_378_029_689_412,
vrfCoordinator: 0xd5D517aBE5cF79B7e95eC98dB0f0277788aFF634,
// 30 gwei Key Hash
keyHash: 0xdc2f87677b01473c763cb0aee938ed3341512f6057324a584e5944e786144d70
});
}

function getPolygonAmoyConfig() internal pure returns (NetworkConfig memory networkConfig) {
networkConfig = NetworkConfig({
// solhint-disable-next-line max-line-length
Expand Down
2 changes: 1 addition & 1 deletion script/DeployProtocol.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Raffl } from "../src/Raffl.sol";
import { RafflFactory } from "../src/RafflFactory.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/Raffl.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: None
// Raffl Protocol (last updated v1.0.0) (Raffl.sol)
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";

Expand Down
14 changes: 10 additions & 4 deletions src/RafflFactory.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: None
// Raffl Protocol (last updated v1.0.0) (RafflFactory.sol)
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { VRFV2PlusClient } from "@chainlink/contracts/src/v0.8/vrf/dev/libraries/VRFV2PlusClient.sol";
import { VRFConsumerBaseV2Plus } from "@chainlink/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Plus.sol";
Expand Down Expand Up @@ -37,6 +37,9 @@ contract RafflFactory is AutomationCompatibleInterface, VRFConsumerBaseV2Plus, F
/// @dev Callback gas limit for the Chainlink VRF
uint32 callbackGasLimit = 500_000;

/// @dev Whether to pay Chainlink fees with native token or LINK
bool nativePayment = true;

/// @dev Number of requests confirmations for the Chainlink VRF
uint16 requestConfirmations = 3;

Expand Down Expand Up @@ -215,11 +218,13 @@ contract RafflFactory is AutomationCompatibleInterface, VRFConsumerBaseV2Plus, F
/// @param _keyHash The gas lane to use, which specifies the maximum gas price to bump to
/// @param _callbackGasLimit Callback gas limit for the Chainlink VRF
/// @param _requestConfirmations Number of requests confirmations for the Chainlink VRF
/// @param _nativePayment Whether to pay Chainlink fees with native token or LINK.
function handleSubscription(
uint64 _subscriptionId,
bytes32 _keyHash,
uint32 _callbackGasLimit,
uint16 _requestConfirmations
uint16 _requestConfirmations,
bool _nativePayment
)
external
onlyOwner
Expand All @@ -228,6 +233,7 @@ contract RafflFactory is AutomationCompatibleInterface, VRFConsumerBaseV2Plus, F
keyHash = _keyHash;
callbackGasLimit = _callbackGasLimit;
requestConfirmations = _requestConfirmations;
nativePayment = _nativePayment;
}

/**
Expand Down Expand Up @@ -283,7 +289,7 @@ contract RafflFactory is AutomationCompatibleInterface, VRFConsumerBaseV2Plus, F
requestConfirmations: requestConfirmations,
callbackGasLimit: callbackGasLimit,
numWords: 1,
extraArgs: VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({ nativePayment: false }))
extraArgs: VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({ nativePayment: nativePayment }))
})
);
IRaffl(raffle).setSuccessCriteria(requestId);
Expand All @@ -297,7 +303,7 @@ contract RafflFactory is AutomationCompatibleInterface, VRFConsumerBaseV2Plus, F
/// @notice Method called by the Chainlink VRF Coordinator
/// @param requestId Id of the VRF request
/// @param randomWords Provably fair and verifiable array of random words
function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal override {
function fulfillRandomWords(uint256 requestId, uint256[] calldata randomWords) internal override {
IRaffl(_requestIds[requestId]).disperseRewards(requestId, randomWords[0]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/abstracts/EntriesManager.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: None
// Raffl Protocol (last updated v1.0.0) (abstracts/EntriesManager.sol)
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

/**
* @title EntriesManager
Expand Down
2 changes: 1 addition & 1 deletion src/abstracts/FactoryFeeManager.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: None
// Raffl Protocol (last updated v1.0.0) (abstracts/FactoryFeeManager.sol)
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Errors } from "../libraries/RafflFactoryErrors.sol";
import { IFeeManager } from "../interfaces/IFeeManager.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IERC20Minimal.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: None
// Raffl Protocol (last updated v1.0.0) (interfaces/IERC20Minimal.sol)
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

/// @title IERC20Minimal
/// @notice Interface for the ERC20 token standard with minimal functionality
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IFactoryFeeManager.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: None
// Raffl Protocol (last updated v1.0.0) (interfaces/FactoryFeeManager.sol)
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { IFeeManager } from "./IFeeManager.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IFeeManager.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: None
// Raffl Protocol (last updated v1.0.0) (interfaces/IFeeManager.sol)
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

/// @title IFeeManager
/// @dev Interface that describes the struct and accessor function for the data related to the collection of fees.
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IRaffl.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: None
// Raffl Protocol (last updated v1.0.0) (interfaces/IRaffl.sol)
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

/// @dev Interface that describes the Prize struct, the GameStatus and initialize function so the `RafflFactory` knows
/// how to initialize the `Raffl`.
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/RafflErrors.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: None
// Raffl Protocol (last updated v1.0.0) (libraries/RafflErrors.sol)
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

/// @title Errors Library for Raffl.sol
library Errors {
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/RafflFactoryErrors.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: None
// Raffl Protocol (last updated v1.0.0) (libraries/RafflFactoryErrors.sol)
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

/// @title Errors Library for RafflFactory.sol
library Errors {
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/TokenLib.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: None
// Raffl Protocol (last updated v1.0.0) (libraries/TokenLib.sol)
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { IERC20Minimal } from "../interfaces/IERC20Minimal.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/factory/RafflFactory.CreationFee.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Errors } from "../../src/libraries/RafflFactoryErrors.sol";
import { IFactoryFeeManager } from "../../src/interfaces/IFactoryFeeManager.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/factory/RafflFactory.Deployment.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { RafflFactory } from "../../src/RafflFactory.sol";
import { Errors } from "../../src/libraries/RafflFactoryErrors.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/factory/RafflFactory.FeeCollector.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Errors } from "../../src/libraries/RafflFactoryErrors.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/factory/RafflFactory.PoolFee.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Errors } from "../../src/libraries/RafflFactoryErrors.sol";
import { IFactoryFeeManager } from "../../src/interfaces/IFactoryFeeManager.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/mocks/ERC20Mock.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: None
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/mocks/ERC721Mock.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: None
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/mocks/VRFCoordinatorV2PlusMock.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: None
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { ConfirmedOwner } from "@chainlink/contracts/src/v0.8/shared/access/ConfirmedOwner.sol";
import { VRFV2PlusClient } from "@chainlink/contracts/src/v0.8/vrf/dev/libraries/VRFV2PlusClient.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/raffle/Raffl.Automation.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { VRFV2PlusClient } from "@chainlink/contracts/src/v0.8/vrf/dev/libraries/VRFV2PlusClient.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/raffle/Raffl.Initialize.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/raffle/custom-fee/Raffl.CustomCreationFee.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Raffl } from "../../../src/Raffl.sol";
import { IFeeManager } from "../../../src/interfaces/IFeeManager.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/raffle/custom-fee/Raffl.CustomPoolFee.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Raffl } from "../../../src/Raffl.sol";
import { IFeeManager } from "../../../src/interfaces/IFeeManager.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/raffle/entries/Raffl.EntriesWithERC20.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Raffl } from "../../../src/Raffl.sol";
import { IRaffl } from "../../../src/interfaces/IRaffl.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/raffle/entries/Raffl.EntriesWithNative.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Raffl } from "../../../src/Raffl.sol";
import { IRaffl } from "../../../src/interfaces/IRaffl.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/raffle/entries/Raffl.FreeEntries.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Raffl } from "../../../src/Raffl.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Raffl } from "../../../src/Raffl.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/raffle/misc/Raffl.Stress.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Raffl } from "../../../src/Raffl.sol";
import { IFeeManager } from "../../../src/interfaces/IFeeManager.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/raffle/refunds/Raffl.RefundsWithERC20Entries.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Raffl } from "../../../src/Raffl.sol";
import { IRaffl } from "../../../src/interfaces/IRaffl.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/raffle/refunds/Raffl.RefundsWithFreeEntries.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Raffl } from "../../../src/Raffl.sol";
import { IRaffl } from "../../../src/interfaces/IRaffl.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/raffle/refunds/Raffl.RefundsWithNativeEntries.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Raffl } from "../../../src/Raffl.sol";
import { IRaffl } from "../../../src/interfaces/IRaffl.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/raffle/rewards/Raffl.NoRewards.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Raffl } from "../../../src/Raffl.sol";
import { IRaffl } from "../../../src/interfaces/IRaffl.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/raffle/rewards/Raffl.RewardsWithERC20Entries.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Raffl } from "../../../src/Raffl.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/raffle/rewards/Raffl.RewardsWithFreeEntries.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Raffl } from "../../../src/Raffl.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/raffle/rewards/Raffl.RewardsWithNativeEntries.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Raffl } from "../../../src/Raffl.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/utils/Common.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;
pragma solidity ^0.8.27;

import { Test, Vm } from "forge-std/src/Test.sol";

Expand Down
Loading