setToll(uint256) :
This function allows the owner of the contract to set a new toll value. The function takes in a uint256 value as an argument, which is the new toll value that the owner wants to set. The function then sets the toll variable to the new value that was passed in. (autogenerated documentation)
setTollCollector(address) :
This function allows the owner of the contract to set a new toll collector address. The function takes in an address as an argument and sets the tollCollector variable to the address provided. This allows the owner to change the address of the toll collector, which is the address that will receive payments from users of the toll road. (autogenerated documentation)
setTollReceiver(address) :
This function allows the owner of the contract to set a new address for the toll receiver. The function takes an address payable as an argument, which is then set as the new toll receiver. This function is only accessible to the owner of the contract, as it is marked with the onlyOwner modifier. (autogenerated documentation)
collectTolls() :
This function is used to collect tolls from users of a service. It requires that the sender of the message (msg.sender) is the toll collector, and if so, it transfers the balance of the contract address to the toll receiver. This ensures that the tolls are collected and sent to the correct recipient. (autogenerated documentation)
sendEth(address,uint256,bytes32,bytes32) :
This function is used to send ETH from the sender to the receiver. It requires that the sender pays a toll, which is set by the toll variable, and that the amount sent is greater than the toll. The function then emits an Announcement event, which contains the receiver's address, the amount of ETH sent, a placeholder for the ETH token, the public key of the receiver, and the ciphertext. Finally, the function transfers the amount of ETH (minus the toll) to the receiver. (autogenerated documentation)
sendToken(address,address,uint256,bytes32,bytes32) :
This function is used to send tokens to a stealth address. It requires the sender to pay a toll, and checks that the receiver has not already received tokens from the same token address. It then emits an Announcement event with the receiver's address, the amount of tokens, the token address, the public key, and the ciphertext. Finally, it uses the SafeERC20.safeTransferFrom function to transfer the tokens from the sender to the receiver. (autogenerated documentation)
withdrawToken(address,address) :
This function allows a user to withdraw tokens from a specified address. It takes two parameters: the address of the acceptor and the address of the token. It then calls the _withdrawTokenInternal function, passing in the sender's address, the acceptor's address, the token's address, a zero address, a zero value, a zero IUmbraHookReceiver, and an empty string. This function will then transfer the tokens from the acceptor's address to the sender's address. (autogenerated documentation)
withdrawTokenAndCall(address,address) :
This function is used to withdraw a token from a specified address and call a specified hook receiver. It takes in four parameters: the address of the acceptor, the address of the token, an IUmbraHookReceiver interface, and a byte array of data. The function first calls the _withdrawTokenInternal function, which is an internal function that handles the actual withdrawal of the token. This function takes in six parameters: the sender address, the acceptor address, the token address, an address for the token to be sent to (which is set to 0 in this case), an amount of the token to be sent (which is set to 0 in this case), the IUmbraHookReceiver interface, and the byte array of data. The _withdrawTokenInternal function then calls the transferFrom function of the token contract, which transfers the token from the acceptor address to the sender address. Once the transfer is complete, the IUmbraHookReceiver interface is called with the data provided. (autogenerated documentation)
withdrawTokenOnBehalf(address,address,address,address,uint256,uint8,bytes32,bytes32) :
This function allows a sponsor to withdraw tokens on behalf of a stealth address. It takes in the stealth address, the acceptor address, the token address, the sponsor address, the sponsor fee, the signature parameters (v, r, s), and an empty string as parameters. The function first validates the signature parameters to ensure that the sponsor is authorized to withdraw tokens on behalf of the stealth address. It then calls the _withdrawTokenInternal function to withdraw the tokens from the stealth address to the acceptor address. The sponsor fee is also taken from the stealth address and sent to the sponsor address. (autogenerated documentation)
withdrawTokenAndCallOnBehalf(address,address,address,address,uint256,uint8,bytes32,bytes32) :
This function is used to withdraw tokens from a stealth address and call a function on behalf of the acceptor. It takes in several parameters, including the stealth address, the acceptor address, the token address, the sponsor address, the sponsor fee, an IUmbraHookReceiver, data, a signature, and two bytes32 values. The function first validates the signature to ensure that the withdraw is authorized. It then calls the _withdrawTokenInternal function to withdraw the tokens from the stealth address and transfer them to the acceptor address. Finally, it calls the function specified by the IUmbraHookReceiver on behalf of the acceptor, passing in the data provided. (autogenerated documentation)
_withdrawTokenInternal(address,address,address,address,uint256) :
This function is an internal function used to withdraw tokens from a stealth address. It takes in a stealth address, an acceptor address, a token address, a sponsor address, a sponsor fee, an UmbraHookReceiver, and some data as parameters. The function first checks to make sure that the amount of tokens stored in the tokenPayments mapping for the stealth address and token address is greater than the sponsor fee. If not, the function will throw an error. If the amount is greater than the sponsor fee, the function will calculate the withdrawal amount by subtracting the sponsor fee from the amount stored in the tokenPayments mapping. It will then delete the entry from the tokenPayments mapping and emit a TokenWithdrawal event. The function will then use the SafeERC20 contract to safely transfer the withdrawal amount to the acceptor address. If the sponsor fee is greater than 0, the function will also use the SafeERC20 contract to safely transfer the sponsor fee to the sponsor address. Finally, if the UmbraHookReceiver is not 0x0, the function will call the tokensWithdrawn function on the UmbraHookReceiver (autogenerated documentation)
_validateWithdrawSignature(address,address,address,address,uint256,uint8,bytes32,bytes32) :
This function is used to validate a signature for a withdraw transaction. It takes in the stealth address of the sender, the address of the acceptor, the address of the token, the address of the sponsor, the sponsor fee, the hook receiver, the data, the v, r, and s values of the signature as parameters. The function first calculates the chain ID of the Ethereum network. It then calculates the digest of the message to be signed by hashing the chain ID, the address of the contract, the address of the acceptor, the address of the token, the address of the sponsor, the sponsor fee, the hook receiver, and the data. Finally, it uses the ecrecover function to recover the address of the sender from the signature and compares it to the stealth address of the sender. If the two addresses match, the signature is valid and the function returns true. Otherwise, the signature is invalid and the function returns false. (autogenerated documentation)