V 2

Contracts

ECDSA

recover(bytes32 hash, bytes signature) → addressinternal

Returns the address that signed a hashed message (hash) with signature. This address can then be used for verification purposes.

The ecrecover EVM opcode allows for malleable (non-unique) signatures: this function rejects them by requiring the s value to be in the lower half order, and the v value to be either 27 or 28.

(.note) This call does not revert if the signature is invalid, or if the signer is otherwise unable to be retrieved. In those scenarios, the zero address is returned.

(.warning) hash must be the result of a hash operation for the verification to be secure: it is possible to craft signatures that recover to arbitrary addresses for non-hashed data. A safe way to ensure this is by receiving a hash of the original message (which may otherwise) be too long), and then calling toEthSignedMessageHash on it.

toEthSignedMessageHash(bytes32 hash) → bytes32internal

Returns an Ethereum Signed Message, created from a hash. This replicates the behavior of the eth_sign JSON-RPC method.

See recover.

GsnTypes

GsnUtils

getChainID() → uint256internal

getError(bytes err) → stringinternal

getMethodSig(bytes msgData) → bytes4internal

getParam(bytes msgData, uint256 index) → uint256internal

getAddressParam(bytes msgData, uint256 index) → addressinternal

getBytes32Param(bytes msgData, uint256 index) → bytes32internal

getBytesParam(bytes msgData, uint256 index) → bytesinternal

getStringParam(bytes msgData, uint256 index) → stringinternal

IForwarder

getNonce(address from) → uint256external

verify(struct IForwarder.ForwardRequest forwardRequest, bytes suffixData, bytes signature)external

execute(struct IForwarder.ForwardRequest forwardRequest, bytes32 domainSeparator, bytes32 requestTypeHash, bytes suffixData, bytes signature) → bool,bytesexternal

registerRequestType(string typeName, string typeSuffix)external

IPenalizer

penalizeRepeatedNonce(bytes unsignedTx1, bytes signature1, bytes unsignedTx2, bytes signature2, contract IRelayHub hub)external

penalizeIllegalTransaction(bytes unsignedTx, bytes signature, contract IRelayHub hub)external

versionPenalizer() → stringexternal

IRelayHub

getStakeManager() → addressexternal

addRelayWorkers(address[] newRelayWorkers)external

registerRelayServer(uint256 baseRelayFee, uint256 pctRelayFee, string url)external

depositFor(address target)external

balanceOf(address target) → uint256external

withdraw(uint256 amount, address payable dest)external

relayCall(struct GsnTypes.RelayRequest relayRequest, bytes signature, bytes approvalData, uint256 externalGasLimit) → bool,stringexternal

penalize(address relayWorker, address payable beneficiary)external

getHubOverhead() → uint256external

calculateCharge(uint256 gasUsed, struct GsnTypes.RelayData relayData) → uint256external

versionHub() → stringexternal

RelayServerRegistered(address relayManager, uint256 baseRelayFee, uint256 pctRelayFee, string relayUrl)

RelayWorkersAdded(address relayManager, address[] newRelayWorkers, uint256 workersCount)

Withdrawn(address account, address dest, uint256 amount)

Deposited(address paymaster, address from, uint256 amount)

TransactionRejectedByPaymaster(address relayManager, address paymaster, address from, address to, address relayWorker, bytes4 selector, string reason)

TransactionRelayed(address relayManager, address relayWorker, address from, address to, address paymaster, bytes4 selector, enum IRelayHub.RelayCallStatus status, uint256 charge)

Penalized(address relayWorker, address sender, uint256 reward)

LibBytesRichErrorsV06

InvalidByteOperationError(enum LibBytesRichErrorsV06.InvalidByteOperationErrorCodes errorCode, uint256 offset, uint256 required) → bytesinternal

LibBytesV06

rawAddress(bytes input) → uint256internal

Gets the memory address for a byte array. @param input Byte array to lookup. @return memoryAddress Memory address of byte array. This points to the header of the byte array which contains the length.

