基于区块链的毕业设计DePay’s Ethereum Router – 德佩的以太坊路由器

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计DePay’s Ethereum Router – 德佩的以太坊路由器 是一篇很好的国外资料

DePay’s Ethereum Router

Plugin based ethereum smart contract enabling various peer-to-peer transactions like: Payments, Subscriptions, Sales, Swaps, Payroll and Credit.

Deployments

Mainnet

DePayRouterV1

Ropsten

DePayRouterV1

Summary

This set of smart contracts enables decentralized payments.

The main purpose of this smart contract evolves around the route function, which allows a sender to route crypto assets while converting tokens as part of the same transaction if required.

This allows for ETH to ETH, tokenA to tokenA, ETH to tokenA, tokenA to ETH and tokenA to tokenB conversions as part of e.g. payments.

To increase functionalities and to enable more and future decentralized exchanges and protocols, additional plugins can be added/approved by calling approvePlugin.

Functionalities

route Route Transactions

The main function to route transactions.

Arguments:

path: The path of the token conversion:

ETH to ETH:  ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE']  DEPAY to DEPAY:  ['0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb']  ETH to DEPAY:  ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', '0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb']  DEPAY to ETH:  ['0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb', '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE']  DEPAY to UNI (routing goes through WETH):  ['0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984'] 

amounts: Amounts passed to proccessors:

e.g. [amountIn, amountOut, deadline] 

addresses: Addresses passed to proccessors:

e.g. [receiver] or [for, smartContractReceiver] 

plugins: List of plugins to be executed in the given order for this payment:

e.g. [DePayRouterV1Uniswap01,DePayRouterV1Payment01] to swap and pay or [DePayRouterV1Uniswap01,DePayRouterV1ApproveAndCallContractAddressAmount01] to swap and call another contract 

See Approved Plugins for more details about available and approved plugins.

data: Additional data passed to the payment plugins (e.g. contract call signatures):

e.g. ["signatureOfSmartContractFunction(address,uint)"] receiving the payment 

approvePlugin Approves a plugin.

plugin: Address for the plugin to be approved.

Approved Plugins

DePayRouterV1Payment01

Used to send a payment (ETH or any transferable token) to a receiver.

Sends the token of path at the last position (path[path.length-1]) for the amount at index 1 (amounts[1]) to the address at the last position (addresses[addresses.length-1]).

Can be used to perform token sales from decentralized exchanges to the sender by setting addresses to [<sender address>].

Mainnet: XXX

Ropsten: 0x7C9cfd8905E8351303b0bE5D8378b3D453532c44

DePayRouterV1PaymentEvent01

Used to log a payment event on-chain if requested. If not required/requested, not using it does safe gas.

Emits a Payment event on the DePayRouterV1PaymentEvent01 contract using addresses[0] as the sender of the event and addresses[addresses.length-1] as the receiver of the Payment.

Mainnet: XXX

Ropsten: 0x076f1f13efA6b194f636E265856D0381704fC394

DePayRouterV1SaleEvent01

Used to log a sale event on-chain if requested. If not required/requested, not using it does safe gas.

Emits a Sale event on the DePayRouterV1SaleEvent01 contract using addresses[0] as the buyer.

Mainnet: XXX

Ropsten: 0x78AC73A852BB11eD09Cb14CAe8c355A4C0fAC476

DePayRouterV1Uniswap01

Swap tokenA to tokenB, ETH to tokenA or tokenA to ETH on Uniswap as part of the payment.

Swaps tokens according to provided path using the amount at index 0 (amounts[0]) as input amount, the amount at index 1 (amounts[1]) as output amount and the amount at index 2 (amount[2]) as deadline.

Mainnet: XXX

Ropsten: 0xc1F6146f45b6EC65FA9E8c8E278bb01879b32268

DePayRouterV1ApproveAndCallContractAddressAmount01

Call another smart contract to deposit an amount for a given address while making sure the amount passed to the contract is approved.

Approves the amount at index 1 of amounts (amounts[1]) for the token at the last position of path (path[path.length-1]) to be used by the smart contract at index 1 of addresses (addresses[1]).

Afterwards, calls the smart contract at index 1 of addresses (addresses[1]), passing the address at index 0 of addresses (addresses[0]) and passing the amount at index 1 of amounts (amounts[1]) to the method with the signature provided in data at index 0 (data[0]).

Mainnet: XXX

Ropsten: 0x60cc73eb2b2B983554C9f66B26115174eD2C6335

Examples

