Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIL-227] Automatic allocator #225

Merged
merged 11 commits into from
Sep 19, 2024
Merged

Conversation

Filip-L
Copy link
Collaborator

@Filip-L Filip-L commented Sep 11, 2024

[FIL-227] Automatic allocator

Two new endpoints have been added to handle the DataCap faucet.

Endpoint: [POST] autoallocator/trigger_autoallocation

Description:
This endpoint enables the automated allocation of DataCap to users at specified intervals.

The autoallocator/trigger_autoallocation endpoint evaluates the following conditions, based on the received data (TriggerAutoallocationInfo):

  • The message dates must be valid (the message has not expired and is not from the future).
  • The client's score must be greater than 30.
  • The client has not received DataCap from any allocator, or no application exists for this client.
  • The last allocation occurred at least 14 days ago.

If these conditions are met, the equivalent of 64GiB in DataCap will be allocated to the client.

Example TriggerAutoallocationInfo:

{
  "message": 
    "KycAutoallocationApproval": {
      "message": "message",
      "client_fil_address": "client_fil_address",
      "issued_at": "issued_date",
      "expires_at": "expiry_date",
    },
  "signature": "client_signature",
}

Endpoint: [GET]autoallocator/last_client_allocation

Description:
The autoallocator/last_client_allocation endpoint returns the timestamp of the last client autoallocation, based on the query params(LastAutoallocationQueryParams)

Example LastAutoallocationQueryParams:

{
  "evm_wallet_address": "evm_wallet_address"
}

Deployment Considerations:

  • New environment variables:

    • AUTOALLOCATOR_PRIVATE_KEY - The private key of the autoallocator wallet.

    • ALLOCATOR_CONTRACT_ADDRESS - The address of the Allocator contract.

    • DAYS_TO_NEXT_AUTOALLOCATION - The time in days to allow allocations (set to 14).

    • AUTOALLOCATION_AMOUNT - The autoallocation amount in bytes (64 GiB = 68719476736 bytes).

fplus-database/Cargo.toml Outdated Show resolved Hide resolved
fplus-lib/src/config.rs Outdated Show resolved Hide resolved
fplus-lib/src/config.rs Outdated Show resolved Hide resolved
fplus-lib/src/core/application/gitcoin_interaction.rs Outdated Show resolved Hide resolved
fplus-lib/src/config.rs Outdated Show resolved Hide resolved
fplus-lib/src/core/autoallocator/mod.rs Outdated Show resolved Hide resolved
fplus-lib/src/core/autoallocator/mod.rs Outdated Show resolved Hide resolved
fplus-database/src/database/autoallocations.rs Outdated Show resolved Hide resolved
fplus-database/src/database/autoallocations.rs Outdated Show resolved Hide resolved
fplus-lib/src/config.rs Outdated Show resolved Hide resolved
fplus-lib/src/config.rs Outdated Show resolved Hide resolved
fplus-lib/src/core/autoallocator/mod.rs Outdated Show resolved Hide resolved
fplus-lib/src/config.rs Outdated Show resolved Hide resolved
@Filip-L Filip-L changed the title Automatic allocator [FIL-227] Automatic allocator Sep 19, 2024
@kacperzuk-neti kacperzuk-neti marked this pull request as ready for review September 19, 2024 13:30
@kacperzuk-neti kacperzuk-neti merged commit d7ac445 into main Sep 19, 2024
4 checks passed
@kacperzuk-neti kacperzuk-neti deleted the FIL-227-automatic-allocator branch September 19, 2024 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants