When you set up the Take profit on your Vault, you will be required to sign a transaction which gives permission for the Automation smart contract to allow vaults to be closed based on your selected parameters.
Once the transaction is confirmed on chain, keepers (scripts that run automatically) will monitor the next OSM price against your Take-Profit trigger. When the Take Profit trigger is hit, a keeper executes the trigger function by calling the Automation smart contract.
Take Profit works by automatically closing your Vault when the collateral asset reaches your “Target Price”. The automation smart contract sends a transaction to close your vault, which sequentially takes a flash loan, repays your Vault’s debt, unlocks and swaps your collateral, pays back the flash loan and sends any remaining funds (in collateral or DAI based on your selection) back to the vault owner’s wallet address.