Skip to content

Commit 8592b57

Browse files
committed
docs: replace "libraryAddress" with "target"
1 parent ffa4ded commit 8592b57

File tree

3 files changed

+24
-25
lines changed

3 files changed

+24
-25
lines changed

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,34 @@ just delegates all calls to the master contract address.
88

99
`npm install @optionality.io/clone-factory`
1010

11-
```javascript
11+
```solidity
1212
import "./Thing.sol";
1313
import "@optionality.io/clone-factory/contracts/CloneFactory.sol";
1414
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
1515
16-
1716
contract ThingFactory is Ownable, CloneFactory {
1817
19-
address public libraryAddress;
18+
address public target;
2019
2120
event ThingCreated(address newThingAddress);
2221
23-
function ThingFactory(address _libraryAddress) public {
24-
libraryAddress = _libraryAddress;
22+
function ThingFactory(address _target) public {
23+
target = _target;
2524
}
2625
27-
function setLibraryAddress(address _libraryAddress) public onlyOwner {
28-
libraryAddress = _libraryAddress;
26+
function setTarget(address _target) public onlyOwner {
27+
target = _target;
2928
}
3029
3130
function createThing(string _name, uint _value) public onlyOwner {
32-
address clone = createClone(libraryAddress);
31+
address clone = createClone(target);
3332
Thing(clone).init(_name, _value);
3433
ThingCreated(clone);
3534
}
3635
}
3736
```
3837

39-
This will inexpensively create a mimimalist forwarding shim contract that will delegate all calls to the contract libraryAddress
38+
This will inexpensively create a mimimalist forwarding shim contract that will delegate all calls to the `target` contract.
4039

4140
## WARNINGS
4241
- Be sure that the master contract is pre-initialized. You can usually accomplish this in your constructor as the only time the master contract constructor is called is during the master contract's creation. Clone contracts do not call the constructor, but are initialized with an inline initialization method (as demonstrated above).

test/ShortThingFactory.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,27 @@ import "../contracts/CloneFactory17.sol";
66

77
contract ShortThingFactory is CloneFactory17 {
88

9-
address public libraryAddress;
9+
address public target;
1010

11-
event ThingCreated(address newThingAddress, address libraryAddress);
11+
event ThingCreated(address newThingAddress, address target);
1212

13-
constructor(address _libraryAddress) public {
14-
libraryAddress = _libraryAddress;
13+
constructor(address _target) public {
14+
target = _target;
1515
}
1616

1717
function onlyCreate() public {
18-
createClone(libraryAddress);
18+
createClone(target);
1919
}
2020

2121
function createThing(string _name, uint _value) public {
22-
address clone = createClone(libraryAddress);
22+
address clone = createClone(target);
2323
Thing(clone).init(_name, _value);
24-
emit ThingCreated(clone, libraryAddress);
24+
emit ThingCreated(clone, target);
2525
}
2626

2727

2828
function isThing(address thing) public view returns (bool) {
29-
return isClone(libraryAddress, thing);
29+
return isClone(target, thing);
3030
}
3131

3232
}

test/ThingFactory.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@ import "../contracts/CloneFactory.sol";
66

77
contract ThingFactory is CloneFactory {
88

9-
address public libraryAddress;
9+
address public target;
1010

11-
event ThingCreated(address newThingAddress, address libraryAddress);
11+
event ThingCreated(address newThingAddress, address target);
1212

13-
constructor (address _libraryAddress) public {
14-
libraryAddress = _libraryAddress;
13+
constructor (address _target) public {
14+
target = _target;
1515
}
1616

1717
function onlyCreate() public {
18-
createClone(libraryAddress);
18+
createClone(target);
1919
}
2020

2121
function createThing(string _name, uint _value) public {
22-
address clone = createClone(libraryAddress);
22+
address clone = createClone(target);
2323
Thing(clone).init(_name, _value);
24-
emit ThingCreated(clone, libraryAddress);
24+
emit ThingCreated(clone, target);
2525
}
2626

2727
function isThing(address thing) public view returns (bool) {
28-
return isClone(libraryAddress, thing);
28+
return isClone(target, thing);
2929
}
3030

3131
function incrementThings(address[] things) public returns (bool) {

0 commit comments

Comments
 (0)