sol-mass-payouts – sol大规模支付区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,sol-mass-payouts – sol大规模支付区块链毕设代写 是一篇很好的国外资料

sol-mass-payouts

Utilities enabling the mass distribution of assets, with a single funding transaction.

Summary example

A funder, such as a yield farming distribution, wishes to distribute 1,000,000 XYZ tokens to 50,000 addresses.

Off-chain, the funder builds a merkle tree of (address,amount) pairs for XYZ payouts.

The funder sends 1,000,000 XYZ tokens, and the Merkle root hash, to this MerkleBox contract for secure storage.

Then, at any time, users may claim their XYZ tokens by providing a Merkle proof of their (address,amount).

The end result is aggregating all the payouts into a single blockchain transaction from the funder. (Users must still individually issue claim transactions)

Public operations (APIs)

Anyone: Validate claim

Validate a supplied merkle receipt is associated with a valid, unspent claim.

User: Claim tokens

Present a valid merkle receipt, and receive the associated tokens.

User must be the address in the claim, and the claim must be unspent.

Funder: Create new claims group

Store a merkle root, and associated ERC20 funds, on chain.

WARNING: There is no on-chain validation that funds supplied equal the funds required to fully satisfy all claims. The funder may under-fund.

Anyone: Add more funds to claims group.

Supply additional quantity of asset to the claims group.

Usually the funder calls this operation, but that is not a requirement. Once a claims group is created, anyone may supply additional funds.

Funder: Withdraw funds from claims group.

The funder (owner) may withdraw funds from the claims group, if-and-only-if the Withdraw Lock is not locked.

Anyone: On-chain ERC20 mass-send

A separate MultiTransfer contract is provided, which provides the simple utility of

  1. Receive N amount of an ERC20 token
  2. Send tokens to a list of (address,amount) pairs.

This contract and function is not tied in any way to the above merkle-related operations, and is provided as an alternate mass-pay operation for ERC20 tokens.

Security notes

Under-funding

It appears prohibitively expensive to validate that a holding is fully funded. (Solutions welcome)

As a consequence, it is possible to under-fund a claims group.

Withdraw locking

The withdraw lock feature permits disabling of withdrawals until a specified time.

To disable this feature, simply set the lock time to zero, or some time in the past. To permanently lock the funds, set the lock time to a maximum, or an arbitrary time millions of years in the future.

Setup.

  1. Install packages
    npm i -g truffle npm i 
  2. Update provider url in config/default.json
  3. Set DEPLOYMENT_ACCOUNT_KEY in env
    create a .env file in root DEPLOYMENT_ACCOUNT_KEY =  "my mnemonic phrase" 
  4. Deploy you own contracts if want to do arb-
    truffle migrate --reset --network mainnet/ropsten 

We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products. Learn more.

Merge pull request


sol批量支付

单一的资产分配,实现大规模的资产交易。

摘要示例

一个投资者,比如一个收益农业分销,希望向50000个地址分发1000000个XYZ代币。

在链下,出资人为XYZ支付构建了(地址、金额)对的merkle树。

出资人向这个MerkleBox契约发送1000000个XYZ令牌和Merkle根散列,以实现安全存储。

然后,在任何时候,用户都可以通过提供其(地址、金额)的Merkle证明来声明他们的XYZ令牌。

最终结果是将所有支出汇总到一个来自出资方的区块链blockchain交易中。(用户仍必须单独发出索赔事务处理)

公共操作(API)

任何人:验证索赔

验证所提供的merkle收据是否与有效、未使用的索赔相关联。

用户:索赔代币

提供有效的merkle收据,并接收相关联的令牌。

用户必须是声明中的地址,并且声明必须是未使用的。

出资人:创建新的索赔组

在链上存储merkle根和相关的ERC20基金。

警告:供应的资金与完全满足所有索赔要求所需的资金不存在链上验证。出资人可能欠基金。

任何人:向索赔组添加更多资金。出资人:从索赔组提取资金。

向索赔组提供额外数量的资产。

通常出资人会调用此操作,但这不是必需的。一旦索赔小组成立,任何人都可以提供额外的资金。

任何人:链上ERC20批量发送

当且仅当提取锁未锁定时,出资人(所有者)可以从索赔组中提取资金。

安全票据

提供了一个单独的多转移合同,它提供了

  1. 接收N个ERC20代币的金额
  2. 将代币发送到(地址、金额)对的列表中。

这个合同和功能与上述merkle相关操作没有任何联系,而是作为ERC20代币的替代批量支付操作提供的。

资金不足

撤销锁定

验证持股是否已完全注资似乎过于昂贵。(欢迎解决方案)

因此,可能会为索赔小组提供资金不足。

设置。

撤消锁定功能允许在指定时间之前禁用提取。

要禁用此功能,只需将锁定时间设置为零,或过去的某个时间。要永久锁定资金,请将锁定时间设置为最大值,或在未来数百万年内任意设置一个时间。

基本cookies

  1. 安装包npm i-g truffle npm i
  2. 在配置中更新提供程序url/默认值.json
  3. 在env中设置DEPLOYMENT_ACCOUNT_KEY在根部署中创建一个.env文件_ACCOUNT_KEY=“my memmonic phrase”
  4. 如果要执行arb-truffle migrate–reset–network mainnet/ropsten,请部署您自己的合同

我们使用可选的第三方分析cookies来了解您如何使用GitHub.com网站所以我们可以制造更好的产品。了解更多。

Merge pull request

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/18507.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 !
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » sol-mass-payouts – sol大规模支付区块链毕设代写

提供最优质的资源集合

立即查看 了解详情