Would it be possible to code a contract to trigger a sale of token a into a liquidity pool? Does anyone have any information or resources on how to do this?
A contract can’t initiate a transaction, only an Externally Owned Account (EOA) can initiate a transaction. You would need to write code to monitor for what you are looking for and then create a transaction.
I suggest looking at OpenZeppelin Defender Autotasks: https://docs.openzeppelin.com/defender/autotasks
It is free to sign up for Defender:
@abcoathup Thank you for the resource!
After partially reviewing what you shared with me, at your leisure would you mind clarifying somethings please?
*** Check your balance in contracts and sweep funds to a wallet upon reaching a threshold.**
- So for example, tokens or %of tokens can be sent one wallet to a contract, then you can use auto task code to check the balance in the contract and sweep them to a second wallet?
- Poke your contracts to have them transition to a new state once a set of conditions is met.
- Could you define what “poke” and “transition to a new state” means?
Sorry for the delay in responding.
Your questions was about the use cases in: https://docs.openzeppelin.com/defender/autotasks#use-cases
Poke would be to initiate a transaction calling a function on a smart contract, which could change one or more state variables in a contract. An external trigger to a contract. e.g. This could be to update some state variables based on a price oracle.