# Smart Contract Overview

Stellar Talent uses Soroban smart contracts to power flexible escrow agreements. Once a recipient accepts, the contract is deployed and funds are locked securely on-chain.

#### Payout Structures

**Single-payment contracts:** Funds are released manually or automatically after a set date.\
**Milestone-based contracts:** Funds are released in parts, either manually or automatically per schedule.

Contracts are immutable once deployed.

***

### On-Chain vs Off-Chain Data

#### Stored On-Chain

* sender and recipient wallet addresses
* totalAmount (XLM)
* releaseType (manual or auto)
* autoReleaseDate
* status
* milestones\[]
* currentMilestoneIndex

#### Stored Off-Chain

* User auth (email, password, wallet metadata)
* Drafts and pending proposals
* UI state (filters, notifications)
* Internal logs (non-critical)

***

### Execution and Permissions

| Function               | Callable By            | Description                   |
| ---------------------- | ---------------------- | ----------------------------- |
| `createEscrow()`       | Backend (post-accept)  | Deploys and funds contract    |
| `releaseFunds()`       | Sender or time trigger | Releases payment or milestone |
| `getContractStatus()`  | Frontend/backend       | Displays contract state       |
| `getContractDetails()` | Frontend/backend       | Shows contract data           |

***
