{"id":17143601,"url":"https://github.com/tangle-network/liquifier","last_synced_at":"2025-10-25T04:14:06.216Z","repository":{"id":256761407,"uuid":"856172777","full_name":"tangle-network/liquifier","owner":"tangle-network","description":"Liquid staking protocol based on Tenderize","archived":false,"fork":false,"pushed_at":"2025-02-22T13:34:35.000Z","size":109,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T09:47:06.859Z","etag":null,"topics":["chainlink","liquid-staking","livepeer","smart-contracts","solidity","staking","thegraphprotocol","validator"],"latest_commit_sha":null,"homepage":"","language":"Solidity","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/tangle-network.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-09-12T05:49:10.000Z","updated_at":"2024-10-03T18:12:01.000Z","dependencies_parsed_at":"2024-09-12T23:54:13.284Z","dependency_job_id":"bd7849e9-ee6e-469f-9e9b-d8434b159086","html_url":"https://github.com/tangle-network/liquifier","commit_stats":null,"previous_names":["webb-tools/liquifier","tangle-network/liquifier"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tangle-network/liquifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fliquifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fliquifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fliquifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fliquifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tangle-network","download_url":"https://codeload.github.com/tangle-network/liquifier/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fliquifier/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280902659,"owners_count":26410834,"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","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["chainlink","liquid-staking","livepeer","smart-contracts","solidity","staking","thegraphprotocol","validator"],"created_at":"2024-10-14T20:40:30.892Z","updated_at":"2025-10-25T04:14:06.181Z","avatar_url":"https://github.com/tangle-network.png","language":"Solidity","readme":"## Liquifier - Liquid Native Staking\n\nThe Liquifier protocol enables **liquid native staking**, each validator on a network can have its own permissionless\nliquid staking vault and ERC20 token for itself and its delegators. It is designed to be fully credibly neutral and\nautonomous, while enabling more flexibility to users when staking.\n\nBased off of [https://github.com/Tenderize/staking](Tenderize)\n\n## Getting Started\n\n## Usage\n\nHere's a list of the most frequently needed commands.\n\n### Build\n\nBuild the contracts:\n\n```sh\nforge build\n```\n\n### Clean\n\nDelete the build artifacts and cache directories:\n\n```sh\nforge clean\n```\n\n### Compile\n\nCompile the contracts:\n\n```sh\nforge build\n```\n\n### Coverage\n\nGet a test coverage report:\n\n```sh\nforge coverage\n```\n\n### Deploy\n\nFor full deploy flow check out the [deploy document](./script/DEPLOY.md).\n\n#### Deploy Liquid Staking and deposit LPT tokens \n\nThe `deploy_liquid_staking.sh` script is used to automate the deployment of the Liquifier protocol components to a local Anvil instance. This script simplifies the deployment process by setting up the necessary environment variables and executing the required deployment commands.\n\n#### Usage\n\nTo use the `deploy_liquid_staking.sh` script, follow these steps:\n\n1. **Start Anvil**: Open a terminal and start Anvil by running:\n    ```sh\n    anvil\n    ```\n   Leave this terminal open and let `anvil` run.\n\n2. **Run the Script**: In a separate terminal, navigate to the directory containing the `deploy_liquid_staking.sh` script and execute it:\n    ```sh\n    ./script/deploy_liquid_staking.sh\n    ```\n\nThe `deploy_liquid_staking.sh` script performs the following steps:\n\n- **Deploy Registry and Factories**: Deploys the registry and factory contracts to the Anvil instance.\n- **Deploy the LPT Token**: Sets the token parameters and deploys the token contract.\n- **Liquid Stake the Tokens**: Deposits teh LPT tokens into the Liquifier contract, which returns tgLPT tokens \n\nDeploy Liquifier to Anvil:\n\n```sh\n$ forge script script/Liquifie_Deploy.s.sol:Liquifie_Deploy --fork-url http://localhost:8545 \\\n --broadcast --private-key $PRIVATE_KEY\n```\n\nDeploy an Adapter to Anvil:\n\n```sh\nforge script script/Adapter_Deploy.s.sol:Adapter_Deploy  --fork-url http://localhost:8545 \\\n --broadcast --private-key $PRIVATE_KEY\n```\n\nFor instructions on how to deploy to a testnet or mainnet, check out the\n[Solidity Scripting tutorial](https://book.getfoundry.sh/tutorials/solidity-scripting.html).\n\n### Format\n\nFormat the contracts:\n\n```sh\nforge fmt\n```\n\n### Gas Usage\n\nGet a gas report:\n\n```sh\nforge test --gas-report\n```\n\n### Lint\n\nLint the contracts:\n\n```sh\nyarn lint\n```\n\n### Test\n\nRun the tests:\n\n```sh\nforge test\n```\n\n## Modules\n\n- [Liquifier](): Liquid staking vault and rebasing ERC20 token\n- [Unlocks](): ERC721 NFTs representing unstaked assets in their unstaking period\n- [Adapter](): Interfaces for interacting with Adapters containing external protocol specific logic\n- [Registry](): Registry and Role-Based access control\n- [Factory](): Factory for deploying new Liquifiers for validators\n\n### ERC1967 Storage\n\nLiquifier contracts use [ERC1967](https://eips.ethereum.org/EIPS/eip-1967) storage slots. Each contract has its own\nstorage space defined as a `struct` stored at a defined location to avoid storage collisions. Storage slots are\naddressed with a dollar sign, `$`, to improve readability when storage is accessed.\n\n### Registry\n\nThe Registry keeps track of entities within the protocol. It is used to update things like `Adapter` for an asset, or\nthe fee for an asset. It also uses Role-based access control to manage roles. It is deployed as an ERC1967 UUPS.\n\n### Liquifier\n\n#### Adapter interactions\n\nA `Liquifier` is a generic contract for Liquid Staking. Protocol specific logic is implemented in an `Adapter`. An\n`Adapter` is essentially a contract that works similar to a library.\n\nEach function on the `Adapter` is called by the `Liquifier` using `delegatecall`, meaning the logic of the `Adapter` is\nexecuted in context of the `Liquifier`. An `Adapter` can have its own storage space, which is stored on the\n`Liquifier` contract, but can only be managed by the `Adapter`.\n\nFor view functions a workaround is used by marking the `internal` functions on the `Liquifier` that interact with the\n`Adapter` as `public` instead. Then creating a separate `external view` function that wraps a call to these functions in\na `staticcall` to the `Liquifier` itself.\n\n#### Clones with immutable args\n\nLiquifiers are deployes as lightweight clones (proxies) with immutable argumants to avoid initialization logic and save\ngas. Immutable arguments are appended to the clone's bytecode at creation time, and appended to the calldata on a\ndelegatecall to the proxy. The implementation can then read and deserialize these arguments from the calldata.\n\n#### LiquidToken\n\n`Liquifier` inherits the `TGToken` contract, which is a rebasing ERC20 token. Its supply always equals the amount staked\nin the underlying protocol for a validator and its delegators. Rebasing changes the total supply depending on whether\nthe validator earned rewards or got slashed.\n\n### Unlocks\n\n`Unlocks` is a ERC-721 NFT contract that represent staked assets in their unstaking period, meaning they have been\nunstaked by their owner. Each unlock has an amount and a maturity date at which the amount can be withdrawn, this burns\nthe NFT. `Unlocks` is not upgradeable. All assets on the same network use the same `Unlocks` contract.\n\nOnly a valid `Liquifier` contract can create or destroy Unlocks, which is checked by the `Unlocks` contract through the\n`Registry`.\n\n#### Renderer\n\nThe Renderer is a UUPS (ERC1967) upgradeable proxy contract that contains logic to how these NFTs and their JSON\nmetadata should be rendered by front-end applications, this data does not affect the value represented by the NFT in any\nway.\n\n### Sequence Diagrams\n\n#### Deposit\n\n![deposit](./diagrams/deposit.png)\n\n#### Unlock\n\n![unlock](./diagrams/unlock.png)\n\n#### Withdraw\n\n![withdraw](./diagrams/withdraw.png)\n\n#### Rebase\n\n![rebase](./diagrams/rebase.png)\n\n\n\n# Deployment of Chainlink adapter\n\nDeployed Contracts on Tenderly:\n- Registry Proxy Address: 0x1C5ffc48077AbdFC8EbbE605Ab011Eb3b218B054\n- Factory Address: 0x25D20120328cc35afe3da930eC1295048CCd9d3b\n- Adapter Address: 0xD60b939004eD587Cc753E6e4C8044af7adBb1a49\n- Liquifier Address: 0x2871DafDB3b0047D06bBdb42f865DeD2514Dd9b0\n- LINK Token Address: 0x514910771AF9Ca656af840dff83E8264EcF986CA\n\nFirst, configure the .env file with the following fields:\n\n```\nTENDERLY_VIRTUAL_TESTNET_RPC=\nTENDERLY_VERIFIER_URL=$TENDERLY_VIRTUAL_TESTNET_RPC/verify/etherscan\nTENDERLY_ACCESS_KEY=\n```\n\nYou can reset the state of the blockchain by running:\n\n```sh\n./script/snapshot_and_revert.sh \n```\n\nThen you can deploy Chainlink-related contracts:\n\n```sh\n./script/chainlink_mainnet.sh \n```\n\nThis will log all the deployed contract addresses to the terminal.\n\nFinally, you can run a script to start staking LINK:\n\n```sh\n./script/stake_link.sh\n```\n\n\n# Deployment Instructions\n\nFollow these steps to deploy and set up the registry, factories, and token.\n\n### 1. Run `anvil`\n\nOpen a terminal and run the following command:\n\n```bash\nanvil\n```\n\nLeave this terminal open and let `anvil` run.\n\n### 2. Deploy the Registry and Factories\n\nIn a separate terminal, set the private key environment variable and deploy the registry and factories:\n\n```bash\nexport PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80\n\nforge script script/Liquifie_Deploy.s.sol:Liquifie_Deploy --fork-url http://127.0.0.1:8545 --broadcast --private-key $PRIVATE_KEY -vvvv\n```\n\n### 3. Set Environment Variables\n\nAfter the deployment completes, you will receive the `REGISTRY` and `FACTORY` addresses. Set these addresses as environment variables:\n\n```bash\nexport REGISTRY=0xa7cA8732Be369CaEaE8C230537Fc8EF82a3387EE\nexport FACTORY=0xF09b219D86Ff3b533FC72148a21a948Ac48216CA\n```\n\n### 4. Deploy a Token\n\nSet the token parameters and deploy the token:\n\n```bash\nexport NAME=\"Livepeer\"\nexport SYMBOL=\"LPT\"\nexport BASE_APR=\"280000\"\nexport UNLOCK_TIME=\"604800\"\nexport TOTAL_SUPPLY=\"30000000000000000000000000\"\nexport ID=0\n\nforge script script/XYZ_Deploy.s.sol:XYZ_Deploy --fork-url http://127.0.0.1:8545 --broadcast --private-key $PRIVATE_KEY -vvvv\n```\n\n### 5. Retrieve Deployed Contract Addresses\n\nAfter deploying the token, you will get the following contract addresses:\n\n```plaintext\nLPT Token: 0x0BC472c881dc7b305Ab0dd03Bb390B52f37Cd617\nLPT Staking: 0x98EC38B997e543c4FCd26Ce02d792c1f1F6ad5eA\nLPT Adapter: 0x7198960C0B1e91f5E9a031507De58A4AE73B2404\n```\n\n### 6. Stake the Tokens\n\nNow you can stake the tokens using the provided addresses.\n\nIf you encounter any issues or need further assistance, please refer to the official documentation or contact support.\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangle-network%2Fliquifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftangle-network%2Fliquifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangle-network%2Fliquifier/lists"}