Skip to content

Commit

Permalink
GITBOOK-419: Improving Periphery section
Browse files Browse the repository at this point in the history
  • Loading branch information
Pilar Rodríguez authored and gitbook-bot committed Aug 2, 2023
1 parent 34116c7 commit 9e48733
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 3 deletions.
6 changes: 6 additions & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@
* [🌐 The Graph](guides/the-graph.md)
* [🔮 Chainlink Price Feeds](guides/price-feeds.md)
* [🛰 Periphery](guides/periphery/README.md)
* [🪂 Airdrop](guides/periphery/airdrop.md)
* [🌀 DebtManager](guides/periphery/debtmanager.md)
* [👓 DebtPreviewer](guides/periphery/debtpreviewer.md)
* [🪙 EXA](guides/periphery/exa.md)
* [🥩 Proto-Staker](guides/periphery/proto-staker.md)
* [👀 Previewer](guides/periphery/previewer.md)
* [🔁 Swapper](guides/periphery/swapper.md)

## Security

Expand Down
4 changes: 4 additions & 0 deletions guides/periphery/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 🛰 Periphery

This section contains valuable resources that are not part of the protocol's core and could be helpful for developers seeking to integrate Exactly into other applications.

These smart contracts function as peripherals, seamlessly integrating with the Protocol contracts and acting as indispensable "helpers." While they undergo continuous development and refinement, it's essential to note that they have not yet undergone a formal audit due to their auxiliary nature.

**Peripheral contracts can be found here:** [https://github.com/exactly/protocol/tree/main/contracts/periphery](https://github.com/exactly/protocol/tree/main/contracts/periphery)
7 changes: 7 additions & 0 deletions guides/periphery/airdrop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 🪂 Airdrop

Using Solmate's Merkle tree library, this smart contract can validate the eligibility of an address for the airdrop and the appropriate amount based on a set of predetermined criteria.

It interfaces with the [Sablier protocol](https://sablier.com), a token streaming mechanism, to facilitate the creation of an NFT for each recipient and subsequently initiate the airdrop stream.

GitHub URL: [https://github.com/exactly/protocol/blob/main/contracts/periphery/Airdrop.sol](https://github.com/exactly/protocol/blob/main/contracts/periphery/Airdrop.sol)
7 changes: 7 additions & 0 deletions guides/periphery/debtmanager.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 🌀 DebtManager

This contract allows users to handle their positions in a more flexible way. Making use of [Balancer's flash loans](https://docs.balancer.fi/reference/contracts/flash-loans.html) (currently, there are 0 fees for flash loans) and [Uniswap's flash swaps](https://docs.uniswap.org/contracts/v2/guides/smart-contract-integration/using-flash-swaps), it allows users to rollover their debts or leverage their positions. The DebtManager contract facilitates both same-asset and cross-asset leverage-deleverage functions. 

This contract also uses ['permits'](https://help.1inch.io/en/articles/5435386-permit-712-signed-token-approvals-and-how-they-work-on-1inch) for approvals related to allowing you to transfer tokens on your behalf and perform withdrawals or borrows from a Market. Permits are signatures spent when the user completes the transaction, and the approved amount is always exact. After the leverage or deleverage operation is completed, the DebtManager no longer has any allowance over tokens, withdraws or borrows.

GitHub URL: [https://github.com/exactly/protocol/blob/main/contracts/periphery/DebtManager.sol](https://github.com/exactly/protocol/blob/main/contracts/periphery/DebtManager.sol)
11 changes: 11 additions & 0 deletions guides/periphery/debtpreviewer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 👓 DebtPreviewer

This is a smart contract designed to abstract the `DebtManager` logic, it provides read-only functions ready to be consumed by Exactly’s web app.

**This contract has mainly 2 purposes:**

* Retrieve information about any account collateral and debt for any pair of markets in exactly.
* Allow accounts to preview their positions, simulating a leverage or deleverage to a certain ratio with a desired health factor.

\
GitHub URL: [https://github.com/exactly/protocol/blob/main/contracts/periphery/DebtPreviewer.sol](https://github.com/exactly/protocol/blob/main/contracts/periphery/DebtPreviewer.sol)
5 changes: 5 additions & 0 deletions guides/periphery/exa.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 🪙 EXA

The EXA smart contract encapsulates the functionality of the EXA ERC20 token. This smart contract uses OpenZeppelin's [`ERC20VotesUpgradeable`](https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/master/contracts/token/ERC20/extensions/ERC20VotesUpgradeable.sol) implementation.

GitHub URL: [https://github.com/exactly/protocol/blob/main/contracts/periphery/EXA.sol](https://github.com/exactly/protocol/blob/main/contracts/periphery/EXA.sol)
4 changes: 1 addition & 3 deletions guides/periphery/previewer.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# 👀 Previewer

The **Previewer** is a smart contract designed exclusively to be consumed by Exactly's web app.

It retrieves comprehensive on-chain information about Exactly's markets and accounts while minimizing the number of requests made, enhancing performance, and abstracting the front-end interface from protocol intricacies.
The Previewer is a read-only smart contract specifically engineered for Exactly's web application. Its role is to gather comprehensive on-chain data pertaining to Exactly's markets, and user accounts while minimizing the amount of necessary requests, thus enhancing performance. Moreover, it abstracts the complexities of the protocol from the front-end interface by directly returning oracle prices, counting the amount of deposits and borrows per market, and providing the current snapshot of any account being queried.

This contract can be found in the [periphery folder of Exactly's repo](https://github.com/exactly/protocol/blob/main/contracts/periphery/Previewer.sol).

Expand Down
14 changes: 14 additions & 0 deletions guides/periphery/proto-staker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 🥩 Proto-Staker

This smart contract is integrated into Exactly Protocol’s web app to enable users to provide EXA and WETH to a [Velodrome](https://velodrome.finance/) liquidity pool in several ways:

* Providing ETH, where half is wrapped into WETH, and the remaining half is used to purchase EXA before being added to the EXA/WETH Liquidity Pool (LP).
* Providing both ETH and EXA to be added to the EXA/WETH Liquidity Pool.
* Claiming EXA rewards and sending ETH, which are both added to the Liquidity Pool.

This contract also uses '[permits](https://help.1inch.io/en/articles/5435386-permit-712-signed-token-approvals-and-how-they-work-on-1inch)' to perform these transactions.

GitHub URL: [https://github.com/exactly/protocol/blob/history/proto-staking-0/contracts/periphery/ProtoStaker.sol ](https://github.com/exactly/protocol/blob/history/proto-staking-0/contracts/periphery/ProtoStaker.sol)

\
\
3 changes: 3 additions & 0 deletions guides/periphery/swapper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 🔁 Swapper

This utility contract allows users to send ETH and purchase EXA. It’s integrated with [Socket](https://socket.tech), enabling purchases on OP Mainnet from other networks. It also uses ['permits'](https://help.1inch.io/en/articles/5435386-permit-712-signed-token-approvals-and-how-they-work-on-1inch).

0 comments on commit 9e48733

Please sign in to comment.