I was wondering, if I create a smart contracts that require a deposit of X ADA, are the deposited tokens going somewhere, or are they only getting locked in the depositor’s wallet for the contract’s purpose until the contract is executed? If they do go somewhere, where are they actually going?
What you are describing sounds like a vesting sceme (there are some contracts that already do this). Then on your question, Cardano uses an UTxO like model, this means every transaction consumes and outputs UTxO’s. In extention smart contract do this too. To put it simply, an address is a holder of funds and each address is associated with an witness that must sign a transaction that tries to spend UTxO’s at this address. This can be some signing key (like what your wallet does) or a more complex witness like a smart contract that checks if certain logic is met. Note that each smart contract has its own address, so each UTxO at that address can only be spend if the witness (the contract) allows it to do so. So if one would like to create such a vesting logic in a contract, the funds will be deposited at the address associated with the logic that you want on those funds. This is really nice since scripts can be small and modulare. That is, logic can be distributed over multiple contracts and they are composable.
Hello. I want to thank you for this answer. I admit it is quite hard to understand but since a smart contract has an adress and signing keys, just like a wallet, does that mean that the ada deposited in that adress could be delegated to a staking pool and the staking pool will get the smart contract adress to send delegation rewards at that adress?
My logic says it could work.
You are correct, staking with an smart contract address is possible. Note that normally the staking keys are separate of the normal signing keys of an address that hold the funds that are staked. So the staking rewards will be deposited in a stake reward address that is not governed by the smart contract. I have not thought up a method decentralize these funds (maybe someone else has? Can another smart contract be used for this?). Thats is, say I have a DeFi contract that locks up 10 million ada, the rewards will be deposited in an stake address that is not governed by any logic.
Another question to ask is, how do these funds get distributed given any contract. Or are they rewards of the owner of the contract and do not need to be distributed? These questions need to be answered as a community. In my opinion it always best to stake those DeFi funds as they contribute to the decentralisation of the protocol. Maybe the DAO’s of the future decide which pools get delegated to and the rewards are distributed to the stake holders of the governance token of said governance token (like dividend). All these things are quite new and innovation is on its way to find good solutions for these questions.
You seem quite knowledgable on the subject and I thank you for your time. I am glad to read your confirmation of what I thought of, it seems like Cardano has a huge advantage on other protocols by being able to delegate the defi pools for the sake of the network decentralisation. Not to forget also that if the owner of the smart contract finds a way to redistribute it to the defi community, it would be another incentive for providing liquidity for the community.