adex-protocol-eth – adex协议eth区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,adex-protocol-eth – adex协议eth区块链毕设代写 是一篇很好的国外资料

adex-protocol-eth

The Ethereum implementation of the AdEx Protocol.

This replaces adex-core.

This repository implements OUTPACE (off-chain unidirectional trustless payment channel) and a gas abstraction layer called AdEx Identity.

Please note

  • Every channel will eventually expire (after validUntil), allowing the non-withdrawn portion of the initial deposit to be received back by whoever opened the channel.
  • Channels can be created with any ERC20 token; if the underlying token of a channel is insecure or malicious, that also compromises the channel as well; this is out of scope of this contract, since this is a fundamental issue with any system that uses ERC20s; needless to say, the user needs to be aware of what token they’re using/earning
  • For more details on how OUTPACE channels work, please read the specs: AdEx Protocol and OUTPACE.

Testing

First, run ganache-cli in a separate terminal

truffle build # This is important cause js/IdentityProxyDeploy uses artifacts from there npm test 

Deployment

The contract AdExCore from version v3.1.0, compiled with solc v0.5.6 is deployed here:

  • Mainnet: https://etherscan.io/address/0x333420fc6a897356e69b62417cd17ff012177d2b
  • Goerli: https://goerli.etherscan.io/address/0x333420fc6a897356e69b62417cd17ff012177d2b
  • Kovan: https://kovan.etherscan.io/address/0x333420fc6a897356e69b62417cd17ff012177d2b

An Identity, initialized with no privileges, to be used as a basis for IdentityProxy:

  • Mainnet: https://etherscan.io/address/0xbdf97b0f5fa78beae684d9fb67dd45f11b996e46
  • Goerli: https://goerli.etherscan.io/address/0xbdf97b0f5fa78beae684d9fb67dd45f11b996e46

An IdentityFactory, set up with the AdEx relayer:

  • Mainnet: https://etherscan.io/address/0x801dbbb2fcbf9f4c3865c6ba5c5012ee19ec283a
  • Goerli: https://goerli.etherscan.io/address/0x801dbbb2fcbf9f4c3865c6ba5c5012ee19ec283a

And the Registry (now obsolete, no longer used):

  • Mainnet: https://etherscan.io/address/0x7671db0a70fa0196071d634f26971b9371627dc0
  • Goerli: https://goerli.etherscan.io/address/0x7671db0a70fa0196071d634f26971b9371627dc0

v4.1

All contracts here were compiled with solc v0.5.13.

The Identity, initialized with no privileges, to be used as a basis for IdentityProxy:

  • Mainnet: https://etherscan.io/address/0x96e3cb4b4632ed45363ff2c9f0fbec9b583d9d3a
  • Goerli: https://goerli.etherscan.io/address/0x96e3cb4b4632ed45363ff2c9f0fbec9b583d9d3a

An IdentityFactory, set up with the AdEx relayer:

  • Mainnet: https://etherscan.io/address/0xd5a1c8a5ea507ea459216ff34939cae3326dba6f
  • Goerli: https://goerli.etherscan.io/address/0xd5a1c8a5ea507ea459216ff34939cae3326dba6f

And the Staking:

  • Mainnet (ADX token and the AdEx multisig as slasher): https://etherscan.io/address/0x46ad2d37ceaee1e82b70b867e674b903a4b4ca32
  • Goerli (TST token and creator as a slasher): https://goerli.etherscan.io/address/0x46ad2d37ceaee1e82b70b867e674b903a4b4ca32

v4.2

The ADXSupplyController contract:

  • Mainnet: https://etherscan.io/address/0x360625ba7bce57f74eb5501fd2b75db8f85a85d8
  • Goerli: https://goerli.etherscan.io/address/0x360625ba7bce57f74eb5501fd2b75db8f85a85d8

The ADXToken contract:

  • Mainnet: https://etherscan.io/address/0xade00c28244d5ce17d72e40330b1c318cd12b7c3
  • Goerli: https://goerli.etherscan.io/address/0xade00c28244d5ce17d72e40330b1c318cd12b7c3

