diff --git a/contracts/Validator.json b/contracts/Validator.json index 4868367..9740ad9 100644 --- a/contracts/Validator.json +++ b/contracts/Validator.json @@ -4,7 +4,7 @@ "name": "validate", "stateMutability": "nonpayable", "inputs": [ - { "name": "creator", "type": "address" }, + { "name": "funder", "type": "address" }, { "name": "token", "type": "address" }, { "name": "amount", "type": "uint256" }, { "name": "products", "type": "bytes32[]" } diff --git a/contracts/Validator.vyi b/contracts/Validator.vyi index 9583620..b0db8e4 100644 --- a/contracts/Validator.vyi +++ b/contracts/Validator.vyi @@ -1,5 +1,22 @@ """ @title StreamManager Validation Interface Specification +@dev + Validators for the ApePay StreamManager are an important part of how your system can be + customized for the requirements of your product, organization, and operation of payments. + There are several use cases for a Validator, and of course any use case where you need to + "hook" into the pre-payment validation point can be covered. + + Here are some use cases for a Validator: + + 1. Check if a stream funder is authorized to do so, based on a pre-vetted list + (see [Allowlist.vy](./validators/Allowlist.vy)) + 2. Check if a stream funder is a known bad actor, against an internal or external + list (see [Denylist.vy](./validators/Denylist.vy)) + 3. Check if the amount of time being funded is too large (e.g. operating a beta) + 4. Compute the `stream_life` for a given set of products (not all validators need to) + 5. Update and track any internal state for other purposes (airdrops, NFT mints, etc.) + 6. Emit more logs (for other Silverback services to hook onto) + @notice Implement this interface with any additional checks that should be performed on stream creation, funding or migration events in order to block certain behaviors or modify the stream @@ -10,7 +27,7 @@ from ethereum.ercs import IERC20 @external def validate( - creator: address, + funder: address, token: IERC20, amount: uint256, products: DynArray[bytes32, 20], diff --git a/contracts/validators/Allowlist.vy b/contracts/validators/Allowlist.vy index 900a98d..f1c93de 100644 --- a/contracts/validators/Allowlist.vy +++ b/contracts/validators/Allowlist.vy @@ -43,10 +43,10 @@ def deny(denied: DynArray[address, 100]): @external def validate( - creator: address, + funder: address, token: IERC20, amount: uint256, products: DynArray[bytes32, MAX_PRODUCTS], ) -> uint256: - assert self.is_allowed[creator] + assert self.is_allowed[funder] return 0 # This validator does not compute any product costs diff --git a/contracts/validators/Denylist.vy b/contracts/validators/Denylist.vy index f10ec00..a3509e0 100644 --- a/contracts/validators/Denylist.vy +++ b/contracts/validators/Denylist.vy @@ -51,10 +51,10 @@ def deny(denied: DynArray[address, 100]): @external def validate( - creator: address, + funder: address, token: IERC20, amount: uint256, products: DynArray[bytes32, MAX_PRODUCTS], ) -> uint256: - assert not self.is_denied[creator] + assert not self.is_denied[funder] return 0 # This validator does not compute any product costs