Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update prettier config #120

Merged
merged 3 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ jobs:
fi

- name: Test
run: npm run test-evm-versions
run: CHECK_CONTRACT_SIZE=true npm run test-evm-versions
18 changes: 11 additions & 7 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
{
"printWidth": 120,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 80,
"tabWidth": 4,
"useTabs": false,
"bracketSpacing": true,
"plugins": ["prettier-plugin-solidity"],
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 120,
"tabWidth": 4,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": true,
"explicitTypes": "always"
}
},
Expand All @@ -25,6 +23,12 @@
"options": {
"tabWidth": 2
}
},
{
"files": "*.yaml",
"options": {
"tabWidth": 2
}
}
]
}
10 changes: 5 additions & 5 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
skipFiles: ['test'],
mocha: {
grep: '@skip-on-coverage', // Add to test description to skip coverage from being run some tests, such as bytecode checks
invert: true,
},
skipFiles: ['test'],
mocha: {
grep: '@skip-on-coverage', // Add to test description to skip coverage from being run some tests, such as bytecode checks
invert: true,
},
};
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Axelar GMP SDK Solidity

This repository contains all the necessary ingredients for successful cross-chain development
utilizing the Axelar General Message Passing protocol.
utilizing the Axelar General Message Passing protocol.

## Documentation