tokenA to tokenB payment with smart contract receiver (e.g. staking pool)

Mainnet: XXX

Ropsten: https://ropsten.etherscan.io/tx/0x6040567eef6538ec092fc7cc06eb00af00674b0287b21d3d192ad0f3daa711cb

path needs to go through tokenA -> WETH -> tokenB if executed by Uniswap.

Requires to approve token at first index of path to be approved for the payment protocol smart contract.

Get amounts through the Uniswap router by passing the same path and the desired output amount to receive the required input amount.

value: 0  path: ["0xAb4c122a024FeB8Eb3A87fBc7044ad69E51645cB","0xc778417E063141139Fce010982780140Aa0cD5Ab","0x9c2Db0108d7C8baE8bE8928d151e0322F75e8Eea"]  amounts: ["8551337980759167135310","1000000000000000000","1711537544"]  addresses: ["0x08B277154218CCF3380CAE48d630DA13462E3950","0x0d8A34Cb6c08Ec71eA8009DF725a779B1877d4c5"]  plugins: ["0xc1F6146f45b6EC65FA9E8c8E278bb01879b32268","0x60cc73eb2b2B983554C9f66B26115174eD2C6335"]  data: ["depositFor(address,uint256)"] 

Gas usage: approx. 304,000

tokenA to tokenB payment

Mainnet: XXX

Ropsten: https://ropsten.etherscan.io/tx/0x03b34fa7b08ad05cb9a74759bf7de0d45197f4b41f0b81509b9fba1cb684d039

path needs to go through tokenA -> WETH -> tokenB if executed by Uniswap.

Requires to approve token at first index of path to be approved for the payment protocol smart contract.

Get amounts through the Uniswap router by passing the same path and the desired output amount to receive the required input amount.

value: 0  path: ["0xAb4c122a024FeB8Eb3A87fBc7044ad69E51645cB","0xc778417e063141139fce010982780140aa0cd5ab","0x1f9840a85d5af5bf1d1762f925bdaddc4201f984"]  amounts: ["10187046138967433440396","10000000000000000","1711537544"]  addresses: ["0x08B277154218CCF3380CAE48d630DA13462E3950"]  plugins: ["0xc1F6146f45b6EC65FA9E8c8E278bb01879b32268","0x7C9cfd8905E8351303b0bE5D8378b3D453532c44"]  data: [] 

Gas usage: approx. 253,000

IMPORTANT: Don’t forget to use the actual payment plugin at the end of plugins to avoid depositing swaps into the payment contract itself (without performing a payment).

tokenA to ETH payment

Mainnet: XXX

Ropsten: https://ropsten.etherscan.io/tx/0xe8536f159ef4302ca5cea76c4bdf1fb7d0bf555f183d1655953a6939e4ee84d2

value: "0"  path: ["0xAb4c122a024FeB8Eb3A87fBc7044ad69E51645cB","0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"]  amounts: ["1735972857185674397500","10000000000000000","1711537544"]  addresses: ["0x08B277154218CCF3380CAE48d630DA13462E3950"]  plugins: ["0xc1F6146f45b6EC65FA9E8c8E278bb01879b32268","0x7C9cfd8905E8351303b0bE5D8378b3D453532c44"]  data: [] 

Gas usage: approx. 213,000

IMPORTANT: Don’t forget to use the actual payment plugin at the end of plugins to avoid depositing swaps into the payment contract itself (without performing a payment).

ETH to tokenA payment

Mainnet: XXX

Ropsten: https://ropsten.etherscan.io/tx/0x5aa12899c7bfb6f48806a1ad859e2f0e6535f3d49fa6cf73d41b9fffa677ca85

value: "5997801900122"  path: ["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0xAb4c122a024FeB8Eb3A87fBc7044ad69E51645cB"]  amounts: ["5997801900122","1000000000000000000","1711537544"]  addresses: ["0x08B277154218CCF3380CAE48d630DA13462E3950"]  plugins: ["0xc1F6146f45b6EC65FA9E8c8E278bb01879b32268","0x7C9cfd8905E8351303b0bE5D8378b3D453532c44"]  data: [] 

Gas usage: approx. 172,000

IMPORTANT: Don’t forget to use the actual payment plugin at the end of plugins to avoid depositing swaps into the payment contract itself (without performing a payment).

Sale (sell tokens from open decentralized exchanges)

Mainnet: XXX

Ropsten: https://ropsten.etherscan.io/tx/0x4cb1ebfdb6d13a6a2b1a19be5cf93a8a704ba30c53408dbb79b8d67543235df4

