Skip to main content

Endaoment Smart Contracts

Endaoment’s smart contracts enable permissionless, onchain charitable giving through a sophisticated system of Entities and supporting infrastructure. This documentation helps developers integrate directly with Endaoment’s contract system.
These contracts are audited, open-source, and deployed across multiple EVM-compatible chains. For API-based integration (recommended for most applications), see our API Documentation.

When to Use Contracts vs API

Use Direct Contract Integration for:
  • Fully decentralized applications
  • Custom donation flows
  • DeFi protocol integrations
  • High-volume operations
Use API for:
  • User authentication and KYC
  • Receipt generation
  • Email notifications
  • Simple integrations
See API Documentation for API-based integration.

Entity Quick Start

New to Endaoment entities? Follow this path:
  1. Query Entity State - Learn to read entity balances and manager info
  2. Make a Donation - Send USDC or other tokens to an entity
  3. Monitor Activity - Track donations and grants in real-time
  4. Apply Best Practices - Build robust integrations
90% of integrations involve these entity operations: querying state and accepting donations. Start with these guides before exploring entity deployment.

Contract Architecture

Core Contracts

Endaoment’s ecosystem consists of several key contract types:

Registry

The central hub of the Endaoment system. The Registry:
  • Controls permissions and roles across all contracts
  • Tracks approved Entities
  • Manages fee structures for donations, transfers, and payouts
  • Stores the treasury address for protocol fees
Key Functions: Permission management, entity validation, fee configuration Contract Addresses: See Deployed Contracts below

Entity (Org & Fund)

Entities represent organizations and funds in the Endaoment system:
  • Org: Represents a 501(c)(3) nonprofit organization
  • Fund: Represents a Donor-Advised Fund (DAF) or Community Fund
Entities can:
  • Receive donations in ETH or ERC-20s
  • Query balances and state information
Key Functions:
  • donate(uint256 _amount) - Direct USDC donation
  • reconcileBalance() - Process USDC sent directly to entity
  • entityType() - Query entity type (0 = Org, 1 = Fund)
  • swapAndDonate(...) - Swap and donate any ERC20 or ETH to USDC
  • Public state: balance, manager, baseToken, registry

OrgFundFactory

Deploys new Org and Fund entities using minimal proxy pattern for gas efficiency:
  • Creates deterministic addresses across chains
  • Supports atomic deploy-and-donate operations
Key Functions: deployOrg(), deployFund(), deployOrgAndDonate(), deployFundAndDonate(), computeOrgAddress(), computeFundAddress()

Entity Operations

Most integrators work primarily with entities (Orgs and Funds). Start here:

Common Integration Patterns

Pattern 1: Simple USDC Donation

import { ethers } from 'ethers';

const provider = new ethers.providers.JsonRpcProvider(RPC_URL);
const signer = new ethers.Wallet(PRIVATE_KEY, provider);

// Approve and donate 100 USDC
const usdc = new ethers.Contract(USDC_ADDRESS, USDC_ABI, signer);
const org = new ethers.Contract(ORG_ADDRESS, ENTITY_ABI, signer);

await usdc.approve(ORG_ADDRESS, ethers.utils.parseUnits('100', 6));
await org.donate(ethers.utils.parseUnits('100', 6));

Pattern 2: Deploy and Donate

// Deploy new Org and donate in one transaction
const factory = new ethers.Contract(FACTORY_ADDRESS, FACTORY_ABI, signer);
const orgId = ethers.utils.formatBytes32String('12-3456789');

await factory.deployOrgAndDonate(orgId, ethers.utils.parseUnits('1000', 6));
// Returns Org address via EntityDeployed event

Deployed Contracts

Ethereum Mainnet

Base Mainnet

OP Mainnet

Key Concepts

Base Token: All entities use USDC. Managers: Fund-specific address with permissions to manage the fund (admin-only operations).

Minimal Proxy Pattern

Entities use EIP-1167 minimal proxies for:
  • Low-cost deployment
  • Deterministic cross-chain addresses
  • Consistent implementation

Contract ABIs

Available in contracts repository: Entity, Registry, OrgFundFactory

Security Considerations

Audits

Contracts audited by Least Authority.

Permissions

  • Donations: Anyone can donate to any entity
  • Querying: Anyone can read entity state and balances

Before Transacting

  1. Approve tokens: token.approve(entity, amount)
  2. Verify entity: registry.isActiveEntity(address)

Developer Resources

Need Help?

Next Steps

Start with Entity Deployment, then explore Donations.