diff --git a/.prettierrc b/.prettierrc index 315f7cf..de6705e 100644 --- a/.prettierrc +++ b/.prettierrc @@ -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 + } + } + ] } diff --git a/README.md b/README.md index 0ade691..e0d2151 100644 --- a/README.md +++ b/README.md @@ -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 ` to extract deployment information from forge broadcast output (broadcast/latest-run.json). --- diff --git a/script/utils/extract.js b/script/utils/extract.js index cab7609..85c8b10 100644 --- a/script/utils/extract.js +++ b/script/utils/extract.js @@ -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, @@ -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, @@ -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 }; } diff --git a/src/PolygonMigration.sol b/src/PolygonMigration.sol index 5fabc9b..9cc05a4 100644 --- a/src/PolygonMigration.sol +++ b/src/PolygonMigration.sol @@ -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; } diff --git a/src/interfaces/IPolygonEcosystemToken.sol b/src/interfaces/IPolygonEcosystemToken.sol index 0107822..9547b6e 100644 --- a/src/interfaces/IPolygonEcosystemToken.sol +++ b/src/interfaces/IPolygonEcosystemToken.sol @@ -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); diff --git a/src/interfaces/IPolygonMigration.sol b/src/interfaces/IPolygonMigration.sol index a420668..78ec75f 100644 --- a/src/interfaces/IPolygonMigration.sol +++ b/src/interfaces/IPolygonMigration.sol @@ -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);