ダオからアラゴンへのチャット

dde700da3abad6de77c8d3377f6e2af2.gif

序文

前の 2 つの記事 (ブロックチェーン DAPP 学習に関する簡単な話 とブロックチェーン DAPP 学習に関する簡単な話・続き) では、DAPP と DAPP の簡単な投票実装について説明しました。 web3. .0所有できるそのようなネットワークの用途は何ですか。

今回は、近年海外で流行しているDAOを使ったweb3.0の今後の応用についてお話しする予定です。

8bc5e1bd738ffdbdace90f7dad5716b1.png

まずDAOとは何でしょうか?

DAO は Decentralized Autonomous Organization の略語で、分散型自律型組織であり、分散型自律型企業 (DAC) とも呼ばれます。共通の目標またはコンセンサスと明確な核となる価値観を持っています。その民主的な投票メカニズムが組織の方向性と運営を決定します。

DAOの意味

eddc95ee50ce7e204911ec4deabbc992.png

まず、DAO はスマート コントラクトとオープンソースを使用してコーディングされています。組織の活動には完全な透明性があります。決定はDAOメンバーによる草の根投票によって行われます。このようなオープンで公平なブロックチェーン技術のサポートにより、私たちはインターネット上にさまざまな組織を設立し、会合する必要はなく、共通の目標に向かって活動することができます。

それは魔法ですが、現在の感染症の状況下での成長の基盤があり、DAO と他のテクノロジーを組み合わせることによって、メタバースはゆっくりまたは急速に成長する可能性が高いです。

DAOプロジェクト

9044b12e4bc73c1dc9a7daad91d90f31.png

理論的には、あらゆる組織が DAO になることができます。DAO への投資と DAO への助成により、プロジェクトに資金を提供できます。コレクターDAOは、NFTデジタルアートやその他の収集品を収集できます。ソーシャル DAO は、メンバーに特定のソーシャル サークルを提供できます。c476f41b937cbffec3199fc124a28a84.png

DAO オペレーション システム

テクノロジーとしては、預言者にはなりたくないのですが、記事のテーマに切り込んで DAO テクノロジー (DAO オペレーション システム) を紹介しますが、関連するテクノロジーはたくさんあります。

幸いなことに、ブロックチェーンはスマート コントラクトを使用して暗号通貨を管理するため、契約のレビューに合格したい場合はオープンソースである必要があります。海外の DAO テクノロジーは数多く見つかります。今日は ARAGON プロジェクトを紹介します。

アラゴンとは

アラゴンはブロックチェーンを使用して、企業や組織の効率と透明性を高めています。企業は Aragon を使用して相互にスマート コントラクト契約に署名でき、その契約はブロックチェーン上に安全に保存され、必要なときに誰でもアクセスできるようになります。

アラゴンは自らをデジタル管轄区域と考えることを好みます。このネットワークは、関係者間の迅速かつ効率的な仲裁に使用できる分散型決済システムを構築しています。このプラットフォームには、料金の支払いに使用される独自のトークン Aragon Network Token (略して「ANT」) があり、善良で誠実なユーザー行動にインセンティブを提供するためにサードパーティでホストされています。

アラゴンの始め方

まず第一に、https://aragon.org/ は彼の公式 Web サイトです。公式 Web サイトにアクセスして独自の DAO 組織を作成できます。df8f99949ddc16b02efdc29d8ce14cdc.pngもちろん、公式 Web サイトを使用して独自の DAO を構築するだけではありません。技術的なアーキテクチャが私たちの目的です。

ARAGON DAO のローカル アーキテクチャを迅速に構築する

ARAGON GITHUB に初めて来ました

https://github.com/aragon/

aragon-cli プロジェクトを見つける

https://github.com/aragon/aragon-cli
まずaragon/cliをグローバルにインストールします
npm install --global @aragon/cli
npm install --global @aragon/cli@nightly
最初の ARAGON DAO プロジェクトを作成する
npx create-aragon-app myapp
cd myapp
npm start

