Skip to content

Commit

Permalink
Merge pull request #32 from 0xPolygon/chore/lint
Browse files Browse the repository at this point in the history
chore: fix lint
  • Loading branch information
DhairyaSethi authored Oct 4, 2023
2 parents 8c0ab2c + e12d439 commit a780764
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 16 deletions.
16 changes: 14 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
{
"printWidth": 120,
"tabWidth": 4,
"tabWidth": 2,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false
"bracketSpacing": true,
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 120,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false
}
}
]
}
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,23 @@ A default implementation is included and this contract will be proxy upgradable

## Development

# Setup
### Setup

- Install foundry: https://book.getfoundry.sh/getting-started/installation
- [Install foundry](https://book.getfoundry.sh/getting-started/installation)
- Install Dependencies: `forge install`
- Build: `forge build`
- Test: `forge test`

# Deployment
### Deployment

1. Ensure .env file is set, `cp .env.example`
2. Populate Enviornment variables: `source .env`

3. We use a forge script to deploy the contracts, and have an additional extract.js script to store a JSON file with
3. We use a forge script to deploy the contracts, and have an additional extract.js script to store a JSON file with coalesced deployment information. (see [output](./output/))

- (mainnet): `forge script script/Deploy.s.sol --broadcast --verify --rpc-url $RPC_URL --private-key $PRIVATE_KEY --etherscan-api-key $ETHERSCAN_API_KEY`
- (testnet, goerli for example): `forge script script/Deploy.s.sol --broadcast --verify --rpc-url $RPC_URL --private-key $PRIVATE_KEY --verifier-url https://api-goerli.etherscan.io/api --chain-id 5`

4. Run `node script/util/extract.js` to extract deployment information from forge broadcast output (broadcast/latest-run.json specifically).
4. Run `node script/util/extract.js <chainId>` to extract deployment information from forge broadcast output (broadcast/latest-run.json).

---

Expand Down
11 changes: 6 additions & 5 deletions script/utils/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ async function main() {
deployments
.filter(
({ contractName }) =>
contractName !== "TransparentUpgradeableProxy" &&
!proxies.find((p) => p.contractName === contractName)
contractName !== "TransparentUpgradeableProxy" && !proxies.find((p) => p.contractName === contractName)
)
.map(async ({ contractName, contractAddress, transaction: { data } }) => ({
address: contractAddress,
Expand Down Expand Up @@ -70,8 +69,10 @@ async function main() {
}
// overwrite latest with changed contracts
out.latest = {
...out.latest,
contracts,
contracts: {
...out.latest?.contracts,
...contracts,
},
input: config[chainId],
commitHash,
timestamp: data.timestamp,
Expand Down Expand Up @@ -106,7 +107,7 @@ async function getVersion(contractAddress, rpcUrl) {
if (res.error) throw new Error(res.error.message);
return { version: hexToAscii(res.result)?.trim() || res.result };
} catch (e) {
if (e.message === "execution reverted") return null; // contract does implement getVersion()
if (e.message === "execution reverted") return null; // contract does not implement getVersion()
console.log("getVersion error:", rpcUrl, e.message);
return { version: undefined };
}
Expand Down
2 changes: 1 addition & 1 deletion src/PolygonMigration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,5 @@ contract PolygonMigration is Ownable2StepUpgradeable, IPolygonMigration {
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[48] private __gap;
uint256[49] private __gap;
}
2 changes: 1 addition & 1 deletion src/interfaces/IPolygonEcosystemToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface IPolygonEcosystemToken is IERC20, IERC20Permit, IAccessControlEnumerab
error MaxMintExceeded(uint256 maxMint, uint256 mintRequested);

function mintPerSecondCap() external view returns (uint256 currentMintPerSecondCap);

function getVersion() external pure returns (string memory version);

function lastMint() external view returns (uint256 lastMintTimestamp);
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IPolygonMigration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface IPolygonMigration {

function unmigrationLocked() external view returns (bool isUnmigrationLocked);

function polygon() external view returns(IERC20 polygonEcosystemToken);
function polygon() external view returns (IERC20 polygonEcosystemToken);

function getVersion() external pure returns (string memory version);

Expand Down

0 comments on commit a780764

Please sign in to comment.