An instance of IdentityFactory used for staking:

  • Mainnet: https://etherscan.io/address/0x9fe0d438e3c29c7cff949ad8e8da9403a531cc1a
  • Goerli: https://goerli.etherscan.io/address/0x9fe0d438e3c29c7cff949ad8e8da9403a531cc1a

The Staking contract:

  • Mainnet (ADX token and the AdEx multisig as slasher): https://etherscan.io/address/0x4846c6837ec670bbd1f5b485471c8f64ecb9c534
  • Goerli (TST token and creator as a slasher): https://goerli.etherscan.io/address/0x4846c6837ec670bbd1f5b485471c8f64ecb9c534

The ADXFlashLoans contract:

  • Mainnet: https://etherscan.io/address/0xae4c306ce6641e1276c57473f2c2953841f0856a
  • Goerli: https://goerli.etherscan.io/address/0xae4c306ce6641e1276c57473f2c2953841f0856a

The ADXLoyaltyPoolToken contract:

  • Mainnet: https://etherscan.io/address/0xd9a4cb9dc9296e111c66dfacab8be034ee2e1c2c
  • Goerli: https://goerli.etherscan.io/address/0xd9a4cb9dc9296e111c66dfacab8be034ee2e1c2c

The ADXLoyaltyPoolIncentiveController contract:

  • Mainnet: https://etherscan.io/address/0xa52588d04c5b21854f42cbcd9502aa6092e6a779
  • Goerli: https://goerli.etherscan.io/address/0xa52588d04c5b21854f42cbcd9502aa6092e6a779

Deployment strategy

The full deploy processis as follows

  • Deploy AdExCore
  • Deploy an IdentityFactory
  • Deploy a single Identity, with no owners and no registry
  • Deploy a Staking

Verifying on etherscan

truffle compile cat build/contracts/AdExCore.json | jq '.bytecode' # this is the bytecode you have to deploy ./scripts/bundle.sh contracts/AdExCore.sol # this will output a bundled .sol code 

Gas usage, from the tests

Measured with solc v0.5.6, commit d80fa80424ef7b8932399424f8d919d67b135a30

channelOpen: 69961 channelWithdrawExpired: 70470 channelWithdraw: 137117 execute: 89900 execRoutines: 114440 channelOpen, through execute: 115086 deploying an identity proxy through the IdentityFactory: 127549 addBond  73404 requestUnbond  34807 unbond  41770 

ENS

This is not a part of the adex-protocol-eth source code, but it may be useful for anyone building on top of adex-protocol-eth who wishes to integrate with ENS.

  • ENS Contract mainnet address: 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e
  • ENS PublicResolve mainnet address: 0x226159d592E2b063810a10Ebf6dcbADA94Ed68b8
  • adex.eth node hash: 0x4e4e818e9467df5c5d1f8c399b11acc73ea24ad69e9c8e1ba6e5784a302c47d4
  • adex.eth subdomain registrar (adex.eth controller), compiled with solc v0.5.6: 0x7bc082552b1a195813ddb500600ce2b544d579cb

Code style and design principles

  • Minimalistic use of smart contracts in general
    • Avoid putting logic in SCs if it’s outcome is controlled by a single entity anyway
    • Do not add complexity and centralization to address various “what ifs” that should be addressed off-chain, e.g. “what if users send tokens to this contract by accident”
  • Detailed tests for every contract
  • No Solidity warnings allowed
  • No modifiers allowed
  • Limited use of inheritance
  • No reentrancy guards allowed, instead we use the Checks-Effects-Interactions pattern
  • All requires should have an error message
  • No delegatecall upgradability; upgradability is achieved via off-chain social consensus
  • No emergency stops or pausability: it dilutes the value of smart contracts

Audits

  • G0 Group: all issues discovered were of Low severity, and all were resolved
  • Sigma Prime: 4 issues discovered with “Informational” severity, all resolved
  • G0 Group, Staking contract: all issues discovered were resolved
  • Forkway, ADXToken: all issues discovered were informational and resolved
  • Forkway, ADXLoyaltyPoolToken: all issues discovered were resolved

