{"id":19715693,"url":"https://github.com/streamflow-finance/non-linear-cli","last_synced_at":"2025-06-29T06:32:26.610Z","repository":{"id":243837599,"uuid":"797165585","full_name":"streamflow-finance/non-linear-cli","owner":"streamflow-finance","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-03T13:38:28.000Z","size":36742,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-27T21:52:24.133Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/streamflow-finance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-07T10:16:47.000Z","updated_at":"2024-07-03T13:38:32.000Z","dependencies_parsed_at":"2025-02-27T17:18:19.979Z","dependency_job_id":"dd448d3d-edd9-440e-ba3b-fec53c5f1940","html_url":"https://github.com/streamflow-finance/non-linear-cli","commit_stats":null,"previous_names":["streamflow-finance/non-linear-cli"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/streamflow-finance/non-linear-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamflow-finance%2Fnon-linear-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamflow-finance%2Fnon-linear-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamflow-finance%2Fnon-linear-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamflow-finance%2Fnon-linear-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streamflow-finance","download_url":"https://codeload.github.com/streamflow-finance/non-linear-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamflow-finance%2Fnon-linear-cli/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262547058,"owners_count":23327093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T22:39:08.647Z","updated_at":"2025-06-29T06:32:26.590Z","avatar_url":"https://github.com/streamflow-finance.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Non-Linear vesting Proxy account\n\nWrapper program that allows to create a Vesting stream with non-linear vesting support (recipient gets rewarded for not claiming a stream);\n\n## Penalized Vesting\n\nThe way it works is:\n\n1. Sender calls `create` method of the program, passes all parameters needed for vesting stream creation along with `increase_rate` and `penalty_rate`.\n2. Program creates a proxy account and creates a vesting stream with the proxy account as sender. It's needed because only stream sender can update release amount for the stream.\n3. A separate worker every release period calls `update_release` method of the program.\n4. Program checks how many funds are released (minus withdrawn) to the recipient.\n5. Program calculates at what step of non-linear vesting recipient should be with this amount of released funds.\n6. Program sets release amount according to the step that recipient is at +1.\n\nWith this logic if recipient claims, released amount gets decreased (we can also increase their punishment by applying `penalty_rate` to the released amount), so we will decrease release amount. If user does not withdraw, release amount is increased.\n\nLimitations:\n- transfer, topup, pause, cliff is not available (basically only cancellation of the stream is possible);\n- auto-claim is not possible as sender is a proxy account;\n\nExample Contract is https://explorer.solana.com/address/DCiRMRzCvd8wqJF3SdJNNe2QRWR77ndQ4ByJCMjx1o4g?cluster=devnet:\n- initial release amount of `100000` with increase rate of `1.5`;\n- second transaction updates release to `150000`; \n- third transaction updates release to `225000`; \n- fourth transaction updates release to `337500`; \n- there no fifth transaction, because it happens before the last unlock period, there is no need to update release amount anymore given user has not withdrawn;\n\n## Non-Penalized Vesting\n\nIt's also possible to create a Proxy Account with `penalized` flag off, this way recipient won't be penalized for claiming.\nEach unlock period their `amount_per_period` will be increased. \nAs `increase_rate` supports value of less than `1`, it can be used to set up a vesting with a decreased rate.\n\nExample proxy account https://explorer.solana.com/address/BRFdc4RzAebs5U1UNqe3MvcxLXQpV294TCsjQTVRNwns?cluster=devnet:\n- initial release amount of `100000` with increase rate of `0.9`;\n- second transaction updates release to `90000`;\n- third transaction updates release to `81000`;\n- fourth transaction updates release to `72900`;\n\n# CLI\n\n## Pre-requisites\n\n- python 3.11\n- [poetry](https://python-poetry.org/docs/#installation)\n\n## Usage\n\nInstall dependencies of the script:\n\n```poetry install```\n\nAnd run the script with:\n\n```poetry run non_linear_cli -h```\n\n```poetry run non_linear_cli --devnet create```\n\n## Parameters on create\n\n```\n  -m, --mint TEXT                 Mint of the token to vest  [default: Es9vMFr\n                                  zaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB]\n  -n, --net-amount INTEGER        Total amount of tokens to vest  [default:\n                                  1000000]\n  -p, --period INTEGER            Release period, release A amount every P\n                                  seconds  [default: 30]\n  -a, --amount-per-period INTEGER\n                                  Release amount, every P seconds release A\n                                  amount  [default: 100000]\n  -ir, --increase-rate TEXT       Increase rate, A amount will be increased by\n                                  it every P seconds  [default: 1.5]\n  -pr, --penalty-rate TEXT        Penalty rate, enacted when recipient\n                                  withdraws between periods  [default: 1]\n  --penalized                     Penalize for claims\n  --name TEXT                     Name of a vesting stream\n  --key TEXT                      Path to the keys.json file for the stream\n                                  sender or base58 encoded private key\n                                  [default: sender.json]\n```\n\n### Notes\n\n- `-n, --net-amount` and `-a, --amount-per-period` are set in Raw tokens amount, should include token decimals, i.e. if your token has 9 decimals and you want to vest 10 tokens, you need to pass `10000000000` as net amount;\n- `-ir, --increase-rate` is the rate by which `amount_per_period` will be multiplied every `period`, to decrease the amount each period it should be less than 1;\n\n## Example commands\n\nPenalized with increasing rate:\n```bash\npoetry run non_linear_cli --devnet create \\\n-m 4r64XjgR6P6KaSwhkvmp1Ye1dZ7YPdFX1Z84e5jZY4nk \\\n-n 500000 \\\n-p 60 \\\n-a 100000 \\\n-ir 1.5 \\\n--name \"Test Penalized\" \\\n--key authority.key \\\n--penalized \\\n4vnGXnpbYBM5EzgKDvNHiGooojyxPFYn9xA4SaFYMpbb\n```\n\nNon-Penalized with decreasing rate:\n```bash\npoetry run non_linear_cli --devnet create \\\n-m 4r64XjgR6P6KaSwhkvmp1Ye1dZ7YPdFX1Z84e5jZY4nk \\\n-n 500000 \\\n-p 60 \\\n-a 100000 \\\n-ir 0.9 \\\n--name \"Test Non-Penalized\" \\\n--key authority.key \\\n4vnGXnpbYBM5EzgKDvNHiGooojyxPFYn9xA4SaFYMpbb\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamflow-finance%2Fnon-linear-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreamflow-finance%2Fnon-linear-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamflow-finance%2Fnon-linear-cli/lists"}