{"id":23599993,"url":"https://github.com/mnrgreg/transferscheduler","last_synced_at":"2026-02-15T03:32:34.204Z","repository":{"id":269333881,"uuid":"893212750","full_name":"MnrGreg/TransferScheduler","owner":"MnrGreg","description":"A contract for scheduling ERC20 transfers","archived":false,"fork":false,"pushed_at":"2025-01-21T03:08:03.000Z","size":4432,"stargazers_count":3,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T10:33:54.725Z","etag":null,"topics":["arbitrum","base","debit","eip712","erc20","ethereum","order","payments","relay","remittance","reoccuring","scheduled","scheduler","transactions","transfers"],"latest_commit_sha":null,"homepage":"https://mnrgreg.github.io/TransferScheduler/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MnrGreg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-11-23T20:36:52.000Z","updated_at":"2025-01-28T17:00:38.000Z","dependencies_parsed_at":"2024-12-22T20:25:21.128Z","dependency_job_id":"f366247d-0abb-48c7-87c9-da6c12280a02","html_url":"https://github.com/MnrGreg/TransferScheduler","commit_stats":null,"previous_names":["mnrgreg/transferscheduler"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MnrGreg/TransferScheduler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MnrGreg%2FTransferScheduler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MnrGreg%2FTransferScheduler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MnrGreg%2FTransferScheduler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MnrGreg%2FTransferScheduler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MnrGreg","download_url":"https://codeload.github.com/MnrGreg/TransferScheduler/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MnrGreg%2FTransferScheduler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29466929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T01:01:38.065Z","status":"online","status_checked_at":"2026-02-15T02:00:07.449Z","response_time":118,"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":["arbitrum","base","debit","eip712","erc20","ethereum","order","payments","relay","remittance","reoccuring","scheduled","scheduler","transactions","transfers"],"created_at":"2024-12-27T11:38:50.543Z","updated_at":"2026-02-15T03:32:34.190Z","avatar_url":"https://github.com/MnrGreg.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TransferScheduler Contract\n\n## Frontend demo\n[![TransferScheduler frontend demo](https://img.youtube.com/vi/DPMkH1oqtj0/0.jpg)](https://youtu.be/DPMkH1oqtj0)\n\n## Overview\nThe TransferScheduler is a public-good smart contract to facilitate scheduled ERC20 token transfers on Ethereum blockchains. It allows users to queue transfers that will be executed at a specified future time, ensuring that transactions occur automatically without the need for manual intervention. This offers:\n\n- **Better Capital Efficiency**: Users retain control of their ERC20 tokens until the scheduled transaction date, allowing them to accrue interest and rewards or utilize funds for other purposes in the interim.\n- **Onchain Transparency**: Senders and Recipients can view upcoming transfers directly on the blockchain, enhancing financial transparency.\n- **Convenience**: This allows users to plan and automate payments, improving convenience. Ideal for routine payments, such as remittances, DAO disbursements, and small business payroll.\n\n## Features\n- **Non-Monotonic Nonces**: Allows for non-sequential scheduling of transactions at arbitrary points in time, independent of previous transactions.\n- **Transfer Restrictions**: `notBeforeDate` and `notAfterDate` dates ensure that transfers are only executed within the valid time frame. `block.timestamp` is used for comparison.\n- **Relayer Gas Compensation**: The contract [compensates](./contracts/src/TransferSchedulerV1.sol#L206-L210) relayers for their ETH gas spend in WETH. An additional gas percentage commission is added to compensate relayers for their `MaxPriorityFeePerGas` tip, compute costs, and opportunity costs.\n  - The gas compensation is calculated as `block.basefee * 380000 (gas usage) * (100 + relayGasCommissionPercentage) / 100`.\n  - `relayGasCommissionPercentage` is initialized at contract deployment for each chain (50% by default).\n  - The WETH payment to the relayer is included automatically as part of the contract transfer.\n  - If insufficient WETH is available, the relayer will not broadcast the transaction.\n- **Gas Price Threshold**: Transfers will not execute if the network gas price `block.basefee` is higher than the user specified threshold `maxBaseFee`.\n- **Offchain queuing**: ScheduledTransfer signed messages can be provided directly to recipients or third party relays for offchain queuing, thereby avoid onchain queueing gas cost (70k gas).\n\n## Components\n### Smart Contract\nThe core functionality is implemented in the TransferScheduler smart contract, which includes methods for:\n- Queuing signed scheduled transfers (address, nonce, nonce status) - 70k gas\n- [Verifies](./contracts/src/TransferSchedulerV1.sol#L198) the user [EIP712 ScheduledTransfer typed message signature](./client-sdk/src/web3.ts#L11-L37)\n- Executing scheduled transfers\n    - Base: 130k gas with EOA | 380k gas with Smart Account\n    - Arbitrum: 700k gas with EOA | 800k gas with Smart Account\n- [Retrieving](./contracts/src/TransferSchedulerV1.sol#L146) the [relay gas token](./contracts/src/TransferSchedulerV1.sol#L32)\n- [Retrieving](./contracts/src/TransferSchedulerV1.sol#L136) the [relay gas usage](./contracts/src/TransferSchedulerV1.sol#L32)\n- [Retrieving](./contracts/src/TransferSchedulerV1.sol#L141) the [relay gas commission percentage](./contracts/src/TransferSchedulerV1.sol#L32)\n\n### Frontend\nThe frontend provides an example user interface for:\n- Creating, signing and queuing scheduled transfers\n- Increasing allowance for the transfer token and relay gas token\n- Watching for TransferScheduled events\n- Listing historical completed or future uncompleted transfers\n\nAn demo example is published at [https://mnrgreg.github.io/TransferScheduler/](https://mnrgreg.github.io/TransferScheduler/) which uses [Arbitrum Mainnet](https://arbiscan.io/address/0xBa551D945d9d4f14F7F6abc9abd26BD2684fA940#writeProxyContract) and [Base Mainnet](https://basescan.org/address/0xBa551D945d9d4f14F7F6abc9abd26BD2684fA940#writeProxyContract) with `WETH` as the relay gas token and [Polygon Mainnet](https://polygonscan.com/address/0xBa551D945d9d4f14F7F6abc9abd26BD2684fA940#writeProxyContract) with `WPOL`.\n\n### Client SDK\nThe client SDK provides a JavaScript library for interacting with the TransferScheduler contract. It includes functions for:\n- Queuing a signed scheduled transfer.\n- Watching for TransferScheduled events.\n- Types for creating and signing scheduled transfers.\n\n### Relay Worker\nA basic reference implementation that is responsible for:\n- Listening for events.\n- Persisting event entries to a local queue.\n- Evaluating all transfer restrictions before executing.\n- Executing the transfer with a pre-signed signature.\n\n\n## Types\n```typescript\n// EIP712 Typed Message for Scheduled Transfers\nprimaryType: 'ScheduledTransfer',\ndomain: {\n    name: 'TransferScheduler',\n    version: '1',\n    chainId: chainId,\n    verifyingContract: TransferSchedulerContractAddress\n},\ntypes: {\n    EIP712Domain: [\n        { name: \"name\", type: \"string\" },\n        { name: \"version\", type: \"string\" },\n        { name: \"chainId\", type: \"uint256\" },\n        { name: \"verifyingContract\", type: \"address\" }\n    ],\n    ScheduledTransfer: [\n        { name: 'owner', type: 'address' },\n        { name: 'nonce', type: 'uint96' },\n        { name: 'token', type: 'address' },\n        { name: 'to', type: 'address' },\n        { name: 'amount', type: 'uint128' },\n        { name: 'spender', type: 'address' },\n        { name: 'notBeforeDate', type: 'uint40' },\n        { name: 'notAfterDate', type: 'uint40' },\n        { name: 'maxBaseFee', type: 'uint40' },\n    ]\n}\n```\n\n\u003c!-- \n## Usage\n### Running the Relay Worker\nTo start the relay worker, run:\n```bash\ncd relay\nRPC_URL=ws://localhost:8545 PRIVATE_KEY=\u003cyour-private-key\u003e ts-node relay-worker.ts\n```\n--\u003e\n\n## Contributing\nContributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.\n\n## License\nThis project is licensed under the MIT License. See the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnrgreg%2Ftransferscheduler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnrgreg%2Ftransferscheduler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnrgreg%2Ftransferscheduler/lists"}