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

Package script updates #1338

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all 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: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"test": "lerna run test",
"test:ci": "lerna run test:ci",
"drain": "node ./scripts/drain-deployer.js",
"migrate-pool": "node ./scripts/migrate-pool.js",
"prepare": "husky install",
"prettier": "prettier --write \"./**/*.sol\" \"./**/*.ts\" \"./**/*.js\" \"./**/*.json\""
},
Expand Down Expand Up @@ -53,6 +54,7 @@
"nx": "^16.5.5",
"prettier": "^2.8.4",
"prettier-plugin-solidity": "^1.1.2",
"prompt-confirm": "^2.0.4",
"solidity-coverage": "^0.8.5",
"ts-node": "^10.9.1",
"typechain": "^8.1.1",
Expand Down
36 changes: 27 additions & 9 deletions source/pool/scripts/migrate.js → scripts/migrate-pool.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,48 @@
require('dotenv').config({ path: './.env' })
const Confirm = require('prompt-confirm')
const { ethers } = require('hardhat')
const { chainNames, ChainIds } = require('@airswap/utils')
const { getReceiptUrl } = require('@airswap/utils')
const {
ChainIds,
chainNames,
apiUrls,
getReceiptUrl,
} = require('@airswap/utils')

const { Pool__factory } = require('../typechain/factories/contracts')
const { abi } = require('./migrate-abis/4-1-1.js')
const deploys = require('../deploys.js')
const { Pool__factory } = require('@airswap/pool/typechain/factories/contracts')
const { abi } = require('@airswap/pool/legacy-abis/4-1-1.js')
const deploys = require('@airswap/pool/deploys.js')

const CONFIRMATIONS = 2
const PREVIOUS_POOL = '0xEEcD248D977Fd4D392915b4AdeF8154BA3aE9c02'
const NEW_POOL = '0xbbcec987E4C189FCbAB0a2534c77b3ba89229F11'

