Skip to content

Instantly share code, notes, and snippets.

@edmulraney
Last active September 2, 2021 15:38
Show Gist options
  • Save edmulraney/221cb5f56567a95d4e96b4b4b7163a26 to your computer and use it in GitHub Desktop.
Save edmulraney/221cb5f56567a95d4e96b4b4b7163a26 to your computer and use it in GitHub Desktop.
Combine Liquity function calls via Instadapp SDK
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