deposit namespace emits a program that makes protocol deposits, withdrawals, stakes or wraps from data. deposit.depositSource(spec) returns a function main() program with each call and its approval, which routes.compileSauceProgram compiles; deposit.listDepositTemplates() lists the supported calls, one template per protocol and action (aave-v3 supply, lido stake, weth unwrap, …).
@eco-incorp/sauce.
deposit.toDeposit
Function · @eco-incorp/sauce
The whole normalization/defaulting/guard decision: lowers a chain-agnostic DepositSpec
into a fully normalized NormalizedDeposit - plain bigints (+ the "pot" sentinel for a
defaulted beneficiary), with its resolved DepositTemplate attached.
spec.amount may be "balance" | "max" - see DepositSourceSpec - in which case it
passes through unresolved (the caller, depositCallStatement, decides the actual amount
EXPRESSION; this function only validates every OTHER field and, for "max",
checks allowsMaxAmount).
Throws (never emits a program that would misbehave on-chain) for: an unknown protocol:action;
token supplied to a raw-call template or omitted from a typed-ABI template;
beneficiary supplied to a beneficiary: "unsupported" template; amount: "max" on a template
with allowsMaxAmount: false; an unrecognized extra field name; an amount given as a number
that is not a safe integer (past 2^53-1 pass a bigint or a string, since the double has already
been rounded); a weth template whose target is known not to be a WETH9 (a chain’s native
ERC-20, or a registry token on a chain with no canonical wrapped native - Arc); and whatever the field’s
own ExtraFieldSpec.normalize throws for an out-of-range extra value.
deposit.Address
Type · @eco-incorp/sauce
A 20-byte EVM address, as an ordinary 0x-prefixed hex string.
deposit.AddressInput
Type · @eco-incorp/sauce
Anything the builders accept for an address-shaped field.
deposit.AmountInput
Type · @eco-incorp/sauce
Anything the builders accept for a numeric-shaped field.
deposit.Hex
Type · @eco-incorp/sauce
A 0x-prefixed hex byte string.
deposit.ApprovalPolicy
Type · @eco-incorp/sauce
How much of spec.amount to approve, when funding === "erc20-approve".
deposit.BeneficiarySupport
Type · @eco-incorp/sauce
Whether a template’s protocol call accepts a caller-chosen beneficiary/recipient address.
deposit.DepositSpec
Interface · @eco-incorp/sauce
The chain-agnostic deposit SPEC a caller builds - the input to toDeposit /
depositCallStatement / depositSource.
token names the asset for a typed-ABI template. Omit it for WETH wrap/unwrap and Lido stake;
WETH unwrap uses target as its token address, while wrap and stake use native ETH.
beneficiary defaults to the Pot and must be omitted on a beneficiary: "unsupported"
template (every such protocol credits msg.sender unconditionally - accepting one would silently
send the position to the wrong account).
deposit.DepositSourceSpec
Type · @eco-incorp/sauce
The extra shapes depositCallStatement/depositSource accept beyond a concrete
DepositSpec:
amount: "balance"- emit a RUNTIME balance read instead of a baked-in literal (IERC20. balanceOf(ctx.self())ontokenor the WETH unwraptarget,ctx.selfBalance()for a native-funded template) - the shape a program needs when the deposit amount is only known when it runs, such as what an earlier swap delivered.amount: "max"- only accepted on a template withallowsMaxAmount: true(Aave/Sparkwithdraw’s documentedtype(uint256).maxwithdraw-all sentinel); rejected everywhere else.
deposit.DepositTemplate
Interface · @eco-incorp/sauce
One per-protocol call template - data + a small pure emitter, deliberately not a class
hierarchy.
deposit.ExtraFieldSpec
Interface · @eco-incorp/sauce
A single extra, protocol-specific field a template accepts beyond the common shape.
deposit.Funding
Type · @eco-incorp/sauce
How a template’s protocol call pulls in the token amount being deposited.
"erc20-approve"- an ERC20 asset;depositCallStatementemitsIERC20.approve(target, amount)immediately before the protocol call (seeApprovalPolicy)."native-value"- no ERC20 leg at all; the amount rides asmsg.valueon a rawevm.call(target, value, calldata). No approve is ever emitted."none"- a redeem/withdraw leg that burns a balance this contract already holds (e.g. Aave’swithdraw, which burns aTokens). No approve, no value.
deposit.NormalizedDeposit
Interface · @eco-incorp/sauce
A DepositSpec, fully normalized - bigint scalars (+ the "pot" sentinel for a defaulted
beneficiary), plus the resolved DepositTemplate.
amount stays a passthrough of whatever toDeposit was handed for the runtime-amount shapes
("balance" etc.) so a caller can tell a concrete deposit from a source-only one apart.
deposit.SkippedProtocolNote
Interface · @eco-incorp/sauce
A short, human-readable note on a protocol considered but not registered as a template.
