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

Publish latest / V5 #1339

Merged
merged 42 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f0eef52
Merge pull request #1251 from airswap/develop
dmosites Jan 11, 2024
6c1cc86
Merge pull request #1260 from airswap/develop
dmosites Jan 15, 2024
a9d08e3
Merge pull request #1266 from airswap/develop
dmosites Jan 18, 2024
da9bbc7
Merge pull request #1268 from airswap/develop
dmosites Jan 19, 2024
58f612c
publish libraries 4.2.1-beta.0
dmosites Jan 20, 2024
d9d08fb
bump libraries beta version
dmosites Jan 25, 2024
f2869d7
Bump follow-redirects from 1.15.5 to 1.15.6 (#1302)
dependabot[bot] Mar 18, 2024
863586a
Batch registry call (#1295)
smartcontrart Mar 19, 2024
7a552bc
Bump express from 4.18.3 to 4.19.2 (#1303)
dependabot[bot] Apr 9, 2024
5b6ea7e
Bump undici from 5.28.3 to 5.28.4 (#1304)
dependabot[bot] Apr 9, 2024
eb5a595
Merge branch 'main' of github.com:airswap/airswap-protocols into develop
dmosites May 15, 2024
54cc4ab
Bump ejs from 3.1.9 to 3.1.10 (#1308)
dependabot[bot] May 16, 2024
da05cb9
Delegates (#1309)
smartcontrart May 27, 2024
ad2ea31
merge from main
dmosites Jun 4, 2024
4ebe713
Merge pull request #1310 from airswap/develop
dmosites Jun 4, 2024
ac0cd74
Merge branch 'main' of github.com:airswap/airswap-protocols into develop
dmosites Jun 14, 2024
8e7450d
@airswap/delegate: update utils version; update yarn.lock
dmosites Jun 14, 2024
87e8971
Merge branch 'develop' of github.com:airswap/airswap-protocols into beta
dmosites Jun 14, 2024
77a16cc
Merge branch 'main' of github.com:airswap/airswap-protocols into develop
dmosites Jun 24, 2024
f221e70
Bump ws from 7.5.9 to 7.5.10 (#1314)
dependabot[bot] Jul 1, 2024
89b5de3
Bump braces from 3.0.2 to 3.0.3 (#1312)
dependabot[bot] Jul 1, 2024
4317242
Delegates (#1320)
smartcontrart Aug 21, 2024
009f7f5
Merge branch 'develop' of github.com:airswap/airswap-protocols into beta
dmosites Aug 28, 2024
fd9a894
Use of hashTypeData for code clarity and check chain ID (#1318)
smartcontrart Aug 28, 2024
fc557e7
Merge branch 'beta' of github.com:airswap/airswap-protocols into develop
dmosites Aug 28, 2024
cf58ace
Delegate and SwapERC20 Finalizations (#1322)
dmosites Aug 28, 2024
8d0b5b8
Scripts enhancements (#1321)
smartcontrart Aug 30, 2024
5d62f32
Bump micromatch from 4.0.5 to 4.0.8 (#1323)
dependabot[bot] Sep 2, 2024
fd54c0f
Bump axios from 1.6.7 to 1.7.7 (#1324)
dependabot[bot] Sep 2, 2024
f12798f
Increased Delegate test coverage to 100% (#1325)
smartcontrart Sep 4, 2024
b8243ac
Delegate tests coverage (#1326)
smartcontrart Sep 4, 2024
dc22193
Fix/audit fixes (#1327)
smartcontrart Sep 9, 2024
e986b92
merge from beta
dmosites Sep 9, 2024
dd22f80
Bump body-parser from 1.20.2 to 1.20.3 (#1331)
dependabot[bot] Sep 27, 2024
526f41f
Bump express from 4.19.2 to 4.20.0 (#1332)
dependabot[bot] Sep 27, 2024
c590604
consolidate deploy confirms; delegates report; consistent swapERC20Co…
dmosites Sep 27, 2024
1cd93c1
natspec pass; swap-erc20 usage consistent with wrapper; interface fix…
dmosites Sep 29, 2024
03d29ef
delegate primary multi-chain deploy (#1336)
dmosites Sep 29, 2024
a60c8da
Merge branch 'main' of github.com:airswap/airswap-protocols into develop
dmosites Oct 1, 2024
db7761b
add delegate to libraries; package versions to v5 (#1337)
dmosites Oct 1, 2024
cf62772
Package script updates (#1338)
dmosites Oct 1, 2024
7501afc
remove extraneous import; neon owner
dmosites Oct 1, 2024
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
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "airswap-protocols",
"version": "0.0.1",
"version": "5.0.0",
"private": true,
"license": "MIT",
"workspaces": {
Expand All @@ -13,12 +13,14 @@
"check:owners": "node ./scripts/owners-report.js",
"check:receivers": "node ./scripts/receivers-report.js",
"check:wrappers": "node ./scripts/wrappers-report.js",
"check:delegates": "node ./scripts/delegates-report.js",
"clean": "lerna run clean",
"compile": "lerna run compile",
"linter": "yarn eslint . --ext .js,.ts --fix",
"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 @@ -52,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
59 changes: 59 additions & 0 deletions scripts/delegates-report.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
require('dotenv').config({ path: './.env' })
const { ethers } = require('ethers')
const { mainnets, chainNames, apiUrls } = require('@airswap/utils')
const swapERC20Deploys = require('@airswap/swap-erc20/deploys.js')

async function main() {
console.log()
for (const chainId of mainnets) {
const apiUrl = apiUrls[chainId]
const provider = new ethers.providers.JsonRpcProvider(apiUrl)
const deployer = new ethers.Wallet(process.env.PRIVATE_KEY, provider)

const deploys = require('../source/delegate/deploys.js')
const {
Delegate__factory,
} = require('@airswap/delegate/typechain/factories/contracts')
if (deploys[chainId]) {
const contract = Delegate__factory.connect(deploys[chainId], deployer)
const currentSwapERC20 = await contract.swapERC20Contract()

const intendedSwapERC20 = swapERC20Deploys[chainId]

if (intendedSwapERC20) {
console.log(
chainNames[chainId].toUpperCase(),
`(${chainId})`,
'· Intended SwapERC20: ',
intendedSwapERC20
)

let label = 'Delegate has correct SwapERC20'
if (currentSwapERC20 !== intendedSwapERC20) {
label = `Delegate has incorrect SwapERC20: ${currentSwapERC20}`
}
console.log(currentSwapERC20 === intendedSwapERC20 ? '✔' : '✘', label)
} else {
console.log(
chainNames[chainId].toUpperCase(),
`(${chainId})`,
'✘ SwapERC20 not deployed'
)
}
} else {
console.log(
chainNames[chainId].toUpperCase(),
`(${chainId})`,
'✘ Delegate not deployed'
)
}
console.log()
}
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})
28 changes: 18 additions & 10 deletions scripts/deployer-info.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
const Confirm = require('prompt-confirm')
const {
chainNames,
chainCurrencies,
EVM_NATIVE_TOKEN_DECIMALS,
} = require('@airswap/utils')

module.exports = {
displayDeployerInfo: async function (deployer) {
confirmDeployment: async function (deployer, targetAddress) {
const gasPrice = await deployer.getGasPrice()
const chainId = await deployer.getChainId()
const balance = ethers.utils.formatUnits(
(await deployer.getBalance()).toString(),
EVM_NATIVE_TOKEN_DECIMALS
)
console.log(`\nNetwork: ${chainNames[chainId].toUpperCase()}`)
console.log(`Gas price: ${gasPrice / 10 ** 9} gwei`)
console.log(`\nDeployer: ${deployer.address}`)
console.log(`Balance: ${balance} ${chainCurrencies[chainId]}`)
console.log(`To ${chainNames[chainId].toUpperCase()}`)
console.log(`· Gas price ${gasPrice / 10 ** 9} gwei`)
console.log(`· Deployer wallet ${deployer.address}`)
console.log(`· Deployer balance ${balance} ${chainCurrencies[chainId]}`)

console.log(
`\nNext contract address will be:\n${ethers.utils.getContractAddress({
from: deployer.address,
nonce: await deployer.provider.getTransactionCount(deployer.address),
})}\n`
const nextAddress = ethers.utils.getContractAddress({
from: deployer.address,
nonce: await deployer.provider.getTransactionCount(deployer.address),
})

console.log(`· Contract address ${nextAddress}\n`)

const prompt = new Confirm(
nextAddress === targetAddress || !targetAddress
? 'Proceed to deploy?'
: 'Address would not match mainnet. Proceed anyway?'
)
return await prompt.run()
},
}
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
1 change: 1 addition & 0 deletions scripts/owners-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {
} = require('@airswap/utils')

const contracts = [
['delegate', 'Delegate'],
['pool', 'Pool'],
['staking', 'Staking'],
['swap', 'Swap'],
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
17 changes: 10 additions & 7 deletions scripts/wrappers-report.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
require('dotenv').config({ path: './.env' })
const { ethers } = require('ethers')
const { mainnets, testnets, chainNames, apiUrls } = require('@airswap/utils')
const { mainnets, chainNames, apiUrls } = require('@airswap/utils')
const swapERC20Deploys = require('@airswap/swap-erc20/deploys.js')

const chains = mainnets.concat(testnets)

async function main() {
console.log()
for (let c = 0; c < chains.length; c++) {
const chainId = chains[c]
for (const chainId of mainnets) {
const apiUrl = apiUrls[chainId]
const provider = new ethers.providers.JsonRpcProvider(apiUrl)
const deployer = new ethers.Wallet(process.env.PRIVATE_KEY, provider)
Expand Down Expand Up @@ -40,11 +37,17 @@ async function main() {
console.log(
chainNames[chainId].toUpperCase(),
`(${chainId})`,
'✘ Not deployed'
'✘ SwapERC20 not deployed'
)
}
console.log()
} else {
console.log(
chainNames[chainId].toUpperCase(),
`(${chainId})`,
'✘ Wrapper not deployed'
)
}
console.log()
}
}

Expand Down
19 changes: 19 additions & 0 deletions source/batch-call/deploys-commits.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
1: '863586ae7594b5088619f243dbee83c8d8e0075f',
31: '863586ae7594b5088619f243dbee83c8d8e0075f',
41: '863586ae7594b5088619f243dbee83c8d8e0075f',
56: '863586ae7594b5088619f243dbee83c8d8e0075f',
97: '863586ae7594b5088619f243dbee83c8d8e0075f',
137: '863586ae7594b5088619f243dbee83c8d8e0075f',
8453: '863586ae7594b5088619f243dbee83c8d8e0075f',
17000: '863586ae7594b5088619f243dbee83c8d8e0075f',
42161: '863586ae7594b5088619f243dbee83c8d8e0075f',
43113: '863586ae7594b5088619f243dbee83c8d8e0075f',
43114: '863586ae7594b5088619f243dbee83c8d8e0075f',
59140: '863586ae7594b5088619f243dbee83c8d8e0075f',
59144: '863586ae7594b5088619f243dbee83c8d8e0075f',
80001: '863586ae7594b5088619f243dbee83c8d8e0075f',
84532: '863586ae7594b5088619f243dbee83c8d8e0075f',
421614: '863586ae7594b5088619f243dbee83c8d8e0075f',
11155111: '863586ae7594b5088619f243dbee83c8d8e0075f',
}
1 change: 1 addition & 0 deletions source/batch-call/deploys-commits.js.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module '@airswap/batch-call/deploys-commits.js'
17 changes: 7 additions & 10 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": "4.2.3",
"description": "Batch balance, allowance, order validity checks",
"version": "5.0.0",
"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 @@ -26,11 +24,10 @@
"owners": "hardhat run ./scripts/owner.js"
},
"devDependencies": {
"@airswap/utils": "4.3.4",
"@airswap/swap": "4.2.2",
"@airswap/swap-erc20": "4.3.1",
"@openzeppelin/contracts": "^4.8.3",
"prompt-confirm": "^2.0.4"
"@airswap/utils": "5.0.0",
"@airswap/swap": "5.0.0",
"@airswap/swap-erc20": "5.0.0",
"@openzeppelin/contracts": "^4.8.3"
},
"publishConfig": {
"access": "public"
Expand Down
36 changes: 29 additions & 7 deletions source/batch-call/scripts/deploy.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/* eslint-disable no-console */
const fs = require('fs')
const prettier = require('prettier')
const Confirm = require('prompt-confirm')
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 { displayDeployerInfo } = require('../../../scripts/deployer-info')
const batchCallCommits = require('../deploys-commits.js')
const { confirmDeployment } = require('../../../scripts/deployer-info')

async function main() {
await run('compile')
Expand All @@ -18,10 +17,9 @@ async function main() {
console.log('Value for --network flag is required')
return
}
await displayDeployerInfo(deployer)
console.log(`\nDeploy BATCHCALL\n`)

const prompt = new Confirm('Proceed to deploy?')
if (await prompt.run()) {
if (await confirmDeployment(deployer, batchCallDeploys)) {
const batchFactory = await ethers.getContractFactory('BatchCall')
const batchCallContract = await batchFactory.deploy()
console.log(
Expand All @@ -48,6 +46,30 @@ async function main() {
{ ...prettierConfig, parser: 'babel' }
)
)

batchCallBlocks[chainId] = (
await batchCallContract.deployTransaction.wait()
).blockNumber
fs.writeFileSync(
'./deploys-blocks.js',
prettier.format(
`module.exports = ${JSON.stringify(batchCallBlocks, null, '\t')}`,
{ ...prettierConfig, parser: 'babel' }
)
)

batchCallCommits[chainId] = require('child_process')
.execSync('git rev-parse HEAD')
.toString()
.trim()
fs.writeFileSync(
'./deploys-commits.js',
prettier.format(
`module.exports = ${JSON.stringify(batchCallCommits, null, '\t')}`,
{ ...prettierConfig, parser: 'babel' }
)
)

console.log(
`Deployed: ${batchCallDeploys[chainId]} @ ${batchCallBlocks[chainId]}`
)
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
Loading
Loading