---
# System prepended metadata

title: RAD DAD

---

# RAD DAD

### RAD
* Build as fast as possible
* Seperate business logic that is common to all apps
* Build tools that help build tools
* Developers should only have to worry about BL of their own app/DAO
* DAPPS are cattle not pets
* DAOs are new, nobody really knows what works
* We need to test coordination mechanisms instead of writing the same JS over and over
* Web3 dev is hard but it doesn't need to be.
* Opportunities
    * We use same API
    * We interact with rpc
    * We should be using the same models
    * Able to use permaweb (IPFS) allows to build in new ways

### DAD: Distributed Application Development
* Build tools that tackle common challenges of DAO dev
* Encode data for a multicall- refactor that somewehre
* Distribute logic over many apps
* Build smaller apps linked together
* Prototype fast, learn how community coordinates
* Reduce forms, on chain TXs, fields, contract interfaces into static data.
* We don't need to host static data
* Apps become interpreters
* Frontends have a new way of talking to each other (legos + permaweb)

Why?
* Life is too short
* DAO dev is very challenging
    * Multicall
    * Polling subgraph
    * Sync multiple sources
    * crunch numbers with tokens
    * Interact with rest of web3 & protocols on that chain
    * New contracts for your DAO
    * Endless forms & integrations
    * Not displaying data is a severe vulnerability
        * Need multiple layers of apps to ensure security
        * Visibility & notifications are important
        * Most rely on frontend, won't check etherscan
    * Every DAO will eventually need its own app
        * Every community will need its own mechanisms 
    
Links
https://github.com/HausDAO/baal-shamans

Starter Repo:
git clone https://github.com/HausDAO/dh-v3-vite-starter.git

Claims Shaman:
https://blockscout.com/xdai/mainnet/address/0xbC9364441E42f3bbA5D5bB9A6c113E6D46026c14#code

Free Ryder DAO (admin interface)
https://admin.daohaus.fun/#/molochv3/0x64/0x7e72ba58d3d331d339566db9ff3ec184b293477d

Free Ryder App:
https://freeryder.daohaus.club/#/

Free Ryder Code
https://github.com/HausDAO/free-ryder-dao

Presentation Slides:
https://hackmd.io/@daohaus/SJ1wg5yui#/



First piece: 
    useClaim.tsx
    
    
```
import { useQuery } from 'react-query';

import { createContract } from '@daohaus/tx-builder';
import { ValidNetwork, Keychain } from '@daohaus/keychain-utils';
import { nowInSeconds } from '@daohaus/utils';

import ClaimAbi from '../abis/claimShaman.json';

const fetchUserClaim = async ({
  shamanAddress,
  userAddress,
  chainId,
  rpcs,
}: {
  shamanAddress: string;
  userAddress: string;
  chainId: ValidNetwork;
  rpcs?: Keychain;
}) => {
  const claimsContract = createContract({
    address: shamanAddress,
    abi: ClaimAbi,
    chainId,
    rpcs,
  });

  try {
    const lastClaimed = await claimsContract.claims(userAddress);
    const claimAmt = await claimsContract.perPeriod();
    const claimPeriod = await claimsContract.period();

    return {
      lastClaimed: lastClaimed.toString() as string,
      claimAmt: claimAmt.toString() as string,
      claimPeriod: claimPeriod.toString() as string,
    };
  } catch (error: any) {
    console.error(error);
    throw new Error(error?.message as string);
  }
};

export const useClaim = ({
  shamanAddress,
  userAddress,
  chainId,
  rpcs,
}: {
  shamanAddress: string;
  userAddress: string | undefined | null;
  chainId: ValidNetwork;
  rpcs?: Keychain;
}) => {
  const { data, ...rest } = useQuery(
    ['claimData', { userAddress }],
    () =>
      fetchUserClaim({
        shamanAddress,
        userAddress: userAddress as string,
        chainId,
        rpcs,
      }),
    { enabled: !!userAddress }
  );
  const hasClaimed = data?.lastClaimed && Number(data.lastClaimed) > 0;
  const canClaim =
    nowInSeconds() - Number(data?.lastClaimed) >= Number(data?.claimPeriod) ||
    !hasClaimed;
  return { data, hasClaimed, canClaim, ...rest };
};
```
    
With every new contract, we should be creating reusable tools.


