Skip to content

Commit

Permalink
Add ColonyExtensionMeta
Browse files Browse the repository at this point in the history
  • Loading branch information
kronosapiens committed Aug 16, 2021
1 parent e0d62ee commit 76be92b
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 23 deletions.
3 changes: 2 additions & 1 deletion contracts/extensions/CoinMachine.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ pragma solidity 0.7.3;
pragma experimental ABIEncoderV2;

import "./../../lib/dappsys/erc20.sol";
import "./../common/BasicMetaTransaction.sol";
import "./ColonyExtension.sol";
import "./Whitelist.sol";

// ignore-file-swc-108


contract CoinMachine is ColonyExtension {
contract CoinMachine is ColonyExtension, BasicMetaTransaction {

// Events

Expand Down
4 changes: 2 additions & 2 deletions contracts/extensions/ColonyExtension.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import "./../../lib/dappsys/math.sol";
import "./../common/EtherRouter.sol";
import "./../colony/IColony.sol";
import "./../colony/ColonyDataTypes.sol";
import "./../common/BasicMetaTransaction.sol";

abstract contract ColonyExtension is DSAuth, DSMath, BasicMetaTransaction {

abstract contract ColonyExtension is DSAuth, DSMath {

uint256 constant UINT256_MAX = 2**256 - 1;

Expand Down
36 changes: 36 additions & 0 deletions contracts/extensions/ColonyExtensionMeta.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
This file is part of The Colony Network.
The Colony Network is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Colony Network is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with The Colony Network. If not, see <http://www.gnu.org/licenses/>.
*/

pragma solidity 0.7.3;
pragma experimental ABIEncoderV2;

import "./../common/BasicMetaTransaction.sol";
import "./ColonyExtension.sol";

abstract contract ColonyExtensionMeta is ColonyExtension, BasicMetaTransaction {

mapping (address => uint256) metatransactionNonces;

function getMetatransactionNonce(address _user) override public view returns (uint256 nonce) {
return metatransactionNonces[_user];
}

function incrementMetatransactionNonce(address _user) override internal {
metatransactionNonces[_user] += 1;
}

}
3 changes: 2 additions & 1 deletion contracts/extensions/EvaluatedExpenditure.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ pragma solidity 0.7.3;
pragma experimental ABIEncoderV2;

import "./ColonyExtension.sol";
import "./../common/BasicMetaTransaction.sol";

// ignore-file-swc-108


contract EvaluatedExpenditure is ColonyExtension {
contract EvaluatedExpenditure is ColonyExtension, BasicMetaTransaction {

uint256 constant EXPENDITURESLOTS_SLOT = 26;
uint256 constant PAYOUT_MODIFIER_OFFSET = 2;
Expand Down
5 changes: 3 additions & 2 deletions contracts/extensions/FundingQueue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
pragma solidity 0.7.3;
pragma experimental ABIEncoderV2;

import "./../colony/ColonyDataTypes.sol";
import "./../colonyNetwork/IColonyNetwork.sol";
import "./../common/BasicMetaTransaction.sol";
import "./../common/ERC20Extended.sol";
import "./../patriciaTree/PatriciaTreeProofs.sol";
import "./../tokenLocking/ITokenLocking.sol";
import "./ColonyExtension.sol";
import "./../colony/ColonyDataTypes.sol";

contract FundingQueue is ColonyExtension, PatriciaTreeProofs {
contract FundingQueue is ColonyExtension, PatriciaTreeProofs, BasicMetaTransaction {

// Events
event ProposalCreated(uint256 id, uint256 indexed fromPot, uint256 indexed toPot, address indexed token, uint256 amount);
Expand Down
3 changes: 2 additions & 1 deletion contracts/extensions/OneTxPayment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ pragma solidity 0.7.3;
pragma experimental ABIEncoderV2;

import "./ColonyExtension.sol";
import "./../common/BasicMetaTransaction.sol";

// ignore-file-swc-108


contract OneTxPayment is ColonyExtension {
contract OneTxPayment is ColonyExtension, BasicMetaTransaction {
event OneTxPaymentMade(address agent, uint256 fundamentalId, uint256 nPayouts);

ColonyDataTypes.ColonyRole constant ADMINISTRATION = ColonyDataTypes.ColonyRole.Administration;
Expand Down
3 changes: 2 additions & 1 deletion contracts/extensions/TokenSupplier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
pragma solidity 0.7.3;
pragma experimental ABIEncoderV2;

import "./../common/BasicMetaTransaction.sol";
import "./../common/ERC20Extended.sol";
import "./ColonyExtension.sol";


contract TokenSupplier is ColonyExtension {
contract TokenSupplier is ColonyExtension, BasicMetaTransaction {

uint256 constant ISSUANCE_PERIOD = 1 days;

Expand Down
5 changes: 3 additions & 2 deletions contracts/extensions/VotingReputation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@
pragma solidity 0.7.3;
pragma experimental ABIEncoderV2;

import "./../colony/ColonyRoles.sol";
import "./../colonyNetwork/IColonyNetwork.sol";
import "./../colony/ColonyRoles.sol";
import "./../common/BasicMetaTransaction.sol";
import "./../common/ERC20Extended.sol";
import "./../patriciaTree/PatriciaTreeProofs.sol";
import "./../tokenLocking/ITokenLocking.sol";
import "./ColonyExtension.sol";


contract VotingReputation is ColonyExtension, PatriciaTreeProofs {
contract VotingReputation is ColonyExtension, PatriciaTreeProofs, BasicMetaTransaction {

// Events
event MotionCreated(uint256 indexed motionId, address creator, uint256 indexed domainId);
Expand Down
3 changes: 2 additions & 1 deletion contracts/extensions/Whitelist.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
pragma solidity 0.7.3;
pragma experimental ABIEncoderV2;

import "./../common/BasicMetaTransaction.sol";
import "./ColonyExtension.sol";

// ignore-file-swc-108


contract Whitelist is ColonyExtension {
contract Whitelist is ColonyExtension, BasicMetaTransaction {

// Events

Expand Down
14 changes: 2 additions & 12 deletions contracts/testHelpers/TestExtensions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
pragma solidity 0.7.3;
pragma experimental ABIEncoderV2;

import "../extensions/ColonyExtension.sol";
import "../extensions/ColonyExtensionMeta.sol";


abstract contract TestExtension is ColonyExtension {
abstract contract TestExtension is ColonyExtensionMeta {
function install(address _colony) public override auth {
require(address(colony) == address(0x0), "extension-already-installed");

Expand All @@ -37,16 +37,6 @@ abstract contract TestExtension is ColonyExtension {
function uninstall() public override auth {
selfdestruct(address(uint160(address(colony))));
}

mapping(address => uint256) metatransactionNonces;
function getMetatransactionNonce(address userAddress) override public view returns (uint256 nonce){
return metatransactionNonces[userAddress];
}

function incrementMetatransactionNonce(address user) override internal {
metatransactionNonces[user] = add(metatransactionNonces[user], 1);
}

}


Expand Down

0 comments on commit 76be92b

Please sign in to comment.