Practical overview
When it fits
Use DSAuth when implementing Solidity contracts that need reusable authorization checks and an owner or authority configuration that can be updated by an authorized caller.
Who it is for
- Solidity developers adding access checks to smart-contract functions.
- Contract teams that need an authority contract to define fine-grained permissions.
Documented uses
- Restrict a function to the contract owner or the contract itself.
- Delegate function-level permission decisions to a DSAuthority implementation.
- Change the contract owner or configured authority through authorized methods.
Requirements & limits
- The default authorization rules allow the owner and the contract itself; other callers require permission through a configured authority.
- Custom fine-grained rules require a contract implementing the DSAuthority interface.
- The README identifies ds-guard and ds-roles as ready-made authority contracts.
- The repository declares the GPL-3.0 license.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Protect a Solidity function with DSAuth
Require an authorized caller for a contract function using the DSAuth `auth` modifier.
Before you start
- A Solidity contract using DSAuth.
Steps
Add the
authmodifier to the function that should be protected, following the documented pattern:function myProtectedFunction() auth {}.Use the authorization behavior supplied by DSAuth: the caller must be the contract owner, the contract itself, or be permitted by a configured authority.
Expected outcome
The function is restricted to callers authorized by DSAuth.
Guide limitations
- The source describes the modifier’s authorization rule but does not document installation, compilation, deployment, or testing steps.
- Fine-grained permissions require a configured authority contract implementing
DSAuthority; its setup is not covered here.
Update a contract’s DSAuth owner or authority
Change the owner or configured authority through DSAuth’s authorized methods.
Before you start
- A contract using DSAuth.
- A caller authorized by the contract’s current authorization rules.
Steps
Call
setOwner(address owner_)to set a new owner, orsetAuthority(DSAuthority authority_)to set a new authority.Ensure the call is authorized; both methods require authorization.
Expected outcome
The contract’s owner or authority is updated, subject to authorization.
Guide limitations
- The source does not document how to initialize DSAuth or deploy an authority contract.
- The source does not specify the permission policy of a custom authority.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 15 October 2026
- Original website title
- dapphub/ds-auth · Official homepage title · retained in its source language

