📑Solidity API Docs
Event, Struct, State, and Function definitions
Solidity API
Ramp
AccountRegistered
DepositReceived
IntentSignaled
IntentPruned
IntentFulfilled
DepositWithdrawn
DepositClosed
UserAddedToDenylist
UserRemovedFromDenylist
MinDepositAmountSet
MaxOnRampAmountSet
IntentExpirationPeriodSet
OnRampCooldownPeriodSet
SustainabilityFeeUpdated
SustainabilityFeeRecipientUpdated
NewSendProcessorSet
NewRegistrationProcessorSet
NewReceiveProcessorSet
AccountInfo
Deposit
DepositWithAvailableLiquidity
Intent
IntentWithOnRamperId
DenyList
GlobalAccountInfo
onlyRegisteredUser
PRECISE_UNIT
MAX_DEPOSITS
CIRCOM_PRIME_FIELD
MAX_SUSTAINABILITY_FEE
usdc
poseidon
registrationProcessor
sendProcessor
isInitialized
globalAccount
accounts
deposits
intents
minDepositAmount
maxOnRampAmount
onRampCooldownPeriod
intentExpirationPeriod
sustainabilityFee
sustainabilityFeeRecipient
depositCounter
constructor
initialize
Initialize Ramp with the addresses of the Processors
Parameters
_registrationProcessor
contract IRegistrationProcessor
Registration processor address
_sendProcessor
contract ISendProcessor
Send processor address
register
Registers a new account by pulling the hash of the account id from the proof and assigning the account owner to the sender of the transaction. One venmo account can be registered to multiple Ethereum addresses.
Parameters
_a
uint256[2]
Parameter of zk proof
_b
uint256[2][2]
Parameter of zk proof
_c
uint256[2]
Parameter of zk proof
_signals
uint256[5]
Encoded public signals of the zk proof, contains mailserverHash, fromEmail, userIdHash
offRamp
Generates a deposit entry for off-rampers that can then be fulfilled by an on-ramper. This function will not add to previous deposits. Every deposit has it's own unique identifier. User must approve the contract to transfer the deposit amount of USDC.
Parameters
_packedVenmoId
uint256[3]
The packed venmo id of the account owner (we pack for easy use with poseidon)
_depositAmount
uint256
The amount of USDC to off-ramp
_receiveAmount
uint256
The amount of USD to receive
signalIntent
Signals intent to pay the depositor defined in the _depositId the _amount * deposit conversionRate off-chain in order to unlock _amount of funds on-chain. Each user can only have one outstanding intent at a time regardless of address (tracked using venmoId). Caller must not be on the depositor's deny list. If there are prunable intents then they will be deleted from the deposit to be able to maintain state hygiene.
Parameters
_depositId
uint256
The ID of the deposit the on-ramper intends to use for
_amount
uint256
The amount of USDC the user wants to on-ramp
_to
address
Address to forward funds to (can be same as onRamper)
cancelIntent
Only callable by the originator of the intent. Cancels an outstanding intent thus allowing user to signal a new intent. Deposit state is updated to reflect the cancelled intent.
Parameters
_intentHash
bytes32
Hash of intent being cancelled
onRamp
Anyone can submit an on-ramp transaction, even if caller isn't on-ramper. Upon submission the proof is validated, intent is removed, and deposit state is updated. USDC is transferred to the on-ramper.
Parameters
_a
uint256[2]
Parameter of zk proof
_b
uint256[2][2]
Parameter of zk proof
_c
uint256[2]
Parameter of zk proof
_signals
uint256[12]
Encoded public signals of the zk proof, contains mailserverHash, fromEmail, timestamp, onRamperIdHash, nullifier, intentHash
withdrawDeposit
Caller must be the depositor for each depositId in the array, if not whole function fails. Depositor is returned all remaining deposits and any outstanding intents that are expired. If an intent is not expired then those funds will not be returned. Deposit will be deleted as long as there are no more outstanding intents.
Parameters
_depositIds
uint256[]
Array of depositIds the depositor is attempting to withdraw
addAccountToDenylist
Adds a venmoId to a depositor's deny list. If an address associated with the banned venmoId attempts to signal an intent on the user's deposit they will be denied.
Parameters
_deniedUser
bytes32
Poseidon hash of the venmoId being banned
removeAccountFromDenylist
Removes a venmoId from a depositor's deny list.
Parameters
_approvedUser
bytes32
Poseidon hash of the venmoId being approved
setSendProcessor
GOVERNANCE ONLY: Updates the send processor address used for validating and interpreting zk proofs.
Parameters
_sendProcessor
contract ISendProcessor
New send proccesor address
setRegistrationProcessor
GOVERNANCE ONLY: Updates the registration processor address used for validating and interpreting zk proofs.
Parameters
_registrationProcessor
contract IRegistrationProcessor
New registration proccesor address
setMinDepositAmount
GOVERNANCE ONLY: Updates the minimum deposit amount a user can specify for off-ramping.
Parameters
_minDepositAmount
uint256
The new minimum deposit amount
setSustainabilityFee
GOVERNANCE ONLY: Updates the sustainability fee. This fee is charged to on-rampers upon a successful on-ramp.
Parameters
_fee
uint256
The new sustainability fee in precise units (10**18, ie 10% = 1e17)
setSustainabilityFeeRecipient
GOVERNANCE ONLY: Updates the recepient of sustainability fees.
Parameters
_feeRecipient
address
The new fee recipient address
setMaxOnRampAmount
GOVERNANCE ONLY: Updates the max amount allowed to be on-ramped in each transaction. To on-ramp more than this amount a user must make multiple transactions.
Parameters
_maxOnRampAmount
uint256
The new max on ramp amount
setOnRampCooldownPeriod
GOVERNANCE ONLY: Updates the on-ramp cooldown period, once an on-ramp transaction is completed the user must wait this amount of time before they can signalIntent to on-ramp again.
Parameters
_onRampCooldownPeriod
uint256
New on-ramp cooldown period
setIntentExpirationPeriod
GOVERNANCE ONLY: Updates the intent expiration period, after this period elapses an intent can be pruned to prevent locking up a depositor's funds.
Parameters
_intentExpirationPeriod
uint256
New intent expiration period
getDeposit
getAccountInfo
getVenmoIdCurrentIntentHash
getLastOnRampTimestamp
getDeniedUsers
isDeniedUser
getIntentsWithOnRamperId
getAccountDeposits
getDepositFromIds
_calculateIntentHash
Calculates the intentHash of new intent
_getPrunableIntents
Cycles through all intents currently open on a deposit and sees if any have expired. If they have expired the outstanding amounts are summed and returned alongside the intentHashes
_pruneIntents
_pruneIntent
Pruning an intent involves deleting its state from the intents mapping, zeroing out the intendee's currentIntentHash in their global account mapping, and deleting the intentHash from the deposit's intentHashes array.
_closeDepositIfNecessary
Removes a deposit if no outstanding intents AND no remaining deposits. Deleting a deposit deletes it from the deposits mapping and removes tracking it in the user's accounts mapping.
_transferFunds
Checks if sustainability fee has been defined, if so sends fee to the fee recipient and intent amount minus fee to the on-ramper. If sustainability fee is undefined then full intent amount is transferred to on-ramper.
_verifyOnRampProof
Validate venmo send payment email and check that it hasn't already been used (done on SendProcessor). Additionally, we validate that the offRamperIdHash matches the one from the specified intent and that enough was paid off-chain inclusive of the conversionRate.
_verifyRegistrationProof
Validate the user has a venmo account, we do not nullify this email since it can be reused to register under different addresses.
IRegistrationProcessor
RegistrationProof
processProof
ISendProcessor
SendProof
processProof
BaseProcessor
onlyRamp
ramp
mailserverKeyHashAdapter
nullifierRegistry
emailFromAddress
constructor
setMailserverKeyHashAdapter
setEmailFromAddress
ONLY OWNER: Sets the from email address for validated emails. Check that email address is properly padded (if necessary). Padding will be dependent on if unpacking functions cut trailing 0s or not.
Parameters
_emailFromAddress
string
The from email address for validated emails, MUST BE PROPERLY PADDED
getEmailFromAddress
getMailserverKeyHash
_validateAndAddNullifier
VenmoRegistrationProcessor
constructor
processProof
_parseSignalArray
VenmoSendProcessor
constructor
processProof
_parseSignalArray
ManagedKeyHashAdapter
mailserverKeyHash
constructor
setMailserverKeyHash
NullifierRegistry
NullifierAdded
WriterAdded
WriterRemoved
onlyWriter
isNullified
isWriter
writers
constructor
addNullifier
ONLY WRITER: Only addresses with permission to write to this contract can call. Stores a nullifier for an email.
Parameters
_nullifier
bytes32
The nullifier to store
addWritePermission
ONLY OWNER: Add address that has write permissions to the registry. Writer must not have been previously added.
Parameters
_newWriter
address
The nullifier to store
removeWritePermission
ONLY OWNER: Remove address that has write permissions to the registry. Writer must have been previously added.
Parameters
_removedWriter
address
The nullifier to store
getWriters
Last updated