{"id":29747373,"url":"https://github.com/onbonsai/bonsai-oft","last_synced_at":"2026-02-13T02:19:11.529Z","repository":{"id":286133230,"uuid":"848831024","full_name":"onbonsai/bonsai-oft","owner":"onbonsai","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-02T21:16:58.000Z","size":506,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-04T14:39:34.785Z","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/onbonsai.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-08-28T13:39:36.000Z","updated_at":"2024-10-02T21:17:02.000Z","dependencies_parsed_at":"2025-04-04T14:50:39.453Z","dependency_job_id":null,"html_url":"https://github.com/onbonsai/bonsai-oft","commit_stats":null,"previous_names":["onbonsai/bonsai-oft"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/onbonsai/bonsai-oft","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onbonsai%2Fbonsai-oft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onbonsai%2Fbonsai-oft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onbonsai%2Fbonsai-oft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onbonsai%2Fbonsai-oft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onbonsai","download_url":"https://codeload.github.com/onbonsai/bonsai-oft/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onbonsai%2Fbonsai-oft/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267141226,"owners_count":24041983,"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-07-26T02:00:08.937Z","response_time":62,"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":[],"created_at":"2025-07-26T08:39:27.238Z","updated_at":"2026-02-13T02:19:11.483Z","avatar_url":"https://github.com/onbonsai.png","language":"Solidity","funding_links":[],"categories":["Use Cases"],"sub_categories":["Github Repositories from Ecosystem Projects"],"readme":"# bonsai-oft\ndeployment of BonsaiOFT to zksync, base, and lens chain - with the BonsaiOFTAdapter to polygon\n\n## pre-requisites\nthis repo was created using the zksync-cli: https://docs.zksync.io/build/zksync-cli\n\nto build the contracts for zksync era, we use foundry-zksync: https://docs.zksync.io/build/tooling/foundry/overview\n\n## Deploying Contracts\n\nSet up deployer wallet/account:\n\n- Rename `.env.example` -\u003e `.env`\n- Set private key for both formats\n- Fund this address with the corresponding chain's native tokens you want to deploy to.\n\nWe're going to deploy\n- `BonsaiOFTAdapter` to polygon\n- `BonsaiOFT` to Base (with cli)\n- `BonsaiOFT` to zkSync Era + Lens Chain (with foundry)\n\nAll scripts set the base uri to the current NFT uri; No initial supply is set for BonsaiOFT contracts on Base/zkSync\n\n## Build the contracts\n```bash\npnpm compile\n```\n\n### Deploy `BonsaiOFTAdapter` to Polygon\nToggle only the polygon network with [SPACE] and set the tag as `BonsaiOFTAdapter`\n```bash\nnpx hardhat lz:deploy\n```\n\n### Deploy `BonsaiOFT` to Base\nToggle only the base network with [SPACE] and set the tag as `BonsaiOFT`\n```bash\nnpx hardhat lz:deploy\n```\n\n### Deploy `BonsaiOFT` to zkSync / lens chain\nRead: https://docs.zksync.io/build/tooling/foundry/getting-started#deploying-smart-contracts-with-forge\n\nTo deploy to zksync, use `foundry create`\n\n```bash\npnpm compile:forge:zksync\nforge create contracts/BonsaiOFT.sol:BonsaiOFT --account myKeystore --rpc-url zksync --chain 324 --zksync --constructor-args 100000 \"0xd07C30aF3Ff30D96BDc9c6044958230Eb797DDBF\" \"0x21aF1185734D213D45C6236146fb81E2b0E8b821\" --verify\n```\n\nManually save the deployed contract address in `addresses.json`\n\nAnd send the `setBaseURI` tx\n```bash\ncast send 0xB0588f9A9cADe7CD5f194a5fe77AcD6A58250f82 \"setBaseURI(string)\" \"ipfs://bafybeiba7hsqirohcgqibxokpml7eoh65z7fagah7ed7ggejud265ro2ky/\" --account myKeystore --rpc-url zksync --chain 324\n```\n\n### Wire the mesh\nWe need to set the peers on all contracts, and set `enforcedOptions` for the Stargate listing requirement. Everything is configured in `*.layerzero.config.ts`\nhttps://docs.layerzero.network/v2/developers/evm/technical-reference/dvn-addresses\nhttps://docs.layerzero.network/v2/developers/evm/technical-reference/deployed-contracts\n```bash\nyarn wire\n```\n\n### Bridge from polygon to zksync/base/lens\nthen, check the tx on layerzeroscan: https://layerzeroscan.com\n```bash\nforge script script/mainnet/Bridge.s.sol:LzSendPolygon --rpc-url polygon -vvvv --broadcast\n```\n\n### Bridge from base to zksync\nthen, check the tx on layerzeroscan: https://layerzeroscan.com\n```bash\nforge script script/mainnet/Bridge.s.sol:LzSendBase --rpc-url base -vvvv --broadcast\n```\n\n### Bridge from zksync to base\nthen, check the tx on layerzeroscan: https://layerzeroscan.com\n```bash\nforge script script/mainnet/Bridge.s.sol:LzSendZkSync --rpc-url zksync -vvvv --broadcast\n```\n\n### Read from BonsaiOFT on base\n```bash\nforge script script/mainnet/Read.s.sol:Read --rpc-url base -vvvv\n```\n\n### Read from BonsaiOFT on zksync\n```bash\nzksync-cli contract read --chain \"zksync\" --contract \"0xB0588f9A9cADe7CD5f194a5fe77AcD6A58250f82\" --method \"mirror()\" --output \"address\"\n```\n\n### Verify BonsaiOFTAdapter on polygon\n```bash\nnpx hardhat verify --network polygon --constructor-args ./utils/verify/bonsaiOFTAdapter.ts 0x303b63e785B656ca56ea5A5C1634Ab20C98895e1\n```\n\n### Verify BonsaiOFT on base\n```bash\nnpx hardhat verify --network base --constructor-args ./utils/verify/bonsaiOFT.ts 0x474f4cb764df9da079D94052fED39625c147C12C\n```\n\n### [TODO] Verify BonsaiOFT on zksync (etherscan)\n`Fail - Unable to verify. Compiled contract runtime bytecode does NOT match the on-chain runtime bytecode.`\n```\nforge verify-contract 0xB0588f9A9cADe7CD5f194a5fe77AcD6A58250f82 contracts/BonsaiOFT.sol:BonsaiOFT --chain-id 324 --watch --zksync --constructor-args $(cast abi-encode \"constructor(uint96,address,address)\" 100000 \"0xd07C30aF3Ff30D96BDc9c6044958230Eb797DDBF\" \"0x21af1185734d213d45c6236146fb81e2b0e8b821\")\n```\n\n### Verify BonsaiOFT on Lens\n```\nforge verify-contract \\\n    --zksync \\\n    --watch \\\n    --verifier zksync  \\\n    --verifier-url https://api-explorer-verify.lens.matterhosted.dev/contract_verification \\\n    --constructor-args $(cast abi-encode \"constructor(uint96,address,address)\" 100000 0x5c6cfF4b7C49805F8295Ff73C204ac83f3bC4AE7 0x21af1185734d213d45c6236146fb81e2b0e8b821) \\\n    0xB0588f9A9cADe7CD5f194a5fe77AcD6A58250f82 \\\n    contracts/BonsaiOFT.sol:BonsaiOFT\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonbonsai%2Fbonsai-oft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonbonsai%2Fbonsai-oft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonbonsai%2Fbonsai-oft/lists"}