{"id":20460442,"url":"https://github.com/dapphub/ds-proxy","last_synced_at":"2025-04-06T03:07:27.631Z","repository":{"id":38054961,"uuid":"76987844","full_name":"dapphub/ds-proxy","owner":"dapphub","description":"a proxy object that can compose transactions on owner's behalf","archived":false,"fork":false,"pushed_at":"2022-10-05T11:18:35.000Z","size":105,"stargazers_count":314,"open_issues_count":6,"forks_count":77,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-30T01:12:55.858Z","etag":null,"topics":["dappsys","ethereum","proxy","solidity"],"latest_commit_sha":null,"homepage":"https://dapp.tools/dappsys/ds-proxy.html","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dapphub.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}},"created_at":"2016-12-20T20:03:58.000Z","updated_at":"2025-02-18T21:57:55.000Z","dependencies_parsed_at":"2023-01-19T06:31:50.317Z","dependency_job_id":null,"html_url":"https://github.com/dapphub/ds-proxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dapphub%2Fds-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dapphub%2Fds-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dapphub%2Fds-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dapphub%2Fds-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dapphub","download_url":"https://codeload.github.com/dapphub/ds-proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247427006,"owners_count":20937201,"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":["dappsys","ethereum","proxy","solidity"],"created_at":"2024-11-15T12:19:38.357Z","updated_at":"2025-04-06T03:07:27.610Z","avatar_url":"https://github.com/dapphub.png","language":"Solidity","funding_links":[],"categories":["Solidity"],"sub_categories":[],"readme":"\u003ch2\u003eDSProxy\n  \u003csmall class=\"text-muted\"\u003e\n    \u003ca href=\"https://github.com/dapphub/ds-proxy\"\u003e\u003cspan class=\"fa fa-github\"\u003e\u003c/span\u003e\u003c/a\u003e\n  \u003c/small\u003e\n\u003c/h2\u003e\n\n_Execute transactions \u0026 sequences of transactions by proxy_\n\nThis contract implements a very useful utility called a _proxy_. It is deployed \nas a standalone contract, and can then be used by the owner to execute code.\n\nA user would pass in the bytecode for the contract as well as the calldata for \nthe function they want to execute.\n\nThe proxy will create a contract using the bytecode. It will then delegatecall \nthe function and arguments specified in the calldata. Loading in this code is \nmore efficient than jumping to it.\n\n### Use Cases\n\n#### 1. Allow actions to be executed through the proxy identity\n\nThis can be very useful for securing complex applications. Because `delegatecall` \nretains `msg.sender` and `msg.value` properties, internal functions can be set \nto only accept calls coming from the proxy through an ownership model like \n[ds-auth](https://dapp.tools/dappsys/ds-auth.html). In this manner as long as \nthe proxy is not compromised, the internal system is protected from outsider \naccess. Should the owner of the internal calls ever need to be changed, this is \nas simple as updating the owner of `ds-proxy` rather than manually updating each \nindividual internal function call, making it much more secure and adaptable.\n\n#### 2. Execute a sequence of actions atomically\n\nDue to restrictions in the EVM instruction set such as being unable to be nested \ndynamically sized types and arguments, 1 transaction could be done at a time. \nSince `ds-proxy` takes in bytecode of a contract, rather than relying on a \npre-deployed contract, customized _script_ contracts can be used. These script \ncontracts share a very important property in that they enable a sequence of \nactions to be executed atomically (all or nothing). This prevents having to \nmanually rollback writes to contracts when a single transaction fails in a set \nof transactions.\n\n### Example Usage\n\nNote: the examples assume the user is using Dapphub's [dapp](https://dapp.tools/dapp/) \nand [seth](https://dapp.tools/seth/) \n\n1. Deploy DSProxyFactory. (Optional - DSProxy can be deployed directly)    \n\n   `dapp create DSProxyFactory`     \n\n2. Call the build function in DSProxyFactory to create a proxy for you. (Optional)    \n\n   `seth send \u003cDSProxyFactoryAddr\u003e \"build()(address)\"`    \n\n3. Create a contract and compile using solc.    \n\n   `dapp build MyCustomContract`    \n\n3. Get the calldata for the function and arguments you want to execute     \n\n   `seth calldata \"\u003cfunctionName\u003e(\u003cargType1\u003e,\u003cargType2\u003e...\u003cargTypeN\u003e)(\u003creturnArgType\u003e)\" \u003carg1\u003e \u003carg2\u003e \u003cargN\u003e`\n\n4. Pass the contract bytecode and calldata to the execute function inside the deployed DSProxy.    \n   `seth send \u003cDSProxyAddr\u003e \"execute(bytes,bytes)(bytes32)\" \u003cContractByteCode\u003e \u003cCallData\u003e`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdapphub%2Fds-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdapphub%2Fds-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdapphub%2Fds-proxy/lists"}