value: "5998045319783"  path: ["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0xAb4c122a024FeB8Eb3A87fBc7044ad69E51645cB"]  amounts: ["5998045319783","1000000000000000000","1711537544"]  addresses: ["0x317D875cA3B9f8d14f960486C0d1D1913be74e90"]  plugins: ["0xc1F6146f45b6EC65FA9E8c8E278bb01879b32268","0x7C9cfd8905E8351303b0bE5D8378b3D453532c44"]  data: [] 

Gas usage: approx. 172,000

IMPORTANT: Make sure to set the address of the purchaser (sender == receiver) and to use the actual payment plugin to send the swap back to the purchaser.

Log sale event

Mainnet: XXX

Ropsten: https://ropsten.etherscan.io/tx/0x679e3cbe6f0a8934d4413beff5bffcbd6b23ba0e240038ff98001965368d4cc0

value: "5998045319783"  path: ["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0xAb4c122a024FeB8Eb3A87fBc7044ad69E51645cB"]  amounts: ["5998045319783","1000000000000000000","1711537544"]  addresses: ["0x317D875cA3B9f8d14f960486C0d1D1913be74e90"]  plugins: ["0xc1F6146f45b6EC65FA9E8c8E278bb01879b32268","0x7C9cfd8905E8351303b0bE5D8378b3D453532c44","0x78AC73A852BB11eD09Cb14CAe8c355A4C0fAC476"]  data: [] 

Gas usage: approx. 187,000

IMPORTANT: The sale log event will be emited on the sale event plugin itself and will be part of the transaction.

tokenA to tokenA payment

Mainnet: XXX

Ropsten: https://ropsten.etherscan.io/tx/0x473d4683d9a52034b120a6309db08745790a136017d2adfe36f1153037d19250

Consider performing tokenA to tokenA transfers directly if you don’t rely on any other plugins or the payment event.

Needs spending approval on path[0] token contract for the router (spender) first.

value: "0"  path: ["0xAb4c122a024FeB8Eb3A87fBc7044ad69E51645cB"]  amounts: ["10000000000000000","10000000000000000"]  addresses: ["0x08B277154218CCF3380CAE48d630DA13462E3950"]  plugins: ["0x7C9cfd8905E8351303b0bE5D8378b3D453532c44"]  data: [] 

Gas usage: approx. 80,000

IMPORTANT: Don’t forget to use the actual payment plugin at the end of plugins to avoid depositing into the payment contract itself without performing a payment.

ETH to ETH payment

Mainnet: XXX

Ropsten: https://ropsten.etherscan.io/tx/0xd2d271463298d98130117e9ec3f29dd702ce1aab9fe2574452c5a1adc32826fa

Consider performing ETH to ETH transfers directly and not via the DePayRouter, if you don’t rely on any other plugin, in order to save gas.

value: "10000000000000000"  path: ["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"]  amounts: ["10000000000000000","10000000000000000"]  addresses: ["0x08B277154218CCF3380CAE48d630DA13462E3950"]  plugins: ["0x7C9cfd8905E8351303b0bE5D8378b3D453532c44"]  data: [] 

Gas usage: approx. 48,400

IMPORTANT: Don’t forget to use the actual payment plugin at the end of plugins to avoid just depositing into the payment contract itself without performing a payment.

Log payment event

Mainnet: XXX

Ropsten: https://ropsten.etherscan.io/tx/0x9ada66ede69fbff9f61ac9d6c3f24c2f6de6dd7d53c0a982e8ea7070a1e92c31

value: "10000000000000000"  path: ["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"]  amounts: ["10000000000000000","10000000000000000"]  addresses: ["0x08B277154218CCF3380CAE48d630DA13462E3950"]  plugins: ["0x7C9cfd8905E8351303b0bE5D8378b3D453532c44","0x076f1f13efA6b194f636E265856D0381704fC394"]  data: [] 

Gas usage: approx. 63,800

IMPORTANT: The payment log event will be emited on the payment event plugin itself and will be part of the transaction.

Security Audits

  1. https://github.com/DePayFi/depay-ethereum-payments/blob/master/docs/Audit1.md
  2. https://github.com/DePayFi/depay-ethereum-payments/blob/master/docs/Audit2.md
  3. https://github.com/DePayFi/depay-ethereum-payments/blob/master/docs/Audit3.md

Development

Quick Start

yarn install yarn test 

Deploy

  1. yarn flatten

  2. Deploy flatten contract via https://remix.ethereum.org/