Credits

  • @BrendanChou for SafeERC20: https://gist.github.com/BrendanChou/88a2eeb80947ff00bcf58ffdafeaeb61
  • @decanus for SignatureValidator
  • @ConnextProject for merkletree.js

adex协议eth

AdEx协议的以太坊eth实现。

这将取代adex core。

此存储库实现outface(链外单向无信任支付通道)和一个称为AdEx Identity的气体提取层。

请注意

  • 可以使用任何ERC20令牌创建频道;如果频道的基础令牌不安全或恶意,也会损害频道;这超出了本合同的范围,因为这是任何使用ERC20的系统的基本问题;不用说,用户需要知道他们正在使用/赚取什么令牌
  • 有关outface频道如何工作的更多详细信息,请阅读规范:AdEx协议和outface。
  • 主网:https://etherscan.io/address/0x333420fc6a897356e69b62417cd17ff012177d2b格尔利:https://goerli.etherscan.io/address/0x333420fc6a897356e69b62417cd17ff012177d2b

测试

首先,在一个单独的终端中运行ganache cli

truffle build # This is important cause js/IdentityProxyDeploy uses artifacts from there npm test 

部署

使用solc v0.5.6编译的v3.1.0版契约AdExCore部署在这里:

  • 科万:https://kovan.etherscan.io/address/0x333420fc6a897356e69b62417cd17ff012177d2b
  • 主网:https://etherscan.io/address/0xbdf97b0f5fa78beae684d9fb67dd45f11b996e46格尔利:https://goerli.etherscan.io/address/0xbdf97b0f5fa78beae684d9fb67dd45f11b996e46
  • 主网:https://etherscan.io/address/0x801dbb2fcbf9f4c3865c6ba5c5012ee19ec283A格尔利:https://goerli.etherscan.io/address/0x801dbb2fcbf9f4c3865c6ba5c5012ee19ec283a

一个没有特权初始化的标识,用作IdentityProxy的基础:

  • 主网:https://etherscan.io/address/0x7671db0a70fa0196071d634f26971b9371627dc0格尔利:https://goerli.etherscan.io/address/0x7671db0a70fa0196071d634f26971b9371627dc0
  • 主网:https://etherscan.io/address/0xd5a1c8a5ea507ea459216ff34939cae3326dba6f格尔利:https://goerli.etherscan.io/address/0xd5a1c8a5ea507ea459216ff34939cae3326dba6f

一个IdentityFactory,使用AdEx中继设置:

  • 主网(ADX令牌和AdEx multisig作为slasher):https://etherscan.io/address/0x46ad2d37ceaee1e82b70b867e674b903a4b4ca32
  • Goerli(TST代币和创造者作为斜杠):https://goerli.etherscan.io/address/0x46ad2d37ceaee1e82b70b867e674b903a4b4ca32

和注册表(现已过时,不再使用):

  • 主网:https://etherscan.io/address/0x360625ba7bce57f74eb5501fd2b75db8f85a85d8格尔利:https://goerli.etherscan.io/address/0x360625ba7bce57f74eb5501fd2b75db8f85a85d8
  • 主网:https://etherscan.io/address/0xade00c28244d5ce17d72e40330b1c318cd12b7c3格尔利:https://goerli.etherscan.io/address/0xade00c28244d5ce17d72e40330b1c318cd12b7c3

v4.1

这里的所有合同都是用solc v0.5.13编译的。

没有特权初始化的标识,用作IdentityProxy的基础:

  • 主网:https://etherscan.io/address/0x9fe0d438e3c29c7cff949ad8e8da9403a531cc1a格尔利:https://goerli.etherscan.io/address/0x9fe0d438e3c29c7cff949ad8e8da9403a531cc1a
  • 主网(ADX令牌和AdEx multisig作为slasher):https://etherscan.io/address/0x4846c6837ec670bbd1f5b485471c8f64ecb9c534

