Skip to content

Commit

Permalink
refactor: harmonize mock contract naming and move CloneFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
heueristik committed Jan 10, 2024
1 parent e2808ec commit d66bb05
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 28 deletions.
11 changes: 5 additions & 6 deletions contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Copied files from [aragon/osx commit e7ba46](https://github.com/aragon/osx/tree/e7ba46026db96931d3e4a585e8f30c585906e1fc)

- interfaces `IMajorityVoting`, `IMembership`, `IProposal`, `IERC20MintableUpgradeable`, `IGovernanceWrappedERC20`
- abstract contracts `MajorityVotingBase`, `Addresslist`,`Proposal`, `ProposalUpgradeable`, `GovernanceERC20`, `GovernanceWrappedERC20`,
- contracts `PlaceholderSetup`,
- libraries `VersionComparisonLib`
- free functions `BitMap`, `Ratio`, and `UncheckedMath`
- test helpers `TestERC1155`, `TestERC20`, `TestERC721`, `TestGovernanceERC20`, `AddresslistMock`, `MajorityVotingMock`, `RatioTest`, `VersionComparisonLibTest`
- interfaces `IDAO`, `IPermissionCondition`, `IPlugin`, `IMembership`, `IProposal`, `IPluginSetup`, `IProtocolVersion`,
- abstract contracts `DaoAuthorizable`, `DaoAuthorizableUpgradeable`, `Plugin`, `PluginCloneable`, `PluginUUPSUpgradeable`, `PermissionCondition`, `PermissionConditionUpgradeable`, `Addresslist`, `Proposal`, `ProposalUpgradeable`, `PluginSetup`
- contracts `CloneFactory`
- libraries `PermissionLib`, `VersionComparisonLib`
- free functions `auth`, `Proxy`, `BitMap`, `Ratio`, `UncheckedMath`
2 changes: 2 additions & 0 deletions contracts/src/mocks/permission/PermissionConditionMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ pragma solidity ^0.8.8;

import {PermissionCondition} from "../../permission/condition/PermissionCondition.sol";

/// @notice A mock permission condition that can be set to permit or deny every call.
/// @dev DO NOT USE IN PRODUCTION!
contract PermissionConditionMock is PermissionCondition {
bool public answer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ contract PluginUUPSUpgradeableSetupMockBuild1 is PluginSetup {
}
}

/// @dev DO NOT USE IN PRODUCTION!
contract PluginUUPSUpgradeableSetupMockBuild2 is PluginSetup {
address internal pluginBase;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ pragma solidity ^0.8.8;

import {Addresslist} from "../../../../plugin/extensions/governance/Addresslist.sol";

/// @title AddresslistMock
/// @author Aragon Association - 2022-2023
/// @notice A mock addresslist that everyone can add and remove addresses to and from, respectively.
/// @dev DO NOT USE IN PRODUCTION!
contract AddresslistMock is Addresslist {
function addAddresses(address[] calldata _newAddresses) external {
_addAddresses(_newAddresses);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ pragma solidity ^0.8.8;

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

/// @title TestERC1155
/// @author Aragon Association - 2022-2023
/// @notice A test [ERC-1155](https://eips.ethereum.org/EIPS/eip-1155) that can be minted and burned by everyone.
/// @notice A mock [ERC-1155](https://eips.ethereum.org/EIPS/eip-1155) token that can be minted and burned by everyone.
/// @dev DO NOT USE IN PRODUCTION!
contract TestERC1155 is ERC1155 {
contract ERC1155Mock is ERC1155 {
constructor(string memory _uri) ERC1155(_uri) {}

function mint(address account, uint256 tokenId, uint256 amount) public {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ pragma solidity ^0.8.8;

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

/// @title TestERC20
/// @author Aragon Association - 2022-2023
/// @notice A test [ERC-20](https://eips.ethereum.org/EIPS/eip-20) that can be minted and burned by everyone.
/// @notice A mock [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token that can be minted and burned by everyone.
/// @dev DO NOT USE IN PRODUCTION!
contract TestERC20 is ERC20 {
contract ERC20Mock is ERC20 {
uint8 public decimals_ = 18;

constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ pragma solidity ^0.8.8;

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

/// @title TestERC721
/// @author Aragon Association - 2022-2023
/// @notice A test [ERC-721](https://eips.ethereum.org/EIPS/eip-721) that can be minted and burned by everyone.
/// @notice A mock [ERC-721](https://eips.ethereum.org/EIPS/eip-721) token that can be minted and burned by everyone.
/// @dev DO NOT USE IN PRODUCTION!
contract TestERC721 is ERC721 {
contract ERC721Mock is ERC721 {
constructor(string memory name_, string memory symbol_) ERC721(name_, symbol_) {}

function mint(address account, uint256 tokenId) public {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.8;

import {RATIO_BASE, _applyRatioCeiled} from "../../utils/math/Ratio.sol";

contract RatioTest {
contract RatioMock {
function getRatioBase() public pure returns (uint256) {
return RATIO_BASE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.8;

import {VersionComparisonLib} from "../../utils/versioning/VersionComparisonLib.sol";

contract VersionComparisonLibTest {
contract VersionComparisonLibMock {
using VersionComparisonLib for uint8[3];

function eq(uint8[3] memory lhs, uint8[3] memory rhs) public pure returns (bool) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

pragma solidity ^0.8.8;

// TODO will be refactored as part of task OS-794

import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";

contract CloneFactory {
Expand Down
8 changes: 4 additions & 4 deletions contracts/test/utils/math/ratio.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {RatioTest, RatioTest__factory} from '../../../typechain';
import {RatioMock, RatioMock__factory} from '../../../typechain';
import {RATIO_BASE, pctToRatio} from '@aragon/osx-commons-sdk';
import {expect} from 'chai';
import {ethers} from 'hardhat';

describe('Ratio', function () {
let ratio: RatioTest;
let ratio: RatioMock;

before(async () => {
const signers = await ethers.getSigners();
const RatioTest = new RatioTest__factory(signers[0]);
ratio = await RatioTest.deploy();
const RatioMock = new RatioMock__factory(signers[0]);
ratio = await RatioMock.deploy();
});

describe('RATIO_BASE', async () => {
Expand Down
8 changes: 4 additions & 4 deletions contracts/test/utils/versioning/version-comparison-lib.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {
VersionComparisonLibTest,
VersionComparisonLibTest__factory,
VersionComparisonLibMock,
VersionComparisonLibMock__factory,
} from '../../../typechain';
import {expect} from 'chai';
import {ethers} from 'hardhat';

type SemVer = [number, number, number];

describe('VersionComparisonLib', function () {
let cmp: VersionComparisonLibTest;
let cmp: VersionComparisonLibMock;

before(async () => {
const signers = await ethers.getSigners();
cmp = await new VersionComparisonLibTest__factory(signers[0]).deploy();
cmp = await new VersionComparisonLibMock__factory(signers[0]).deploy();
});

describe('eq', async () => {
Expand Down

0 comments on commit d66bb05

Please sign in to comment.