contentAddress(bytes input) → uint256internal

Gets the memory address for the contents of a byte array. @param input Byte array to lookup. @return memoryAddress Memory address of the contents of the byte array.

memCopy(uint256 dest, uint256 source, uint256 length)internal

Copies length bytes from memory location source to dest. @param dest memory address to copy bytes to. @param source memory address to copy bytes from. @param length number of bytes to copy.

slice(bytes b, uint256 from, uint256 to) → bytesinternal

Returns a slices from a byte array. @param b The byte array to take a slice from. @param from The starting index for the slice (inclusive). @param to The final index for the slice (exclusive). @return result The slice containing bytes at indices [from, to)

sliceDestructive(bytes b, uint256 from, uint256 to) → bytesinternal

Returns a slice from a byte array without preserving the input. When from == 0, the original array will match the slice. In other cases its state will be corrupted. @param b The byte array to take a slice from. Will be destroyed in the process. @param from The starting index for the slice (inclusive). @param to The final index for the slice (exclusive). @return result The slice containing bytes at indices [from, to)

popLastByte(bytes b) → bytes1internal

Pops the last byte off of a byte array by modifying its length. @param b Byte array that will be modified. @return result The byte that was popped off.

equals(bytes lhs, bytes rhs) → boolinternal

Tests equality of two byte arrays. @param lhs First byte array to compare. @param rhs Second byte array to compare. @return equal True if arrays are the same. False otherwise.

readAddress(bytes b, uint256 index) → addressinternal

Reads an address from a position in a byte array. @param b Byte array containing an address. @param index Index in byte array of address. @return result address from byte array.

writeAddress(bytes b, uint256 index, address input)internal

Writes an address into a specific position in a byte array. @param b Byte array to insert address into. @param index Index in byte array of address. @param input Address to put into byte array.

readBytes32(bytes b, uint256 index) → bytes32internal

Reads a bytes32 value from a position in a byte array. @param b Byte array containing a bytes32 value. @param index Index in byte array of bytes32 value. @return result bytes32 value from byte array.

writeBytes32(bytes b, uint256 index, bytes32 input)internal

Writes a bytes32 into a specific position in a byte array. @param b Byte array to insert <input> into. @param index Index in byte array of <input>. @param input bytes32 to put into byte array.

readUint256(bytes b, uint256 index) → uint256internal

Reads a uint256 value from a position in a byte array. @param b Byte array containing a uint256 value. @param index Index in byte array of uint256 value. @return result uint256 value from byte array.

writeUint256(bytes b, uint256 index, uint256 input)internal

Writes a uint256 into a specific position in a byte array. @param b Byte array to insert <input> into. @param index Index in byte array of <input>. @param input uint256 to put into byte array.

readBytes4(bytes b, uint256 index) → bytes4internal

Reads an unpadded bytes4 value from a position in a byte array. @param b Byte array containing a bytes4 value. @param index Index in byte array of bytes4 value. @return result bytes4 value from byte array.

writeLength(bytes b, uint256 length)internal

Writes a new length to a byte array. Decreasing length will lead to removing the corresponding lower order bytes from the byte array. Increasing length may lead to appending adjacent in-memory bytes to the end of the byte array. @param b Bytes array to write new length to. @param length New length of byte array.

LibRichErrorsV06

StandardError(string message) → bytesinternal

ABI encode a standard, string revert error payload. This is the same payload that would be included by a revert(string) solidity statement. It has the function signature Error(string). @param message The error string. @return The ABI encoded error.

rrevert(bytes errorData)internal

Reverts an encoded rich revert reason errorData. @param errorData ABI encoded error data.

Penalizer

penalizeRepeatedNonce(bytes unsignedTx1, bytes signature1, bytes unsignedTx2, bytes signature2, contract IRelayHub hub)public

penalizeIllegalTransaction(bytes unsignedTx, bytes signature, contract IRelayHub hub)public

RLPReader

decodeTransaction(bytes rawTransaction) → uint256,uint256,uint256,address,uint256,bytesinternal

