Skip to content

Commit

Permalink
added view, deployed to Kovan
Browse files Browse the repository at this point in the history
  • Loading branch information
Aodhgan committed Mar 12, 2021
1 parent 77bfb0a commit 9aa2498
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 47 deletions.
2 changes: 1 addition & 1 deletion contracts/PrizePoolRegistry.sol
Expand Up @@ -29,7 +29,7 @@ contract PrizePoolRegistry is Ownable {

/// @notice Returns an array of all prizePools in the linked list
///@return Array of prize pool addresses
function getPrizePools() external returns(address[] memory){
function getPrizePools() view external returns(address[] memory){
return prizePoolList.addressArray();
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/PrizeStrategyUpkeep.sol
Expand Up @@ -28,7 +28,7 @@ contract PrizeStrategyUpkeep is KeeperCompatibleInterface {
/// @notice Checks if PrizePools require upkeep. Call in a static manner every block by the Chainlink Upkeep network.
/// @param checkData Not used in this implementation.
/// @return upkeepNeeded as true if performUpkeep() needs to be called, false otherwise. performData returned empty.
function checkUpkeep(bytes calldata checkData) override external returns (bool upkeepNeeded, bytes memory performData){ // check view
function checkUpkeep(bytes calldata checkData) view override external returns (bool upkeepNeeded, bytes memory performData){ // check view

address[] memory prizePools = PrizePoolRegistryInterface(prizePoolRegistry).getPrizePools();

Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/PrizePoolInterface.sol
Expand Up @@ -3,5 +3,5 @@
pragma solidity ^0.7.6;

interface PrizePoolInterface {
function prizeStrategy() external returns (address);
function prizeStrategy() external view returns (address);
}
2 changes: 1 addition & 1 deletion contracts/interfaces/PrizePoolRegistryInterface.sol
Expand Up @@ -3,5 +3,5 @@
pragma solidity ^0.7.6;

interface PrizePoolRegistryInterface {
function getPrizePools() external returns(address[] memory);
function getPrizePools() external view returns(address[] memory);
}
6 changes: 3 additions & 3 deletions contracts/utils/SafeAwardable.sol
Expand Up @@ -10,15 +10,15 @@ import "../interfaces/PeriodicPrizeStrategyInterface.sol";
library SafeAwardable{

///@return canCompleteAward returns true if the function is supported AND can be completed
function canCompleteAward(address self) internal returns (bool canCompleteAward){
function canCompleteAward(address self) internal view returns (bool canCompleteAward){
if(supportsFunction(self, PeriodicPrizeStrategyInterface.canCompleteAward.selector)){
return PeriodicPrizeStrategyInterface(self).canCompleteAward();
}
return false;
}

///@return canStartAward returns true if the function is supported AND can be started, false otherwise
function canStartAward(address self) internal returns (bool canStartAward){
function canStartAward(address self) internal view returns (bool canStartAward){
if(supportsFunction(self, PeriodicPrizeStrategyInterface.canStartAward.selector)){
return PeriodicPrizeStrategyInterface(self).canStartAward();
}
Expand All @@ -27,7 +27,7 @@ library SafeAwardable{

///@param selector is the function selector to check against
///@return success returns true if function is implemented, false otherwise
function supportsFunction(address self, bytes4 selector) internal returns (bool success){
function supportsFunction(address self, bytes4 selector) internal view returns (bool success){
bytes memory encodedParams = abi.encodeWithSelector(selector);
(bool success, bytes memory result) = self.staticcall{ gas: 30000 }(encodedParams);
if (result.length < 32){
Expand Down
10 changes: 5 additions & 5 deletions deploy/deploy.js
Expand Up @@ -14,7 +14,7 @@ module.exports = async (hardhat) => {

console.log("running deploy script")

console.log("network id ", getChainId())
console.log("network id ", await getChainId())

const { getNamedAccounts, deployments, ethers } = hardhat
const { deploy } = deployments
Expand All @@ -29,17 +29,17 @@ module.exports = async (hardhat) => {
const prizePoolRegistry = await deploy('PrizePoolRegistry', {
args: [],
from: deployer,
skipIfAlreadyDeployed: true
skipIfAlreadyDeployed: false
})
green(`Deployed PrizePoolRegistry: ${prizePoolRegistry.address}`)

dim(`deploying PrizePoolUpkeep contract from ${deployer}`)
dim(`deploying PrizeStrategyUpkeep contract from ${deployer}`)
const prizePoolUpkeep = await deploy('PrizeStrategyUpkeep', {
args: [prizePoolRegistry.address, batchSize],
from: deployer,
skipIfAlreadyDeployed: true
skipIfAlreadyDeployed: false
})
green(`Deployed PrizePoolUpkeep: ${prizePoolUpkeep.address}`)
green(`Deployed PrizeStrategyUpkeep: ${prizePoolUpkeep.address}`)


}
40 changes: 20 additions & 20 deletions deployments/kovan/PrizePoolRegistry.json

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions deployments/kovan/PrizeStrategyUpkeep.json

Large diffs are not rendered by default.

66 changes: 66 additions & 0 deletions deployments/kovan/solcInputs/20d3358fd77b25249d09dbdeb2d71edd.json

Large diffs are not rendered by default.

0 comments on commit 9aa2498

Please sign in to comment.