一个IdentityFactory,设置与AdEx中继:

  • Goerli(TST代币和创造者作为斜杠):https://goerli.etherscan.io/address/0x4846c6837ec670bbd1f5b485471c8f64ecb9c534
  • 主网:https://etherscan.io/address/0xae4c306ce6641e1276c57473f2c2953841f0856a格尔利:https://goerli.etherscan.io/address/0xae4c306ce6641e1276c57473f2c2953841f0856a

和锁定:

  • 主网:https://etherscan.io/address/0xd9a4cb9dc9296e111c66dfacab8be034ee2e1c2c格尔利:https://goerli.etherscan.io/address/0xd9a4cb9dc9296e111c66dfacab8be034ee2e1c2c
  • 主网:https://etherscan.io/address/0xa52588d04c5b21854f42cbcd9502aa6092e6a779格尔利:https://goerli.etherscan.io/address/0xa52588d04c5b21854f42cbcd9502aa6092e6a779

v4.2

ADX供应控制器合同:

  • 部署AdExCore
  • 部署IdentityFactory

ADXToken合同:

  • 部署单个标识,在没有所有者和注册表的情况下,部署锁定主机地址:0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e公共解析主机地址:0x226159D592E2B063810EBF6DCBADA94ED68B8阿德克斯·埃斯节点哈希:0x4e4e818e9467df5c5d1f8c399b11ac73ea24ad69e9c8e1ba6e5784a302c47d4阿德克斯·埃斯子域注册器(阿德克斯·埃斯控制器),用solc v0.5.6编译:0x7bc082552b1a195813ddb500600ce2b544d579cb
  • 智能合约的最低限度使用通常避免将逻辑放在SCs中,如果结果由单个实体控制,无论如何不要增加复杂性和集中化,以解决应在链外解决的各种“假设”,e、 g.“如果用户意外地向本合同发送令牌怎么办”

用于锁定的IdentityFactory实例:

  • 如果SCs的结果由单个实体控制,则应避免将逻辑放入SCs中无论如何
  • 不要增加复杂性和集中化,以解决应在链外解决的各种“假设”,e、 g.“如果用户意外地向这个契约发送令牌怎么办”

锁定合同:

  • 对每个契约进行详细的测试
  • 不允许使用坚固性警告

ADXFlashLoans合同:

  • 不允许使用修饰符
  • 限制继承的使用

ADXLoyaltyPoolToken合同:

  • 不允许重入保护,而是使用Checks-Effects-Interactions模式出现错误消息
  • 无授权呼叫可升级性;可升级性是通过链外社会共识实现的

ADXLoyaltyPoolIncentiveController契约:

  • 无紧急停止或暂停:它稀释了智能合约的价值
  • G0组:发现的所有问题的严重性都很低,全部解决

部署策略

完整的部署过程如下

  • Sigma Prime:发现4个严重程度为“信息性”的问题,全部解决
  • G0组,立约合同:所有发现的问题都已解决
  • Forkway,ADXToken:所有发现的问题都已解决
  • Forkway,ADXLoyaltyPoolToken:所有发现的问题都已解决

验证etherscan

truffle compile cat build/contracts/AdExCore.json | jq '.bytecode' # this is the bytecode you have to deploy ./scripts/bundle.sh contracts/AdExCore.sol # this will output a bundled .sol code 

