@1hive/apps-token-request 中文文档教程

发布于 3年前 浏览 25 更新于 3年前

Token Request

CircleCICoverage Status

1Hive 的令牌请求应用程序允许用户创建投票,请求组织的令牌以换取付款。 例如,用户可以请求铸造 100 个组织代币以换取 100 DAI。 该请求需要投票才能批准,如果投票被拒绝,用户将收到他们的付款,如果获得批准,付款将存入组织的金库。

Security review status: Contracts updated for audit as of commit 5ae77ee154383ff01db3215dc5c8e6ad7786c761

此 repo 中的代码未经审计。

How does it work

令牌请求应用程序应被授予对 Aragon Voting 应用程序实例的 Create Votes 权限。 当用户提出请求时,他们应该将付款转移到令牌请求应用程序,该应用程序将在创建和执行投票时将他们托管在第三方账户中。 如果投票持续时间过去并且付款仍在令牌请求应用程序中,则用户应该能够领取他们的令牌。 如果投票通过,那么执行投票应该将用户令牌从令牌请求应用程序转移到组织保险库,并从令牌管理器为用户铸造令牌。

Initialization

令牌请求应用程序通过传递 令牌管理器 实例的地址、_vault 实例的地址和地址数组 _acceptedDepositTokens 进行初始化. _acceptedDepositTokens 数组必须小于设置为 100 的 MAX_ACCEPTED_DEPOSIT_TOKENS 变量。

Roles

令牌请求应用程序应实现以下角色:

  • Finalise token requests
  • Change Vault Address
  • Change Token Manager Address
  • Add/remove offered tokens to/from the accepted offered token list

Interface

我们不需要提供用于更改的接口参数,因为这可以由高级用户使用 aragonCLI 完成。

该界面允许用户请求代币,他们可以在其中指定金额和相关支付。 它还允许随时撤回他们的请求。

有关应用程序流程的详细视图,请查看我们的用户指南

How to run Token Request app locally

首先确保您已安装节点、npm 和 aragonCLI和工作。 可以在此处找到关于如何设置的说明。 您还需要启用 Metamask 或某种网络钱包才能在浏览器中签署交易。

Git 克隆这个仓库。

git clone https://github.com/1Hive/token-request-app.git

导航到 token-request-app 目录。

cd token-request-app

安装 npm 依赖项。

npm i

在您的本地环境中部署一个带有 Lock 应用程序的 dao。

npm run start:template

How to deploy to an organization

令牌请求应用已部署到 Rinkeby 的 token-request.open.aragonpm.eth

要部署到 Aragon DAO,您可以使用 Aragon CLI

aragon dao install <dao-address> token-request.open.aragonpm.eth --app-init-args <vault-address> <token-manager-address>


Contributing

我们欢迎社区贡献!

请查看我们的 [open Issues]() 以开始使用。

如果您发现可能影响安全的事情,请立即通知我们。 联系我们的最快方式是通过我们的team Keybase chat 中的#dev 频道。 只要打个招呼,你发现了一个潜在的安全漏洞,我们就会私信给你讨论细节。


Token Request

CircleCICoverage Status

1Hive's Token Request app allows users to create a vote which requests an Organization's tokens in exchange for payment. For example a user may request minting 100 organization tokens in exchange for 100 DAI. The request would require a vote to approve, if the vote is rejected the user would receive their payment back and if it is approved the payment would be deposited in the organization's vault.

???? Security review status: Contracts updated for audit as of commit 5ae77ee154383ff01db3215dc5c8e6ad7786c761

The code in this repo has not been audited.

How does it work

The Token Request App should be granted the Create Votes permission on an instance of the Aragon Voting app. When a user makes a request they should transfer the payment to the Token Request app which will hold them in escrow while the vote is created and executed. If the vote duration passes and the payment is still in the Token Request app, the user should be able to claim their tokens. If the vote passes then executing the vote should transfer the users tokens from the Token Request app to the organizations vault, and mint tokens from the token manager for the user.

Initialization

The token request app is initialized by passing the address of a token manager instance, the address of a _vault instance, and an array of addresses _acceptedDepositTokens. The _acceptedDepositTokens array must be less than the MAX_ACCEPTED_DEPOSIT_TOKENS variable which is set to 100.

Roles

The Token Request application should implement the following roles:

  • Finalise token requests
  • Change Vault Address
  • Change Token Manager Address
  • Add/remove offered tokens to/from the accepted offered token list

Interface

We do not need to provide an interface for changing parameters as this can be done by power users using the aragonCLI.

The interface allows users to request tokens, where they would specify the amount and the associated payment. It also allows for withdrawing their requests at any time.

For a detailed view of the flow of the app check out our user-guide

How to run Token Request app locally

First make sure that you have node, npm, and the aragonCLI installed and working. Instructions on how to set that up can be found here. You'll also need to have Metamask or some kind of web wallet enabled to sign transactions in the browser.

Git clone this repo.

git clone https://github.com/1Hive/token-request-app.git

Navigate into the token-request-app directory.

cd token-request-app

Install npm dependencies.

npm i

Deploy a dao with Lock app installed on your local environment.

npm run start:template

How to deploy to an organization

Token Request app has been deployed to Rinkeby at token-request.open.aragonpm.eth

To deploy to an Aragon DAO you can use the Aragon CLI.

aragon dao install <dao-address> token-request.open.aragonpm.eth --app-init-args <vault-address> <token-manager-address>


Contributing

We welcome community contributions!

Please check out our [open Issues]() to get started.

If you discover something that could potentially impact security, please notify us immediately. The quickest way to reach us is via the #dev channel in our team Keybase chat. Just say hi and that you discovered a potential security vulnerability and we'll DM you to discuss details.


    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文