Skip to content

Commit

Permalink
bump libraries beta version
Browse files Browse the repository at this point in the history
  • Loading branch information
dmosites committed Jan 25, 2024
2 parents 58f612c + 1c5a8bd commit d9d08fb
Show file tree
Hide file tree
Showing 44 changed files with 848 additions and 809 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ Each `deploys.js` must be limited to contracts deployed from that package versio
Each package has commands `yarn deploy` and `yarn verify`. Each command takes a `--network` flag. For example:

```
yarn deploy --network goerli
yarn verify --network goerli
yarn deploy --network sepolia
yarn verify --network sepolia
```

The source of these scripts can be found in the `scripts` folder of each package. The account used to deploy and verify is derived from the `PRIVATE_KEY` environment variable in `.env` in the repository root.
5 changes: 0 additions & 5 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ module.exports = {
url: apiUrls[ChainIds.MAINNET],
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : undefined,
},
goerli: {
url: apiUrls[ChainIds.GOERLI],
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : undefined,
},
bsctestnet: {
url: apiUrls[ChainIds.BSCTESTNET],
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : undefined,
Expand Down Expand Up @@ -133,7 +129,6 @@ module.exports = {
etherscan: {
apiKey: {
mainnet: process.env.ETHERSCAN_API_KEY,
goerli: process.env.ETHERSCAN_API_KEY,
bsc: process.env.BSCSCAN_API_KEY,
bscTestnet: process.env.BSCSCAN_API_KEY,
polygon: process.env.POLYGONSCAN_API_KEY,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"nx": "^16.5.5",
"prettier": "^2.8.4",
"prettier-plugin-solidity": "^1.1.2",
"solidity-coverage": "^0.8.2",
"solidity-coverage": "^0.8.5",
"ts-node": "^10.9.1",
"typechain": "^8.1.1",
"typescript": "^5.0.4"
Expand Down
27 changes: 13 additions & 14 deletions source/batch-call/contracts/BatchCall.sol
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ contract BatchCall {

/**
* @notice Check validity of an array of Orders
* @param senderWallet address wallet that would send the order
* @param orders ISwap.Order[] list of orders to be checked
* @param swapContract ISwap swap contract to call
* @return bool[] true indicates the order is valid
* @param senderWallet address Wallet that would send the order
* @param orders ISwap.Order[] Array of orders to be checked
* @param swapContract ISwap Swap contract to call
* @return bool[] True indicates the order is valid
*/
function getOrdersValid(
address senderWallet,
Expand All @@ -218,8 +218,8 @@ contract BatchCall {
bool[] memory orderValidity = new bool[](orders.length);

for (uint256 i; i < orders.length; ) {
(, uint256 errorCount) = swapContract.check(senderWallet, orders[i]);
orderValidity[i] = errorCount == 0 ? true : false;
bytes32[] memory errors = swapContract.check(senderWallet, orders[i]);
orderValidity[i] = errors.length == 0 ? true : false;
unchecked {
++i;
}
Expand All @@ -229,10 +229,10 @@ contract BatchCall {

/**
* @notice Check validity of an array of OrderERC20s
* @param senderWallet address wallet that would send the order
* @param orders ISwapERC20.OrderERC20[] list of orders to be checked
* @param swapERC20Contract ISwapERC20 swap contract to call
* @return bool[] validity of each order
* @param senderWallet address Wallet that would send the order
* @param orders ISwapERC20.OrderERC20[] Array of orders to be checked
* @param swapERC20Contract ISwapERC20 Swap contract to call
* @return bool[] True indicates the order is valid
*/
function getOrdersValidERC20(
address senderWallet,
Expand All @@ -244,7 +244,7 @@ contract BatchCall {

for (uint256 i; i < orders.length; ) {
ISwapERC20.OrderERC20 memory order = orders[i];
(uint256 errorCount, ) = swapERC20Contract.check(
bytes32[] memory errors = swapERC20Contract.check(
senderWallet,
order.nonce,
order.expiry,
Expand All @@ -257,7 +257,7 @@ contract BatchCall {
order.r,
order.s
);
orderValidity[i] = errorCount == 0 ? true : false;
orderValidity[i] = errors.length == 0 ? true : false;
unchecked {
++i;
}
Expand All @@ -278,9 +278,8 @@ contract BatchCall {
uint256[] calldata nonces,
ISwap swapContract
) external view returns (bool[] memory) {
if (signerWallets.length <= 0) revert ArgumentInvalid();
if (signerWallets.length == 0) revert ArgumentInvalid();
if (signerWallets.length != nonces.length) revert ArgumentInvalid();
require(signerWallets.length == nonces.length);
bool[] memory nonceUsed = new bool[](signerWallets.length);

for (uint256 i; i < signerWallets.length; ) {
Expand Down
4 changes: 1 addition & 3 deletions source/batch-call/deploys-blocks.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
module.exports = {
5: 10395372,
}
module.exports = {}
4 changes: 1 addition & 3 deletions source/batch-call/deploys.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
module.exports = {
5: '0x4B79d8603E0C3244D20356D867759232551B9330',
}
module.exports = {}
10 changes: 5 additions & 5 deletions source/batch-call/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airswap/batch-call",
"version": "4.2.0-beta.0",
"version": "4.2.0-beta.1",
"description": "Batch balance, allowance, order validity checks",
"license": "MIT",
"repository": {
Expand All @@ -27,12 +27,12 @@
},
"dependencies": {
"@openzeppelin/contracts": "^4.8.3",
"@airswap/swap": "4.2.0-beta.0",
"@airswap/swap-erc20": "4.2.0-beta.0"
"@airswap/swap": "4.2.0-beta.1",
"@airswap/swap-erc20": "4.2.0-beta.2"
},
"devDependencies": {
"@airswap/constants": "4.2.0-beta.1",
"@airswap/utils": "4.2.0-beta.0",
"@airswap/constants": "4.2.0-beta.3",
"@airswap/utils": "4.2.0-beta.2",
"prompt-confirm": "^2.0.4"
},
"publishConfig": {
Expand Down
6 changes: 3 additions & 3 deletions source/pool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
"@openzeppelin/contracts": "^4.8.3"
},
"devDependencies": {
"@airswap/constants": "4.2.0-beta.1",
"@airswap/constants": "4.2.0-beta.3",
"@airswap/metadata": "4.1.16",
"@airswap/types": "4.2.0-beta.0",
"@airswap/utils": "4.2.0-beta.0",
"@airswap/types": "4.2.0-beta.1",
"@airswap/utils": "4.2.0-beta.2",
"prompt-confirm": "^2.0.4"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion source/registry/deploys-blocks.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
5: 10396251,
11155111: 5151266,
}
2 changes: 1 addition & 1 deletion source/registry/deploys.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
5: '0xA8e182416C22FC677bc84719f640826d6171d352',
11155111: '0x47C116ac7E9D1F020761eFb81D3ce9d887273967',
}
6 changes: 3 additions & 3 deletions source/registry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airswap/registry",
"version": "4.2.0-beta.0",
"version": "4.2.0-beta.1",
"description": "AirSwap: Server Registry",
"license": "MIT",
"repository": {
Expand Down Expand Up @@ -32,8 +32,8 @@
"access": "public"
},
"devDependencies": {
"@airswap/constants": "4.2.0-beta.1",
"@airswap/utils": "4.2.0-beta.0",
"@airswap/constants": "4.2.0-beta.3",
"@airswap/utils": "4.2.0-beta.2",
"prompt-confirm": "^2.0.4"
}
}
34 changes: 29 additions & 5 deletions source/registry/test/RegistryIntegration.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe('Registry Integration', () => {
let registry
const STAKING_COST = 1000
const SUPPORT_COST = 10
const TOKEN_BALANCE = 10000

beforeEach(async () => {
snapshotId = await ethers.provider.send('evm_snapshot')
Expand All @@ -33,7 +34,7 @@ describe('Registry Integration', () => {
ERC20PresetFixedSupply.abi,
ERC20PresetFixedSupply.bytecode
)
).deploy('TestERC20', 'TERC20', '10000', account1.address)
).deploy('TestERC20', 'TERC20', TOKEN_BALANCE, account1.address)

await stakingToken.deployed()

Expand All @@ -42,7 +43,7 @@ describe('Registry Integration', () => {
.connect(deployer)
.deploy(stakingToken.address, STAKING_COST, SUPPORT_COST)
await registry.deployed()
stakingToken.connect(account1).approve(registry.address, '10000')
stakingToken.connect(account1).approve(registry.address, TOKEN_BALANCE)
})

describe('constructor values', async () => {
Expand Down Expand Up @@ -70,12 +71,35 @@ describe('Registry Integration', () => {
)
})

it('staking cost is always retruned when a URL is unset', async () => {
await registry.connect(account1).setServerURL('maker1.com')
it('staking and support costs return when a server is unset', async () => {
expect(await stakingToken.balanceOf(account1.address)).to.equal(
TOKEN_BALANCE
)
expect(await stakingToken.balanceOf(registry.address)).to.equal(0)

const url = 'maker1.com'
const protocols = [protocol1, protocol2]
const tokens = [token1.address, token2.address]

await registry.connect(account1).setServerURL(url)
await registry.connect(account1).addProtocols(protocols)
await registry.connect(account1).addTokens(tokens)

expect(await stakingToken.balanceOf(account1.address)).to.equal(
TOKEN_BALANCE -
(STAKING_COST + SUPPORT_COST * (protocols.length + tokens.length))
)
expect(await stakingToken.balanceOf(registry.address)).to.equal(
STAKING_COST + SUPPORT_COST * (protocols.length + tokens.length)
)

await expect(registry.connect(account1).unsetServer())
.to.emit(registry, 'UnsetServer')
.withArgs(account1.address, 'maker1.com', [], [])
.withArgs(account1.address, url, protocols, tokens)

expect(await stakingToken.balanceOf(account1.address)).to.equal(
TOKEN_BALANCE
)
expect(await stakingToken.balanceOf(registry.address)).to.equal(0)
})
})
Expand Down
Loading

0 comments on commit d9d08fb

Please sign in to comment.