Expand Down Expand Up @@ -37,6 +37,23 @@ const Upgradable = require('@axelar-network/axelar-cgp-solidity/artifacts/contra

Unit tests can also be run against live networks for integration testing, see [here](https://github.com/axelarnetwork/axelar-cgp-solidity#live-network-testing).

### Development

Check gas usage
```bash
REPORT_GAS=true npm run test
```

Check storage layout of contracts.
```bash
STORAGE_LAYOUT=true npx hardhat check
```

Check contract bytecode size
```bash
CHECK_CONTRACT_SIZE=true npm run build
```

## Available contracts

### AxelarExecutable
Expand Down
98 changes: 55 additions & 43 deletions hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,63 +1,75 @@
require('@nomicfoundation/hardhat-toolbox');
require('solidity-coverage');

if (process.env.STORAGE_LAYOUT) {
require('hardhat-storage-layout');
}

if (process.env.CHECK_CONTRACT_SIZE) {
require('hardhat-contract-sizer');
}

const { importNetworks, readJSON } = require('@axelar-network/axelar-chains-config');

const env = process.env.ENV || 'testnet';
const {
importNetworks,
readJSON,
} = require('@axelar-network/axelar-chains-config');
const chains = require(`@axelar-network/axelar-chains-config/info/${env}.json`);
const keys = readJSON(`${__dirname}/keys.json`);
const { networks, etherscan } = importNetworks(chains, keys);

const optimizerSettings = {
enabled: true,
runs: 1000000,
details: {
peephole: process.env.COVERAGE === undefined,
inliner: process.env.COVERAGE === undefined,
jumpdestRemover: true,
orderLiterals: true,
deduplicate: true,
cse: process.env.COVERAGE === undefined,
constantOptimizer: true,
yul: true,
yulDetails: {
stackAllocation: true,
enabled: true,
runs: 1000000,
details: {
peephole: process.env.COVERAGE === undefined,
inliner: process.env.COVERAGE === undefined,
jumpdestRemover: true,
orderLiterals: true,
deduplicate: true,
cse: process.env.COVERAGE === undefined,
constantOptimizer: true,
yul: true,
yulDetails: {
stackAllocation: true,
},
},
},
};
const compilerSettings = {
version: '0.8.19',
settings: {
evmVersion: process.env.EVM_VERSION || 'london',
optimizer: optimizerSettings,
},
version: '0.8.19',
settings: {
evmVersion: process.env.EVM_VERSION || 'london',
optimizer: optimizerSettings,
},
};

/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: {
compilers: [compilerSettings],
// Fix the Proxy bytecodes
overrides: {
'contracts/deploy/Create2Deployer.sol': compilerSettings,
'contracts/deploy/Create3Deployer.sol': compilerSettings,
'contracts/upgradable/Proxy.sol': compilerSettings,
'contracts/upgradable/InitProxy.sol': compilerSettings,
'contracts/upgradable/FinalProxy.sol': compilerSettings,
'contracts/upgradable/FixedProxy.sol': compilerSettings,
solidity: {
compilers: [compilerSettings],
// Fix the Proxy bytecodes
overrides: {
'contracts/deploy/Create2Deployer.sol': compilerSettings,
'contracts/deploy/Create3Deployer.sol': compilerSettings,
'contracts/upgradable/Proxy.sol': compilerSettings,
'contracts/upgradable/InitProxy.sol': compilerSettings,
'contracts/upgradable/FinalProxy.sol': compilerSettings,
'contracts/upgradable/FixedProxy.sol': compilerSettings,
},
},
defaultNetwork: 'hardhat',
networks,
etherscan,
mocha: {
timeout: 4 * 60 * 60 * 1000, // 4 hrs
},
gasReporter: {
enabled: process.env.REPORT_GAS !== undefined,
excludeContracts: ['contracts/test'],
},
contractSizer: {
runOnCompile: process.env.CHECK_CONTRACT_SIZE,
strict: process.env.CHECK_CONTRACT_SIZE,
except: ['contracts/test'],
},
},
defaultNetwork: 'hardhat',
networks,
etherscan,
mocha: {
timeout: 4 * 60 * 60 * 1000, // 4 hrs
},
gasReporter: {
enabled: process.env.REPORT_GAS ? true : false,
},
};
82 changes: 41 additions & 41 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
'use strict';
const {
estimateGasForCreate2Deploy,
estimateGasForCreate2DeployAndInit,
create2DeployContract,
create2DeployAndInitContract,
getCreate2Address,
estimateGasForCreate2Deploy,
estimateGasForCreate2DeployAndInit,
create2DeployContract,
create2DeployAndInitContract,
getCreate2Address,
} = require('./scripts/create2Deployer');
const {
estimateGasForCreate3Deploy,
estimateGasForCreate3DeployAndInit,
create3DeployContract,
create3DeployAndInitContract,
getCreate3Address,
estimateGasForCreate3Deploy,
estimateGasForCreate3DeployAndInit,
create3DeployContract,
create3DeployAndInitContract,
getCreate3Address,
} = require('./scripts/create3Deployer');
const {
estimateGasForDeploy,
estimateGasForDeployAndInit,
deployContractConstant,
deployAndInitContractConstant,
predictContractConstant,
estimateGasForDeploy,
estimateGasForDeployAndInit,
deployContractConstant,
deployAndInitContractConstant,
predictContractConstant,
} = require('./scripts/constAddressDeployer');
const {
deployUpgradable,
deployCreate2InitUpgradable,
deployCreate3Upgradable,
deployCreate3InitUpgradable,
upgradeUpgradable,
deployUpgradable,
deployCreate2InitUpgradable,
deployCreate3Upgradable,
deployCreate3InitUpgradable,
upgradeUpgradable,
} = require('./scripts/upgradable');
const { printObj } = require('./scripts/utils');

module.exports = {
estimateGasForDeploy,
estimateGasForDeployAndInit,
deployContractConstant,
deployAndInitContractConstant,
predictContractConstant,
estimateGasForDeploy,
estimateGasForDeployAndInit,
deployContractConstant,
deployAndInitContractConstant,
predictContractConstant,

estimateGasForCreate2Deploy,
estimateGasForCreate2DeployAndInit,
create2DeployContract,
create2DeployAndInitContract,
getCreate2Address,
estimateGasForCreate2Deploy,
estimateGasForCreate2DeployAndInit,
create2DeployContract,
create2DeployAndInitContract,
getCreate2Address,

estimateGasForCreate3Deploy,
estimateGasForCreate3DeployAndInit,
create3DeployContract,
create3DeployAndInitContract,
getCreate3Address,
estimateGasForCreate3Deploy,
estimateGasForCreate3DeployAndInit,
create3DeployContract,
create3DeployAndInitContract,
getCreate3Address,

deployUpgradable,
deployCreate2InitUpgradable,
deployCreate3Upgradable,
deployCreate3InitUpgradable,
upgradeUpgradable,
printObj,
deployUpgradable,
deployCreate2InitUpgradable,
deployCreate3Upgradable,
deployCreate3InitUpgradable,
upgradeUpgradable,
printObj,
};
Loading
Loading