Skip to content

Commit

Permalink
Add formatter options, run pre-compile
Browse files Browse the repository at this point in the history
  • Loading branch information
gretzke committed Nov 4, 2023
1 parent 1982945 commit 68d1a29
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 25 deletions.
10 changes: 5 additions & 5 deletions docs/autogen/src/src/Counter.sol/contract.Counter.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Counter
[Git Source](https://github.com/0xPolygon/foundry-template/blob/a9f2dec0535500e07491e0f2e99dcf48319d8022/src/Counter.sol)
[Git Source](https://github.com/0xPolygon/foundry-template/blob/1982945ef9a5f6e6ec018759f8fcd1f51129ed46/src/Counter.sol)

**Inherits:**
[ICounter](/docs/autogen/src/src/interface/ICounter.sol/interface.ICounter.md), Initializable
Expand All @@ -23,7 +23,7 @@ function initialize(uint256 initialNumber) public initializer;

### setNumber

set the number
Sets the number.


```solidity
Expand All @@ -33,12 +33,12 @@ function setNumber(uint256 newNumber) public;

|Name|Type|Description|
|----|----|-----------|
|`newNumber`|`uint256`|the new number|
|`newNumber`|`uint256`|The new number.|


### increment

increment the number by 1
Increments the number by 1.


```solidity
Expand All @@ -55,6 +55,6 @@ function version() external pure returns (string memory);

|Name|Type|Description|
|----|----|-----------|
|`<none>`|`string`|the version of the contract|
|`<none>`|`string`|The version of the contract.|


Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ICounter
[Git Source](https://github.com/0xPolygon/foundry-template/blob/8d1e780e7b907a30a740d7d96eeb5db9fb0b1450/src/interface/ICounter.sol)
[Git Source](https://github.com/0xPolygon/foundry-template/blob/1982945ef9a5f6e6ec018759f8fcd1f51129ed46/src/interface/ICounter.sol)

**Inherits:**
[IVersioned](/docs/autogen/src/src/interface/IVersioned.sol/interface.IVersioned.md)
Expand All @@ -16,12 +16,12 @@ function number() external view returns (uint256);

|Name|Type|Description|
|----|----|-----------|
|`<none>`|`uint256`|the current number|
|`<none>`|`uint256`|The current number.|


### setNumber

set the number
Sets the number.


```solidity
Expand All @@ -31,12 +31,12 @@ function setNumber(uint256 newNumber) external;

|Name|Type|Description|
|----|----|-----------|
|`newNumber`|`uint256`|the new number|
|`newNumber`|`uint256`|The new number.|


### increment

increment the number by 1
Increments the number by 1.


```solidity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IVersioned
[Git Source](https://github.com/0xPolygon/foundry-template/blob/8d1e780e7b907a30a740d7d96eeb5db9fb0b1450/src/interface/IVersioned.sol)
[Git Source](https://github.com/0xPolygon/foundry-template/blob/1982945ef9a5f6e6ec018759f8fcd1f51129ed46/src/interface/IVersioned.sol)


## Functions
Expand All @@ -13,6 +13,6 @@ function version() external pure returns (string memory);

|Name|Type|Description|
|----|----|-----------|
|`<none>`|`string`|the version of the contract|
|`<none>`|`string`|The version of the contract.|


4 changes: 4 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ remappings = [
runs = 10000
max_test_rejects = 999999

[fmt]
line_length = 160
number_underscore = "thousands"

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
2 changes: 1 addition & 1 deletion script/1.0.0/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ contract Deploy is Script, ScriptHelpers, CounterDeployer {
vm.broadcast(deployerPrivateKey);
proxyAdmin = address(new ProxyAdmin(input.readAddress($("ProxyAdmin.initialOwner"))));

(counter, , ) = deployCounter(address(proxyAdmin), input.readUint($("Counter.number")));
(counter,,) = deployCounter(address(proxyAdmin), input.readUint($("Counter.number")));
}
}
14 changes: 3 additions & 11 deletions script/deployers/DeployCounter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,17 @@ import "src/Counter.sol";
import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";

abstract contract CounterDeployer is Script {
function deployCounter(
address proxyAdmin,
uint256 number
) internal returns (Counter proxyAsCounter, address proxy, address logic) {
function deployCounter(address proxyAdmin, uint256 number) internal returns (Counter proxyAsCounter, address proxy, address logic) {
bytes memory initData = abi.encodeCall(Counter.initialize, (number));

return _deployCounter(proxyAdmin, initData);
}

function deployCounter_NoInit(
address proxyAdmin
) internal returns (Counter proxyAsCounter, address proxy, address logic) {
function deployCounter_NoInit(address proxyAdmin) internal returns (Counter proxyAsCounter, address proxy, address logic) {
return _deployCounter(proxyAdmin, "");
}

function _deployCounter(
address proxyAdmin,
bytes memory initData
) private returns (Counter proxyAsCounter, address proxy, address logic) {
function _deployCounter(address proxyAdmin, bytes memory initData) private returns (Counter proxyAsCounter, address proxy, address logic) {
vm.startBroadcast(vm.envUint("PRIVATE_KEY"));

logic = address(new Counter());
Expand Down
2 changes: 1 addition & 1 deletion test/1.0.0/Counter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ abstract contract BeforeScript is Test, TestHelpers, CounterDeployer {
Counter internal counter;

function setUp() public {
(counter, , ) = deployCounter_NoInit(makeAddr(""));
(counter,,) = deployCounter_NoInit(makeAddr(""));
}
}

Expand Down

0 comments on commit 68d1a29

Please sign in to comment.