Skip to content

Commit

Permalink
formatting and linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dmosites committed Nov 3, 2024
1 parent 7501afc commit deddb70
Show file tree
Hide file tree
Showing 43 changed files with 303 additions and 303 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@

## Contracts

| Package | Version | Description |
| :------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------ | :---------------------------- |
| [`@airswap/registry`](/source/registry) | [![npm](https://img.shields.io/npm/v/@airswap/registry)](https://www.npmjs.com/package/@airswap/registry) | Server Registry |
| [`@airswap/swap`](/source/swap) | [![npm](https://img.shields.io/npm/v/@airswap/swap)](https://www.npmjs.com/package/@airswap/swap) | Atomic Token Swap |
| [`@airswap/swap-erc20`](/source/swap-erc20) | [![npm](https://img.shields.io/npm/v/@airswap/swap-erc20)](https://www.npmjs.com/package/@airswap/swap-erc20) | Atomic Token Swap (ERC20) |
| [`@airswap/wrapper`](/source/wrapper) | [![npm](https://img.shields.io/npm/v/@airswap/wrapper)](https://www.npmjs.com/package/@airswap/wrapper) | Wrapper for Native Tokens |
| [`@airswap/staking`](/source/staking) | [![npm](https://img.shields.io/npm/v/@airswap/staking)](https://www.npmjs.com/package/@airswap/staking) | Staking for Members |
| [`@airswap/pool`](/source/pool) | [![npm](https://img.shields.io/npm/v/@airswap/pool)](https://www.npmjs.com/package/@airswap/pool) | Rewards Pool for Members |
| [`@airswap/batch-call`](/source/batch-call) | [![npm](https://img.shields.io/npm/v/@airswap/batch-call)](https://www.npmjs.com/package/@airswap/batch-call) | Batch Token and Order Calls |
| Package | Version | Description |
| :------------------------------------------ | :------------------------------------------------------------------------------------------------------------ | :-------------------------- |
| [`@airswap/registry`](/source/registry) | [![npm](https://img.shields.io/npm/v/@airswap/registry)](https://www.npmjs.com/package/@airswap/registry) | Server Registry |
| [`@airswap/swap`](/source/swap) | [![npm](https://img.shields.io/npm/v/@airswap/swap)](https://www.npmjs.com/package/@airswap/swap) | Atomic Token Swap |
| [`@airswap/swap-erc20`](/source/swap-erc20) | [![npm](https://img.shields.io/npm/v/@airswap/swap-erc20)](https://www.npmjs.com/package/@airswap/swap-erc20) | Atomic Token Swap (ERC20) |
| [`@airswap/wrapper`](/source/wrapper) | [![npm](https://img.shields.io/npm/v/@airswap/wrapper)](https://www.npmjs.com/package/@airswap/wrapper) | Wrapper for Native Tokens |
| [`@airswap/staking`](/source/staking) | [![npm](https://img.shields.io/npm/v/@airswap/staking)](https://www.npmjs.com/package/@airswap/staking) | Staking for Members |
| [`@airswap/pool`](/source/pool) | [![npm](https://img.shields.io/npm/v/@airswap/pool)](https://www.npmjs.com/package/@airswap/pool) | Rewards Pool for Members |
| [`@airswap/batch-call`](/source/batch-call) | [![npm](https://img.shields.io/npm/v/@airswap/batch-call)](https://www.npmjs.com/package/@airswap/batch-call) | Batch Token and Order Calls |

## Tools

| Package | Version | Description |
| :-------------------------------------- | :---------------------------------------------------------------------------------------------------------- | :---------------------------- |
| [`@airswap/libraries`](tools/libraries) | [![npm](https://img.shields.io/npm/v/@airswap/libraries)](https://www.npmjs.com/package/@airswap/libraries) | Libraries for Developers |
| [`@airswap/utils`](/tools/utils) | [![npm](https://img.shields.io/npm/v/@airswap/utils)](https://www.npmjs.com/package/@airswap/utils) | Utils for Developers |
| Package | Version | Description |
| :-------------------------------------- | :---------------------------------------------------------------------------------------------------------- | :----------------------- |
| [`@airswap/libraries`](tools/libraries) | [![npm](https://img.shields.io/npm/v/@airswap/libraries)](https://www.npmjs.com/package/@airswap/libraries) | Libraries for Developers |
| [`@airswap/utils`](/tools/utils) | [![npm](https://img.shields.io/npm/v/@airswap/utils)](https://www.npmjs.com/package/@airswap/utils) | Utils for Developers |

## Commands

Expand Down
2 changes: 1 addition & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ module.exports = {
],
},
gasReporter: {
enabled: process.env.REPORT_GAS === 'true' ? true : false,
enabled: process.env.REPORT_GAS === 'true',
},
paths: {
artifacts: './build',
Expand Down
2 changes: 1 addition & 1 deletion scripts/deployer-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const {
} = require('@airswap/utils')

module.exports = {
confirmDeployment: async function (deployer, targetAddress) {
confirmDeployment: async (deployer, targetAddress) => {
const gasPrice = await deployer.getGasPrice()
const chainId = await deployer.getChainId()
const balance = ethers.utils.formatUnits(
Expand Down
6 changes: 3 additions & 3 deletions scripts/drain-deployer.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function main() {
}

if (RECIPIENT === ADDRESS_ZERO) {
console.log(`\n✘ RECIPIENT must be set.\n`)
console.log('\n✘ RECIPIENT must be set.\n')
process.exit(0)
}

Expand Down Expand Up @@ -72,7 +72,7 @@ async function main() {
)

if (value.isNegative()) {
console.log(`✘ Not enough balance to perform transfer.\n`)
console.log('✘ Not enough balance to perform transfer.\n')
process.exit(0)
}

Expand All @@ -85,7 +85,7 @@ async function main() {
})
console.log('Transferring...', getReceiptUrl(chainId, tx.hash), '\n')
await tx.wait(CONFIRMATIONS)
console.log(`✔ Balance transfer complete.\n`)
console.log('✔ Balance transfer complete.\n')
}
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/migrate-pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async function main() {
const gasPrice = await account.getGasPrice()
console.log(`\nGas price: ${gasPrice / 10 ** 9} gwei\n`)

const prompt = new Confirm(`Enable and set above as claimed on to-pool?`)
const prompt = new Confirm('Enable and set above as claimed on to-pool?')
if (await prompt.run()) {
const tx = await newPool.enableAndSetClaimed(tree, root, trees[tree])
console.log('Updating...', getReceiptUrl(chainId, tx.hash), '\n')
Expand Down
2 changes: 1 addition & 1 deletion scripts/owners-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function main() {
const chainId = mainnets[m]
let apiUrl = apiUrls[chainId]
if (apiUrl.indexOf('infura.io') !== -1)
apiUrl += '/' + process.env.INFURA_API_KEY
apiUrl += `/${process.env.INFURA_API_KEY}`
const provider = new ethers.providers.JsonRpcProvider(apiUrl)
const deployer = new ethers.Wallet(process.env.PRIVATE_KEY, provider)

Expand Down
20 changes: 10 additions & 10 deletions scripts/owners-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const TRANSFER_STARTED =
'0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700'

module.exports = {
check: async function (name, factory, deploys) {
check: async (name, factory, deploys) => {
const [account] = await ethers.getSigners()
const gasPrice = await account.getGasPrice()
const chainId = await account.getChainId()
Expand All @@ -24,7 +24,7 @@ module.exports = {
console.log(`Network: ${chainNames[chainId].toUpperCase()}\n`)

if (!deploys[chainId]) {
console.log(`✘ No deploy found for selected network.\n`)
console.log('✘ No deploy found for selected network.\n')
process.exit(0)
}

Expand All @@ -36,28 +36,28 @@ module.exports = {
console.log(`Intended owner: ${ownerAddresses[chainId] || 'Not set'}`)

if (currentOwner === ownerAddresses[chainId]) {
console.log(`\n✔ Owner matches intended owner.\n`)
console.log('\n✔ Owner matches intended owner.\n')
} else if (!ownerAddresses[chainId]) {
console.log(`\n✘ Intended owner must be set.\n`)
console.log('\n✘ Intended owner must be set.\n')
} else if (account.address !== currentOwner) {
console.log(`\n✘ Current owner does not match intended owner.`)
console.log('\n✘ Current owner does not match intended owner.')
console.log(
`✘ Cannot update because current account does not match current owner.\n`
'✘ Cannot update because current account does not match current owner.\n'
)
} else {
console.log(`\n✘ Current owner does not match intended owner.\n`)
console.log('\n✘ Current owner does not match intended owner.\n')
console.log(`Gas price: ${gasPrice / 10 ** 9} gwei\n`)
const prompt = new Confirm(`Transfer ownership to intended owner?`)
const prompt = new Confirm('Transfer ownership to intended owner?')
if (await prompt.run()) {
const tx = await contract.transferOwnership(ownerAddresses[chainId])
console.log('Updating...', getReceiptUrl(chainId, tx.hash), '\n')
const receipt = await tx.wait(CONFIRMATIONS)
if (receipt.logs[0].topics[0] === TRANSFER_STARTED) {
console.log(
`✔ Ownership transfer started but must be accepted by new owner.\n`
'✔ Ownership transfer started but must be accepted by new owner.\n'
)
} else {
console.log(`✔ Ownership transfer complete.\n`)
console.log('✔ Ownership transfer complete.\n')
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/receivers-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function main() {
const chainId = mainnets[m]
let apiUrl = apiUrls[chainId]
if (apiUrl.indexOf('infura.io') !== -1)
apiUrl += '/' + process.env.INFURA_API_KEY
apiUrl += `/${process.env.INFURA_API_KEY}`
const provider = new ethers.providers.JsonRpcProvider(apiUrl)
const deployer = new ethers.Wallet(process.env.PRIVATE_KEY, provider)

Expand Down
6 changes: 3 additions & 3 deletions source/batch-call/scripts/deploy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-console */
const fs = require('fs')
const fs = require('node:fs')
const prettier = require('prettier')
const { ethers, run } = require('hardhat')
const { ChainIds, chainLabels, getReceiptUrl } = require('@airswap/utils')
Expand All @@ -17,7 +17,7 @@ async function main() {
console.log('Value for --network flag is required')
return
}
console.log(`\nDeploy BATCHCALL\n`)
console.log('\nDeploy BATCHCALL\n')

if (await confirmDeployment(deployer, batchCallDeploys)) {
const batchFactory = await ethers.getContractFactory('BatchCall')
Expand Down Expand Up @@ -58,7 +58,7 @@ async function main() {
)
)

batchCallCommits[chainId] = require('child_process')
batchCallCommits[chainId] = require('node:child_process')
.execSync('git rev-parse HEAD')
.toString()
.trim()
Expand Down
2 changes: 1 addition & 1 deletion source/batch-call/scripts/owner.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log(`\n✘ BatchCall is not ownable.\n`)
console.log('\n✘ BatchCall is not ownable.\n')
6 changes: 3 additions & 3 deletions source/delegate/scripts/deploy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-console */
const fs = require('fs')
const fs = require('node:fs')
const prettier = require('prettier')

const { ethers, run } = require('hardhat')
Expand All @@ -20,7 +20,7 @@ async function main() {
return
}

console.log(`\nDeploy DELEGATE`)
console.log('\nDeploy DELEGATE')

console.log(`· swapERC20Contract ${swapERC20Deploys[chainId]}\n`)

Expand Down Expand Up @@ -53,7 +53,7 @@ async function main() {
{ ...prettierConfig, parser: 'babel' }
)
)
delegateCommits[chainId] = require('child_process')
delegateCommits[chainId] = require('node:child_process')
.execSync('git rev-parse HEAD')
.toString()
.trim()
Expand Down
6 changes: 3 additions & 3 deletions source/pool/scripts/deploy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-console */
const fs = require('fs')
const fs = require('node:fs')
const prettier = require('prettier')
const { ethers, run } = require('hardhat')
const { chainLabels, ChainIds, getReceiptUrl } = require('@airswap/utils')
Expand All @@ -21,7 +21,7 @@ async function main() {
const scale = 10
const max = 100

console.log(`\nDeploy POOL`)
console.log('\nDeploy POOL')

console.log(`· max ${max}`)
console.log(`· scale ${scale}\n`)
Expand Down Expand Up @@ -53,7 +53,7 @@ async function main() {
{ ...prettierConfig, parser: 'babel' }
)
)
poolCommits[chainId] = require('child_process')
poolCommits[chainId] = require('node:child_process')
.execSync('git rev-parse HEAD')
.toString()
.trim()
Expand Down
26 changes: 13 additions & 13 deletions source/pool/test/Pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('Pool Unit', () => {
await expect(
(await ethers.getContractFactory('Pool')).deploy(CLAIM_SCALE, max)
)
.to.be.revertedWith(`MaxTooHigh`)
.to.be.revertedWith('MaxTooHigh')
.withArgs(max)
})

Expand All @@ -105,7 +105,7 @@ describe('Pool Unit', () => {
await expect(
(await ethers.getContractFactory('Pool')).deploy(scale, CLAIM_MAX)
)
.to.be.revertedWith(`ScaleTooHigh`)
.to.be.revertedWith('ScaleTooHigh')
.withArgs(scale)
})

Expand Down Expand Up @@ -139,7 +139,7 @@ describe('Pool Unit', () => {
const newRoot = getRoot(newTree)
await expect(pool.connect(alice).enable(TREE, newRoot)).to.be.emit(
pool,
`Enable`
'Enable'
)
})
})
Expand Down Expand Up @@ -185,7 +185,7 @@ describe('Pool Unit', () => {
pool
.connect(bob)
.withdraw([], feeToken.address, WITHDRAW_MINIMUM, bob.address)
).to.be.revertedWith(`ClaimsNotProvided`)
).to.be.revertedWith('ClaimsNotProvided')

const isClaimed = await pool.claimed(TREE, bob.address)
expect(isClaimed).to.equal(false)
Expand All @@ -212,7 +212,7 @@ describe('Pool Unit', () => {
bob.address
)
)
.to.be.revertedWith(`TreeNotEnabled`)
.to.be.revertedWith('TreeNotEnabled')
.withArgs(TREE)

const isClaimed = await pool.claimed(TREE, bob.address)
Expand Down Expand Up @@ -256,7 +256,7 @@ describe('Pool Unit', () => {
WITHDRAW_MINIMUM,
bob.address
)
).to.be.revertedWith(`ClaimAlreadyUsed`)
).to.be.revertedWith('ClaimAlreadyUsed')

const isClaimed = await pool.claimed(TREE, bob.address)
expect(isClaimed).to.equal(true)
Expand Down Expand Up @@ -284,7 +284,7 @@ describe('Pool Unit', () => {
bob.address
)
)
.to.be.revertedWith(`ProofInvalid`)
.to.be.revertedWith('ProofInvalid')
.withArgs(TREE, root)

const isClaimed = await pool.claimed(TREE, bob.address)
Expand Down Expand Up @@ -318,7 +318,7 @@ describe('Pool Unit', () => {
bob.address
)
)
.to.be.revertedWith(`AmountInsufficient`)
.to.be.revertedWith('AmountInsufficient')
.withArgs(amount)

const isClaimed = await pool.claimed(TREE, alice.address)
Expand Down Expand Up @@ -413,7 +413,7 @@ describe('Pool Unit', () => {
it('setScale reverts', async () => {
const scale = 1000
await expect(pool.setScale(scale))
.to.be.revertedWith(`ScaleTooHigh`)
.to.be.revertedWith('ScaleTooHigh')
.withArgs(scale)
})
})
Expand All @@ -435,7 +435,7 @@ describe('Pool Unit', () => {
it('setMax reverts', async () => {
const max = 101
await expect(pool.setMax(max))
.to.be.revertedWith(`MaxTooHigh`)
.to.be.revertedWith('MaxTooHigh')
.withArgs(max)
})
})
Expand All @@ -454,7 +454,7 @@ describe('Pool Unit', () => {

it('setAdmin reverts with zero address', async () => {
await expect(pool.connect(deployer).setAdmin(ADDRESS_ZERO))
.to.be.revertedWith(`AddressInvalid`)
.to.be.revertedWith('AddressInvalid')
.withArgs(ADDRESS_ZERO)
})

Expand All @@ -473,7 +473,7 @@ describe('Pool Unit', () => {

it('unsetAdmin executed by non-admin reverts', async () => {
await expect(pool.connect(deployer).unsetAdmin(alice.address))
.to.be.revertedWith(`AdminNotSet`)
.to.be.revertedWith('AdminNotSet')
.withArgs(alice.address)
})
})
Expand All @@ -500,7 +500,7 @@ describe('Pool Unit', () => {
WITHDRAW_MINIMUM,
bob.address
)
).to.be.revertedWith(`ClaimAlreadyUsed`)
).to.be.revertedWith('ClaimAlreadyUsed')
})

it('set claimed with non-owner reverts', async () => {
Expand Down
6 changes: 3 additions & 3 deletions source/registry/scripts/deploy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-console */
const fs = require('fs')
const fs = require('node:fs')
const prettier = require('prettier')
const { ethers, run } = require('hardhat')
const { ChainIds, chainLabels, getReceiptUrl } = require('@airswap/utils')
Expand Down Expand Up @@ -29,7 +29,7 @@ async function main() {
;({ stakingToken, stakingCost, supportCost } = config[ChainIds.MAINNET])
}

console.log(`\nDeploy REGISTRY`)
console.log('\nDeploy REGISTRY')

console.log(`· stakingCost ${stakingCost}`)
console.log(`· supportCost ${supportCost}`)
Expand Down Expand Up @@ -66,7 +66,7 @@ async function main() {
{ ...prettierConfig, parser: 'babel' }
)
)
registryCommits[chainId] = require('child_process')
registryCommits[chainId] = require('node:child_process')
.execSync('git rev-parse HEAD')
.toString()
.trim()
Expand Down
2 changes: 1 addition & 1 deletion source/registry/scripts/owner.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log(`\n✘ Registry is not ownable.\n`)
console.log('\n✘ Registry is not ownable.\n')
Loading

0 comments on commit deddb70

Please sign in to comment.