I am curious to know what happens to ADA when it gets locked to a script as far as staking goes. In other words, can ADA locked at a script address by staked?
3 Answers
When you create an output with a script address, you can put whatever staking key you like on it. That staking key behaves exactly like staking keys do in all other outputs. Scripts can see staking keys associated with outputs, so if you want to make an assertion about what staking key is used on an output, you can do that.
So yes, if you have an ongoing state machine you can assert that the funds are always staked with a particular key.
In addition, you can also have a script control the delegation rights itself. Each address has a payment credential (key or script hash), and can also have a stake credential (key or script hash — or a reference to a stake address registration certificate, which will yield you a key or script hash, but is more compact in the UTxO).
An Ada address is made up of 2 separate credentials, one for payment and one for staking. These are both treated independently and one, the other or both can be script hashes instead of plain key based addresses. This means the user putting funds in a smart contract can keep those funds associated with their stake address until the script is spent (at which time the person redeeming the script gets to choose what stake credential is used).
-
Is there an example of this? You mentioned the possibility of the UTxO "creator" to specify the delegation of that UTxO, is this regardless of the the location it ends up at? I thought that once send the funds are delegated to that which the address it sits at specify (not the transaction it originated from).– FermatCommented Jan 31, 2022 at 13:00
-
I would really like for this to be possible, but I don't see how. Is there a way that I, a normal cardano defi degen can construct a transaction to provide liquidity to Sundae Swap, lock my ada/<TOKEN> pair up in one of their LP scripts and keep my ada staked but still get the LP tokens in return? If this is doable, it needs to be more publicized than it is. Commented Feb 1, 2022 at 0:26
Yes. There are a few projects doing this, one of them is StakingDAO, which is in Catalyst Fund 7. I cannot give you details about how this is done, but I heard a few other people saying this is possible.