Crates.io | elfo-protocol-core |
lib.rs | elfo-protocol-core |
version | 0.1.0 |
source | src |
created_at | 2022-03-15 14:00:58.659432 |
updated_at | 2022-03-15 14:00:58.659432 |
description | A subscription protocol on solana |
homepage | https://eflo.cc/ |
repository | https://github.com/elfo-protocol/elfo-core/ |
max_upload_size | |
id | 550498 |
size | 34,561 |
Elfo Protocol enables subscription payment on Solana blockchain.
The protocol consists of three main componenets.
[This Repository]
[ github.com/elfo-protocol/elfo-node ]
[github.com/elfo-protocol/elfo-sdk]
The program is written using anchor protocol. Instructions listed bellow makes up the protocol.
Creates a subscription plan.
create_subscription_plan(
plan_name
,
subscription_amount
,
frequency
,
feePercentage
):
Name | Type | Description |
---|---|---|
plan_name |
String |
A string mentioning a name for subscription plan |
subscription_amount |
i64 |
Subscription amount in USDC with decimals |
frequency |
i64 |
Subscription frequency in seconds |
feePercentage |
i8 |
An integer between 1 - 5 that specifies the percentage of the fees that goes to nodes. The higher the percentage, the more incentive for nodes to monitor and trigger payments. |
Name | Description | References & Notes |
---|---|---|
authority |
The account which creates the subscription plan. | Signer |
protocol_state |
The elfo protocol state account. | ELFO_PROTOCOL_STATE |
subscription_plan_author |
Subscription payment author account (init-if-needed). | SubscriptionPlanAuthor.address |
subscription_plan |
Subscription plan account (init). | SubscriptionPlan.address |
subscription_plan_payment_account |
USDC Associated Token account of subscription author to recieve payments. | getAssociateTokenAddress |
mint |
USDC mint account. | USDC Mint |
token_program |
Token Program | TOKEN_PROGRAM_ID |
associated_token_program |
Associated Token Program | ASSOCIATED_TOKEN_PROGRAM_ID |
system_program |
System Program | SystemProgram.programId |
rent |
Rent Program | SYSVAR_RENT_PUBKEY |
Delegates (approve) required tokens and subscribes to subscription plan.
subscribe ( how_many_cycles
)
Name | Type | Description |
---|---|---|
how_many_cycles |
i64 |
How many cycles should the funds be delegated to |
Name | Description | References & Notes |
---|---|---|
who_subscribes |
The account which subscribes to the plan. | Signer |
protocol_signer |
The elfo protocol signer account. | ELFO_PROTOCOL_SIGNER |
subscription |
Subscription account (init_if_needed) | Subscription.address |
subscriber |
Subscriber account (init_if_needed) | Subscriber.address |
subscriber_payment_account |
USDC Associated Token account of subscriber to delegate payments. | getAssociateTokenAddress |
subscription_plan |
Subscription plan account | SubscriptionPlan.address |
subscription_plan_payment_account |
USDC Associated Token account of subscription author to recieve payments. | getAssociateTokenAddress |
mint |
USDC mint account. | USDC Mint |
token_program |
Token Program | TOKEN_PROGRAM_ID |
associated_token_program |
Associated Token Program | ASSOCIATED_TOKEN_PROGRAM_ID |
system_program |
System Program | SystemProgram.programId |
rent |
Rent Program | SYSVAR_RENT_PUBKEY |
clock |
Clock Program | SYSVAR_CLOCK_PUBKEY |
Registers a Elfo node to the protocol. Only registered node can monitor and trigger payment to earn fees.
register_node ()
None
Name | Description | References & Notes |
---|---|---|
authority |
The account which registers the node (node authority) | Signer |
node |
Node account (init_if_needed) | ElfoNode.address |
node_payment_account |
USDC Associated Token account of node_payment_wallet to recieve USDC fee payments. |
getAssociateTokenAddress |
protocol_state |
The elfo protocol state account. | ELFO_PROTOCOL_STATE |
node_payment_wallet |
Wallet account used to get and verify node_payment_account |
|
mint |
USDC mint account. | USDC Mint |
token_program |
Token Program | TOKEN_PROGRAM_ID |
associated_token_program |
Associated Token Program | ASSOCIATED_TOKEN_PROGRAM_ID |
system_program |
System Program | SystemProgram.programId |
rent |
Rent Program | SYSVAR_RENT_PUBKEY |
Trigger a payment on a subscription. This is called by registered elfo-nodes.
trigger_payment ()
None
Name | Description | References & Notes |
---|---|---|
authority |
The account which registered the node (node authority) | Signer |
subscriber_payment_account |
USDC Associated Token account of subscriber to delegate payments. | getAssociateTokenAddress |
protocol_signer |
The elfo protocol signer account. | ELFO_PROTOCOL_SIGNER |
subscription |
Subscription account | Subscription.address |
subscriber |
Subscriber account | Subscriber.address |
subscription_plan_payment_account |
USDC Associated Token account of subscription author to recieve payments. | getAssociateTokenAddress |
subscription_plan |
Subscription plan account. | SubscriptionPlan.address |
node |
Node account | ElfoNode.address |
node_payment_account |
USDC Associated Token account of node_payment_wallet to recieve USDC fee payments. |
getAssociateTokenAddress |
node_payment_wallet |
Wallet account used to get and verify node_payment_account |
|
mint |
USDC mint account. | USDC Mint |
token_program |
Token Program | TOKEN_PROGRAM_ID |
clock |
Clock Program | SYSVAR_CLOCK_PUBKEY |
Unsubscribe from a subscription plan
unsubscribe ()
None
Name | Description | References & Notes |
---|---|---|
who_unsubscribes |
The account which unsubscribes from the plan. | Signer |
subscriber |
Subscriber account | Subscriber.address |
subscription_plan |
Subscription plan account. | SubscriptionPlan.address |
Closes a subscription plan
close_subscription_plan ()
None
Name | Description | References & Notes |
---|---|---|
authority |
The account which initially created the subscription plan | Signer |
subscription_plan_author |
Subscription payment author account. | SubscriptionPlanAuthor.address |
subscription_plan |
Subscription plan account. | SubscriptionPlan.address |
Elfo Protocol is licensed under Apache 2.0.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Anchor by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.