プロジェクトを開くと、http://localhost:3000/ がデフォルトのブラウザで開かれ、0b79a71af800287ceb2a57b4e852aa65.pngガナッシュが起動され、8 つのアカウントが初期化され、ENS、DAO APM などのアドレスが表示されていることがわかります。簡単に言えば、アラゴンのローカル環境を初期化します。eb343e8d680dab58aac3dc8df780c6e0.png右上隅から、ローカル ガナッシュ ウォレットがデフォルトでリンクされており、ローカル ウォレットのアドレスが表示されていることがわかります。d5db6c7b7c15e439e5b11a53324d52c4.png

コード分​​析

c43f3455820161a42124cf1bb5fb58df.pngこれを読むと、以前の構造と非常によく似ていることがわかります。契約の下に CounterApp.sol 契約があります。

pragma solidity ^0.4.24;

import "@aragon/os/contracts/apps/AragonApp.sol";
import "@aragon/os/contracts/lib/math/SafeMath.sol";

contract CounterApp is AragonApp {
    using SafeMath for uint256;

    /// Events
    event Increment(address indexed entity, uint256 step);
    event Decrement(address indexed entity, uint256 step);

    /// State
    uint256 public value;

    /// ACL
    bytes32 constant public INCREMENT_ROLE = keccak256("INCREMENT_ROLE");
    bytes32 constant public DECREMENT_ROLE = keccak256("DECREMENT_ROLE");

    function initialize(uint256 _initValue) public onlyInit {
        value = _initValue;

        initialized();
    }

    /**
     * @notice Increment the counter by `step`
     * @param step Amount to increment by
     */
    function increment(uint256 step) external auth(INCREMENT_ROLE) {
        value = value.add(step);
        emit Increment(msg.sender, step);
    }

    /**
     * @notice Decrement the counter by `step`
     * @param step Amount to decrement by
     */
    function decrement(uint256 step) external auth(DECREMENT_ROLE) {
        value = value.sub(step);
        emit Decrement(msg.sender, step);
    }
}

これは加算と減算の 2 つの機能を持つ集計コントラクトです。実際、元の投票とほぼ同じです。本人認証がありません。前の記事の関連コードを追加して補うことができます。

8c34086ca33babecbf641382dfe3a2c6.png

buidler-hooks.js in the scripts directory . これらのフックは、開始タスクのライフサイクル中に Aragon Buidler プラグインによって呼び出され、buidler 構成ファイル (buidler.config.js) と組み合わせてデプロイされ、コントラクトにフックされます。 js)。

const { usePlugin } = require('@nomiclabs/buidler/config')
const hooks = require('./scripts/buidler-hooks')

usePlugin('@aragon/buidler-aragon')

module.exports = {
  // Default Buidler configurations. Read more about it at https://buidler.dev/config/
  defaultNetwork: 'localhost',
  networks: {
    localhost: {
      url: 'http://localhost:8545',
    },
  },
  solc: {
    version: '0.4.24',
    optimizer: {
      enabled: true,
      runs: 10000,
    },
  },
  // Etherscan plugin configuration. Learn more at https://github.com/nomiclabs/buidler/tree/master/packages/buidler-etherscan
  etherscan: {
    apiKey: '', // API Key for smart contract verification. Get yours at https://etherscan.io/apis
  },
  // Aragon plugin configuration
  aragon: {
    appServePort: 8001,
    clientServePort: 3000,
    appSrcPath: 'app/',
    appBuildOutputPath: 'dist/',
    appName: 'myapp',
    hooks, // Path to script hooks
  },
}

buidler.config.js コードが表示されます。デフォルトでは、ローカルホストのガナッシュにリンクし、関連するコントラクトをデプロイします。

946bfdda6826c9abc45f65e1cd123ad3.png

src ディレクトリ内の App.js

import { useAragonApi } from '@aragon/api-react'

const { api, appState, path, requestPath } = useAragonApi()
const { count, isSyncing } = appState

API メソッドと appState のカウント値を取得するために useAragonApi が使用されていることは明らかです。app.js のソース コードを添付します。

