Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
e2bf45f2
Commit
e2bf45f2
authored
Mar 02, 2021
by
Francisco Giordano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename variable master to implementation
(cherry picked from commit
cdb929aa
)
parent
93d990c6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
Clones.sol
contracts/proxy/Clones.sol
+11
-11
No files found.
contracts/proxy/Clones.sol
View file @
e2bf45f2
...
...
@@ -17,16 +17,16 @@ pragma solidity ^0.8.0;
*/
library Clones {
/**
* @dev Deploys and returns the address of a clone that mimics the behaviour of `
master
`.
* @dev Deploys and returns the address of a clone that mimics the behaviour of `
implementation
`.
*
* This function uses the create opcode, which should never revert.
*/
function clone(address
master
) internal returns (address instance) {
function clone(address
implementation
) internal returns (address instance) {
// solhint-disable-next-line no-inline-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(ptr, 0x14), shl(0x60,
master
))
mstore(add(ptr, 0x14), shl(0x60,
implementation
))
mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
instance := create(0, ptr, 0x37)
}
...
...
@@ -34,18 +34,18 @@ library Clones {
}
/**
* @dev Deploys and returns the address of a clone that mimics the behaviour of `
master
`.
* @dev Deploys and returns the address of a clone that mimics the behaviour of `
implementation
`.
*
* This function uses the create2 opcode and a `salt` to deterministically deploy
* the clone. Using the same `
master
` and `salt` multiple time will revert, since
* the clone. Using the same `
implementation
` and `salt` multiple time will revert, since
* the clones cannot be deployed twice at the same address.
*/
function cloneDeterministic(address
master
, bytes32 salt) internal returns (address instance) {
function cloneDeterministic(address
implementation
, bytes32 salt) internal returns (address instance) {
// solhint-disable-next-line no-inline-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(ptr, 0x14), shl(0x60,
master
))
mstore(add(ptr, 0x14), shl(0x60,
implementation
))
mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
instance := create2(0, ptr, 0x37, salt)
}
...
...
@@ -55,12 +55,12 @@ library Clones {
/**
* @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
*/
function predictDeterministicAddress(address
master
, bytes32 salt, address deployer) internal pure returns (address predicted) {
function predictDeterministicAddress(address
implementation
, bytes32 salt, address deployer) internal pure returns (address predicted) {
// solhint-disable-next-line no-inline-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(ptr, 0x14), shl(0x60,
master
))
mstore(add(ptr, 0x14), shl(0x60,
implementation
))
mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000)
mstore(add(ptr, 0x38), shl(0x60, deployer))
mstore(add(ptr, 0x4c), salt)
...
...
@@ -72,7 +72,7 @@ library Clones {
/**
* @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
*/
function predictDeterministicAddress(address
master
, bytes32 salt) internal view returns (address predicted) {
return predictDeterministicAddress(
master
, salt, address(this));
function predictDeterministicAddress(address
implementation
, bytes32 salt) internal view returns (address predicted) {
return predictDeterministicAddress(
implementation
, salt, address(this));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment