Customized Bots-DAI
This tutorial guides you in setting up Argus Customized Bots to monitor stablecoin prices and automate withdrawals as well as token swaps in response to depegging events.
Last updated
This tutorial guides you in setting up Argus Customized Bots to monitor stablecoin prices and automate withdrawals as well as token swaps in response to depegging events.
Last updated
Argus Customized Bots empower users to configure their own triggers and set up any tasks to be executed on-chain automatically, including data monitoring, alert notifications, advanced DeFi operations (e.g., liquidity management, trade execution, exit strategies) and beyond.
This tutorial guides you through the process of using a Customized Bot to monitor DAI prices, and automatically convert sDAI to DAI and then swap DAI for USDC when DAI's price either deviates from its peg or reaches a predefined threshold.
How to use Safe{Wallet} to convert DAI to sDAI
How to set up triggers for your Customized Bot to monitor DAI prices
How to set up DeFi operations for your Customized Bot
To watch a video tutorial, please click here.
Step 1: Head to Spark Protocol and click on "Connect Wallet" on the upper-right corner.
Step 2: Select WalletConnect to connect to the dApp.
Copy the WalletConnect URI.
Step 3: Head back to Safe{Wallet} and click on "Use WalletConnect".
Paste in the WalletConnect URI to connect to the Spark Protocol.
Step 4: Head back to the Spark Protocol and then convert DAI to sDAI.
Step 1: Head to Cobo Argus and click on "Bots" on the left menu. Locate "Customized Bots" and then click on "Create".
Step 2: Select your Safe{Wallet} and click on "Create New Bot".
Enter a name for your Customized Bot.
Step 3: Tick "Contract Value Monitor".
Contract address: 0xAed0c38402a5d19df6E4c03F4E2DceD6e29c1ee9
(i.e., contract address for Chainlink's DAI/USD price feed)
Function: latestAnswer
Indicator: Output0(int256) <=
Enter the depegging price for DAI. If you determine that DAI will become depegged at $0.98, for instance, please manually key in the value as 98000000. Do take note on the decimal places.
You may use the provided example as a reference to customize the smart contract address and the depegging price of DAI for the Customized Bot to monitor.
Step 1: Convert sDAI to DAI
a. Tick "Call Smart Contracts
"
b. Enter the contract address: 0x83F20F44975D03b1b09e64809B757c47f942BEeA
(i.e., sDAI contract address)
c. Select the 'redeem
' function
d. Set parameters
shares (i.e., amount to redeem): select "All Token Balance
" and "sDAI
" (i.e., all sDAI tokens will be redeemed as DAI)
receiver/owner (i.e., receiving address, owner address): set both parameters to the address of the Safe{Wallet}
you are currently using
Step 2: Swap DAI to USDC
Option 1: Swap DAI to USDC using a DEX aggregator
Currently, Cobo Argus supports the use of three aggregators - 1inch, ParaSwap, and 0x - to swap DAI to USDC. The amount is customizable and can be specified as either a "Customized number," "All token balances," or "Changes in token amount." Additionally, you can also set a slippage control.
If the order routing implements a Peg Stability Module (PSM), you can expect a seamless transaction experience with no slippage and zero transaction fees.
If the order routing employs an Automated Market Makers (AMM), kindly note that slippage and transaction fees may be incurred.
Note: The DEX aggregator will calculate the optimal trade route using the aggregated liquidity data. This responsibility does not fall under the purview of Cobo Argus.
Option 2: Grant DAI token approvals to PSM
You can directly call the PSM smart contracts to bypass slippage and transaction fees. The swap rate between DAI and USDC is fixed at 1:1. Do note that in the event of significant DAI depegging, the PSM may become disabled or it may no longer have sufficient USDC reserves. In this case, your transaction will fail.
Step 1: Grant DAI approvals to PSM
b. Tick "Call Smart Contracts
"
c. Enter the contract address: 0x6B175474E89094C44Da98b954EedeAC495271d0F
(i.e., DAI contract address)
d. Select the "approve
" function
e. Set parameters
usr: a smart contract that can spend DAI
0x89B78CfA322F6C5dE0aBcEecab66Aee45393cC5A
(i.e., PSM contract address)
Step 2: Swap DAI to USDC
a. Tick "Call Smart Contracts
"
b. Enter the contract address: 0x89B78CfA322F6C5dE0aBcEecab66Aee45393cC5A
(i.e., MakerDAO PSM contract address)
c. Select the "sellGem
" function (i.e., swap DAI to USDC)
d. Set parameters
usr (i.e., receiving address): set usr
to the address of the Safe{Wallet} you are currently using
gemAmt (i.e., swap amount): select "All Token Balance
" and "DAI
" (i.e., all DAI tokens will be swapped into USDC)