toRlpItem(bytes item) → struct RLPReader.RLPIteminternal

toList(struct RLPReader.RLPItem item) → struct RLPReader.RLPItem[]internal

isList(struct RLPReader.RLPItem item) → boolinternal

numItems(struct RLPReader.RLPItem item) → uint256internal

_itemLength(uint256 memPtr) → uint256internal

_payloadOffset(uint256 memPtr) → uint256internal

toRlpBytes(struct RLPReader.RLPItem item) → bytesinternal

toBoolean(struct RLPReader.RLPItem item) → boolinternal

toAddress(struct RLPReader.RLPItem item) → addressinternal

toUint(struct RLPReader.RLPItem item) → uint256internal

toBytes(struct RLPReader.RLPItem item) → bytesinternal

copy(uint256 src, uint256 dest, uint256 len)internal

BaseRelayRecipient

isTrustedForwarder(address forwarder) → boolpublic

_msgSender() → address payableinternal

Forwarder

fallback()external

getNonce(address from) → uint256public

constructor()public

verify(struct IForwarder.ForwardRequest req, bytes suffixData, bytes sig)public

execute(struct IForwarder.ForwardRequest req, bytes32 domainSeparator, bytes32 requestTypeHash, bytes suffixData, bytes sig) → bool,bytespublic

_verifyNonce(struct IForwarder.ForwardRequest req)internal

_updateNonce(struct IForwarder.ForwardRequest req)internal

registerRequestType(string typeName, string typeSuffix)external

registerRequestTypeInternal(string requestType)internal

getRelayMessageHash(struct GsnTypes.RelayRequest req) → bytes32public

_getEncoded(struct IForwarder.ForwardRequest relayRequest, bytes suffixData) → bytes32internal

_verifySig(struct IForwarder.ForwardRequest req, bytes suffixData, bytes sig)public

RequestTypeRegistered(bytes32 typeHash, string typeStr)

GsnEip712Library

splitRequest(struct GsnTypes.RelayRequest req) → struct IForwarder.ForwardRequest,bytesinternal

verifyForwarderTrusted(struct GsnTypes.RelayRequest relayRequest)internal

verifySignature(struct GsnTypes.RelayRequest relayRequest, bytes signature)internal

verify(struct GsnTypes.RelayRequest relayRequest, bytes signature)internal

execute(struct GsnTypes.RelayRequest relayRequest, bytes signature) → bool,stringinternal

domainSeparator(address forwarder) → bytes32internal

getChainID() → uint256internal

hashDomain(struct GsnEip712Library.EIP712Domain req) → bytes32internal

hashRelayData(struct GsnTypes.RelayData req) → bytes32internal

hash(struct IForwarder.ForwardRequest req) → bytes32internal

IPaymaster

getHubAddr() → addressexternal

getRelayHubDeposit() → uint256external

getGasLimits() → struct IPaymaster.GasLimitsexternal

acceptRelayedCall(struct GsnTypes.RelayRequest relayRequest, bytes signature, bytes approvalData, uint256 maxPossibleGas) → bytesexternal

preRelayedCall(bytes context) → bytes32external

postRelayedCall(bytes context, bool success, bytes32 preRetVal, uint256 gasUseWithoutPost, struct GsnTypes.RelayData relayData)external

versionPaymaster() → stringexternal

IRelayRecipient

isTrustedForwarder(address forwarder) → boolpublic

_msgSender() → address payableinternal

versionRecipient() → stringexternal

ISignatureVerifier

verify(struct ISignatureVerifier.RelayRequest req, bytes signature) → boolexternal

versionSM() → stringexternal

IStakeManager

stakeForAddress(address relayManager, uint256 unstakeDelay)external

unlockStake(address relayManager)external

withdrawStake(address relayManager)external

authorizeHubByOwner(address relayManager, address relayHub)external

authorizeHubByManager(address relayHub)external

unauthorizeHubByOwner(address relayManager, address relayHub)external

