{"id":18263732,"url":"https://github.com/yearn/yearn-stb","last_synced_at":"2025-04-09T01:28:17.754Z","repository":{"id":236122677,"uuid":"782286393","full_name":"yearn/yearn-stb","owner":"yearn","description":"Yearn Stake the Bridge Setup for Polygon CDK","archived":false,"fork":false,"pushed_at":"2024-05-23T01:40:51.000Z","size":2953,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-23T02:38:16.737Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/yearn.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-04-05T01:57:36.000Z","updated_at":"2024-05-23T02:38:30.951Z","dependencies_parsed_at":"2024-05-23T02:38:23.104Z","dependency_job_id":"0359e03a-4b5d-4073-8681-9b8d2cf40ac6","html_url":"https://github.com/yearn/yearn-stb","commit_stats":null,"previous_names":["yearn/yearn-stb"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yearn%2Fyearn-stb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yearn%2Fyearn-stb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yearn%2Fyearn-stb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yearn%2Fyearn-stb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yearn","download_url":"https://codeload.github.com/yearn/yearn-stb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247955908,"owners_count":21024479,"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-05T11:12:27.027Z","updated_at":"2025-04-09T01:28:17.736Z","avatar_url":"https://github.com/yearn.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Yearn Stake the Bridge \n\n# Structure\n\n![alt text](image.png)\n\n## [Role Manager](https://github.com/yearn/yearn-stb/blob/seperate/src/RoleManager.sol)\n\n- Yearn governed contract to handle vault deployments and configuration\n\n## [L1 Deployer](https://github.com/yearn/yearn-stb/blob/master/src/L1Deployer.sol)\n\n- The L1 rollup admin will register their rollup with the L1 Deployer\n    - `registerRollup`\n        - rollupID\n        - L1 EscrowManager\n        - L2 Deployer\n\n    - Deploys a new vault if not yet, does full setup. \n    - Deploys L1 escrow and sends message to bridge to L2 escrow.\n\n- Allows anyone to add a new asset to any registered Rollup\n    - `newEscrow`\n        - rollupID\n        - L1 Token\n\n- Allows for a Rollup Admin to add custom vaults for a specific asset.\n    - `newCustomVault`\n        - rollupID\n        - L1 Token\n        - Vault (Optional)\n\n- Allows for a Rollup Admin to update is EScrow Manager or L2 Deployer\n\n\n## [L2 Deployer](https://github.com/yearn/yearn-stb/blob/master/src/L2Deployer.sol)\n\n- Receives message from L1 Deployer when a new escrow was created for a new asset.\n- Deploys L2 Token, Escrow and convertor and completes setup\n- Owned by L2 Admin\n\n## [L1 Yearn Escrow](https://github.com/yearn/yearn-stb/blob/master/src/L1YearnEscrow.sol)\n- Yearn specific L1 Escrow contract that handles bridge transactions.\n\n- Will deposit funds into a Yearn vault during a bridge if amounts are over any set `minimumBuffer`\n\n- If withdraws cannot be processed it will send shares to users when bridging back to L1.\n\n- Rollups Admin can update the `minimumBuffer` as well as the vault it uses.\n\n- Allows for permissionless rebalance's based on the `minimumBuffer`.\n\n\n# Deployments\n\n\n**L1 Deployer**: `0x1316a3312CfF738aDCBF011bCE9D1e7B9C88C817`\n**STB Role Manager**: `0x51b76329d2C6b8974053C9655484e231f7dcd418`\n\n\nIn order to integrate your Polygon CDK chain with STB you will need to \n\n1. Deploy an `L2Deployer` on your rollup.\n2. Register the rollup and the L2 Deployer address with the L1 Deployer.\n\nOnce done it is permsissionless for anyone to use the STB to bridge from mainnet to your rollup.\n\nThere is a pre-built [script](https://github.com/yearn/yearn-stb/blob/master/scripts/RegisterRollup.s.sol) that can be run from this repo in order to complete the full setup.\n\n**NOTE**: The script assumes the rollups `admin` on the L1 is a Gnosis Safe and the private key input maps to either a singer or a delegate of that safe in order to post the txn that registers the rollup.\n\n```shell\n$ git clone --recursive https://github.com/yearn/yearn-stb\n\n$ cd yearn-stb\n\n$ cp .env.example .env\n```\n\nFill in the full .env with your specific rollup RPC, Polygon CDK based rollup ID, and the desired addresses. \n\n**NOTE**: To deploy a L2 Deployer during the script leave the `L2_DEPLOYER` variable as address(0). If one is already deployed, insert the address in that variable to not re-deploy.\n\nTo just deploy the L2 Deployer and not send the registerRollup Safe txn put 0 as the `ROLLUP_ID`.\n\nIf you have not added a keystore private key to foundry before add your address to use\n\n```shell\n$ cast wallet import --interactive \u003cwallet_name\u003e\n```\n\nRun the script\n```shell\n$ make register account=\u003cwallet_name\u003e sender=\u003cwallet_address\u003e\n```\n\nIf successful the txn will both deploy the L2 Deployer on the specified rollup and post a Safe txn to register the Rollup in the L1 Deployer.\n\n\n### Verification\n\nThe L2 Deployer will deploy 3 other implementation contracts with it when deployed.\n\nYou can find the flatten version of all contracts deployed on the L2 in the repo https://github.com/yearn/yearn-stb/tree/master/flat\n\nThe encoded constructor arguments used for the L2 deployer should be logged in the console on deployment as well.\n\n## Foundry Documentation\n\nhttps://book.getfoundry.sh/\n\n## Usage\n\n### Build\n\n```shell\n$ make build\n```\n\n### Test\n\n```shell\n$ make tests\n```\n\n### Trace\n\n```shell\n$ make trace\n```\n\n### Gas Snapshots\n\n```shell\n$ make snapshot\n```\n\n### Cast\n\n```shell\n$ cast \u003csubcommand\u003e\n```\n\n### Help\n\n```shell\n$ forge --help\n$ anvil --help\n$ cast --help\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyearn%2Fyearn-stb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyearn%2Fyearn-stb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyearn%2Fyearn-stb/lists"}