DePay的以太坊eth路由器

基于插件的以太坊eth智能合约支持各种点对点交易,如:支付、订阅、销售、交换、工资和信贷。这套智能合约支持分散支付。

部署

主网

此智能合约的主要目的是围绕路由功能发展,该功能允许发送方路由加密资产,同时在需要时将令牌转换为同一事务的一部分。

Ropsten

这允许ETH到ETH、tokenA到tokenA、ETH到tokenA、tokenA到ETH和tokenA到tokenB的转换作为支付的一部分。

摘要

要增加功能并支持更多和未来的分散式交换和协议,可以通过调用approvePlugin添加/批准其他插件。

路由事务的主要功能。

参数:

路径:令牌转换的路径:

功能

路由事务

金额:传递给进程的金额:

地址:传递给进程的地址:

插件:按给定顺序执行此支付的插件列表:

ETH to ETH:  ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE']  DEPAY to DEPAY:  ['0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb']  ETH to DEPAY:  ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', '0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb']  DEPAY to ETH:  ['0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb', '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE']  DEPAY to UNI (routing goes through WETH):  ['0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984'] 

有关可用插件和已批准插件的详细信息,请参阅已批准插件。

e.g. [amountIn, amountOut, deadline] 

数据:传递给支付插件的附加数据(例如,合同调用签名):

e.g. [receiver] or [for, smartContractReceiver] 

插件:待批准插件的地址。

e.g. [DePayRouterV1Uniswap01,DePayRouterV1Payment01] to swap and pay or [DePayRouterV1Uniswap01,DePayRouterV1ApproveAndCallContractAddressAmount01] to swap and call another contract 

用于向接收者发送付款(ETH或任何可转让的代币)。

在最后一个位置(path)发送path的令牌[路径长度-1] )索引1处的金额(金额[1])到最后一个位置的地址(地址[地址.长度-1]).

e.g. ["signatureOfSmartContractFunction(address,uint)"] receiving the payment 

approvePlugin批准插件。

可以通过将地址设置为[&lt;发件人地址&gt;],来执行从分散式交易所到发件人的代币销售。

批准的插件

DePayRouterV1Payment01

Mainnet:XXX

Ropsten:0x7C9cfd8905E8351303b0bE5D8378b3D453532c44

如果请求,用于在链上记录支付事件。如果不需要/要求,不使用它不会产生安全气体。

在DePayRouterV1PaymentEvent01合约上发出一个付款事件,使用地址[0]作为事件和地址的发送者[地址.长度-1] 作为收款人。

Mainnet:XXX

DePayRouterV1PaymentEvent01

Ropsten:0x076f1f13efA6b194f636E265856D0381704fC394

如果需要,用于在链上记录销售事件。如果不需要/要求,不使用它不会产生安全气体。

使用地址[0]作为买方,在DePayRouterV1SaleEvent01合同上发出销售事件。

主网:XXX

DePayRouterV1SaleEvent01

收件人:0x78AC73A852BB11eD09Cb14CAe8c355A4C0fAC476

在Uniswap上交换tokenA到tokenB、ETH到tokenA或tokenA到ETH,作为支付的一部分。

根据提供的路径交换令牌,使用索引0处的金额(金额[0])作为输入金额,索引1处的金额(金额[1])作为输出金额,索引2处的金额(金额[2])作为截止日期。

主网:XXX

DepayRouterv1Niswap01

收件人:0xc1F6146f45b6EC65FA9E8c8E278bb01879b32268

调用另一个智能合约为给定地址存入金额,同时确保传递给该合约的金额得到批准。

批准路径(path)最后一个位置的令牌的金额(金额[1])索引1处的金额[路径长度-1] )由智能合约在地址索引1处使用(地址[1])。

之后,调用地址索引1(地址[1])处的智能合约,将地址索引0处的地址(地址[0])和金额索引1处的金额(金额[1])传递给具有索引0处数据(数据[0])中提供的签名的方法。

DepayRouterv1Approved and CallContractAddressAmount01

主网:XXX

收件人:0x60cc73eb2b2B983554C9f66B26115174eD2C6335

主网:XXX

收件人:https://ropsten.etherscan.io/tx/0x6040567eef6538ec092fc7cc06eb00af00674b0287b21d3d192ad0f3daa711cb

如果由Uniswap执行,路径需要经过tokenA-&gt;WETH-&gt;tokenB。

示例

tokenA到tokenB使用智能合约接收器进行支付(例如,锁定池)

