Skip to content

Commit

Permalink
docs(contracts): update creator -> funder in Validator interface
Browse files Browse the repository at this point in the history
also add `@dev` to Validator.vyi
  • Loading branch information
fubuloubu committed Sep 28, 2024
1 parent c516102 commit 1f46007
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion contracts/Validator.json
Original file line number Diff line number Diff line change
Expand Up @@ -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[]" }
Expand Down
19 changes: 18 additions & 1 deletion contracts/Validator.vyi
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -10,7 +27,7 @@ from ethereum.ercs import IERC20

@external
def validate(
creator: address,
funder: address,
token: IERC20,
amount: uint256,
products: DynArray[bytes32, 20],
Expand Down
4 changes: 2 additions & 2 deletions contracts/validators/Allowlist.vy
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions contracts/validators/Denylist.vy
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1f46007

Please sign in to comment.