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

swap-erc20 mainnets deploy, others to follow; dep upgrades #1298

Merged
merged 6 commits into from
Mar 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: 1 addition & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require('dotenv').config({ path: '../../.env' })
require('@typechain/hardhat')
require('@nomiclabs/hardhat-ethers')
require('@nomiclabs/hardhat-waffle')
require('@nomiclabs/hardhat-etherscan')
require('@nomicfoundation/hardhat-verify')
require('hardhat-gas-reporter')
require('solidity-coverage')

Expand Down
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,20 @@
"prettier": "prettier --write \"./**/*.sol\" \"./**/*.ts\" \"./**/*.js\" \"./**/*.json\""
},
"devDependencies": {
"@ensdomains/ens": "^0.4.4",
"@ensdomains/resolver": "^0.2.4",
"@ethersproject/abi": "^5.7.0",
"@ethersproject/bytes": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@nomiclabs/hardhat-ethers": "^2.1.0",
"@nomiclabs/hardhat-etherscan": "^3.1.0",
"@nomiclabs/hardhat-waffle": "^2.0.3",
"@typechain/ethers-v5": "^10.2.0",
"@typechain/hardhat": "^6.1.5",
"@nomicfoundation/hardhat-verify": "^2.0.4",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-waffle": "^2.0.6",
"@typechain/ethers-v5": "^11.1.2",
"@typechain/hardhat": "^7.0.0",
"@types/mocha": "^10.0.1",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"@types/sinon-chai": "^3.2.12",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^7.1.0",
"chai": "^4.3.6",
"dotenv": "^16.0.1",
"eslint": "^8.20.0",
Expand Down
4 changes: 2 additions & 2 deletions source/batch-call/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"dependencies": {
"@openzeppelin/contracts": "^4.8.3",
"@airswap/swap": "4.2.1",
"@airswap/swap-erc20": "4.2.1"
"@airswap/swap-erc20": "4.3.0"
},
"devDependencies": {
"@airswap/utils": "4.2.10",
"@airswap/utils": "4.3.0",
"prompt-confirm": "^2.0.4"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion source/pool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@openzeppelin/contracts": "^4.8.3"
},
"devDependencies": {
"@airswap/utils": "4.2.10",
"@airswap/utils": "4.3.0",
"@airswap/merkle": "0.0.2",
"prompt-confirm": "^2.0.4"
},
Expand Down
2 changes: 1 addition & 1 deletion source/registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"access": "public"
},
"devDependencies": {
"@airswap/utils": "4.2.10",
"@airswap/utils": "4.3.0",
"prompt-confirm": "^2.0.4"
}
}
2 changes: 1 addition & 1 deletion source/staking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"access": "public"
},
"devDependencies": {
"@airswap/utils": "4.2.10",
"@airswap/utils": "4.3.0",
"prompt-confirm": "^2.0.4"
}
}
13 changes: 7 additions & 6 deletions source/swap-erc20/contracts/SwapERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ contract SwapERC20 is ISwapERC20, Ownable, EIP712 {
returns (string memory name, string memory version)
{
name = "SWAP_ERC20";
version = "4.2";
version = "4.3";
}

/**
Expand Down Expand Up @@ -734,7 +734,7 @@ contract SwapERC20 is ISwapERC20, Ownable, EIP712 {
}

/**
* @notice Calculates and transfers protocol fee and bonus
* @notice Calculates and transfers protocol fee and staking bonus
* @param sourceToken address
* @param sourceWallet address
* @param amount uint256
Expand All @@ -744,33 +744,34 @@ contract SwapERC20 is ISwapERC20, Ownable, EIP712 {
address sourceWallet,
uint256 amount
) private {
// Transfer fee from signer to feeWallet
// Determine protocol fee from amount
uint256 feeAmount = (amount * protocolFee) / FEE_DIVISOR;
if (feeAmount > 0) {
uint256 bonusAmount;
if (stakingToken != address(0)) {
// Only check bonus if staking is set
// Only check staking bonus if staking token set
bonusAmount = calculateBonus(
ERC20(stakingToken).balanceOf(msg.sender),
feeAmount
);
}
if (bonusAmount > 0) {
// Transfer fee from signer to sender
// Transfer staking bonus from source to msg.sender
SafeTransferLib.safeTransferFrom(
sourceToken,
sourceWallet,
msg.sender,
bonusAmount
);
// Transfer fee from signer to feeWallet
// Transfer remaining protocol fee from source to fee wallet
SafeTransferLib.safeTransferFrom(
sourceToken,
sourceWallet,
protocolFeeWallet,
feeAmount - bonusAmount
);
} else {
// Transfer full protocol fee from source to fee wallet
SafeTransferLib.safeTransferFrom(
sourceToken,
sourceWallet,
Expand Down
24 changes: 6 additions & 18 deletions source/swap-erc20/deploys-blocks.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
module.exports = {
1: 19169050,
31: 4776706,
41: 280828324,
56: 35875262,
97: 37474882,
137: 53160880,
8453: 10229426,
17000: 882207,
42161: 178077878,
43113: 29751054,
43114: 41340140,
59140: 3401119,
59144: 2075514,
80001: 45572097,
84532: 5684322,
421613: 61943880,
421614: 11892510,
11155111: 5224921,
1: 19341464,
56: 36593146,
137: 54144778,
43114: 42345669,
59144: 2613444,
11155111: 5395281,
}
24 changes: 6 additions & 18 deletions source/swap-erc20/deploys.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
module.exports = {
1: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
31: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
41: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
56: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
97: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
137: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
8453: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
17000: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
42161: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
43113: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
43114: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
59140: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
59144: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
80001: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
84532: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
421613: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
421614: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
11155111: '0xD82a5ff379f20fc45e213F4ee1D1FCF47545665e',
1: '0xD82E10B9A4107939e55fCCa9B53A9ede6CF2fC46',
56: '0xD82E10B9A4107939e55fCCa9B53A9ede6CF2fC46',
137: '0xD82E10B9A4107939e55fCCa9B53A9ede6CF2fC46',
43114: '0xD82E10B9A4107939e55fCCa9B53A9ede6CF2fC46',
59144: '0xD82E10B9A4107939e55fCCa9B53A9ede6CF2fC46',
11155111: '0xD82E10B9A4107939e55fCCa9B53A9ede6CF2fC46',
}
6 changes: 3 additions & 3 deletions source/swap-erc20/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airswap/swap-erc20",
"version": "4.2.1",
"version": "4.3.0",
"description": "AirSwap: Atomic ERC20 Token Swap",
"license": "MIT",
"repository": {
Expand All @@ -26,11 +26,11 @@
"owners": "hardhat run ./scripts/owner.js"
},
"dependencies": {
"solady": "0.0.172"
"solady": "0.0.173"
},
"devDependencies": {
"@airswap/staking": "4.2.1",
"@airswap/utils": "4.2.10",
"@airswap/utils": "4.3.0",
"prompt-confirm": "^2.0.4"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion source/swap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@openzeppelin/contracts": "^4.8.3"
},
"devDependencies": {
"@airswap/utils": "4.2.10",
"@airswap/utils": "4.3.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.7"
},
"publishConfig": {
Expand Down
4 changes: 2 additions & 2 deletions source/wrapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
"owners": "hardhat run ./scripts/owner.js"
},
"dependencies": {
"@airswap/swap-erc20": "4.2.1",
"@airswap/swap-erc20": "4.3.0",
"@openzeppelin/contracts": "^4.8.3"
},
"devDependencies": {
"@airswap/utils": "4.2.10",
"@airswap/utils": "4.3.0",
"@uniswap/v2-periphery": "^1.1.0-beta.0",
"prompt-confirm": "^2.0.4"
},
Expand Down
6 changes: 3 additions & 3 deletions tools/libraries/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airswap/libraries",
"version": "4.2.13",
"version": "4.3.0",
"description": "AirSwap: Libraries for Developers",
"repository": {
"type": "git",
Expand Down Expand Up @@ -28,8 +28,8 @@
"@airswap/pool": "4.2.1",
"@airswap/staking": "4.2.1",
"@airswap/swap": "4.2.1",
"@airswap/swap-erc20": "4.2.1",
"@airswap/utils": "4.2.10",
"@airswap/swap-erc20": "4.3.0",
"@airswap/utils": "4.3.0",
"@airswap/wrapper": "4.2.1",
"browser-or-node": "^2.1.1",
"ethers": "^5.7.2",
Expand Down
2 changes: 1 addition & 1 deletion tools/stores/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"test": "REDISCLOUD_URL=redis://localhost:6379 TS_NODE_COMPILER_OPTIONS='{\"strict\":false}' yarn mocha -r ts-node/esm test/*.ts"
},
"dependencies": {
"@airswap/utils": "4.2.10",
"@airswap/utils": "4.3.0",
"redis": "^4.6.13"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion tools/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airswap/utils",
"version": "4.2.10",
"version": "4.3.0",
"description": "AirSwap: Utilities for Developers",
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion tools/utils/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const DOMAIN_NAME_SWAP_ERC20 = 'SWAP_ERC20'
export const DOMAIN_VERSION_SWAP_ERC20 = '4.2'
export const DOMAIN_VERSION_SWAP_ERC20 = '4.3'
export const DOMAIN_NAME_SWAP = 'SWAP'
export const DOMAIN_VERSION_SWAP = '4.2'
export const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000'
Expand Down Expand Up @@ -239,6 +239,7 @@ export const ownerAddresses: Record<number, string> = {
[ChainIds.ARBITRUM]: '0xed669F5fe2A37Ef204DB178c7a982717B9f03Ec2',
[ChainIds.AVALANCHE]: '0xed669F5fe2A37Ef204DB178c7a982717B9f03Ec2',
[ChainIds.LINEA]: '0xed669F5fe2A37Ef204DB178c7a982717B9f03Ec2',
[ChainIds.SEPOLIA]: '0xed669F5fe2A37Ef204DB178c7a982717B9f03Ec2',
}

export const protocolFeeReceiverAddresses: Record<number, string> = {
Expand Down
Loading
Loading