气体使用情况,从测试来看,每个渠道最终都将到期(在有效期之后),允许任何开通渠道的人收回初始存款的未提取部分。
  • 可以使用任何ERC20令牌创建频道;如果频道的基础令牌不安全或恶意,也会损害频道;这超出了本合同的范围,因为这是任何使用ERC20的系统的基本问题;不用说,用户需要知道他们正在使用/赚取什么令牌
  • 有关outface频道如何工作的更多详细信息,请阅读规范:AdEx协议和outface。
  • 主网:https://etherscan.io/address/0x333420fc6a897356e69b62417cd17ff012177d2b格尔利:https://goerli.etherscan.io/address/0x333420fc6a897356e69b62417cd17ff012177d2b
  • 科万:https://kovan.etherscan.io/address/0x333420fc6a897356e69b62417cd17ff012177d2b
  • 主网:https://etherscan.io/address/0xbdf97b0f5fa78beae684d9fb67dd45f11b996e46格尔利:https://goerli.etherscan.io/address/0xbdf97b0f5fa78beae684d9fb67dd45f11b996e46
  • 主网:https://etherscan.io/address/0x801dbb2fcbf9f4c3865c6ba5c5012ee19ec283A格尔利:https://goerli.etherscan.io/address/0x801dbb2fcbf9f4c3865c6ba5c5012ee19ec283a
  • 主网:https://etherscan.io/address/0x7671db0a70fa0196071d634f26971b9371627dc0格尔利:https://goerli.etherscan.io/address/0x7671db0a70fa0196071d634f26971b9371627dc0
  • 主网:https://etherscan.io/address/0x96e3cb4b4632ed45363ff2c9f0fbec9b583d9d3a戈里:https://goerli.etherscan.io/address/0x96e3cb4b4632ed45363ff2c9f0fbec9b583d9d3a

  • 主网:https://etherscan.io/address/0xd5a1c8a5ea507ea459216ff34939cae3326dba6f格尔利:https://goerli.etherscan.io/address/0xd5a1c8a5ea507ea459216ff34939cae3326dba6f
  • 主网(ADX令牌和AdEx multisig作为slasher):https://etherscan.io/address/0x46ad2d37ceaee1e82b70b867e674b903a4b4ca32
  • Goerli(TST代币和创造者作为斜杠):https://goerli.etherscan.io/address/0x46ad2d37ceaee1e82b70b867e674b903a4b4ca32
  • 主网:https://etherscan.io/address/0x360625ba7bce57f74eb5501fd2b75db8f85a85d8格尔利:https://goerli.etherscan.io/address/0x360625ba7bce57f74eb5501fd2b75db8f85a85d8
  • 主网:https://etherscan.io/address/0xade00c28244d5ce17d72e40330b1c318cd12b7c3格尔利:https://goerli.etherscan.io/address/0xade00c28244d5ce17d72e40330b1c318cd12b7c3
  • 主网:https://etherscan.io/address/0x9fe0d438e3c29c7cff949ad8e8da9403a531cc1a格尔利:https://goerli.etherscan.io/address/0x9fe0d438e3c29c7cff949ad8e8da9403a531cc1a
  • 主网(ADX令牌和AdEx multisig作为slasher):https://etherscan.io/address/0x4846c6837ec670bbd1f5b485471c8f64ecb9c534
  • Goerli(TST代币和创造者作为斜杠):https://goerli.etherscan.io/address/0x4846c6837ec670bbd1f5b485471c8f64ecb9c534
  • 主网:https://etherscan.io/address/0xae4c306ce6641e1276c57473f2c2953841f0856a格尔利:https://goerli.etherscan.io/address/0xae4c306ce6641e1276c57473f2c2953841f0856a
  • 主网:https://etherscan.io/address/0xd9a4cb9dc9296e111c66dfacab8be034ee2e1c2c格尔利:https://goerli.etherscan.io/address/0xd9a4cb9dc9296e111c66dfacab8be034ee2e1c2c
  • 主网:https://etherscan.io/address/0xa52588d04c5b21854f42cbcd9502aa6092e6a779格尔利:https://goerli.etherscan.io/address/0xa52588d04c5b21854f42cbcd9502aa6092e6a779
  • 部署AdExCore
  • 部署IdentityFactory
  • 部署单个标识,在没有所有者和注册表的情况下,部署锁定主机地址:0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e公共解析主机地址:0x226159D592E2B063810EBF6DCBADA94ED68B8阿德克斯·埃斯节点哈希:0x4e4e818e9467df5c5d1f8c399b11ac73ea24ad69e9c8e1ba6e5784a302c47d4阿德克斯·埃斯子域注册器(阿德克斯·埃斯控制器),用solc v0.5.6编译:0x7bc082552b1a195813ddb500600ce2b544d579cb
  • 智能合约的最低限度使用通常避免将逻辑放在SCs中,如果结果由单个实体控制,无论如何不要增加复杂性和集中化,以解决应在链外解决的各种“假设”,e、 g.“如果用户意外地向本合同发送令牌怎么办”
  • 如果SCs的结果由单个实体控制,则应避免将逻辑放入SCs中无论如何
  • 不要增加复杂性和集中化,以解决应在链外解决的各种“假设”,e、 g.“如果用户意外地向这个契约发送令牌怎么办”
  • 对每个契约进行详细的测试
  • 不允许使用坚固性警告
  • 不允许使用修饰符
  • 限制继承的使用
  • 不允许重入保护,而是使用Checks-Effects-Interactions模式出现错误消息
  • 无授权呼叫可升级性;可升级性是通过链外社会共识实现的
  • 无紧急停止或暂停:它稀释了智能合约的价值
  • G0组:发现的所有问题的严重性都很低,全部解决
  • Sigma Prime:发现4个严重程度为“信息性”的问题,全部解决
  • G0组,立约合同:所有发现的问题都已解决
  • Forkway,ADXToken:所有发现的问题都已解决
  • Forkway,ADXLoyaltyPoolToken:所有发现的问题都已解决
  • @BrendanChou for SafeERC20:https://gist.github.com/BrendanChou/88a2eeb80947ff00bcf58ffdafeaeb61签名者的decanusmerkletree.js公司你知道吗
  • 使用solc v0.5.6进行测量,提交d80fa80424ef7b8932399424f8d919d67b135a30

    channelOpen: 69961 channelWithdrawExpired: 70470 channelWithdraw: 137117 execute: 89900 execRoutines: 114440 channelOpen, through execute: 115086 deploying an identity proxy through the IdentityFactory: 127549 addBond  73404 requestUnbond  34807 unbond  41770 

    ENS

    这不是adex协议eth源代码的一部分,但是对于任何在adex协议eth之上构建、希望与ENS集成的人来说,它可能很有用。

    • @BrendanChou for SafeERC20:https://gist.github.com/BrendanChou/88a2eeb80947ff00bcf58ffdafeaeb61签名者的decanusmerkletree.js公司你知道吗
    • ENS PublicResolve mainnet address: 0x226159d592E2b063810a10Ebf6dcbADA94Ed68b8
    • adex.eth node hash: 0x4e4e818e9467df5c5d1f8c399b11acc73ea24ad69e9c8e1ba6e5784a302c47d4
    • adex.eth subdomain registrar (adex.eth controller), compiled with solc v0.5.6: 0x7bc082552b1a195813ddb500600ce2b544d579cb

    Code style and design principles

    • Minimalistic use of smart contracts in general
      • Avoid putting logic in SCs if it’s outcome is controlled by a single entity anyway
      • Do not add complexity and centralization to address various “what ifs” that should be addressed off-chain, e.g. “what if users send tokens to this contract by accident”
    • Detailed tests for every contract
    • No Solidity warnings allowed
    • No modifiers allowed
    • Limited use of inheritance
    • No reentrancy guards allowed, instead we use the Checks-Effects-Interactions pattern
    • All requires should have an error message
    • No delegatecall upgradability; upgradability is achieved via off-chain social consensus
    • No emergency stops or pausability: it dilutes the value of smart contracts

    Audits

    • G0 Group: all issues discovered were of Low severity, and all were resolved
    • Sigma Prime: 4 issues discovered with “Informational” severity, all resolved
    • G0 Group, Staking contract: all issues discovered were resolved
    • Forkway, ADXToken: all issues discovered were informational and resolved
    • Forkway, ADXLoyaltyPoolToken: all issues discovered were resolved

    Credits

    • @BrendanChou for SafeERC20: https://gist.github.com/BrendanChou/88a2eeb80947ff00bcf58ffdafeaeb61
    • @decanus for SignatureValidator
    • @ConnextProject for merkletree.js

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

    www.interchains.cc

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

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

    提供最优质的资源集合

    立即查看 了解详情