Skip to content

Commit

Permalink
update description
Browse files Browse the repository at this point in the history
  • Loading branch information
polartar committed Oct 17, 2023
1 parent c6bb02f commit 37df27d
Show file tree
Hide file tree
Showing 31 changed files with 90 additions and 90 deletions.
4 changes: 2 additions & 2 deletions pkg/asset-manager-utils/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# <img src="../../logo.svg" alt="Balancer" height="128px">

# Balancer V2 Asset Manager Utilities
# Symmetric V2 Asset Manager Utilities

[![NPM Package](https://img.shields.io/npm/v/@balancer-labs/v2-asset-manager-utils.svg)](https://www.npmjs.org/package/@balancer-labs/v2-asset-manager-utils)
[![Docs](https://img.shields.io/badge/docs-%F0%9F%93%84-blue)](https://docs.balancer.fi/developers/smart-contracts/apis/asset-managers)
Expand All @@ -11,4 +11,4 @@ Files in this directory **are not** production-ready, have not been audited by a

---

This package contains Solidity utilities for developing Balancer V2 Asset Managers.
This package contains Solidity utilities for developing Symmetric V2 Asset Managers.
2 changes: 1 addition & 1 deletion pkg/balancer-js/src/utils/signatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class RelayerAuthorization {
}

const domain = {
name: 'Balancer V2 Vault',
name: 'Symmetric V2 Vault',
version: '1',
chainId,
verifyingContract: validator.address,
Expand Down
4 changes: 2 additions & 2 deletions pkg/deployments/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# <img src="../../logo.svg" alt="Balancer" height="128px">

# Balancer V2 Deployments
# Symmetric V2 Deployments

[![NPM Package](https://img.shields.io/npm/v/@balancer-labs/v2-deployments.svg)](https://www.npmjs.org/package/@balancer-labs/v2-deployments)
[![GitHub Repository](https://img.shields.io/badge/github-deployments-lightgrey?logo=github)](https://github.com/balancer-labs/balancer-v2-monorepo/tree/deployments-latest/pkg/deployments)

This package contains the addresses and ABIs of all Balancer V2 deployed contracts, for Ethereum, Polygon and Arbitrum mainnet, as well as various test networks. Each deployment consists of a deployment script (called 'task'), inputs (script configuration, such as dependencies), outputs (typically contract addresses), and ABIs of related contracts.
This package contains the addresses and ABIs of all Symmetric V2 deployed contracts, for Ethereum, Polygon and Arbitrum mainnet, as well as various test networks. Each deployment consists of a deployment script (called 'task'), inputs (script configuration, such as dependencies), outputs (typically contract addresses), and ABIs of related contracts.

Addresses and ABIs can be used consumed from the package in JavaScript environments, or manually retrieved from the [GitHub](https://github.com/balancer-labs/balancer-v2-monorepo/tree/deployments-latest/pkg/deployments) repository.

Expand Down
2 changes: 1 addition & 1 deletion pkg/deployments/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@balancer-labs/v2-deployments",
"version": "2.3.0",
"description": "Addresses and ABIs of all Balancer V2 deployed contracts",
"description": "Addresses and ABIs of all Symmetric V2 deployed contracts",
"license": "GPL-3.0-only",
"homepage": "https://github.com/balancer-labs/balancer-v2-monorepo/tree/master/pkg/deployments#readme",
"repository": {
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pkg/deployments/tasks/20210418-vault/build-info/Vault.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/deployments/tasks/20210418-vault/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 2021-04-18 Vault

Deployment of the Vault, Balancer V2's core contract.
Deployment of the Vault, Symmetric V2's core contract.

Note that the Authorizer used in the Vault's original deployment may change over time: the current Authorizer should be retrieved by calling `vault.getAuthorizer()` instead.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"language": "Solidity",
"sources": {
"contracts/BalancerHelpers.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0-or-later\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see <http://www.gnu.org/licenses/>.\n\npragma solidity ^0.7.0;\npragma experimental ABIEncoderV2;\n\nimport \"@balancer-labs/v2-solidity-utils/contracts/math/Math.sol\";\nimport \"@balancer-labs/v2-solidity-utils/contracts/math/FixedPoint.sol\";\n\nimport \"@balancer-labs/v2-solidity-utils/contracts/helpers/InputHelpers.sol\";\nimport \"@balancer-labs/v2-solidity-utils/contracts/helpers/BalancerErrors.sol\";\n\nimport \"@balancer-labs/v2-solidity-utils/contracts/misc/IWETH.sol\";\n\nimport \"@balancer-labs/v2-vault/contracts/AssetHelpers.sol\";\nimport \"@balancer-labs/v2-vault/contracts/interfaces/IVault.sol\";\nimport \"@balancer-labs/v2-vault/contracts/balances/BalanceAllocation.sol\";\n\nimport \"@balancer-labs/v2-pool-utils/contracts/BasePool.sol\";\n\n/**\n * @dev This contract simply builds on top of the Balancer V2 architecture to provide useful helpers to users.\n * It connects different functionalities of the protocol components to allow accessing information that would\n * have required a more cumbersome setup if we wanted to provide these already built-in.\n */\ncontract BalancerHelpers is AssetHelpers {\n using Math for uint256;\n using BalanceAllocation for bytes32;\n using BalanceAllocation for bytes32[];\n\n IVault public immutable vault;\n\n constructor(IVault _vault) AssetHelpers(_vault.WETH()) {\n vault = _vault;\n }\n\n function queryJoin(\n bytes32 poolId,\n address sender,\n address recipient,\n IVault.JoinPoolRequest memory request\n ) external returns (uint256 bptOut, uint256[] memory amountsIn) {\n (address pool, ) = vault.getPool(poolId);\n (uint256[] memory balances, uint256 lastChangeBlock) = _validateAssetsAndGetBalances(poolId, request.assets);\n IProtocolFeesCollector feesCollector = vault.getProtocolFeesCollector();\n\n (bptOut, amountsIn) = BasePool(pool).queryJoin(\n poolId,\n sender,\n recipient,\n balances,\n lastChangeBlock,\n feesCollector.getSwapFeePercentage(),\n request.userData\n );\n }\n\n function queryExit(\n bytes32 poolId,\n address sender,\n address recipient,\n IVault.ExitPoolRequest memory request\n ) external returns (uint256 bptIn, uint256[] memory amountsOut) {\n (address pool, ) = vault.getPool(poolId);\n (uint256[] memory balances, uint256 lastChangeBlock) = _validateAssetsAndGetBalances(poolId, request.assets);\n IProtocolFeesCollector feesCollector = vault.getProtocolFeesCollector();\n\n (bptIn, amountsOut) = BasePool(pool).queryExit(\n poolId,\n sender,\n recipient,\n balances,\n lastChangeBlock,\n feesCollector.getSwapFeePercentage(),\n request.userData\n );\n }\n\n function _validateAssetsAndGetBalances(bytes32 poolId, IAsset[] memory expectedAssets)\n internal\n view\n returns (uint256[] memory balances, uint256 lastChangeBlock)\n {\n IERC20[] memory actualTokens;\n IERC20[] memory expectedTokens = _translateToIERC20(expectedAssets);\n\n (actualTokens, balances, lastChangeBlock) = vault.getPoolTokens(poolId);\n InputHelpers.ensureInputLengthMatch(actualTokens.length, expectedTokens.length);\n\n for (uint256 i = 0; i < actualTokens.length; ++i) {\n IERC20 token = actualTokens[i];\n _require(token == expectedTokens[i], Errors.TOKENS_MISMATCH);\n }\n }\n}\n"
"content": "// SPDX-License-Identifier: GPL-3.0-or-later\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see <http://www.gnu.org/licenses/>.\n\npragma solidity ^0.7.0;\npragma experimental ABIEncoderV2;\n\nimport \"@balancer-labs/v2-solidity-utils/contracts/math/Math.sol\";\nimport \"@balancer-labs/v2-solidity-utils/contracts/math/FixedPoint.sol\";\n\nimport \"@balancer-labs/v2-solidity-utils/contracts/helpers/InputHelpers.sol\";\nimport \"@balancer-labs/v2-solidity-utils/contracts/helpers/BalancerErrors.sol\";\n\nimport \"@balancer-labs/v2-solidity-utils/contracts/misc/IWETH.sol\";\n\nimport \"@balancer-labs/v2-vault/contracts/AssetHelpers.sol\";\nimport \"@balancer-labs/v2-vault/contracts/interfaces/IVault.sol\";\nimport \"@balancer-labs/v2-vault/contracts/balances/BalanceAllocation.sol\";\n\nimport \"@balancer-labs/v2-pool-utils/contracts/BasePool.sol\";\n\n/**\n * @dev This contract simply builds on top of the Symmetric V2 architecture to provide useful helpers to users.\n * It connects different functionalities of the protocol components to allow accessing information that would\n * have required a more cumbersome setup if we wanted to provide these already built-in.\n */\ncontract BalancerHelpers is AssetHelpers {\n using Math for uint256;\n using BalanceAllocation for bytes32;\n using BalanceAllocation for bytes32[];\n\n IVault public immutable vault;\n\n constructor(IVault _vault) AssetHelpers(_vault.WETH()) {\n vault = _vault;\n }\n\n function queryJoin(\n bytes32 poolId,\n address sender,\n address recipient,\n IVault.JoinPoolRequest memory request\n ) external returns (uint256 bptOut, uint256[] memory amountsIn) {\n (address pool, ) = vault.getPool(poolId);\n (uint256[] memory balances, uint256 lastChangeBlock) = _validateAssetsAndGetBalances(poolId, request.assets);\n IProtocolFeesCollector feesCollector = vault.getProtocolFeesCollector();\n\n (bptOut, amountsIn) = BasePool(pool).queryJoin(\n poolId,\n sender,\n recipient,\n balances,\n lastChangeBlock,\n feesCollector.getSwapFeePercentage(),\n request.userData\n );\n }\n\n function queryExit(\n bytes32 poolId,\n address sender,\n address recipient,\n IVault.ExitPoolRequest memory request\n ) external returns (uint256 bptIn, uint256[] memory amountsOut) {\n (address pool, ) = vault.getPool(poolId);\n (uint256[] memory balances, uint256 lastChangeBlock) = _validateAssetsAndGetBalances(poolId, request.assets);\n IProtocolFeesCollector feesCollector = vault.getProtocolFeesCollector();\n\n (bptIn, amountsOut) = BasePool(pool).queryExit(\n poolId,\n sender,\n recipient,\n balances,\n lastChangeBlock,\n feesCollector.getSwapFeePercentage(),\n request.userData\n );\n }\n\n function _validateAssetsAndGetBalances(bytes32 poolId, IAsset[] memory expectedAssets)\n internal\n view\n returns (uint256[] memory balances, uint256 lastChangeBlock)\n {\n IERC20[] memory actualTokens;\n IERC20[] memory expectedTokens = _translateToIERC20(expectedAssets);\n\n (actualTokens, balances, lastChangeBlock) = vault.getPoolTokens(poolId);\n InputHelpers.ensureInputLengthMatch(actualTokens.length, expectedTokens.length);\n\n for (uint256 i = 0; i < actualTokens.length; ++i) {\n IERC20 token = actualTokens[i];\n _require(token == expectedTokens[i], Errors.TOKENS_MISMATCH);\n }\n }\n}\n"
},
"@balancer-labs/v2-solidity-utils/contracts/math/Math.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0;\n\nimport \"../helpers/BalancerErrors.sol\";\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow checks.\n * Adapted from OpenZeppelin's SafeMath library\n */\nlibrary Math {\n /**\n * @dev Returns the addition of two unsigned integers of 256 bits, reverting on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n _require(c >= a, Errors.ADD_OVERFLOW);\n return c;\n }\n\n /**\n * @dev Returns the addition of two signed integers, reverting on overflow.\n */\n function add(int256 a, int256 b) internal pure returns (int256) {\n int256 c = a + b;\n _require((b >= 0 && c >= a) || (b < 0 && c < a), Errors.ADD_OVERFLOW);\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers of 256 bits, reverting on overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n _require(b <= a, Errors.SUB_OVERFLOW);\n uint256 c = a - b;\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two signed integers, reverting on overflow.\n */\n function sub(int256 a, int256 b) internal pure returns (int256) {\n int256 c = a - b;\n _require((b >= 0 && c <= a) || (b < 0 && c > a), Errors.SUB_OVERFLOW);\n return c;\n }\n\n /**\n * @dev Returns the largest of two numbers of 256 bits.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers of 256 bits.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a * b;\n _require(a == 0 || c / a == b, Errors.MUL_OVERFLOW);\n return c;\n }\n\n function div(\n uint256 a,\n uint256 b,\n bool roundUp\n ) internal pure returns (uint256) {\n return roundUp ? divUp(a, b) : divDown(a, b);\n }\n\n function divDown(uint256 a, uint256 b) internal pure returns (uint256) {\n _require(b != 0, Errors.ZERO_DIVISION);\n return a / b;\n }\n\n function divUp(uint256 a, uint256 b) internal pure returns (uint256) {\n _require(b != 0, Errors.ZERO_DIVISION);\n\n if (a == 0) {\n return 0;\n } else {\n return 1 + (a - 1) / b;\n }\n }\n}\n"
Expand Down Expand Up @@ -111582,7 +111582,7 @@
"id": 8144,
"nodeType": "StructuredDocumentation",
"src": "1382:317:37",
"text": " @dev This contract simply builds on top of the Balancer V2 architecture to provide useful helpers to users.\n It connects different functionalities of the protocol components to allow accessing information that would\n have required a more cumbersome setup if we wanted to provide these already built-in."
"text": " @dev This contract simply builds on top of the Symmetric V2 architecture to provide useful helpers to users.\n It connects different functionalities of the protocol components to allow accessing information that would\n have required a more cumbersome setup if we wanted to provide these already built-in."
},
"fullyImplemented": true,
"id": 8375,
Expand Down
Loading

0 comments on commit 37df27d

Please sign in to comment.