async function main() {
const [account] = await ethers.getSigners()
const chainId = await account.getChainId()
if (chainId === ChainIds.HARDHAT) {
let chainId
if (process.argv[2] === '--network') {
chainId = ChainIds[process.argv[3].toUpperCase()]
}

if (!chainId) {
console.log('Value for --network flag is required')
return
}

const provider = new ethers.providers.JsonRpcProvider(apiUrls[chainId])
const account = new ethers.Wallet(process.env.PRIVATE_KEY, provider)

console.log(`Account: ${account.address}`)
console.log(`Network: ${chainNames[chainId].toUpperCase()}\n`)
console.log(`From-pool: ${PREVIOUS_POOL}`)
console.log(`To-pool: ${NEW_POOL}`)

const previousPool = new ethers.Contract(PREVIOUS_POOL, abi, account.provider)
const logs = await previousPool.queryFilter(previousPool.filters.UseClaim())
let logs
try {
logs = await previousPool.queryFilter(previousPool.filters.UseClaim())
} catch (error) {
console.log('\n✘ Error querying claim events on from-pool.\n\n', error.body)
return
}

if (!logs.length) {
console.log('\n✘ No claim events found on from-pool.\n')
Expand Down
8 changes: 6 additions & 2 deletions scripts/owners-update.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
const Confirm = require('prompt-confirm')
const { ethers } = require('hardhat')
const { chainNames, ChainIds, ownerAddresses } = require('@airswap/utils')
const { getReceiptUrl } = require('@airswap/utils')
const {
chainNames,
ChainIds,
ownerAddresses,
getReceiptUrl,
} = require('@airswap/utils')

const CONFIRMATIONS = 2
const TRANSFER_STARTED =
Expand Down
2 changes: 1 addition & 1 deletion scripts/receivers-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const {
chainNames,
apiUrls,
protocolFeeReceiverAddresses,
ADDRESS_ZERO,
} = require('@airswap/utils')
const poolDeploys = require('@airswap/pool/deploys.js')
const { ADDRESS_ZERO } = require('@airswap/utils')

const contracts = [
['swap', 'Swap'],
Expand Down
9 changes: 3 additions & 6 deletions source/batch-call/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@airswap/batch-call",
"version": "5.0.0",
"description": "Batch balance, allowance, order validity checks",
"description": "AirSwap: Balance, Allowance, Validity Checks",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -10,9 +10,7 @@
"files": [
"./build",
"./typechain",
"./deploys.js",
"./deploys-blocks.js",
"./deploys.js.d.ts"
"./deploys*"
],
"scripts": {
"clean": "rm -rf ./cache && rm -rf ./build && rm -rf ./typechain",
Expand All @@ -29,8 +27,7 @@
"@airswap/utils": "5.0.0",
"@airswap/swap": "5.0.0",
"@airswap/swap-erc20": "5.0.0",
"@openzeppelin/contracts": "^4.8.3",
"prompt-confirm": "^2.0.4"
"@openzeppelin/contracts": "^4.8.3"
},
"publishConfig": {
"access": "public"
Expand Down
3 changes: 1 addition & 2 deletions source/batch-call/scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
const fs = require('fs')
const prettier = require('prettier')
const { ethers, run } = require('hardhat')
const { ChainIds, chainLabels } = require('@airswap/utils')
const { getReceiptUrl } = require('@airswap/utils')
const { ChainIds, chainLabels, getReceiptUrl } = require('@airswap/utils')
const batchCallDeploys = require('../deploys.js')
const batchCallBlocks = require('../deploys-blocks.js')
const batchCallCommits = require('../deploys-commits.js')
Expand Down
2 changes: 1 addition & 1 deletion source/batch-call/test/BatchCall.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const {
createOrderSignature,
createOrderERC20,
createOrderERC20Signature,
TokenKinds,
} = require('@airswap/utils')
const { TokenKinds } = require('@airswap/utils')

const CHAIN_ID = 31337
const PROTOCOL_FEE = '30'
Expand Down
11 changes: 4 additions & 7 deletions source/delegate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
"files": [
"./build",
"./typechain",
"./deploys.js",
"./deploys-blocks.js",
"./deploys.js.d.ts"
"./deploys*"
],
"scripts": {
"clean": "rm -rf ./cache && rm -rf ./build && rm -rf ./typechain",
Expand All @@ -22,13 +20,12 @@
"test": "hardhat test",
"test:ci": "hardhat test",
"deploy": "hardhat run ./scripts/deploy.js",
"owners": "hardhat run ./scripts/owner.js",
"verify": "hardhat run ./scripts/verify.js"
"verify": "hardhat run ./scripts/verify.js",
"owners": "hardhat run ./scripts/owner.js"
},
"devDependencies": {
"@airswap/utils": "5.0.0",
"@airswap/swap-erc20": "5.0.0",
"prompt-confirm": "^2.0.4"
"@airswap/swap-erc20": "5.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
3 changes: 1 addition & 2 deletions source/delegate/scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ const prettier = require('prettier')

const { ethers, run } = require('hardhat')
const swapERC20Deploys = require('@airswap/swap-erc20/deploys.js')
const { ChainIds, chainLabels } = require('@airswap/utils')
const { getReceiptUrl } = require('@airswap/utils')
const { ChainIds, chainLabels, getReceiptUrl } = require('@airswap/utils')
const delegateDeploys = require('../deploys.js')
const delegateBlocks = require('../deploys-blocks.js')
const delegateCommits = require('../deploys-commits.js')
Expand Down
8 changes: 2 additions & 6 deletions source/pool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
"files": [
"./build",
"./typechain",
"./deploys.js",
"./deploys-blocks.js",
"./deploys.js.d.ts"
"./deploys*"
],
"scripts": {
"clean": "rm -rf ./cache && rm -rf ./build && rm -rf ./typechain",
Expand All @@ -24,14 +22,12 @@
"deploy": "hardhat run ./scripts/deploy.js",
"verify": "hardhat run ./scripts/verify.js",
"owners": "hardhat run ./scripts/owner.js",
"migrate": "hardhat run ./scripts/migrate.js",
"balances": "hardhat run ./scripts/balances.js"
},
"devDependencies": {
"@airswap/utils": "5.0.0",
"@airswap/merkle": "0.0.2",
"@openzeppelin/contracts": "^4.8.3",
"prompt-confirm": "^2.0.4"
"@openzeppelin/contracts": "^4.8.3"
},
"publishConfig": {
"access": "public"
Expand Down
3 changes: 1 addition & 2 deletions source/pool/scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
const fs = require('fs')
const prettier = require('prettier')
const { ethers, run } = require('hardhat')
const { chainLabels, ChainIds } = require('@airswap/utils')
const { getReceiptUrl } = require('@airswap/utils')
const { chainLabels, ChainIds, getReceiptUrl } = require('@airswap/utils')
const poolDeploys = require('../deploys.js')
const poolBlocks = require('../deploys-blocks.js')
const poolCommits = require('../deploys-commits.js')
Expand Down
3 changes: 1 addition & 2 deletions source/pool/test/Pool.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
const { expect } = require('chai')
const { toAtomicString } = require('@airswap/utils')
const { toAtomicString, ADDRESS_ZERO } = require('@airswap/utils')
const { generateTreeFromData, getRoot, getProof } = require('@airswap/merkle')
const { soliditySha3 } = require('web3-utils')

const { ethers, waffle } = require('hardhat')
const { deployMockContract } = waffle
const IERC20 = require('@openzeppelin/contracts/build/contracts/IERC20.json')
const STAKING = require('@airswap/staking/build/contracts/Staking.sol/Staking.json')
const { ADDRESS_ZERO } = require('@airswap/utils')

function toWei(value, places) {
return toAtomicString(value, places || 18)
Expand Down
13 changes: 5 additions & 8 deletions source/registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
"files": [
"./build",
"./typechain",
"./deploys.js",
"./deploys-blocks.js",
"./deploys.js.d.ts"
"./deploys*"
],
"scripts": {
"clean": "rm -rf ./cache && rm -rf ./build && rm -rf ./typechain",
Expand All @@ -25,12 +23,11 @@
"verify": "hardhat run ./scripts/verify.js",
"owners": "hardhat run ./scripts/owner.js"
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@airswap/utils": "5.0.0",
"@openzeppelin/contracts": "^4.8.3",
"prompt-confirm": "^2.0.4"
"@openzeppelin/contracts": "^4.8.3"
},
"publishConfig": {
"access": "public"
}
}
3 changes: 1 addition & 2 deletions source/registry/scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
const fs = require('fs')
const prettier = require('prettier')
const { ethers, run } = require('hardhat')
const { ChainIds, chainLabels } = require('@airswap/utils')
const { getReceiptUrl } = require('@airswap/utils')
const { ChainIds, chainLabels, getReceiptUrl } = require('@airswap/utils')
const registryDeploys = require('../deploys.js')
const registryBlocks = require('../deploys-blocks.js')
const registryCommits = require('../deploys-commits.js')
Expand Down
15 changes: 6 additions & 9 deletions source/staking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
"files": [
"./build",
"./typechain",
"./deploys.js",
"./deploys-blocks.js",
"./deploys.js.d.ts"
"./deploys*"
],
"scripts": {
"clean": "rm -rf cache && rm -rf ./build && rm -rf ./typechain",
"clean": "rm -rf ./cache && rm -rf ./build && rm -rf ./typechain",
"compile": "hardhat compile; yarn typechain",
"typechain": "tsc -b",
"coverage": "hardhat coverage",
Expand All @@ -25,12 +23,11 @@
"verify": "hardhat run ./scripts/verify.js",
"owners": "hardhat run ./scripts/owner.js"
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@airswap/utils": "5.0.0",
"@openzeppelin/contracts": "^4.8.3",
"prompt-confirm": "^2.0.4"
"@openzeppelin/contracts": "^4.8.3"
},
"publishConfig": {
"access": "public"
}
}
3 changes: 1 addition & 2 deletions source/staking/scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
const fs = require('fs')
const prettier = require('prettier')
const { ethers, run } = require('hardhat')
const { chainLabels, ChainIds } = require('@airswap/utils')
const { getReceiptUrl } = require('@airswap/utils')
const { chainLabels, ChainIds, getReceiptUrl } = require('@airswap/utils')
const stakingDeploys = require('../deploys.js')
const stakingBlocks = require('../deploys-blocks.js')
const stakingCommits = require('../deploys-commits.js')
Expand Down
5 changes: 1 addition & 4 deletions source/swap-erc20/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
"files": [
"./build",
"./typechain",
"./deploys.js",
"./deploys-blocks.js",
"./deploys.js.d.ts"
"./deploys*"
],
"scripts": {
"clean": "rm -rf ./cache && rm -rf ./build && rm -rf ./typechain",
Expand All @@ -28,7 +26,6 @@
"devDependencies": {
"@airswap/staking": "5.0.0",
"@airswap/utils": "5.0.0",
"prompt-confirm": "^2.0.4",
"solady": "0.0.173"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion source/swap-erc20/scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const {
ChainIds,
chainLabels,
protocolFeeReceiverAddresses,
getReceiptUrl,
} = require('@airswap/utils')
const { getReceiptUrl } = require('@airswap/utils')
const swapERC20Deploys = require('../deploys.js')
const swapERC20Blocks = require('../deploys-blocks.js')
const swapERC20Commits = require('../deploys-commits.js')
Expand Down
3 changes: 2 additions & 1 deletion source/swap-erc20/test/SwapERC20.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const { expect } = require('chai')
const { ADDRESS_ZERO, SECONDS_IN_DAY } = require('@airswap/utils')
const {
createOrderERC20,
orderERC20ToParams,
createOrderERC20Signature,
ADDRESS_ZERO,
SECONDS_IN_DAY,
} = require('@airswap/utils')
const { ethers, waffle } = require('hardhat')
const { deployMockContract } = waffle
Expand Down
5 changes: 1 addition & 4 deletions source/swap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
"files": [
"./build",
"./typechain",
"./deploys.js",
"./deploys-blocks.js",
"./deploys.js.d.ts",
"./deploys-adapters.js"
"./deploys*"
],
"scripts": {
"clean": "rm -rf ./cache && rm -rf ./build && rm -rf ./typechain",
Expand Down
3 changes: 1 addition & 2 deletions source/swap/scripts/deploy-adapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
const fs = require('fs')
const prettier = require('prettier')
const { ethers, run } = require('hardhat')
const { chainLabels, ChainIds } = require('@airswap/utils')
const { getReceiptUrl } = require('@airswap/utils')
const { chainLabels, ChainIds, getReceiptUrl } = require('@airswap/utils')
const adapterDeploys = require('../deploys-adapters.js')
const adapterBlocks = require('../deploys-adapters-blocks.js')
const adapterCommits = require('../deploys-adapters-commits.js')
Expand Down
2 changes: 1 addition & 1 deletion source/swap/scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const {
ChainIds,
protocolFeeReceiverAddresses,
ADDRESS_ZERO,
getReceiptUrl,
} = require('@airswap/utils')
const { getReceiptUrl } = require('@airswap/utils')
const poolDeploys = require('@airswap/pool/deploys.js')
const swapDeploys = require('../deploys.js')
const swapBlocks = require('../deploys-blocks.js')
Expand Down
Loading
Loading