import React from 'react'
import { useAragonApi } from '@aragon/api-react'
import {
  Box,
  Button,
  GU,
  Header,
  IconMinus,
  IconPlus,
  Main,
  SyncIndicator,
  Tabs,
  Text,
  textStyle,
} from '@aragon/ui'
import styled from 'styled-components'

function App() {
  const { api, appState, path, requestPath } = useAragonApi()
  const { count, isSyncing } = appState

  const pathParts = path.match(/^\/tab\/([0-9]+)/)
  const pageIndex = Array.isArray(pathParts)
    ? parseInt(pathParts[1], 10) - 1
    : 0

  return (
    <Main>
      {isSyncing && <SyncIndicator />}
      <Header
        primary="Counter"
        secondary={
          <span
            css={`
              ${textStyle('title2')}
            `}
          >
            {count}
          </span>
        }
      />
      <Tabs
        items={['Tab 1', 'Tab 2']}
        selected={pageIndex}
        onChange={index => requestPath(`/tab/${index + 1}`)}
      />
      <Box
        css={`
          display: flex;
          align-items: center;
          justify-content: center;
          text-align: center;
          height: ${50 * GU}px;
          ${textStyle('title3')};
        `}
      >
        Count: {count}
        <Buttons>
          <Button
            display="icon"
            icon={<IconMinus />}
            label="Decrement"
            onClick={() => api.decrement(1).toPromise()}
          />
          <Button
            display="icon"
            icon={<IconPlus />}
            label="Increment"
            onClick={() => api.increment(1).toPromise()}
            css={`
              margin-left: ${2 * GU}px;
            `}
          />
        </Buttons>
      </Box>
    </Main>
  )
}

const Buttons = styled.div`
  display: grid;
  grid-auto-flow: column;
  grid-gap: 40px;
  margin-top: 20px;
`

export default App

api.decrement(1).toPromise() api.increment(1).toPromise() 2 つのメソッドは加算と減算を呼び出してコントラクト インターフェイスを実装します。821f734740af003d572087b24adf3676.pngプラス記号またはマイナス記号をクリックしてc67f6b9501cc9156074d02d9b94b7d7c.png関数を完了します。これを使用して投票を再構築します。とてもシンプルです。

アラゴンを配備する

これに加えて、aragon の公式 Web サイトのいくつかの機能を迅速に展開することはできますか? できる

mkdir aragon
npm init
npm install @aragon/aragen
npx aragen start
572bb865e2e4f1b31ba93c3ae36d5437.png

アラゴンガナッシュ環境が初期化されていることがわかります。

これらには次のものが含まれます: ENS インスタンス: 0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1 (use-token: 関連するコントラクトを含むイーサリアム上のトークン関連情報を取得するための React ユーティリティ)。

クライアントプロジェクトを開始する

まず ARAGON GITHUB にアクセスして、Aragon クライアントを見つけます。

https://github.com/aragon/client

プロジェクトをダウンロードし、プロジェクトのルート ディレクトリに移動します。

yarn
npm run start:local

サービスは http://localhost:3000 で開始されます。プロジェクトのルート ディレクトリに arapp.json があります。そのコンテンツのデフォルトは、rpc ネットワーク (ローカル ネットワーク localhost:8545) です。