要求批准支付协议智能合约中要批准的路径的第一个索引处的令牌。

通过Uniswap路由器通过传递相同的路径和所需的输出量来获得所需的输入量。燃气使用量:约304000https://ropsten.etherscan.io/tx/0x03b34fa7b08ad05cb9a74759bf7de0d4519f4b41f0b81509b9fba1cb684d039

如果由Uniswap执行,路径需要经过tokenA-&gt;WETH-&gt;tokenB。

要求批准支付协议智能合约中要批准的路径的第一个索引处的令牌。

通过Uniswap路由器通过传递相同的路径和所需的输出量来获得所需的输入量。

value: 0  path: ["0xAb4c122a024FeB8Eb3A87fBc7044ad69E51645cB","0xc778417E063141139Fce010982780140Aa0cD5Ab","0x9c2Db0108d7C8baE8bE8928d151e0322F75e8Eea"]  amounts: ["8551337980759167135310","1000000000000000000","1711537544"]  addresses: ["0x08B277154218CCF3380CAE48d630DA13462E3950","0x0d8A34Cb6c08Ec71eA8009DF725a779B1877d4c5"]  plugins: ["0xc1F6146f45b6EC65FA9E8c8E278bb01879b32268","0x60cc73eb2b2B983554C9f66B26115174eD2C6335"]  data: ["depositFor(address,uint256)"] 

气体使用量:约253000

代币A到代币B支付

重要提示:不要忘记在插件末尾使用实际的支付插件,以避免将掉期存入支付合同本身(不执行支付)。

主网:XXX

收件人:https://ropsten.etherscan.io/tx/0xe8536f159ef4302ca5cea76c4bdf1f7d0bf555f183d1655953a6939e4ee84d2

气体使用量:约213,000

重要提示:不要忘记在插件末尾使用实际的支付插件,以避免将掉期存入支付合同本身(不执行支付)。

value: 0  path: ["0xAb4c122a024FeB8Eb3A87fBc7044ad69E51645cB","0xc778417e063141139fce010982780140aa0cd5ab","0x1f9840a85d5af5bf1d1762f925bdaddc4201f984"]  amounts: ["10187046138967433440396","10000000000000000","1711537544"]  addresses: ["0x08B277154218CCF3380CAE48d630DA13462E3950"]  plugins: ["0xc1F6146f45b6EC65FA9E8c8E278bb01879b32268","0x7C9cfd8905E8351303b0bE5D8378b3D453532c44"]  data: [] 

主网:XXX

收件人:https://ropsten.etherscan.io/tx/0x5aa12899c7bfb6f48806a1ad859e2f0e6535f3d49fa6cf73d41b9fffa677ca85

代币A到ETH支付

气体使用量:约172,000

重要提示:不要忘记在插件末尾使用实际的支付插件,以避免将掉期存入支付合同本身(不执行支付)。

value: "0"  path: ["0xAb4c122a024FeB8Eb3A87fBc7044ad69E51645cB","0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"]  amounts: ["1735972857185674397500","10000000000000000","1711537544"]  addresses: ["0x08B277154218CCF3380CAE48d630DA13462E3950"]  plugins: ["0xc1F6146f45b6EC65FA9E8c8E278bb01879b32268","0x7C9cfd8905E8351303b0bE5D8378b3D453532c44"]  data: [] 

主网:XXX

收件人:https://ropsten.etherscan.io/tx/0x4cb1ebfdb6d13a6a2b1a19be5cf93a8a704ba30c53408dbb79b8d6754335df4

ETH到代币A支付

气体使用量:约172000

重要事项:确保设置购买者的地址(发送者==接收者),并使用实际支付插件将掉期发送回购买者。

value: "5997801900122"  path: ["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0xAb4c122a024FeB8Eb3A87fBc7044ad69E51645cB"]  amounts: ["5997801900122","1000000000000000000","1711537544"]  addresses: ["0x08B277154218CCF3380CAE48d630DA13462E3950"]  plugins: ["0xc1F6146f45b6EC65FA9E8c8E278bb01879b32268","0x7C9cfd8905E8351303b0bE5D8378b3D453532c44"]  data: [] 

主网:XXX

收件人:https://ropsten.etherscan.io/tx/0x679e3cbe6f0a8934d4413beff5bffcfcbbd6b23ba0e240038ff98001965368d4cc0

销售(从开放的分散式交易所出售代币)

气体使用量:约187000

重要信息:sale log事件将在sale event插件本身上发出,并将成为事务的一部分。

