Setting Up Chainlink Automation
Use Chainlink Automation to Auto-Claim
This version of Horizon Academy has been deprecated! To find the latest version, please visit: English V2
Welcome to the Guide for using Chainlink Automation to auto-claim your weekly staking rewards on Horizon Genesis.
The following guide will take you through the process of setting Chainlink Automation up (screenshots from 2022.09.18).
Note that setting up Chainlink Automation for Horizon Genesis will help with auto-claiming, but it does not auto-burn to fix your C-Ratio.
We will be looking into how to potentially include auto-burning into the Chainlink Automation contract so it can be completely hands-off in the future.
Chainlink Automation Quick Start
Step 0. Grant Contract Authorization Step 1. Get LINK BEP-20 Tokens Step 2. Convert LINK BEP-20 to BEP-677 Step 3. Register Upkeep Step 4. Auto-Claiming Optional Step 5. Canceling Your Upkeep
What is Chainlink Automation?
Chainlink Automation is a decentralized automation service. For Horizon Genesis, the way Chainlink Automation works is it will check every block to see if a reward claim is available. If it is, it will automatically claim your rewards for you on your behalf. Each claim transaction will cost LINK tokens, though checking if a claim is available or not is free and will not cost anything.
Before you start, it is important to note that a Chainlink Automation upkeep costs money to maintain. A minimum balance of LINK tokens is required to be stored in an upkeep for it to operate and each weekly claim will deduct a small amount of LINK tokens.
Also, the entire process currently is only supported by MetaMask wallet.
To activate, you need to give the Chainlink Automation upkeep contract permission to take the actions you want and deposit enough money (in the form of ERC-677 LINK tokens) for it to take these actions for you.
For more information about Chainlink Automation, you can read about it here:
One of the most important questions will be how many LINK tokens are required to maintain an upkeep. There is specific documentation regarding this available here:
Step 0. Grant Contract Authorization
The pre-requisite step is to allow the Chainlink Automation upkeep contract to claim for you by giving it permission to claim on your behalf.
The target contract address you will be giving permission to is: 0xa623F29ae4cEd27dFBB39a94152F3184140f6c21
To grant authorization, please follow the following steps:
The following user interface Horizon Genesis is being built and should be online soon.
In the meantime, please scroll down a little to see instructions for authorization via BSCscan.com.
You should get a wallet confirmation screen as shown below.
Once confirmed, authorization will have been completed.
Step 1. Get LINK BEP-20 Tokens
The first thing you will need to do to create a Chainlink Automation Upkeep is to acquire LINK tokens.
You can acquire LINK BEP-20 tokens at DEXs, such as PancakeSwap, or CEXs, such as Binance. It is recommended to buy at least 10 LINK tokens to maintain your Auto-Claim Upkeep. This balance could maintain your upkeep for about 4-5 months, but the true duration is based on market prices.
If you are buying LINK tokens on a CEX, such as Binance, make sure you are withdrawing the LINK onto the BNB Chain (BEP-20 token) and not withdrawing onto the Ethereum chain (ERC-20 token). Since the Chainlink Automation upkeep is operating on the BNB Chain for Horizon Protocol, it must be a BEP-20 LINK token.
The screenshots below will focus on using PancakeSwap to buy LINK BEP-20 tokens:
Step 2. Convert LINK BEP-20 to BEP-677
Chainlink Automation uses a special wrapped ERC-677 format, which allows you to include additional data along with the contract. This functionality is required for Chainlink Automation upkeep to be able to perform its decentralized automation.
In this step, we will be converting LINK BEP-20 into a LINK BEP-677 token.
Fun fact: the LINK BEP-677 token is a wrapped ERC677 token, which is a synthetic asset that uses the original BEP-20 token as collateral.
To convert, we will be going to the following website:
After a successful swap, the pegchain page will typically freeze. Just refresh it (this is a known bug) and it should show your tokens have swapped.
Lastly, if you want to add the token to your Metamask wallet, this is the Wrapped ERC677 LINK token address for the BNB Chain: 0x404460C6A5EdE2D891e8297795264fDe62ADBB75
More details on the contract address here:
Step 3. Register Upkeep
We are at the final step of this process.
We will now register your upkeep:
Target contract address: 0xa623F29ae4cEd27dFBB39a94152F3184140f6c21
Information to be written above:
Upkeep Name: Horizon Protocol Auto-Claim (limited length, you can choose whatever name)
Gas limit: 700,000 (gas limit will be higher than how much it would cost to just claim directly because it is a contract calling another contract. Typical gas required for small transactions are around 250000, within the same order of magnitude. It is kind of weird to see 2300 as a gas limit written in the text box.)
Starting Balance (LINK): 10+ (add how much LINK, the wrapped ERC677 ones, that you want to deposit into your upkeep. It is recommended to deposit at least 10 as the Minimum Balance to maintain the upkeep can fluctuate based on market prices)
Check data (Hexadecimal): Your Wallet Address (Is the public address of your wallet you want to claim rewards on)
Your email address (Email Needed for Upkeep notifications)
The above information can be changed later, but it will cost a transaction.
If everything is set up properly and you have rewards to claim with the proper C-Ratio, the Upkeep should immediately claim your rewards for you.
Remember to refresh your Upkeep page until the "Minimum Balance" shows up. "Balance" should also show up.
Random information about min-balance:
Step 4. Auto-Claiming
This isn't really a step, but just showing how the Auto-Claiming will work.
For reference, the automated Upkeep transaction cost $1.22 ($0.95 + 30% premium). The 30% premium on BNB Chain is lower than on any of the other chains (can compare here:
The above Upkeep transaction can also be found here:
Optional Step 5. Canceling Your Upkeep
The final step is for canceling Upkeeps. Canceling your Upkeep consists of two parts:
Cancel Upkeep
Withdraw Funds
We can start this step by going back to https://automation.chain.link/bsc. Make sure your wallet is connected.
The process for Cancel Upkeep and Withdraw Funds will lose you a bit of LINK (in this case, we went from 6 --> 5.9).
If you check your wallet, you should see your LINK there. Note that this is still the Wrapped LINK ERC677 token. You will need to go to Step 2. and perform a reverse swap to get back LINK BEP-20 tokens.
Last updated