{"id":28393706,"url":"https://github.com/foxytanuki/curvegrid-payroll","last_synced_at":"2026-02-16T02:08:34.078Z","repository":{"id":286126403,"uuid":"960448041","full_name":"foxytanuki/curvegrid-payroll","owner":"foxytanuki","description":"An award-winning cross-chain payroll app using Curvegrid and Circle’s CCTP v2, built for ETHGlobal Taipei 2025.","archived":false,"fork":false,"pushed_at":"2025-04-07T11:21:53.000Z","size":2099,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-11T23:36:07.828Z","etag":null,"topics":["cctp","cctp-v2","curvegrid","ethglobal","multibaas","smart-contracts","solidity"],"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/foxytanuki.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,"zenodo":null}},"created_at":"2025-04-04T13:01:21.000Z","updated_at":"2025-06-01T17:27:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"c0143034-e6b9-431d-be08-b5ab53310b61","html_url":"https://github.com/foxytanuki/curvegrid-payroll","commit_stats":null,"previous_names":["foxytanuki/curvegrid-payroll"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/foxytanuki/curvegrid-payroll","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxytanuki%2Fcurvegrid-payroll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxytanuki%2Fcurvegrid-payroll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxytanuki%2Fcurvegrid-payroll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxytanuki%2Fcurvegrid-payroll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foxytanuki","download_url":"https://codeload.github.com/foxytanuki/curvegrid-payroll/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxytanuki%2Fcurvegrid-payroll/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260234549,"owners_count":22979021,"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":["cctp","cctp-v2","curvegrid","ethglobal","multibaas","smart-contracts","solidity"],"created_at":"2025-05-31T17:02:35.827Z","updated_at":"2026-02-16T02:08:34.008Z","avatar_url":"https://github.com/foxytanuki.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Curvegrid Payroll\n\n---\n\n**🏆 Our project won prizes from Curvegrid and Circle!**\nhttps://ethglobal.com/showcase/curvegrid-payroll-kzyix\n\n---\n\n### Summaries for \"Best Overall Use of MultiBaas\" Prize.\n\n#### 1. A one-sentence summary of your project\n**Curvegrid Payroll** is a **cross-chain payroll application** facilitating USDC payments, leveraging **Circle's Cross-Chain Transfer Protocol (CCTP) V2**, powered by **Curvegrid**.\n\n#### 2. How you used MultiBaas in your project\n\n- MultiBaas REST API (directly or via SDK)\n  - Seamlessly integrated MultiBaas REST API calls directly within Google Apps Script to manage smart contract interactions.\n- Cloud Wallets\n  - Secured contract ownership and management using a MultiBaas Cloud Wallet hosted on Azure Key Vault.\n- Transaction Manager (TXM)\n  - Leveraged TXM during the development phase for real-time, efficient monitoring of transaction statuses.\n- Safe{Wallet}\n  - Explored Safe{Wallet} integration for potential multisig security enhancements, confirming its value for future iterations.\n- Event Queries\n  - Utilized MultiBaas Event Queries via REST API from Google Apps Script to effectively track on-chain contract events.\n\n#### 3. A brief intro to your team and their social handles\n\n##### Natsuki Yamaguchi\nX(Twitter): [0x_natto](0x_natto)\n\nKomlock Lab CTO \u0026 Technical Lead at CryptoGames, specializing in Blockchain Development.\n\n##### Takuma Abe\nX(Twitter): [takupesoo](https://x.com/takupesoo)\n\nKomlock Lab VPoE and backend and blockchain developer.\n\n##### Yuta Tsurusaki\nX(Twitter): [foxytanuki](https://x.com/foxytanuki)\n\nCore Developer at [Mycel](https://www.mycel.land/). Full-stack blockchain developer passionate about intents and cross-chain solutions.\n\n#### 4. Clear setup and testing instructions\n\n##### Install dependencies\n\n```\npnpm i\n```\n\n##### Deploy contracts\n\n###### CCTPHookWrapper\n\n```\npnpm deploy:hook --reset\n```\n\n###### MultichainPayrollMultisig\n\n```\npnpm deploy:payroll-multisig --reset\n```\n\n#### 5. Your experience with MultiBaas (feedback, challenges, wins)\n\n- **Wins:**\n  - CloudWallet provided secure and convenient key management.\n  - Responsive Support helped clarify best practices quickly.\n  - The Contract Linking feature was remarkably intuitive and fast, significantly aiding the development workflow.\n  - The ability to link already deployed contracts is a valuable feature.\n  - The state overview in the \"On-chain Contracts\" section was extremely convenient during development, eliminating the need for manual `read` function calls.\n  - Helpful input comments within the \"Functions\" tab of \"On-chain Contracts\" facilitated accurate parameter entry.\n  - The flexibility to connect both Cloud Wallets and Web Wallets is a significant advantage.\n  - The inclusion of Chainlist links when a connected Web Wallet doesn't support the deployment's chain was very helpful.\n  - Successfully implemented an automated event update mechanism using Google Apps Script (GAS) when synchronous updates weren't available via spreadsheet integration or `MBQUERY`.\n- **Challenges:**\n  - CloudWallet setup on Azure Key Vault was somewhat complex initially.\n  - Integrating with Safe{Wallet} proved challenging due to dependencies within the Safe{Wallet} ecosystem (e.g., SDKs), hindering straightforward integration.\n  - Occasionally encountered an issue where contracts deployed using `hardhat-multibaas-plugin` were linked to an incorrect address within the MultiBaas UI, despite successful on-chain deployment.\n  - Native spreadsheet integration and `MBQUERY` did not support synchronous/real-time event updates, requiring a custom GAS solution as a workaround.\n- **Feedback:**\n  - Simplified instructions or scripts for CloudWallet setup would be beneficial.\n  - Proxy \u0026 Upgradable Contracts documentation could benefit from more detailed examples.\n  - Provide clearer guidance or dedicated libraries/examples to simplify Safe{Wallet} integration, considering external dependencies.\n  - Investigate and resolve the intermittent contract address mismatch issue in the MultiBaas UI after deployment with `hardhat-multibaas-plugin`.\n  - Providing built-in options for real-time or easier automated event fetching (beyond manual `MBQUERY` or custom scripting) would enhance the developer experience for applications requiring timely event data.\n\n---\n\n## Commands\n\n### Deploy Contracts via Hardhat Ignition\n\n#### CCTPHookWrapper.sol\n\nThe following command will deploy CCTPHookWrapper to Hardhat local network.\n\n```\npnpm deploy:hook\n```\n\n##### BaseSepolia\n\n```\npnpm deploy:hook --network baseSepolia\n```\n\n##### Sepolia with verify\n\n```\npnpm deploy:hook --network sepolia --verify\n```\n\n#### MultichainPayroll.sol\n\n```\npnpm deploy:payroll\n```\n\n### WithHooks\n\n1. `pnpm deploy:hook-v2 --verify`\n2. `pnpm deploy:payroll-hook-destination --verify`\n3. fill the values of MultichainPayrollWithHookSourceModule in `/ignition/parameters.json` \n4. `pnpm deploy:payroll-hook-source --verify`\n\n\n### BatchPayEmployees from sepolia\n\n```\n➜  curvegrid-payroll git:(main) ✗ pnpm hardhat run scripts/payroll.ts --network sepolia\nRunning script on network: sepolia (chainId: 11155111)\nUsing deployer account: 0x39338FD37f41BabC04e119332198346C0EB31022\n\nGetting deployed contract address for ID: MultichainPayrollModule#MultichainPayroll on chain 11155111...\n  Reading deployed addresses from: /Users/foxy/Development/personal/hackathon/curvegrid-payroll/ignition/deployments/chain-11155111/deployed_addresses.json\n  Found contract address: 0xa65552404dFc42380Bd1327C9795126F9a8626c1\nSuccessfully retrieved MultichainPayroll contract instance.\n\nStep 1: Setting route info for employee 0x45D17a2C9092ec9F86FB27A8416c2777858fB591...\n  Transaction sent: 0x5399eb2c1b6046e33459c32fe0a0f70fdd574e75e5f22bffe2665edc5948b2a5\n  Route info set successfully. Gas used: 50911\n\nStep 2: Sending 0.2 USDC to Payroll contract (0xa65552404dFc42380Bd1327C9795126F9a8626c1)...\n  Deployer (0x39338FD37f41BabC04e119332198346C0EB31022) USDC balance: 33.9\n  USDC transfer transaction sent: 0xfc85a68caa3aeb505521e13721ebfbd439e96efde67ac8e1a948c4b0e5cd563e\n  USDC transferred successfully. Gas used: 62159\n  Payroll contract USDC balance: 0.2\n\nStep 3: Paying employee 0x45D17a2C9092ec9F86FB27A8416c2777858fB591 (0.1 USDC) via batchPayEmployees...\n Payroll contract balance before payment: 0.2 USDC\n  batchPayEmployees transaction sent: 0xa34ad7a4b3fc05db224157a42d1d677ea169f0f7178c035ea1e5a9640cdfea98\n  Payment sent successfully via CCTP. Gas used: 135792\n  Payroll contract USDC balance after payment tx: 0.1\n\nScript finished successfully.\n```\n\n### Get an attestation\n\n```\n➜  curvegrid-payroll git:(main) pnpm tsx scripts/attestation.ts 0xa34ad7a4b3fc05db224157a42d1d677ea169f0f7178c035ea1e5a9640cdfea98\nRetrieving attestation for transaction: 0xa34ad7a4b3fc05db224157a42d1d677ea169f0f7178c035ea1e5a9640cdfea98\nAttestation retrieved successfully!\n\n{\n  attestation: '0xa28a1cbab7a4cc56235aea6066c21f0e3c2a66472a7ed00d7131afbbd671722f1ace7ceb158d013756d6b66b3b0cb4fc05125b61fe88b5a8cc29b299b26f806e1c13def4c37828096dac949b0a0b7b2775172662f6426095aa648aa86718975fd54e3fb2531d6ed1f44ea3691aebe3fe34a9830d3abccef34f9aca067eabd3c3f31b',\n  message: '0x000000010000000000000006a482c6b74d999a4a814bb9a82bfbc98505808adce9db435556c451b5107ed45c0000000000000000000000008fe6b999dc680ccfdd5bf7eb0974218be2542daa0000000000000000000000008fe6b999dc680ccfdd5bf7eb0974218be2542daa0000000000000000000000000000000000000000000000000000000000000000000003e8000007d0000000010000000000000000000000001c7d4b196cb0c7b01d743fbc6116a902379c723800000000000000000000000045d17a2c9092ec9f86fb27a8416c2777858fb59100000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000a65552404dfc42380bd1327c9795126f9a8626c100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',\n  eventNonce: '0xa482c6b74d999a4a814bb9a82bfbc98505808adce9db435556c451b5107ed45c',\n  cctpVersion: 2,\n  status: 'complete'\n}\n```\n\n### Receive Message on the destination chain\n\n```\npnpm hardhat run scripts/2-receive-message.ts --network baseSepolia\nReading attestation data from: /Users/foxy/Development/personal/hackathon/curvegrid-payroll/attestation_data.json\nSuccessfully read attestation data:\n  Message: 0x000000010000000000000006a482c6b74d999a4a...\n  Attestation: 0xa28a1cbab7a4cc56235aea6066c21f0e3c2a6647...\n\nRunning script on network: baseSepolia (chainId: 84532)\nUsing signer account: 0x39338FD37f41BabC04e119332198346C0EB31022\n\nGetting deployed CCTPHookWrapper address for ID: CCTPHookWrapperModule#CCTPHookWrapper on chain 84532...\n  Reading deployed addresses from: /Users/foxy/Development/personal/hackathon/curvegrid-payroll/ignition/deployments/chain-84532/deployed_addresses.json\n  Found contract address: 0x36f6eb97FE0Ac332B651c46D08B201fE471C16e2\nSuccessfully retrieved CCTPHookWrapper contract instance.\n\nCalling receiveMessage on CCTPHookWrapper (0x36f6eb97FE0Ac332B651c46D08B201fE471C16e2)...\n  Transaction sent: 0x3bb0ceab1685ba8e4cbcfccd28d4b4d53d6eb0f838e0560d881c8fa2c914da0a\n  Message received successfully. Gas used: 184131\n  View transaction on explorer: https://baseSepolia.etherscan.io/tx/0x3bb0ceab1685ba8e4cbcfccd28d4b4d53d6eb0f838e0560d881c8fa2c914da0a\n```\n\n## Architecture\n\n```mermaid\nsequenceDiagram\n    participant BO as Business Owner\n    participant CP_S as CirclePayroll (Source)\n    participant TM as TokenMessenger\n    participant Circle as Circle API\n    participant CG as Curvegrid Gas\n    participant CCTP_H as CCTPHookWrapper\n    participant MT as MessageTransmitter\n    participant CP_D as CirclePayroll (Destination)\n    participant Emp as Employee\n\n    Note over BO,Emp: Destination Chain Setup\n    BO-\u003e\u003eCP_D: setRouteInfo(employee, domain, token, lending)\n\n    Note over BO,Emp: Source Chain Setup\n    BO-\u003e\u003eCP_D: setRouteInfo(employee, domain, token, lending)\n\n    Note over BO,Emp: Source Chain Payment\n    BO-\u003e\u003eCP_S: transfer USDC to contract\n    BO-\u003e\u003eCP_S: batchPayEmployees(employees)\n    CP_S-\u003e\u003eTM: depositForBurn(amount, domain, to, USDC)\n    \n    Note over BO,Emp: Offchain Process\n    Note over TM,Circle: Circle API Processing\n    TM-\u003e\u003eCircle: Request attestation\n    Circle--\u003e\u003eCG: Generate attestation\n\n    Note over CG,CCTP_H: Message Relay\n    loop Polling\n        CG-\u003e\u003eCircle: Check attestation status\n        Circle--\u003e\u003eCG: Return attestation when ready\n    end\n    \n    Note over BO,Emp: Destination Chain Payment\n    CG-\u003e\u003eCCTP_H: relay(message, attestation)\n    \n    Note over CCTP_H,CP_D: Receive Bridged Assets\n    CCTP_H-\u003e\u003eMT: receiveMessage(message, attestation)\n    CCTP_H-\u003e\u003eCP_D: handleReceiveMessage(recipient, amount)\n    \n    Note over CP_D,Emp: Hook Execution\n    alt Route Configured\n        CP_D-\u003e\u003eCP_D: Check route info\n        alt Token Swap Required\n            CP_D-\u003e\u003eCP_D: _swapUSDCToToken()\n        end\n        alt Lending Enabled\n            CP_D-\u003e\u003eCP_D: _depositToDeFi()\n        else Direct Transfer\n            CP_D-\u003e\u003eEmp: transfer tokens\n        end\n    else Route Not Configured\n        Note over CP_D: USDC remains in contract\n        Note over CP_D: Admin can withdraw using withdrawUSDC()\n    end\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxytanuki%2Fcurvegrid-payroll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoxytanuki%2Fcurvegrid-payroll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxytanuki%2Fcurvegrid-payroll/lists"}