StealthGive Contracts
What each contract does, the public surface area, and how they compose.
edited & set
by Ezra Nahumury
StealthGiveDollar (SGD)
A vanilla ERC-20 with a faucet. claim() mints 1,000 SGD per call; a 24-hour cooldown per address acts as anti-Sybil. SGD has 6 decimals so it lines up with USDC conventions.
| Standard | ERC-20 |
| Decimals | 6 |
| Drip | 1,000 SGD |
| Cooldown | 24 hours per address |
function claim() external {
require(block.timestamp >= lastClaim[msg.sender] + COOLDOWN, "cooldown");
lastClaim[msg.sender] = uint64(block.timestamp);
_mint(msg.sender, DRIP);
}ConfidentialSGD (cSGD)
A concrete instance of iExec's ERC20ToERC7984Wrapper. Calling wrap(donor, amount) locks SGD and mints encrypted cSGD; unwrap reverses the operation.
contract ConfidentialSGD is ERC20ToERC7984Wrapper {
constructor(IERC20 underlying)
ERC7984("Confidential StealthGive Dollar", "cSGD", "")
ERC20ToERC7984Wrapper(underlying) {}
}Factory & Registry
↳ StealthGiveFactory
Deploys a fresh Campaign instance per fundraiser. Public method:
function createCampaign(
string calldata metadataURI, // data:application/json;base64,...
uint256 goal, // target in cSGD (6 dec)
uint256 deadline, // unix timestamp
address recipient // who can withdraw
) external returns (address campaign);↳ CampaignRegistry
A view-only indexer. The frontend uses two methods to render the /campaigns page without any backend service:
function paginate(uint256 offset, uint256 limit)
external view returns (address[] memory campaigns, uint256 total);
function summariseMany(address[] calldata campaigns)
external view returns (Summary[] memory);Campaign Contract
Each campaign is a small state machine. Donations stay in Active; anyone can settle() after the deadline; the recipient withdraws during the grace window or donors refund afterwards.
- state · 01Active
Donations accepted. Encrypted aggregate updated on each donate.
ActsAnyone - state · 02Settling
Deadline reached. Recipient has 7 days to withdraw funds.
ActsRecipient - state · 03Withdrawn
Funds delivered to recipient. Terminal state.
Acts— - state · 04Refunding
Recipient missed window. Each donor may refund individually.
ActsEach donor
enum State { Active, Settling, Withdrawn, Refunding }
function donate(bytes32 handle, bytes calldata handleProof) external;
function settle() external; // anyone, after deadline
function withdraw() external; // recipient only
function refund() external; // donor, after grace| Refund grace | 7 days post-settle |
| Receiver hook | Implements IERC7984Receiver for confidentialTransferAndCall |
ConfidentialEscrow
The abstract base every Campaign inherits from. It owns the encrypted state and is the single place that calls into the Nox SDK — making contract audits much easier.
euint256 internal _encryptedTotal;
mapping(address => euint256) internal _encryptedContrib;
function _credit(address donor, bytes32 handle, bytes calldata proof) internal {
euint256 amount = Nox.toEuint256(handle, proof);
_encryptedContrib[donor] = Nox.add(_encryptedContrib[donor], amount);
_encryptedTotal = Nox.add(_encryptedTotal, amount);
Nox.allowThis(_encryptedTotal);
Nox.allowPublicDecryption(_encryptedTotal);
}