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

pool and registry deploys; write blocks; add pool to libraries #1183

Merged
merged 2 commits into from
Aug 21, 2023
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
4 changes: 2 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"bracketSpacing": true,
"printWidth": 80,
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"bracketSpacing": true,
"tabWidth": 2,
"trailingComma": "es5",
"overrides": [
{
Expand Down
3 changes: 3 additions & 0 deletions source/pool/deploys-blocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
5: 9556269,
}
13 changes: 1 addition & 12 deletions source/pool/deploys.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
module.exports = {
1: '0xe2E7AE67E7ee6d4D90dfef945aB6dE6A14dB4c17',
5: '0xE5f1542054d5DA46C2CB3728C197857958bb44a5',
30: '0x9e9c21C4747B078712D2bb49A279A043973BE9a0',
31: '0xb1B586AfA8a2AaB42826Fb2Ab9896CD0c686d0F4',
56: '0x16B57a5958271C479f64BC5F830DfC4f30ba2235',
97: '0x64888583E676368390D6eB573bC2AC3bCE9002B3',
137: '0xb1b586afa8a2aab42826fb2ab9896cd0c686d0f4',
42161: '0xb1B586AfA8a2AaB42826Fb2Ab9896CD0c686d0F4',
43113: '0x1CfA1b1809b9fF6bDCE1d4c5fCc842eAA31a836d',
43114: '0xd3B6279cD6b21e92A6c53476E59a2C819018D6fE',
80001: '0xC32a3c867aBAd28d977e1724f92D9684fF3d2976',
421613: '0x5E5A433cdfB14aB228c45E23251Ad83F7b1E3302',
5: '0xFeEFD5F62A10277fF8082a80735a8380033439d0',
}
1 change: 1 addition & 0 deletions source/pool/deploys.js.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
declare module '@airswap/pool/deploys.js'
declare module '@airswap/pool/deploys-blocks.js'
4 changes: 2 additions & 2 deletions source/pool/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@airswap/pool",
"version": "4.0.3-beta.0",
"description": "AirSwap: Rewards Pool",
"version": "4.0.3-beta.1",
"description": "AirSwap: Withdrawable Token Pool",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
35 changes: 20 additions & 15 deletions source/pool/scripts/deploy.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
/* eslint-disable no-console */
const fs = require('fs')
const prettier = require('prettier')
const Confirm = require('prompt-confirm')
const { ethers, run } = require('hardhat')
const stakingDeploys = require('@airswap/staking/deploys.js')
const {
chainNames,
ChainIds,
stakingTokenAddresses,
} = require('@airswap/constants')
const { chainNames, ChainIds } = require('@airswap/constants')
const { getReceiptUrl } = require('@airswap/utils')
const poolDeploys = require('../deploys.js')
const poolBlocks = require('../deploys-blocks.js')

async function main() {
await run('compile')
const config = await prettier.resolveConfig('../deploys.js')

const [deployer] = await ethers.getSigners()
const gasPrice = await deployer.getGasPrice()
const chainId = await deployer.getChainId()
Expand All @@ -26,12 +25,6 @@ async function main() {

const scale = 10
const max = 100
const stakingContract = stakingDeploys[chainId]
const stakingToken = stakingTokenAddresses[chainId]

console.log(`Staking token: ${stakingToken}`)
console.log(`Staking contract: ${stakingContract}`)
console.log(`Gas price: ${gasPrice / 10 ** 9} gwei`)

const prompt = new Confirm('Proceed to deploy?')
if (await prompt.run()) {
Expand All @@ -42,14 +35,26 @@ async function main() {
getReceiptUrl(chainId, poolContract.deployTransaction.hash)
)
await poolContract.deployed()
console.log(`Deployed: ${poolContract.address}`)

poolDeploys[chainId] = poolContract.address
fs.writeFileSync(
'./deploys.js',
`module.exports = ${JSON.stringify(poolDeploys, null, '\t')}`
prettier.format(
`module.exports = ${JSON.stringify(poolDeploys, null, '\t')}`,
{ ...config, parser: 'babel' }
)
)
poolBlocks[chainId] = (
await poolContract.deployTransaction.wait()
).blockNumber
fs.writeFileSync(
'./deploys-blocks.js',
prettier.format(
`module.exports = ${JSON.stringify(poolBlocks, null, '\t')}`,
{ ...config, parser: 'babel' }
)
)
console.log('Updated deploys.js')
console.log(`Deployed: ${poolDeploys[chainId]} @ ${poolBlocks[chainId]}`)

console.log(
`\nVerify with "yarn verify --network ${chainNames[
Expand Down
3 changes: 3 additions & 0 deletions source/registry/deploys-blocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
5: 9556263,
}
4 changes: 1 addition & 3 deletions source/registry/deploys.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module.exports = {
1: '0xf5E6730c5A915b6f47AeAB0952655036aE2e73E9',
5: '0x4b572E93511120a9e1a2EA29C8b2358bdD0addc0',
59140: '0xAa7fC83C31db055261cb88e5cAa02CAFe12c8dCD',
5: '0xA5630a92E45c2b4DeFA95Bf312B3bb9B69944A13',
}
1 change: 1 addition & 0 deletions source/registry/deploys.js.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
declare module '@airswap/registry/deploys.js'
declare module '@airswap/registry/deploys-blocks.js'
2 changes: 1 addition & 1 deletion source/registry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airswap/registry",
"version": "4.0.3",
"version": "4.0.4-beta.0",
"description": "AirSwap: Server URL Registry",
"license": "MIT",
"repository": {
Expand Down
24 changes: 21 additions & 3 deletions source/registry/scripts/deploy.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
/* eslint-disable no-console */
const fs = require('fs')
const prettier = require('prettier')
const Confirm = require('prompt-confirm')
const { ethers, run } = require('hardhat')
const { ChainIds, chainNames, ADDRESS_ZERO } = require('@airswap/constants')
const { getReceiptUrl } = require('@airswap/utils')
const registryDeploys = require('../deploys.js')
const registryBlocks = require('../deploys-blocks.js')

async function main() {
await run('compile')
const config = await prettier.resolveConfig('../deploys.js')

const [deployer] = await ethers.getSigners()
const gasPrice = await deployer.getGasPrice()
const chainId = await deployer.getChainId()
Expand Down Expand Up @@ -40,14 +44,28 @@ async function main() {
getReceiptUrl(chainId, registryContract.deployTransaction.hash)
)
await registryContract.deployed()
console.log(`Deployed: ${registryContract.address}`)

registryDeploys[chainId] = registryContract.address
fs.writeFileSync(
'./deploys.js',
`module.exports = ${JSON.stringify(registryDeploys, null, '\t')}`
prettier.format(
`module.exports = ${JSON.stringify(registryDeploys, null, '\t')}`,
{ ...config, parser: 'babel' }
)
)
registryBlocks[chainId] = (
await registryContract.deployTransaction.wait()
).blockNumber
fs.writeFileSync(
'./deploys-blocks.js',
prettier.format(
`module.exports = ${JSON.stringify(registryBlocks, null, '\t')}`,
{ ...config, parser: 'babel' }
)
)
console.log(
`Deployed: ${registryDeploys[chainId]} @ ${registryBlocks[chainId]}`
)
console.log('Updated deploys.js')

console.log(
`\nVerify with "yarn verify --network ${chainNames[
Expand Down
5 changes: 3 additions & 2 deletions tools/libraries/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airswap/libraries",
"version": "4.0.19",
"version": "4.0.20-beta.0",
"description": "AirSwap: Libraries for Developers",
"repository": {
"type": "git",
Expand Down Expand Up @@ -29,8 +29,9 @@
"@airswap/balances": "4.0.2",
"@airswap/constants": "4.0.10",
"@airswap/jsonrpc-client-websocket": "0.0.1",
"@airswap/registry": "4.0.3",
"@airswap/registry": "4.0.4-beta.0",
"@airswap/maker-registry": "4.0.4",
"@airswap/pool": "4.0.3-beta.1",
"@airswap/staking": "4.0.3",
"@airswap/swap": "4.0.4",
"@airswap/swap-erc20": "4.0.6",
Expand Down
4 changes: 4 additions & 0 deletions tools/libraries/src/Contracts.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import { ethers } from 'ethers'
import { ChainIds } from '@airswap/constants'

import { Pool__factory } from '@airswap/pool/typechain/factories/contracts'
import { Staking__factory } from '@airswap/staking/typechain/factories/contracts'
import { Swap__factory } from '@airswap/swap/typechain/factories/contracts'
import { SwapERC20__factory } from '@airswap/swap-erc20/typechain/factories/contracts'
import { Wrapper__factory } from '@airswap/wrapper/typechain/factories/contracts'
import { WETH9__factory } from '@airswap/wrapper/typechain/factories/contracts'

import poolDeploys from '@airswap/pool/deploys.js'
import stakingDeploys from '@airswap/staking/deploys.js'
import swapERC20Deploys from '@airswap/swap-erc20/deploys.js'
import swapDeploys from '@airswap/swap/deploys.js'
import wrapperDeploys from '@airswap/wrapper/deploys.js'
import wethDeploys from '@airswap/wrapper/deploys-weth.js'

import poolBlocks from '@airswap/pool/deploys-blocks.js'
import stakingBlocks from '@airswap/staking/deploys-blocks.js'
import swapERC20Blocks from '@airswap/swap-erc20/deploys-blocks.js'
import wrapperBlocks from '@airswap/wrapper/deploys-blocks.js'
Expand Down Expand Up @@ -54,6 +57,7 @@ export class Contract {
}
}

export const Pool = new Contract('Pool', poolDeploys, poolBlocks, Pool__factory)
export const Staking = new Contract(
'Staking',
stakingDeploys,
Expand Down
3 changes: 2 additions & 1 deletion tools/libraries/src/RegistryV4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { ethers } from 'ethers'
import { ServerOptions } from '@airswap/types'
import { Registry__factory } from '@airswap/registry/typechain/factories/contracts'
import registryDeploys from '@airswap/registry/deploys.js'
import registryBlocks from '@airswap/registry/deploys-blocks.js'

import { Server } from './Server'
import { Contract, SwapERC20 } from './Contracts'

class ServerRegistry extends Contract {
public constructor() {
super('Registry', registryDeploys, {}, Registry__factory)
super('Registry', registryDeploys, registryBlocks, Registry__factory)
}
public async getServerURLs(
providerOrSigner: ethers.providers.Provider | ethers.Signer,
Expand Down
Loading