value: "5998045319783"  path: ["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0xAb4c122a024FeB8Eb3A87fBc7044ad69E51645cB"]  amounts: ["5998045319783","1000000000000000000","1711537544"]  addresses: ["0x317D875cA3B9f8d14f960486C0d1D1913be74e90"]  plugins: ["0xc1F6146f45b6EC65FA9E8c8E278bb01879b32268","0x7C9cfd8905E8351303b0bE5D8378b3D453532c44"]  data: [] 

主网:XXX

收件人:https://ropsten.etherscan.io/tx/0x473d4683d9a52034b120a6309db08745790a13617d2adfe36f1153037d19250

记录销售事件

如果您不依赖任何其他插件或支付事件,请考虑直接执行tokenA到tokenA的传输。

首先需要对路由器(spender)的路径[0]令牌合约进行支出批准。

value: "5998045319783"  path: ["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0xAb4c122a024FeB8Eb3A87fBc7044ad69E51645cB"]  amounts: ["5998045319783","1000000000000000000","1711537544"]  addresses: ["0x317D875cA3B9f8d14f960486C0d1D1913be74e90"]  plugins: ["0xc1F6146f45b6EC65FA9E8c8E278bb01879b32268","0x7C9cfd8905E8351303b0bE5D8378b3D453532c44","0x78AC73A852BB11eD09Cb14CAe8c355A4C0fAC476"]  data: [] 

气体使用量:约80000

重要提示:不要忘记在插件末尾使用实际的支付插件,以避免在不执行支付的情况下存入支付合同本身。

代币A到代币A支付

主网:XXX

收件人:https://ropsten.etherscan.io/tx/0xd2d271463298d98130117e9ec3f29dd702ce1aab9fe2574452c5a1adc32826fa

如果您不依赖任何其他插件,请考虑直接执行ETH到ETH的传输,而不是通过DePayRouter,以节省汽油。

气体使用量:约48400

value: "0"  path: ["0xAb4c122a024FeB8Eb3A87fBc7044ad69E51645cB"]  amounts: ["10000000000000000","10000000000000000"]  addresses: ["0x08B277154218CCF3380CAE48d630DA13462E3950"]  plugins: ["0x7C9cfd8905E8351303b0bE5D8378b3D453532c44"]  data: [] 

重要提示:不要忘记在插件末尾使用实际的支付插件,以避免在不执行支付的情况下直接存入支付合同本身。

主网:XXX

记录支付事件

收件人:https://ropsten.etherscan.io/tx/0x9ada66ede69fbff9f61ac9d6c3f24c2f6de6dd7d53c0a982e8ea70a1e92c31

气体使用量:约63800

重要提示:支付日志事件将在支付事件插件本身上发出,并将成为事务的一部分。

value: "10000000000000000"  path: ["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"]  amounts: ["10000000000000000","10000000000000000"]  addresses: ["0x08B277154218CCF3380CAE48d630DA13462E3950"]  plugins: ["0x7C9cfd8905E8351303b0bE5D8378b3D453532c44"]  data: [] 

纱线展平

通过https://remix.ethereum.org/

安全审计

Mainnet: XXX

Ropsten: https://ropsten.etherscan.io/tx/0x9ada66ede69fbff9f61ac9d6c3f24c2f6de6dd7d53c0a982e8ea7070a1e92c31

value: "10000000000000000"  path: ["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"]  amounts: ["10000000000000000","10000000000000000"]  addresses: ["0x08B277154218CCF3380CAE48d630DA13462E3950"]  plugins: ["0x7C9cfd8905E8351303b0bE5D8378b3D453532c44","0x076f1f13efA6b194f636E265856D0381704fC394"]  data: [] 

Gas usage: approx. 63,800

IMPORTANT: The payment log event will be emited on the payment event plugin itself and will be part of the transaction.

开发

  1. https://github.com/DePayFi/depay-ethereum-payments/blob/master/docs/Audit1.md
  2. https://github.com/DePayFi/depay-ethereum-payments/blob/master/docs/Audit2.md
  3. https://github.com/DePayFi/depay-ethereum-payments/blob/master/docs/Audit3.md纱线压扁

快速启动

部署

yarn install yarn test 

Deploy

  1. 通过部署扁平化合同https://remix.ethereum.org/你知道吗
  2. Deploy flatten contract via https://remix.ethereum.org/

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

www.interchains.cc

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

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计DePay’s Ethereum Router – 德佩的以太坊路由器

提供最优质的资源集合

立即查看 了解详情