"environments": {
    "default": {
      "registry": "0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1",
      "appName": "aragon.aragonpm.eth",
      "network": "rpc"
    },

彼のレジストリ アドレスは、aragon によって開始されたネットワークと同じです

80d8be1674231bb9df8ff859e8055c2e.png

http://localhost:3000 を開きます。

aea0e303c10655d0b48e5d4d86a81244.png

財布を変える

右上隅に、ウォレットがローカルチェーンに接続できないことがわかります。プロジェクトのウォレットを変更しようとしているようです。早速ですが、プロジェクトの src/contexts/ ディレクトリに Wellet.js コードが添付されています。

import React, {
  useContext,
  useEffect,
  useMemo,
  useCallback,
  useState,
} from 'react'
import PropTypes from 'prop-types'
import BN from 'bn.js'
import {
  useWallet as useWalletBase,
  UseWalletProvider,
  ChainUnsupportedError,
  chains,
} from 'use-wallet'
import { getWeb3, filterBalanceValue } from '../util/web3'
import { useWalletConnectors } from '../ethereum-providers/connectors'
import { useAPM, updateAPMContext } from './elasticAPM'
import { LocalStorageWrapper } from '../local-storage-wrapper'

export const WALLET_STATUS = Object.freeze({
  providers: 'providers',
  connecting: 'connecting',
  connected: 'connected',
  disconnected: 'disconnected',
  error: 'error',
})

// default network is mainnet if user is not connected
const NETWORK_TYPE_DEFAULT = chains.getChainInformation(1)?.type

const WalletContext = React.createContext()

function WalletContextProvider({ children }) {
  const {
    account,
    balance,
    ethereum,
    connector,
    status,
    chainId,
    providerInfo,
    type,
    networkName,
    ...walletBaseRest
  } = useWalletBase()

  const initialNetwork = useMemo(() => {
    const lastNetwork = LocalStorageWrapper.get('last-network', false)
    if (!lastNetwork) return NETWORK_TYPE_DEFAULT
    return lastNetwork
  }, [])

  const [walletWeb3, setWalletWeb3] = useState(null)
  const [disconnectedNetworkType, setDisconnectedNetworkType] = useState(
    initialNetwork
  )

  const connected = useMemo(() => status === 'connected', [status])
  const networkType = useMemo(() => {
    const newNetwork = connected ? networkName : disconnectedNetworkType
    LocalStorageWrapper.set('last-network', newNetwork, false)
    return newNetwork
  }, [connected, networkName, disconnectedNetworkType])

  const changeNetworkTypeDisconnected = useCallback(
    newNetworkType => {
      if (status === 'disconnected') {
        setDisconnectedNetworkType(newNetworkType)
      }
    },
    [status]
  )

  // get web3 and set local storage prefix whenever networkType changes
  useEffect(() => {
    let cancel = false

    if (!ethereum) {
      return
    }

    const walletWeb3 = getWeb3(ethereum)
    if (!cancel) {
      setWalletWeb3(walletWeb3)
    }

    return () => {
      cancel = true
      setWalletWeb3(null)
    }
  }, [ethereum, networkType])

  const wallet = useMemo(
    () => ({
      account,
      balance: new BN(filterBalanceValue(balance)),
      ethereum,
      networkType,
      providerInfo: providerInfo,
      web3: walletWeb3,
      status,
      chainId: connected ? chainId : 1, // connect to mainnet if wallet is not connected
      connected,
      changeNetworkTypeDisconnected,
      ...walletBaseRest,
    }),
    [
      account,
      balance,
      ethereum,
      networkType,
      providerInfo,
      status,
      chainId,
      walletBaseRest,
      walletWeb3,
      connected,
      changeNetworkTypeDisconnected,
    ]
  )

  const { apm } = useAPM()
  useEffect(() => {
    updateAPMContext(apm, wallet.networkType)
  }, [apm, wallet.networkType])

  return (
    <WalletContext.Provider value={wallet}>{children}</WalletContext.Provider>
  )
}
WalletContextProvider.propTypes = { children: PropTypes.node }

export function WalletProvider({ children }) {
  return (
    <UseWalletProvider connectors={useWalletConnectors} autoConnect>
      <WalletContextProvider>{children}</WalletContextProvider>
    </UseWalletProvider>
  )
}
WalletProvider.propTypes = { children: PropTypes.node }

export function useWallet() {
  return useContext(WalletContext)
}

export { ChainUnsupportedError }

ローカルウォレットに接続する

注意深く読んだところ、ウォレットは「use-wallet」を使用しており、リンクできるかどうかを判断するコードが呼び出されたモジュール内にあることがわかりました。これを変更することによってのみ、aragon のローカル クライアントをローカルにデプロイできます。ソース コード使用ウォレットのアドレス

c5ffa17cec70798d1207bf246b29f241.pngファイルの場所 src/connectors/ConnectorInjected.ts

#添加的代码就这一段;这个就是添加钱包可以链接的本地chainId
chainId.push(1337)

ローカル EDC チェーンの構成

ファイル アドレス src/chains.ts に、次のコードを追加します。

const EDC: Currency = {
  name: 'Ether',
  symbol: 'ETH',
  decimals: 18,
}
.....................
  [
    1337,
    {
      id: 1337,
      nativeCurrency: EDC,
      fullName: 'EDC',
      shortName: 'EDC',
      type: 'local',
      testnet: true,
    },
  ],

添付された完全なコード

import { ChainUnknownError } from './errors'
import { ChainInformation, ChainType, Currency } from './types'

const ETH: Currency = {
  name: 'Ether',
  symbol: 'ETH',
  decimals: 18,
}

const MATIC: Currency = {
  name: 'Matic Token',
  symbol: 'MATIC',
  decimals: 18,
}

const AVAX: Currency = {
  name: 'Avax',
  symbol: 'AVAX',
  decimals: 9,
}

const ONE: Currency = {
  name: 'ONE Token',
  symbol: 'ONE',
  decimals: 18,
}

const XDAI: Currency = {
  name: 'xDAI',
  symbol: 'xDAI',
  decimals: 18,
}

const BNB: Currency = {
  name: 'Binance Token',
  symbol: 'BNB',
  decimals: 18,
}

const TT: Currency = {
  name: 'Thunder Token',
  symbol: 'TT',
  decimals: 18,
}

const CELO: Currency = {
  name: 'Celo',
  symbol: 'CELO',
  decimals: 18,
}

const METIS: Currency = {
  name: 'METIS',
  symbol: 'METIS',
  decimals: 18,
}

const FTM: Currency = {
  name: 'FTM',
  symbol: 'FTM',
  decimals: 18,
}

const DEV: Currency = {
  name: 'DEV',
  symbol: 'DEV',
  decimals: 18,
}
const MOVR: Currency = {
  name: 'Moonriver',
  symbol: 'MOVR',
  decimals: 18,
}
const GLMR: Currency = {
  name: 'Glimmer',
  symbol: 'GLMR',
  decimals: 18,
}
const EDC: Currency = {
  name: 'Ether',
  symbol: 'ETH',
  decimals: 18,
}
const CHAIN_INFORMATION = new Map<number, ChainInformation | ChainType>([
  [
    1,
    {
      id: 1,
      nativeCurrency: ETH,
      type: 'main',
      fullName: 'Ethereum Mainnet',
      shortName: 'Ethereum',
      explorerUrl: `https://etherscan.io`,
      testnet: false,
    },
  ],
  [
    3,
    {
      id: 3,
      nativeCurrency: ETH,
      type: 'ropsten',
      fullName: 'Ropsten Testnet',
      shortName: 'Ropsten',
      explorerUrl: `https://ropsten.etherscan.io`,
      testnet: true,
    },
  ],
  [
    4,
    {
      id: 4,
      nativeCurrency: ETH,
      type: 'rinkeby',
      fullName: 'Rinkeby Testnet',
      shortName: 'Rinkeby',
      explorerUrl: `https://rinkeby.etherscan.io`,
      testnet: true,
    },
  ],
  [
    5,
    {
      id: 5,
      nativeCurrency: ETH,
      type: 'goerli',
      fullName: 'Goerli Testnet',
      shortName: 'Goerli',
      explorerUrl: `https://goerli.etherscan.io`,
      testnet: true,
    },
  ],
  [
    42,
    {
      id: 42,
      nativeCurrency: ETH,
      type: 'kovan',
      fullName: 'Kovan Testnet',
      shortName: 'Kovan',
      explorerUrl: `https://kovan.etherscan.io`,
      testnet: true,
    },
  ],
  [
    43112,
    {
      id: 43112,
      nativeCurrency: AVAX,
      type: 'avalocal',
      shortName: 'Avalanche Local',
      fullName: 'Avalanche Local',
      testnet: true,
    },
  ],
  [
    43113,
    {
      id: 43113,
      nativeCurrency: AVAX,
      type: 'fuji',
      fullName: 'Avalanche Fuji',
      shortName: 'Fuji',
      explorerUrl: 'https://testnet.snowtrace.io/',
      testnet: true,
    },
  ],
  [
    43114,
    {
      id: 43114,
      nativeCurrency: AVAX,
      type: 'avalanche',
      fullName: 'Avalanche Mainnet',
      shortName: 'Avalanche',
      explorerUrl: 'https://snowtrace.io/',
      testnet: false,
    },
  ],
  [
    100,
    {
      id: 100,
      nativeCurrency: XDAI,
      type: 'xdai',
      fullName: 'xDAI',
      shortName: 'xDAI',
      explorerUrl: 'https://blockscout.com/xdai/mainnet/',
      testnet: false,
    },
  ],
  [
    137,
    {
      id: 137,
      nativeCurrency: MATIC,
      type: 'matic',
      fullName: 'Polygon Mainnet',
      shortName: 'Polygon',
      explorerUrl: `https://polygonscan.com`,
      testnet: false,
    },
  ],
  [
    80001,
    {
      id: 80001,
      nativeCurrency: MATIC,
      type: 'mumbai',
      fullName: 'Mumbai Testnet',
      shortName: 'Mumbai',
      explorerUrl: `https://mumbai.polygonscan.com`,
      testnet: true,
    },
  ],
  [
    250,
    {
      id: 250,
      nativeCurrency: FTM,
      type: 'fantom',
      fullName: 'Fantom Opera Mainnet',
      shortName: 'FTM',
      explorerUrl: `https://ftmscan.com/`,
      testnet: false,
    },
  ],
  [
    1666600000,
    {
      id: 1666600000,
      nativeCurrency: ONE,
      type: 'harmony',
      fullName: 'Harmony ONE',
      shortName: 'Harmony',
      explorerUrl: `https://explorer.harmony.one/`,
      testnet: false,
    },
  ],
  [
    1666700000,
    {
      id: 1666700000,
      nativeCurrency: ONE,
      type: 'harmonyTest',
      fullName: 'Harmony ONE Testnet',
      shortName: 'Harmony Testnet',
      explorerUrl: `https://explorer.testnet.harmony.one/`,
      testnet: true,
    },
  ],
  [
    56,
    {
      id: 56,
      nativeCurrency: BNB,
      type: 'bsc',
      fullName: 'Binance Smart Chain',
      shortName: 'BSC',
      explorerUrl: `https://bscscan.com/`,
      testnet: false,
    },
  ],
  [
    97,
    {
      id: 97,
      nativeCurrency: BNB,
      type: 'bscTest',
      fullName: 'Binance Smart Chain Testnet',
      shortName: 'BSC Testnet',
      explorerUrl: `https://testnet.bscscan.com/`,
      testnet: true,
    },
  ],
  [
    108,
    {
      id: 108,
      nativeCurrency: TT,
      type: 'thundercore',
      fullName: 'ThunderCore Mainnet',
      shortName: 'ThunderCore',
      explorerUrl: `https://scan.thundercore.com/`,
      testnet: false,
    },
  ],
  [
    18,
    {
      id: 18,
      nativeCurrency: TT,
      type: 'thundercoreTest',
      fullName: 'ThunderCore Testnet',
      shortName: 'ThunderCore Testnet',
      explorerUrl: `https://scan-testnet.thundercore.com/`,
      testnet: true,
    },
  ],
  [
    421611,
    {
      id: 421611,
      nativeCurrency: ETH,
      type: 'arbitrumTest',
      fullName: 'Arbitrum Testnet',
      shortName: 'Arbitrum Testnet',
      explorerUrl: 'https://testnet.arbiscan.io/',
      testnet: true,
    },
  ],
  [
    42161,
    {
      id: 42161,
      nativeCurrency: ETH,
      type: 'arbitrum',
      fullName: 'Arbitrum Mainnet',
      shortName: 'Arbitrum',
      explorerUrl: 'https://arbiscan.io/',
      testnet: false,
    },
  ],
  [
    42220,
    {
      id: 42220,
      nativeCurrency: CELO,
      type: 'celo',
      fullName: 'Celo (Mainnet)',
      shortName: 'Celo',
      explorerUrl: 'https://explorer.celo.org/',
      testnet: false,
    },
  ],
  [
    44787,
    {
      id: 44787,
      nativeCurrency: CELO,
      type: 'celoTest',
      fullName: 'Celo (Alfajores Testnet)',
      shortName: 'Alfajores',
      explorerUrl: 'https://alfajores-blockscout.celo-testnet.org/',
      testnet: true,
    },
  ],
  [
    588,
    {
      id: 588,
      nativeCurrency: METIS,
      type: 'stardust',
      fullName: 'Metis Stardust Testnet',
      shortName: 'Stardust',
      explorerUrl: 'https://stardust-explorer.metis.io/',
      testnet: true,
    },
  ],
  [
    1088,
    {
      id: 1088,
      nativeCurrency: METIS,
      type: 'andromeda',
      fullName: 'Metis Andromeda',
      shortName: 'Andromeda',
      explorerUrl: 'https://andromeda-explorer.metis.io/',
      testnet: false,
    },
  ],
  [
    1313161555,
    {
      id: 1313161555,
      nativeCurrency: ETH,
      type: 'aurora',
      fullName: 'Aurora Testnet',
      shortName: 'AuroraTest',
      explorerUrl: 'https://explorer.testnet.aurora.dev/',
      testnet: true,
    },
  ],
  [
    1313161554,
    {
      id: 1313161554,
      nativeCurrency: ETH,
      type: 'aurora',
      fullName: 'Aurora Mainnet',
      shortName: 'Aurora',
      explorerUrl: 'https://explorer.mainnet.aurora.dev/',
      testnet: false,
    },
  ],
  [
    1287,
    {
      id: 1287,
      nativeCurrency: DEV,
      type: 'moonbase',
      fullName: 'moonbase',
      shortName: 'Moonbase Alphanet',
      explorerUrl: 'https://moonbase.moonscan.io/',
      testnet: true,
    },
  ],
  [
    1285,
    {
      id: 1285,
      nativeCurrency: MOVR,
      type: 'moonriver',
      fullName: 'Moonriver',
      shortName: 'Moonriver',
      explorerUrl: 'https://moonriver.moonscan.io/',
      testnet: false,
    },
  ],
  [
    1284,
    {
      id: 1284,
      nativeCurrency: GLMR,
      type: 'moonbeam',
      fullName: 'Moonbeam',
      shortName: 'Moonbeam',
      explorerUrl: 'https://moonbeam.moonscan.io/',
      testnet: false,
    },
  ],
  [
    1337,
    {
      id: 1337,
      nativeCurrency: EDC,
      fullName: 'EDC',
      shortName: 'EDC',
      type: 'local',
      testnet: true,
    },
  ],
  [
    5777,
    {
      id: 5777,
      type: 'ganache',
      testnet: true,
    },
  ],
])

/**
 * This method checks whether a particular chain id is known.
 *
 * @param {number} chainId chain id to check
 * @returns {boolean} true if chain is known
 */
export function isKnownChain(chainId: number): boolean {
  return CHAIN_INFORMATION.has(chainId)
}

/**
 *
 * @param {number} chainId chain id to retrieve information for
 * @throws {ChainUnknownError} if chain is unknown
 * @returns {boolean} information for specified chain
 */
export function getChainInformation(
  chainId: number
): ChainInformation | ChainType {
  const chainInfo = CHAIN_INFORMATION.get(chainId)
  if (!chainInfo) throw new ChainUnknownError(`Unknown chain id: ${chainId}`)
  return chainInfo
}

/**
 * This is a getter method to returns the chain ids of all known chains.
 *
 * @returns {number[]} array of chain Ids
 */
export function getKnownChainsIds(): number[] {
  return Array.from(CHAIN_INFORMATION.keys())
}

/**
 * This is a getter method to return all information available for each known chain.
 *
 * @returns {ChainInformation | ChainType[]} An array containing information for
 * each known chain
 */
export function getKnownChainInformation(): ChainInformation | ChainType[] {
  return Array.from(CHAIN_INFORMATION.values())
}

export function getDefaultChainId(): number {
  return 1
}

コンパイルを開始する

yarn run build

ビルドが完了したら、dist ディレクトリ内のファイルをクライアント プロジェクトの node_modules/use-wallet/dist/ にコピーします。

クライアントプロジェクトを構成する

  • src/network-config.js は isActive: false を isActive: true に変更します。

  • ensRegistry: localEnsRegistryAddress,要変更(ensRegistry: localEnsRegistryAddress||"0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1")

[chains.getChainInformation(1337).type]: {
    isActive: false,//就是这里
    addresses: {
      ensRegistry: localEnsRegistryAddress,
      governExecutorProxy: null,
    },
    nodes: {
      defaultEth: 'ws://localhost:8545',
    },
    connectGraphEndpoint: null,
    settings: {
      // Local development environments by convention use
      // a chainId of value 1337, but for the sake of configuration
      // we expose a way to change this value.
      chainId: 1337,
      testnet: true,
      ...chains.getChainInformation(1337),
      live: false,
    },
  },

フロントエンドページを実行する

ffb208e5777e7d09aece011fa9077e4a.png

TestnetsにはEDCがあり、さらにローカルチェーンのウォレットチェーンが追加されているので、仮想通貨不足を気にせずにその機能を思う存分利用できることが分かりました。

47155e5bbb838b81482cfac3c6c275f8.png

ローカル組織を作成する

以下に、ローカルで組織を作成するプロセスを示します。5ec89ce89f5ac39442c14d278f836c06.png

「作成」をクリックします

14f0e43b1114404f5d3c17b2d7a7935d.pngクリックメンバーシップ

410ff883aa8cfb16cd908ba155f0bac1.png

「このテンプレートを使用する」をクリックします

63adf97c8ddbfa4b8747a25fdb3075e0.png

「次へ」をクリックします

8e7e2ce6af4492bf09ae2b6736ca79da.png

「次へ」をクリックしてローカルアカウントのアドレスを入力します

585d692158868855e3856fa521b51737.png

次に進む

79e205a2ea7cd71dc6c58a4305827551.pngba99d8bb7f5c2cde4538fe1ddf9e11c4.pngfeb18241bbc248adaf3c661f9c932e1d.pngfd6fc304c084093da51e952f184fb558.png

投票および転送機能

はい、この組織内のすべてのことに投票が必要です。送金する場合でも、メンバー全員が投票する必要があります。

a86a1f820be5d7142d5fa903d59f0807.png7c54e50952c8e8ba8739ac36ba9c8e2a.png

まとめ

上記は、aragon デプロイメントの簡単な紹介です。契約をデプロイしていないため、今は company を使用しませんでした。

  • コントラクトは dao-templates でダウンロードしてデプロイできるので、機会があれば後で書き留めることもできますが、実際、プロジェクト内の設定ファイルは非常に明確に記述されています。

https://github.com/aragon/dao-templates
  • また、aragon のデフォルトのガナッシュ環境を使用していますが、変更できますか? aragen を通じてソース コードをダウンロードすることもできます。

https://github.com/aragon/aragen
  • web3.0 は python2 の nodejs バージョンです。バージョンを選択することは非常に重要です。

  • プロジェクトは主要なプロジェクトをすべて自動的にダウンロードします。いくつかのプロジェクトの環境は異なりますが、環境展開をブロックで切り替えることができます。

  • ipfs もあります。実際、多くのピクチャが ipfs に存在し、ローカルに展開して、aragon プロジェクトを通じて ipfs ローカル サービスに公開する必要があります。

  • ipfs公式ウェブサイトのアドレス、

https://docs.ipfs.io/install/command-line/#official-distributions

あまり言うことはありません。実際、技術的にはまだ書ききれていない部分がたくさんあります。私のスキルにも限界があります。間違いや漏れがあれば修正していただければ幸いです。

おすすめ

転載: blog.csdn.net/weixin_47479625/article/details/124113850