Browse Source

Further reorganisation of the repo (#2575)

Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
Hadrien Croubois 4 years ago
parent
commit
f076ff5dbd

+ 4 - 0
CHANGELOG.md

@@ -37,6 +37,10 @@ npx openzeppelin-contracts-migrate-imports
 
 
 Make sure you're using git or another version control system to be able to recover from any potential error in our script.
 Make sure you're using git or another version control system to be able to recover from any potential error in our script.
 
 
+### How to upgrade from 4.0-beta.x
+
+Some further changes have been done during the beta the 4.0-beta.x phase. Transitions made during this period are also configured in the `migrate-imports` script. Consequently, you can upgrade from the 4.0-beta.x stage using the same script as described in the *How to upgrade from 3.x* section.
+
 ## 3.4.0 (2021-02-02)
 ## 3.4.0 (2021-02-02)
 
 
  * `BeaconProxy`: added new kind of proxy that allows simultaneous atomic upgrades. ([#2411](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2411))
  * `BeaconProxy`: added new kind of proxy that allows simultaneous atomic upgrades. ([#2411](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2411))

+ 3 - 3
contracts/utils/PaymentSplitter.sol → contracts/finance/PaymentSplitter.sol

@@ -2,9 +2,9 @@
 
 
 pragma solidity ^0.8.0;
 pragma solidity ^0.8.0;
 
 
-import "./Address.sol";
-import "./Context.sol";
-import "./math/SafeMath.sol";
+import "../utils/Address.sol";
+import "../utils/Context.sol";
+import "../utils/math/SafeMath.sol";
 
 
 /**
 /**
  * @title PaymentSplitter
  * @title PaymentSplitter

+ 10 - 0
contracts/finance/README.adoc

@@ -0,0 +1,10 @@
+= Finance
+
+[.readme-notice]
+NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/finance
+
+This directory includes primitives for financial systems. We currently only offer the {PaymentSplitter} contract, but we want to grow this directory so we welcome ideas.
+
+== PaymentSplitter
+
+{{PaymentSplitter}}

+ 1 - 1
contracts/governance/README.adoc

@@ -1,7 +1,7 @@
 = Governance
 = Governance
 
 
 [.readme-notice]
 [.readme-notice]
-NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/access
+NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/governance
 
 
 This directory includes primitives for on-chain governance. We currently only offer the {TimelockController} contract, that can be used as a component in a governance systems to introduce a delay between a proposal and its execution.
 This directory includes primitives for on-chain governance. We currently only offer the {TimelockController} contract, that can be used as a component in a governance systems to introduce a delay between a proposal and its execution.
 
 

+ 1 - 1
contracts/mocks/InitializableMock.sol

@@ -2,7 +2,7 @@
 
 
 pragma solidity ^0.8.0;
 pragma solidity ^0.8.0;
 
 
-import "../utils/Initializable.sol";
+import "../proxy/utils/Initializable.sol";
 
 
 /**
 /**
  * @title InitializableMock
  * @title InitializableMock

+ 1 - 1
contracts/mocks/MultipleInheritanceInitializableMocks.sol

@@ -2,7 +2,7 @@
 
 
 pragma solidity ^0.8.0;
 pragma solidity ^0.8.0;
 
 
-import "../utils/Initializable.sol";
+import "../proxy/utils/Initializable.sol";
 
 
 // Sample contracts showing upgradeability with multiple inheritance.
 // Sample contracts showing upgradeability with multiple inheritance.
 // Child contract inherits from Father and Mother contracts, and Father extends from Gramps.
 // Child contract inherits from Father and Mother contracts, and Father extends from Gramps.

+ 1 - 1
contracts/mocks/RegressionImplementation.sol

@@ -2,7 +2,7 @@
 
 
 pragma solidity ^0.8.0;
 pragma solidity ^0.8.0;
 
 
-import "../utils/Initializable.sol";
+import "../proxy/utils/Initializable.sol";
 
 
 contract Implementation1 is Initializable {
 contract Implementation1 is Initializable {
   uint internal _value;
   uint internal _value;

+ 1 - 1
contracts/mocks/SingleInheritanceInitializableMocks.sol

@@ -2,7 +2,7 @@
 
 
 pragma solidity ^0.8.0;
 pragma solidity ^0.8.0;
 
 
-import "../utils/Initializable.sol";
+import "../proxy/utils/Initializable.sol";
 
 
 /**
 /**
  * @title MigratableMockV1
  * @title MigratableMockV1

+ 4 - 0
contracts/proxy/README.adoc

@@ -40,3 +40,7 @@ CAUTION: Using upgradeable proxies correctly and securely is a difficult task th
 == Minimal Clones
 == Minimal Clones
 
 
 {{Clones}}
 {{Clones}}
+
+== Utils
+
+{{Initializable}}

+ 1 - 1
contracts/utils/Initializable.sol → contracts/proxy/utils/Initializable.sol

@@ -3,7 +3,7 @@
 // solhint-disable-next-line compiler-version
 // solhint-disable-next-line compiler-version
 pragma solidity ^0.8.0;
 pragma solidity ^0.8.0;
 
 
-import "./Address.sol";
+import "../../utils/Address.sol";
 
 
 /**
 /**
  * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
  * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed

+ 8 - 4
contracts/utils/README.adoc

@@ -40,6 +40,14 @@ Finally, {Create2} contains all necessary utilities to safely use the https://bl
 
 
 {{EIP712}}
 {{EIP712}}
 
 
+== Escrow
+
+{{ConditionalEscrow}}
+
+{{Escrow}}
+
+{{RefundEscrow}}
+
 == Introspection
 == Introspection
 
 
 This set of interfaces and contracts deal with https://en.wikipedia.org/wiki/Type_introspection[type introspection] of contracts, that is, examining which functions can be called on them. This is usually referred to as a contract's _interface_.
 This set of interfaces and contracts deal with https://en.wikipedia.org/wiki/Type_introspection[type introspection] of contracts, that is, examining which functions can be called on them. This is usually referred to as a contract's _interface_.
@@ -84,7 +92,3 @@ Note that, in all cases, accounts simply _declare_ their interfaces, but they ar
 {{Counters}}
 {{Counters}}
 
 
 {{Strings}}
 {{Strings}}
-
-== Other
-
-{{Initializable}}

+ 4 - 2
scripts/migrate-imports.js

@@ -30,7 +30,8 @@ const pathUpdates = {
   'payment/escrow/ConditionalEscrow.sol': 'utils/escrow/ConditionalEscrow.sol',
   'payment/escrow/ConditionalEscrow.sol': 'utils/escrow/ConditionalEscrow.sol',
   'payment/escrow/Escrow.sol': 'utils/escrow/Escrow.sol',
   'payment/escrow/Escrow.sol': 'utils/escrow/Escrow.sol',
   'payment/escrow/RefundEscrow.sol': 'utils/escrow/RefundEscrow.sol',
   'payment/escrow/RefundEscrow.sol': 'utils/escrow/RefundEscrow.sol',
-  'payment/PaymentSplitter.sol': 'utils/PaymentSplitter.sol',
+  'payment/PaymentSplitter.sol': 'finance/PaymentSplitter.sol',
+  'utils/PaymentSplitter.sol': 'finance/PaymentSplitter.sol',
   'payment/PullPayment.sol': 'security/PullPayment.sol',
   'payment/PullPayment.sol': 'security/PullPayment.sol',
   'presets/ERC1155PresetMinterPauser.sol': 'token/ERC1155/presets/ERC1155PresetMinterPauser.sol',
   'presets/ERC1155PresetMinterPauser.sol': 'token/ERC1155/presets/ERC1155PresetMinterPauser.sol',
   'presets/ERC20PresetFixedSupply.sol': 'token/ERC20/presets/ERC20PresetFixedSupply.sol',
   'presets/ERC20PresetFixedSupply.sol': 'token/ERC20/presets/ERC20PresetFixedSupply.sol',
@@ -40,7 +41,8 @@ const pathUpdates = {
   'proxy/BeaconProxy.sol': 'proxy/beacon/BeaconProxy.sol',
   'proxy/BeaconProxy.sol': 'proxy/beacon/BeaconProxy.sol',
   // 'proxy/Clones.sol': undefined,
   // 'proxy/Clones.sol': undefined,
   'proxy/IBeacon.sol': 'proxy/beacon/IBeacon.sol',
   'proxy/IBeacon.sol': 'proxy/beacon/IBeacon.sol',
-  'proxy/Initializable.sol': 'utils/Initializable.sol',
+  'proxy/Initializable.sol': 'proxy/utils/Initializable.sol',
+  'utils/Initializable.sol': 'proxy/utils/Initializable.sol',
   'proxy/ProxyAdmin.sol': 'proxy/transparent/ProxyAdmin.sol',
   'proxy/ProxyAdmin.sol': 'proxy/transparent/ProxyAdmin.sol',
   // 'proxy/Proxy.sol': undefined,
   // 'proxy/Proxy.sol': undefined,
   'proxy/TransparentUpgradeableProxy.sol': 'proxy/transparent/TransparentUpgradeableProxy.sol',
   'proxy/TransparentUpgradeableProxy.sol': 'proxy/transparent/TransparentUpgradeableProxy.sol',