Function: unlock(address token, uint256 amount, address user, string hash, uint256 fee, bytes[] _signatures)
This function unlocks the tokens.
Inputs
tokenControl: Fully controlled by the caller.
Constraints: Must be whitelisted.
Impact: Address of the token to unlock.
amountControl: Fully controlled by the caller.
Constraints: Must be less than or equal to
maxAmountand greater than or equal tominAmount.Impact: Amount to unlock.
userControl: Fully controlled by the caller.
Constraints: Must be signed with the ECDSA.
Impact: Address to transfer to.
hashControl: Fully controlled by the caller.
Constraints: Must be signed with the ECDSA.
Impact: String for the
unlockHash.
feeControl: Fully controlled by the caller.
Constraints: Must be signed with the ECDSA.
Impact: Amount to take as a fee.
_signaturesControl: Fully controlled by the caller.
Constraints: Must be a valid signature.
Impact: Signature to check the signer.
Branches and code coverage
Intended branches
Check the signer.
Transfer the token or Ether to a given user address.
Negative behavior
Revert when the hash has been already used.
Revert when the signer is not the validator.
Revert when the token balance is not enough.