Skip to content

Commit

Permalink
happy linter - happy life
Browse files Browse the repository at this point in the history
  • Loading branch information
peersky committed Sep 1, 2023
1 parent ff72622 commit 11c53bb
Show file tree
Hide file tree
Showing 29 changed files with 1,045 additions and 1,316 deletions.
498 changes: 234 additions & 264 deletions src/facets/BestOfFacet.sol

Large diffs are not rendered by default.

541 changes: 234 additions & 307 deletions src/facets/gameMastersFacet.sol

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/fixtures/MigrationFixture.sol
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity ^0.8.0;
2 changes: 1 addition & 1 deletion src/fixtures/MigrationInitFixture.sol
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity ^0.8.0;
9 changes: 4 additions & 5 deletions src/fixtures/MigrationLibFixture.sol
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,10 @@ library LibMultipass {
domain.nonce[record.id] += record.nonce;
}

function _resolveFromAddress(address _address, DomainNameService storage _domain)
private
view
returns (bool, RecordBytes32 memory)
{
function _resolveFromAddress(
address _address,
DomainNameService storage _domain
) private view returns (bool, RecordBytes32 memory) {
RecordBytes32 memory resolved;

resolved.id = _domain.addressToId[_address];
Expand Down
88 changes: 40 additions & 48 deletions src/governance/Governor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,21 @@ import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorVotesQ
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorTimelockControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

contract MyGovernor is Initializable, GovernorUpgradeable, GovernorSettingsUpgradeable, GovernorCountingSimpleUpgradeable, GovernorVotesUpgradeable, GovernorVotesQuorumFractionUpgradeable, GovernorTimelockControlUpgradeable {
contract MyGovernor is
Initializable,
GovernorUpgradeable,
GovernorSettingsUpgradeable,
GovernorCountingSimpleUpgradeable,
GovernorVotesUpgradeable,
GovernorVotesQuorumFractionUpgradeable,
GovernorTimelockControlUpgradeable
{
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}

function initialize(IVotesUpgradeable _token, TimelockControllerUpgradeable _timelock)
initializer public
{
function initialize(IVotesUpgradeable _token, TimelockControllerUpgradeable _timelock) public initializer {
__Governor_init("MyGovernor");
__GovernorSettings_init(1 /* 1 block */, 45818 /* 1 week */, 1e18);
__GovernorCountingSimple_init();
Expand All @@ -28,47 +34,32 @@ contract MyGovernor is Initializable, GovernorUpgradeable, GovernorSettingsUpgra

// The following functions are overrides required by Solidity.

function votingDelay()
public
view
override(IGovernorUpgradeable, GovernorSettingsUpgradeable)
returns (uint256)
{
function votingDelay() public view override(IGovernorUpgradeable, GovernorSettingsUpgradeable) returns (uint256) {
return super.votingDelay();
}

function votingPeriod()
public
view
override(IGovernorUpgradeable, GovernorSettingsUpgradeable)
returns (uint256)
{
function votingPeriod() public view override(IGovernorUpgradeable, GovernorSettingsUpgradeable) returns (uint256) {
return super.votingPeriod();
}

function quorum(uint256 blockNumber)
public
view
override(IGovernorUpgradeable, GovernorVotesQuorumFractionUpgradeable)
returns (uint256)
{
function quorum(
uint256 blockNumber
) public view override(IGovernorUpgradeable, GovernorVotesQuorumFractionUpgradeable) returns (uint256) {
return super.quorum(blockNumber);
}

function state(uint256 proposalId)
public
view
override(GovernorUpgradeable, GovernorTimelockControlUpgradeable)
returns (ProposalState)
{
function state(
uint256 proposalId
) public view override(GovernorUpgradeable, GovernorTimelockControlUpgradeable) returns (ProposalState) {
return super.state(proposalId);
}

function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)
public
override(GovernorUpgradeable, IGovernorUpgradeable)
returns (uint256)
{
function propose(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
string memory description
) public override(GovernorUpgradeable, IGovernorUpgradeable) returns (uint256) {
return super.propose(targets, values, calldatas, description);
}

Expand All @@ -81,18 +72,22 @@ contract MyGovernor is Initializable, GovernorUpgradeable, GovernorSettingsUpgra
return super.proposalThreshold();
}

function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)
internal
override(GovernorUpgradeable, GovernorTimelockControlUpgradeable)
{
function _execute(
uint256 proposalId,
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) internal override(GovernorUpgradeable, GovernorTimelockControlUpgradeable) {
super._execute(proposalId, targets, values, calldatas, descriptionHash);
}

function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)
internal
override(GovernorUpgradeable, GovernorTimelockControlUpgradeable)
returns (uint256)
{
function _cancel(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) internal override(GovernorUpgradeable, GovernorTimelockControlUpgradeable) returns (uint256) {
return super._cancel(targets, values, calldatas, descriptionHash);
}

Expand All @@ -105,12 +100,9 @@ contract MyGovernor is Initializable, GovernorUpgradeable, GovernorSettingsUpgra
return super._executor();
}

function supportsInterface(bytes4 interfaceId)
public
view
override(GovernorUpgradeable, GovernorTimelockControlUpgradeable)
returns (bool)
{
function supportsInterface(
bytes4 interfaceId
) public view override(GovernorUpgradeable, GovernorTimelockControlUpgradeable) returns (bool) {
return super.supportsInterface(interfaceId);
}
}
5 changes: 2 additions & 3 deletions src/initializers/MultipassInit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import "../modifiers/OnlyOwnerDiamond.sol";
// of your diamond. Add parameters to the init funciton if you need to.

contract MultipassInit is OnlyOwnerDiamond {

function _buildDomainSeparator(
function _buildDomainSeparator(
bytes32 typeHash,
bytes32 nameHash,
bytes32 versionHash
Expand All @@ -40,7 +39,7 @@ contract MultipassInit is OnlyOwnerDiamond {
ds.supportedInterfaces[type(IDiamondLoupe).interfaceId] = true;
ds.supportedInterfaces[type(IERC173).interfaceId] = true;

bytes32 hashedName = keccak256(bytes(name));
bytes32 hashedName = keccak256(bytes(name));
bytes32 hashedVersion = keccak256(bytes(version));
bytes32 typeHash = keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
Expand Down
85 changes: 40 additions & 45 deletions src/interfaces/IBestOf.sol
Original file line number Diff line number Diff line change
@@ -1,57 +1,52 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import { LibTBG } from "../libraries/LibTurnBasedGame.sol";
import { LibCoinVending } from "../libraries/LibCoinVending.sol";
import {LibTBG} from "../libraries/LibTurnBasedGame.sol";
import {LibCoinVending} from "../libraries/LibCoinVending.sol";

interface IBestOf {
struct Score {
address participant;
uint256 score;
}
struct Score {
address participant;
uint256 score;
}

struct BOGSettings {
uint256 gamePrice;
uint256 joinGamePrice;
uint256 numGames;
address rankTokenAddress;
bool contractInitialized;
}
struct BOGSettings {
uint256 gamePrice;
uint256 joinGamePrice;
uint256 numGames;
address rankTokenAddress;
bool contractInitialized;
}

struct ContractState {
BOGSettings BestOfState;
LibTBG.GameSettings TBGSEttings;
}
struct ContractState {
BOGSettings BestOfState;
LibTBG.GameSettings TBGSEttings;
}

// struct HiddenProposal {
// string cipherText; //encrypted with game masters key
// bytes32 hash; //plain proposal string hashed with current turn salt
// }
// struct HiddenProposal {
// string cipherText; //encrypted with game masters key
// bytes32 hash; //plain proposal string hashed with current turn salt
// }

struct VoteHidden {
bytes32[3] votedFor;
bytes proof;
}
struct VoteHidden {
bytes32[3] votedFor;
bytes proof;
}

struct BOGInstance {
uint256 rank;
address createdBy;
mapping(uint256 => string) ongoingProposals; //Previous Turn Proposals (These are being voted on)
uint256 numOngoingProposals;
mapping(address => bytes32) proposalCommitmentHashes; //Current turn Proposal submittion
uint256 numCommitments;
mapping(address => VoteHidden) votesHidden;
}
struct BOGInstance {
uint256 rank;
address createdBy;
mapping(uint256 => string) ongoingProposals; //Previous Turn Proposals (These are being voted on)
uint256 numOngoingProposals;
mapping(address => bytes32) proposalCommitmentHashes; //Current turn Proposal submittion
uint256 numCommitments;
mapping(address => VoteHidden) votesHidden;
}

event RegistrationOpen(uint256 indexed gameid);
event PlayerJoined(uint256 indexed gameId, address participant);
event GameStarted(uint256 indexed gameId);
event gameCreated(
uint256 gameId,
address indexed gm,
address indexed creator,
uint256 rank
);
event GameClosed(uint256 indexed gameId);
event PlayerLeft(uint256 indexed gameId, address indexed player);
event RegistrationOpen(uint256 indexed gameid);
event PlayerJoined(uint256 indexed gameId, address participant);
event GameStarted(uint256 indexed gameId);
event gameCreated(uint256 gameId, address indexed gm, address indexed creator, uint256 rank);
event GameClosed(uint256 indexed gameId);
event PlayerLeft(uint256 indexed gameId, address indexed player);
}
1 change: 0 additions & 1 deletion src/interfaces/IERC1155Receiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

pragma solidity ^0.8.0;


/**
* @title ERC1155 transfer receiver interface
*/
Expand Down
7 changes: 3 additions & 4 deletions src/interfaces/IMultipass.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ pragma solidity ^0.8.4;
import "../libraries/LibMultipass.sol";

interface IMultipass {
function resolveRecord(LibMultipass.NameQuery memory query)
external
view
returns (bool, LibMultipass.Record memory);
function resolveRecord(
LibMultipass.NameQuery memory query
) external view returns (bool, LibMultipass.Record memory);

/** @dev same as resolveRecord but returns username, id and LibMultipass.Domain as string */
// function resolveRecordToString(LibMultipass.NameQuery memory query)
Expand Down
3 changes: 2 additions & 1 deletion src/interfaces/IRankToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ pragma solidity ^0.8.4;

interface IRankToken {
function mint(address to, uint256 amount, uint256 poolId, bytes memory data) external;

function batchMint(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) external;
}
}
6 changes: 1 addition & 5 deletions src/libraries/LibArray.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ pragma solidity ^0.8.4;
import "hardhat/console.sol";

library LibArray {
function quickSort(
uint256[] memory arr,
int256 left,
int256 right
) internal view {
function quickSort(uint256[] memory arr, int256 left, int256 right) internal view {
int256 i = left;
int256 j = right;
if (i == j) return;
Expand Down
Loading

0 comments on commit 11c53bb

Please sign in to comment.