Guild Swaps
In addition to swapping debt tokens (zTokens) and money tokens in Uniswap v3 pools, users can also swap between these pairs using the Guild’s swapMoneyForZTokens and swapZTokensForMoney functions. The Guild has infinite zToken liquidity, meaning users can always swapMoneyForZTokens at the zToken facePrice. This is useful if there are not enough zTokens in the Uniswap v3 pool to pay off a user’s debt, if the user needs zTokens for liquidations, or if zToken marketPrices are too high (more details on this below). The Guild does not have infinite money tokens, however, so swapZTokensForMoney can only be used after users have already executed swapMoneyForZTokens and the Guild has a remaining money balance.
Guild money <> zToken swaps will always occur at the debt token facePrice (see details here). As a result, users can potentially take advantage of arbitrage opportunities if, for instance, the zToken marketPrice > facePrice or if zToken facePrice < marketPrice and there is Guild money to be claimed.
Note: The following is meant for advanced defi users. Proceed with extreme caution and follow these steps at your own risk.
How to swapMoneyForZTokens :
swapMoneyForZTokens :Approve Money Token Transfers:
Navigate to the top of the Market Details page in https://alpha.covenant.finance/ , and click on the link out from the money token in the right metrics panel

This will take you to the block explorer page for the money token. Navigate to the
Contracts>Write Contract(orWrite as Proxyif available) tab and click theConnect to Web3button to connect your wallet to the site.
After connecting your wallet, click the
approvedropdown. Executing this function will enable the Guild to transfer an amount of money tokens on your behalf, which is required to executeswapMoneyForZTokens.
You can find Guild address by navigating back to the Market Details page and clicking on the address button next to the market name at the top of the page.

Input the guild address into the
spenderinput field and add the money token amount you want to swap in thevaluefield. Note: the money token value should be in money token units (i.e. 1 sUSD = 1000000000000000000) - ALWAYS confirm the decimal value of the money token you intend to swap.
Click on the
Writebutton & sign the transactions in your wallet to execute theapprovefunction.
Swap money for zTokens
Navigate back to the Market Details page and click on the link out to the Guild address on the block explorer.

This will take you to the block explorer page for the money token. Navigate to the
Contracts>Write Contract(orWrite as Proxyif available) tab and click theConnect to Web3button to connect your wallet to the site.
Navigate to the bottom of the page, click on the
swapMoneyForZTokensfunction, and enter the amount of money you want to swap with the Guild (note: this cannot exceed the amount of money you approved in the previous step).
Click the
Writebutton & approve transactions in your wallet to execute the Guild swap.
How to swapZTokensForMoney :
swapZTokensForMoney :Navigate to the bottom of the Market Details page to check if the Guild has money to swap (i.e. the
Guild Balanceis greater than 0):
Approve zToken Transfers:
Navigate to the top of the Market Details page in https://alpha.covenant.finance/, and click on the link out from the zToken in the right metrics panel

This will take you to the block explorer page for the Guild contract. Navigate to the
Contracts>Write Contract(orWrite as Proxyif available) tab and click theConnect to Web3button to connect your wallet to the site.
After connecting your wallet, click the
approvedropdown. Executing this function will enable the Guild to transfer an amount of zTokens on your behalf, which is required to executeswapZTokensForMoney.
You can find Guild address by navigating back to the Market Details page and clicking on the address button next to the market name at the top of the page.

Input the guild address into the
spenderinput field and add the zToken amount you want to swap in thevaluefield. Note: the money token value should be in zToken units (i.e. 1 zTazzDebtTest = 1000000000000000000) - ALWAYS confirm the decimal value of the zToken you intend to swap.
Click on the
Writebutton & sign the transactions in your wallet to execute theapprovefunction.
Swap zTokens for money
Navigate back to the Market Details page and click on the link out to the Guild address on the block explorer.

This will take you to the block explorer page for the Guild contract. Navigate to the
Contracts>Write Contract(orWrite as Proxyif available) tab and click theConnect to Web3button to connect your wallet to the site.
Navigate to the bottom of the page, click on the
swapZTokenForMoneyfunction, and enter the amount of zToken you want to swap with the Guild (note: this cannot exceed the amount of zToken you approved in the previous step).
Click the
Writebutton & approve transactions in your wallet to execute the Guild swap.
Last updated