How do smart contracts work at DeFi?

As in the subject. How do smart contracts work at DeFi?