Skip to content
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
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
9 changes: 7 additions & 2 deletions core/contracts/Clearinghouse.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vertex-core",
"version": "3.1.0",
"version": "3.2.0",
"license": "UNLICENSED",
"description": "EVM implementation of Vertex",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion lba/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vertex-lba",
"version": "3.1.0",
"version": "3.2.0",
"license": "UNLICENSED",
"description": "Vertex LBA contracts",
"scripts": {
Expand Down
Loading