Last active
September 2, 2021 15:38
-
-
Save edmulraney/221cb5f56567a95d4e96b4b4b7163a26 to your computer and use it in GitHub Desktop.
Combine Liquity function calls via Instadapp SDK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const moveLusdGainToStabilityPoolRecipe = (dsa, frontendTagAddress) => { | |
| const spells = dsa.Spell() | |
| const lusdGainId = 1; // ID reference to the LUSD amount that is claimed | |
| const claimStakingGainsSpell = { | |
| connector: "LIQUITY-A", | |
| method: "claimStakingGains", | |
| args: [0, lusdGainId] | |
| } | |
| const depositLusdIntoStabilityPoolSpell = { | |
| connector: "LIQUITY-A", | |
| method: "stabilityDeposit", | |
| args: [ | |
| 0, // Amount to deposit. We don't specify an amount here, instead we use the reference to the LUSD gained from the previous spell | |
| frontendTagAddress, | |
| lusdGainId, // The reference to the LUSD gained in the previous spell | |
| 0, | |
| 0 | |
| ] | |
| } | |
| spells.add(claimStakingGainsSpell) | |
| spells.add(depositLusdIntoStabilityPoolSpell) | |
| await spells.cast() // Executes the recipe of spells on the user's DSA account | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment