A smart contract (self-executing contract, blockchain contract) is an agreement between parties that is enforced by a program encoded onto a blockchain which executes code exactly as originally written.
"A layer 2 refers to any off-chain network, system, or technology built on top of a blockchain that helps extend the capabilities of the underlying base layer network. Layer-2 networks can enhance any blockchain such as higher transaction throughputs."