diff --git a/README.md b/README.md new file mode 100644 index 0000000..88dca2f --- /dev/null +++ b/README.md @@ -0,0 +1,49 @@ +# Vertex Protocol + +This repository contains the smart contract implementations for the Vertex Protocol ecosystem. + +## Project Structure + +The repository is organized into two main projects: + +- **[vertex-contracts/core](./core)**: EVM implementation of Vertex core functionality +- **[vertex-contracts/lba](./lba)**: Vertex LBA (Liquidity Bootstrap Auction) contracts + +## Requirements + +- Node.js >=16 +- [Yarn](https://yarnpkg.com/) + +## Getting Started + +Each project has its own setup and development commands. Navigate to the respective directories for project-specific instructions: + +``` +# For Vertex EVM Core Contracts +cd vertex-contracts/core +yarn install +yarn compile + +# For Vertex LBA Contracts +cd vertex-contracts/lba +yarn install +# Follow the .env setup instructions +``` + +## Available Commands + +### Core Contracts + +- `yarn compile`: Compile Vertex EVM contracts +- See project-specific README for more details + +### LBA Contracts + +- `yarn lint`: Run prettier & SolHint +- `yarn contracts:force-compile`: Compile contracts and generate TS bindings + ABIs +- `yarn run-local-node`: Run a persistent local Hardhat node for testing +- See project-specific README for more details + +## Further Documentation + +For more detailed information about each project, please refer to their respective README files. \ No newline at end of file diff --git a/core/contracts/Clearinghouse.sol b/core/contracts/Clearinghouse.sol index 5eb3430..9b6288f 100644 --- a/core/contracts/Clearinghouse.sol +++ b/core/contracts/Clearinghouse.sol @@ -531,8 +531,13 @@ contract Clearinghouse is EndpointGated, ClearinghouseStorage, IClearinghouse { spotEngine.updateBalance(VLP_PRODUCT_ID, V_ACCOUNT, vlpAmount); int128 quoteAmount = vlpAmount.mul(oraclePriceX18); - spotEngine.updateBalance(QUOTE_PRODUCT_ID, txn.sender, quoteAmount); - spotEngine.updateBalance(QUOTE_PRODUCT_ID, V_ACCOUNT, -quoteAmount); + int128 burnFee = MathHelper.max(ONE, quoteAmount / 1000); + quoteAmount = MathHelper.max(0, quoteAmount - burnFee); + + if (quoteAmount != 0) { + spotEngine.updateBalance(QUOTE_PRODUCT_ID, txn.sender, quoteAmount); + spotEngine.updateBalance(QUOTE_PRODUCT_ID, V_ACCOUNT, -quoteAmount); + } require( spotEngine.getBalance(VLP_PRODUCT_ID, txn.sender).amount >= 0, diff --git a/core/package.json b/core/package.json index 374d640..8326bb1 100644 --- a/core/package.json +++ b/core/package.json @@ -1,6 +1,6 @@ { "name": "vertex-core", - "version": "3.1.0", + "version": "3.2.0", "license": "UNLICENSED", "description": "EVM implementation of Vertex", "scripts": { diff --git a/lba/package.json b/lba/package.json index 04868fa..884c5af 100644 --- a/lba/package.json +++ b/lba/package.json @@ -1,6 +1,6 @@ { "name": "vertex-lba", - "version": "3.1.0", + "version": "3.2.0", "license": "UNLICENSED", "description": "Vertex LBA contracts", "scripts": {