unauthorizeHubByManager(address relayHub)external

isRelayManagerStaked(address relayManager, uint256 minAmount, uint256 minUnstakeDelay) → boolexternal

penalizeRelayManager(address relayManager, address payable beneficiary, uint256 amount)external

getStakeInfo(address relayManager) → struct IStakeManager.StakeInfoexternal

versionSM() → stringexternal

StakeAdded(address relayManager, address owner, uint256 stake, uint256 unstakeDelay)

StakeUnlocked(address relayManager, address owner, uint256 withdrawBlock)

StakeWithdrawn(address relayManager, address owner, uint256 amount)

StakePenalized(address relayManager, address beneficiary, uint256 reward)

HubAuthorized(address relayManager, address relayHub)

HubUnauthorized(address relayManager, address relayHub, uint256 removalBlock)

RelayHubV2

FunctionsEvents

getHubOverhead() → uint256external

constructor(contract StakeManager _stakeManager, contract Penalizer _penalizer)public

getStakeManager() → addressexternal

registerRelayServer(uint256 baseRelayFee, uint256 pctRelayFee, string url)public

addRelayWorkers(address[] newRelayWorkers)public

depositFor(address target)public

balanceOf(address target) → uint256external

withdraw(uint256 amount, address payable dest)public

canRelay(struct GsnTypes.RelayRequest relayRequest, uint256 initialGas, bytes signature, bytes approvalData) → bool,bytes,struct IPaymaster.GasLimitspublic

relayCall(struct GsnTypes.RelayRequest relayRequest, bytes signature, bytes approvalData, uint256 externalGasLimit) → bool,stringpublic

innerRelayCall(struct GsnTypes.RelayRequest relayRequest, bytes signature, struct IPaymaster.GasLimits gasLimits, uint256 totalInitialGas, bytes recipientContext) → enum IRelayHub.RelayCallStatuspublic

calculateCharge(uint256 gasUsed, struct GsnTypes.RelayData relayData) → uint256public

penalize(address relayWorker, address payable beneficiary)external

SafeMath

add(uint256 a, uint256 b) → uint256internal

Returns the addition of two unsigned integers, reverting on overflow.

Counterpart to Solidity's + operator.

Requirements:

  • Addition cannot overflow.

sub(uint256 a, uint256 b) → uint256internal

Returns the subtraction of two unsigned integers, reverting on overflow (when the result is negative).

Counterpart to Solidity's - operator.

Requirements:

  • Subtraction cannot overflow.

mul(uint256 a, uint256 b) → uint256internal

Returns the multiplication of two unsigned integers, reverting on overflow.

Counterpart to Solidity's * operator.

Requirements:

  • Multiplication cannot overflow.

div(uint256 a, uint256 b) → uint256internal

Returns the integer division of two unsigned integers. Reverts on division by zero. The result is rounded towards zero.

Counterpart to Solidity's / operator. Note: this function uses a revert opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas).

Requirements:

  • The divisor cannot be zero.

mod(uint256 a, uint256 b) → uint256internal

Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts when dividing by zero.

Counterpart to Solidity's % operator. This function uses a revert opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas).

Requirements:

  • The divisor cannot be zero.

StakeManager

getStakeInfo(address relayManager) → struct IStakeManager.StakeInfoexternal

stakeForAddress(address relayManager, uint256 unstakeDelay)external

unlockStake(address relayManager)external

withdrawStake(address relayManager)external

authorizeHubByOwner(address relayManager, address relayHub)external

authorizeHubByManager(address relayHub)external

_authorizeHub(address relayManager, address relayHub)internal

unauthorizeHubByOwner(address relayManager, address relayHub)external

unauthorizeHubByManager(address relayHub)external

_unauthorizeHub(address relayManager, address relayHub)internal

isRelayManagerStaked(address relayManager, uint256 minAmount, uint256 minUnstakeDelay) → boolexternal

penalizeRelayManager(address relayManager, address payable beneficiary, uint256 amount)external