Baseline Protocol Contracts – 基线协议合同区块链毕设代写

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

Baseline Protocol Contracts

Control Flows and Natspec

  • Baseline Protocol Contracts
    • Registry Contracts Overview
      • Files Description Table
      • Contracts Description Table
      • Legend
    • Privacy Contracts Description Report
      • Files Description Table
      • Contracts Description Table
      • Legend
      • Registrar
      • onlyManager()
      • constructor(address ERC1820RegistryAddress) (public)
      • setInterfaceImplementation(string _interfaceLabel, address _implementation) (internal)
      • interfaceAddr(address addr, string _interfaceLabel) → address (external)
      • assignManagement(address _newManager) (internal)
      • getManager() → address (public)
    • OrgRegistry
      • constructor(address _erc1820) (public)
      • setInterfaces() → bool (public)
      • getInterfaces() → bytes4 (external)
      • canImplementInterfaceForAddress(bytes32 interfaceHash, address addr) → bytes32 (external)
      • assignManager(address _newManager) (external)
      • registerOrg(address _address, bytes32 _name, bytes _messagingEndpoint, bytes _whisperKey, bytes _zkpPublicKey, bytes _metadata) → bool (external)
      • updateOrg(address _address, bytes32 _name, bytes _messagingEndpoint, bytes _whisperKey, bytes _zkpPublicKey, bytes _metadata) → bool (external)
      • registerInterfaces(bytes32 _groupName, address _tokenAddress, address _shieldAddress, address _verifierAddress) → bool (external)
      • getOrgCount() → uint256 (external)
      • getOrg(address _address) → address, bytes32, bytes, bytes, bytes, bytes (external)
      • getInterfaceAddresses() → bytes32[], address[], address[], address[] (external)
      • RegisterOrg(bytes32 _name, address _address, bytes _messagingEndpoint, bytes _whisperKey, bytes _zkpPublicKey, bytes _metadata)
      • UpdateOrg(bytes32 _name, address _address, bytes _messagingEndpoint, bytes _whisperKey, bytes _zkpPublicKey, bytes _metadata)
    • IOrgRegistry
      • registerOrg(address, bytes32, bytes, bytes, bytes, bytes) → bool (external)
      • updateOrg(address, bytes32, bytes, bytes, bytes, bytes) → bool (external)
      • getOrgCount() → uint256 (external)
      • getOrg(address) → address, bytes32, bytes, bytes, bytes, bytes (external)
    • ERC165Compatible
      • setInterfaces() → bool (public)
    • ERC1820Registry
      • getInterfaceImplementer(address _addr, bytes32 _interfaceHash) → address (external)
      • setInterfaceImplementer(address _addr, bytes32 _interfaceHash, address _implementer) (external)
      • setManager(address _addr, address _newManager) (external)
      • getManager(address _addr) → address (public)
      • interfaceHash(string _interfaceName) → bytes32 (external)
      • updateERC165Cache(address _contract, bytes4 _interfaceId) (external)
      • implementsERC165Interface(address _contract, bytes4 _interfaceId) → bool (public)
      • implementsERC165InterfaceNoCache(address _contract, bytes4 _interfaceId) → bool (public)
      • isERC165Interface(bytes32 _interfaceHash) → bool (internal)
      • noThrowCall(address _contract, bytes4 _interfaceId) → uint256 success, uint256 result (internal)
      • InterfaceImplementerSet(address addr, bytes32 interfaceHash, address implementer)
      • ManagerChanged(address addr, address newManager)

Organization Registry

Each organization registered within the OrgRegistry first generates a secp256k1 keypair and uses the Ethereum public address representation as “primary key” for future resolution. This key SHOULD NOT sign transactions. A best practice is to use an HD wallet to rotate keys, preventing any account from signing more than a single transaction.

Note that an organization may not update its address.

struct Org {     address orgAddress;     bytes32 name;     bytes messagingEndpoint;     bytes whisperKey;     bytes zkpPublicKey;     bytes metadata; }  struct OrgInterfaces {     bytes32 groupName;     address tokenAddress;     address shieldAddress;     address verifierAddress; }  mapping (address => Org) orgMap; mapping (uint => OrgInterfaces) orgInterfaceMap; uint orgInterfaceCount;  Org[] public orgs; mapping(address => address) managerMap;  event RegisterOrg(     bytes32 _name,     address _address,     bytes _messagingEndpoint,     bytes _whisperKey,     bytes _zkpPublicKey,     bytes _metadata );  event UpdateOrg(     bytes32 _name,     address _address,     bytes _messagingEndpoint,     bytes _whisperKey,     bytes _zkpPublicKey,     bytes _metadata );

Shield

Unlike the Radish34 Reference Implementation, the contracts package does not include a “shield” contract. Rather, it is up to each workgroup to determine a suitable shielding mechanism to ensure privacy. For example, the IBaselineRPC implementation within the Nethermind client used in the BRI-1 Reference Implementation ships with shield contract binaries (i.e., including the MerkleTreeSHA contract).

Registry Contracts Overview

Files Description Table

File Name SHA-1 Hash
contracts/registry/IOrgRegistry.sol 0514e15aa16c4c92f61c3cdc3f17d93e3ee56377
contracts/registry/OrgRegistry.sol e0bb2ddd83c0d3373d6b58d50ec756a833ac88d0
contracts/registry/Registrar.sol 6507a72d2283a5e2cc04bc99ea90ef1f878fe9b7

Contracts Description Table

Contract Type Bases
Function Name Visibility Mutability Modifiers
IOrgRegistry Interface
registerOrg External ❗️ 🛑 NO❗️
updateOrg External ❗️ 🛑 NO❗️
getOrgCount External ❗️ NO❗️
getOrg External ❗️ NO❗️
OrgRegistry Implementation Ownable, ERC165Compatible, Registrar, IOrgRegistry
Public ❗️ 🛑 ERC165Compatible Registrar
setInterfaces Public ❗️ 🛑 onlyOwner
getInterfaces External ❗️ NO❗️
canImplementInterfaceForAddress External ❗️ NO❗️
assignManager External ❗️ 🛑 onlyOwner
registerOrg External ❗️ 🛑 onlyOwner
updateOrg External ❗️ 🛑 NO❗️
registerInterfaces External ❗️ 🛑 onlyOwner
getOrgCount External ❗️ NO❗️
getOrg External ❗️ NO❗️
getInterfaceAddresses External ❗️ NO❗️
Registrar Implementation
Public ❗️ 🛑 NO❗️
setInterfaceImplementation Internal 🔒 🛑
interfaceAddr External ❗️ NO❗️
assignManagement Internal 🔒 🛑
getManager Public ❗️ NO❗️

Legend

Symbol Meaning
🛑 Function can modify state
💵 Function is payable

Privacy Contracts Description Report

Files Description Table

File Name SHA-1 Hash
contracts/privacy/IShield.sol c4b6e694bbdd4317e6fdc1e595e467cb10e5e1dd
contracts/privacy/IVerifier.sol ba4926ea2f01fde5d11362808fc1e573e69e31e3
contracts/privacy/Shield.sol 14415a0a47a10c0865993bdc3c8a350c683dc69f

Contracts Description Table

Contract Type Bases
Function Name Visibility Mutability Modifiers
IShield Interface
getVerifier External ❗️ NO❗️
verifyAndPush External ❗️ 🛑 NO❗️
IVerifier Interface
verify External ❗️ 🛑 NO❗️
Shield Implementation IShield, MerkleTreeSHA256
Public ❗️ 🛑 MerkleTreeSHA256
getVerifier External ❗️ NO❗️
verifyAndPush External ❗️ 🛑 NO❗️

Legend

Symbol Meaning
🛑 Function can modify state
💵 Function is payable

Registrar

Contract that acts as a client for interacting with the ERC1820Registry

onlyManager()

Throws if called by any account other than the owner.

constructor(address ERC1820RegistryAddress) (public)

Constructor that takes an argument of the ERC1820RegistryAddress

Upon actual deployment of a static registry contract, this argument can be removed

setInterfaceImplementation(string _interfaceLabel, address _implementation) (internal)

Since this is an internal method any contract inheriting this contract would be leveraged as the sender for the interface registry

This enables setting the interface implementation

interfaceAddr(address addr, string _interfaceLabel) → address (external)

This enables getting the address of the implementer

assignManagement(address _newManager) (internal)

Since this is an internal method any contract inheriting this contract would be leveraged to call this function directly

This enables assigning or changing manager

getManager() → address (public)

This allows you to get this contract manager address

OrgRegistry

Contract for maintaining organization registry Contract inherits from Ownable and ERC165Compatible Ownable contains ownership criteria of the organization registry ERC165Compatible contains interface compatibility checks

constructor(address _erc1820) (public)

constructor function that takes the address of a pre-deployed ERC1820 registry. Ideally, this contract is a publicly known address: 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24. Inherently, the constructor sets the interfaces and registers the current contract with the global registry

setInterfaces() → bool (public)

This is an implementation of setting interfaces for the organization registry contract

the character ‘^’ corresponds to bit wise xor of individual interface id’s which are the parsed 4 bytes of the function signature of each of the functions in the org registry contract

getInterfaces() → bytes4 (external)

This function is a helper function to be able to get the set interface id by the setInterfaces()

canImplementInterfaceForAddress(bytes32 interfaceHash, address addr) → bytes32 (external)

Indicates whether the contract implements the interface ‘interfaceHash’ for the address ‘addr’ or not.

Below implementation is necessary to be able to have the ability to register with ERC1820

assignManager(address _newManager) (external)

Since this is an inherited method from Registrar, it allows for a new manager to be set for this contract instance

registerOrg(address _address, bytes32 _name, bytes _messagingEndpoint, bytes _whisperKey, bytes _zkpPublicKey, bytes _metadata) → bool (external)

Function to register an organization

Function to register an organization

updateOrg(address _address, bytes32 _name, bytes _messagingEndpoint, bytes _whisperKey, bytes _zkpPublicKey, bytes _metadata) → bool (external)

Function to update an organization

Function to update an organization

registerInterfaces(bytes32 _groupName, address _tokenAddress, address _shieldAddress, address _verifierAddress) → bool (external)

Function to register the names of the interfaces associated with the OrgRegistry

Function to register an organization’s interfaces for easy lookup

getOrgCount() → uint256 (external)

Function to get the count of number of organizations to help with extraction

getOrg(address _address) → address, bytes32, bytes, bytes, bytes, bytes (external)

Function to get a single organization’s details

getInterfaceAddresses() → bytes32[], address[], address[], address[] (external)

Function to get organization’s interface details

RegisterOrg(bytes32 _name, address _address, bytes _messagingEndpoint, bytes _whisperKey, bytes _zkpPublicKey, bytes _metadata)

UpdateOrg(bytes32 _name, address _address, bytes _messagingEndpoint, bytes _whisperKey, bytes _zkpPublicKey, bytes _metadata)

IOrgRegistry

registerOrg(address, bytes32, bytes, bytes, bytes, bytes) → bool (external)

updateOrg(address, bytes32, bytes, bytes, bytes, bytes) → bool (external)

getOrgCount() → uint256 (external)

getOrg(address) → address, bytes32, bytes, bytes, bytes, bytes (external)

ERC165Compatible

setInterfaces() → bool (public)

ERC1820Registry

This contract is the official implementation of the ERC1820 Registry. For more details, see https://eips.ethereum.org/EIPS/eip-1820

getInterfaceImplementer(address _addr, bytes32 _interfaceHash) → address (external)

Query if an address implements an interface and through which contract.

setInterfaceImplementer(address _addr, bytes32 _interfaceHash, address _implementer) (external)

Sets the contract which implements a specific interface for an address. Only the manager defined for that address can set it. (Each address is the manager for itself until it sets a new manager.)

setManager(address _addr, address _newManager) (external)

Sets ‘_newManager’ as manager for ‘_addr’. The new manager will be able to call ‘setInterfaceImplementer’ for ‘_addr’.

getManager(address _addr) → address (public)

Get the manager of an address.

interfaceHash(string _interfaceName) → bytes32 (external)

Compute the keccak256 hash of an interface given its name.

updateERC165Cache(address _contract, bytes4 _interfaceId) (external)

Updates the cache with whether the contract implements an ERC165 interface or not.

implementsERC165Interface(address _contract, bytes4 _interfaceId) → bool (public)

implementsERC165InterfaceNoCache(address _contract, bytes4 _interfaceId) → bool (public)

Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.

isERC165Interface(bytes32 _interfaceHash) → bool (internal)

Checks whether the hash is a ERC165 interface (ending with 28 zeroes) or not.

noThrowCall(address _contract, bytes4 _interfaceId) → uint256 success, uint256 result (internal)

Make a call on a contract without throwing if the function does not exist.

InterfaceImplementerSet(address addr, bytes32 interfaceHash, address implementer)

Indicates a contract is the ‘implementer’ of ‘interfaceHash’ for ‘addr’.

ManagerChanged(address addr, address newManager)

Indicates ‘newManager’ is the address of the new manager for ‘addr’.

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


基线协议合同

控制流和Natspec

  • 基线协议合同注册表合同概述文件描述表合同描述表图例隐私合同描述报告文件描述表合同描述表图例登记员onlyManager()构造函数(地址ERC1820RegistryAddress)(public)setInterfaceImplementation(string接口标签,地址u实现)(内部)interfaceAddr(地址addr,stringu interfaceLabel)→address(外部)assignManagement(address _newManager)(内部)getManager()→address(public)OrgRegistry构造函数(address _erc1820)(public)setInterfaces()→bool(public)getInterfaces()→bytes4(外部)canImplementInterfaceForAddress(bytes32 interfaceHash,address addr)→bytes32(外部)assignManager(addressu newManager)(外部)registerOrg(地址u address,bytes32u name,bytesu messagingEndpoint,bytes _whispkey,bytes _zkpPublicKey,bytes _metadata)→bool(外部)u

组织注册表

在OrgRegistry中注册的每个组织首先生成一个secp256k1密钥对,并将以太坊eth公共地址表示作为“主键”用于将来的解析。此密钥不应签名事务。一个最好的做法是使用高清钱包来旋转密钥,防止任何帐户签署超过一个交易。

请注意,组织可能不会更新其地址。

struct Org {     address orgAddress;     bytes32 name;     bytes messagingEndpoint;     bytes whisperKey;     bytes zkpPublicKey;     bytes metadata; }  struct OrgInterfaces {     bytes32 groupName;     address tokenAddress;     address shieldAddress;     address verifierAddress; }  mapping (address => Org) orgMap; mapping (uint => OrgInterfaces) orgInterfaceMap; uint orgInterfaceCount;  Org[] public orgs; mapping(address => address) managerMap;  event RegisterOrg(     bytes32 _name,     address _address,     bytes _messagingEndpoint,     bytes _whisperKey,     bytes _zkpPublicKey,     bytes _metadata );  event UpdateOrg(     bytes32 _name,     address _address,     bytes _messagingEndpoint,     bytes _whisperKey,     bytes _zkpPublicKey,     bytes _metadata );

屏蔽

与RadiH34参考实施不同,合同包不包括“屏蔽”合同。相反,由每个工作组决定合适的屏蔽机制来确保隐私。例如,BRI-1参考实现中使用的Nethermind客户机中的IBaselineRPC实现附带了屏蔽合同二进制文件(即,包括MerkleTreeSHA合同)。

注册表合同概述

文件描述表

File Name SHA-1 Hash
contracts/registry/IOrgRegistry.sol 0514e15aa16c4c92f61c3cdc3f17d93e3ee56377
contracts/registry/OrgRegistry.sol e0bb2ddd83c0d3373d6b58d50ec756a833ac88d0
contracts/registry/Registrar.sol 6507a72d2283a5e2cc04bc99ea90ef1f878fe9b7

合同描述表

Contract Type Bases
Function Name Visibility Mutability Modifiers
IOrgRegistry Interface
registerOrg External ❗️ 🛑 NO❗️
updateOrg External ❗️ 🛑 NO❗️
getOrgCount External ❗️ NO❗️
getOrg External ❗️ NO❗️
OrgRegistry Implementation Ownable, ERC165Compatible, Registrar, IOrgRegistry
Public ❗️ 🛑 ERC165Compatible Registrar
setInterfaces Public ❗️ 🛑 onlyOwner
getInterfaces External ❗️ NO❗️
canImplementInterfaceForAddress External ❗️ NO❗️
assignManager External ❗️ 🛑 onlyOwner
registerOrg External ❗️ 🛑 onlyOwner
updateOrg External ❗️ 🛑 NO❗️
registerInterfaces External ❗️ 🛑 onlyOwner
getOrgCount External ❗️ NO❗️
getOrg External ❗️ NO❗️
getInterfaceAddresses External ❗️ NO❗️
Registrar Implementation
Public ❗️ 🛑 NO❗️
setInterfaceImplementation Internal 🔒 🛑
interfaceAddr External ❗️ NO❗️
assignManagement Internal 🔒 🛑
getManager Public ❗️ NO❗️

隐私合同描述报告

Symbol Meaning
🛑 Function can modify state
💵 Function is payable

文件描述表

合同描述表,stringu interfaceLabel)→地址(外部)

File Name SHA-1 Hash
contracts/privacy/IShield.sol c4b6e694bbdd4317e6fdc1e595e467cb10e5e1dd
contracts/privacy/IVerifier.sol ba4926ea2f01fde5d11362808fc1e573e69e31e3
contracts/privacy/Shield.sol 14415a0a47a10c0865993bdc3c8a350c683dc69f

assignManagement(addressu newManager)(内部)

Contract Type Bases
Function Name Visibility Mutability Modifiers
IShield Interface
getVerifier External ❗️ NO❗️
verifyAndPush External ❗️ 🛑 NO❗️
IVerifier Interface
verify External ❗️ 🛑 NO❗️
Shield Implementation IShield, MerkleTreeSHA256
Public ❗️ 🛑 MerkleTreeSHA256
getVerifier External ❗️ NO❗️
verifyAndPush External ❗️ 🛑 NO❗️

getManager()→地址(public)

Symbol Meaning
🛑 Function can modify state
💵 Function is payable

OrgRegistry

作为与ERC1820注册表交互的客户端的合同在所有者以外的任何帐户调用时抛出。

构造函数(地址

构造函数,它在实际部署静态注册表协定时接受ERC1820RegistryAddress的参数,此参数可以删除

setInterfaces()→bool(public)

,因为这是一个内部方法,继承此协定的任何协定都将被用作接口注册表的发送方

这将允许设置接口实现

getInterfaces()→bytes4(外部)

这将允许获取实现者的地址

,因为这是任何协定的内部方法继承此合同将被用来直接调用此函数organization registry ERC165Compatible包含接口兼容性检查

canImplementInterfaceForAddress(bytes32 interface hash,address addr)→bytes32(外部)

构造函数,该函数接受预先部署的ERC1820注册表的地址。理想情况下,此合同是一个公开的地址:0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24。本质上,构造函数设置接口并将当前协定注册到全局注册表中

assignManager(addressu newManager)(外部)

这是为组织注册表协定设置接口的实现

字符“^”对应于单个接口id的位异或,这些id是每个org registry contract中的函数此函数是一个助手函数,可以通过setInterfaces()获取设置的接口id。

registerOrg(地址地址地址,字节名称,字节消息发送点,字节信息密钥,字节字节信息发布,字节元数据)→bool(外部)

指示合约是否为地址“addr”实现接口“interfaceHash”。

更新org(地址_address,bytes32u name,bytesu messagingEndpoint,bytesu whispekey,bytes _zkpPublicKey,bytes _metadata)→bool(外部)

由于这是从注册器继承的方法,因此必须实现以下实现才能向ERC1820注册

寄存器接口(bytes32 _groupName,address _shieldAddress,address _shieldAddress,address _verifierAddress)→bool(外部)

,它允许为该合同实例设置新的管理器

getOrgCount()→uint256(外部)

注册组织的函数

更新组织的函数

getOrg(地址_address)→address,bytes32,bytes,bytes,bytes,bytes(external)

更新组织的函数

getInterfaceAddresses()→bytes32[],address[],address[](外部)

注册与OrgRegistry关联的接口名称的函数

函数注册组织的接口以便于查找

RegisterOrg(bytes32u name,addressu address,bytesmessagingEndpoint,bytesu whispekey,bytes _zkPublickey,bytes _metadata)

获取组织数量的函数帮助提取

更新org(bytes32名称,addressu address,字节

获取单个组织详细信息的函数

获取组织接口详细信息的函数

updateOrg(地址,字节32,字节,字节,字节,字节)→bool(外部)

此合同是ERC1820的正式实现登记处。有关详细信息,请参阅https://eips.ethereum.org/eips/eip-1820

查询地址是否实现接口以及通过哪个协定实现。

getOrgCount()→uint256(外部)

设置为地址实现特定接口的协定。只有为该地址定义的管理器才能设置它。(在设置新管理器之前,每个地址都是其自身的管理器。)

将“u newManager”设置为“u addr”的管理器。新的管理器将能够为”u addr’调用’setInterfaceImplementer’。

getOrg(地址)→address,bytes32,字节,字节,字节,字节(外部)

获取地址的经理。

ERC165Compatible

计算给定接口名称的keccak256哈希。

setInterfaces()→bool(公共)

使用协定是否实现ERC165接口更新缓存。

ERC1820Registry

getInterfaceImplementer(地址u addr,字节32→地址(外部)

setInterfaceImplementer(addr,bytes32接口hash,addressu implementer)(外部)

setManager(地址,addressu newManager(外部)

getManager(addr)→address(public)

interfaceHash(字符串接口名)→bytes32(外部)

updaterc165cache(地址_contract,bytes4 _interfaceId)(外部)

实现165interface(address _contract,bytes4u interfaceId)→bool(public)

实现Serc165InterfaceCache(地址合同,字节4接口ID)→bool(公共)

iserc165接口(bytes32接口hash)→bool(内部)

在不使用或更新缓存的情况下检查协定是否实现ERC165接口。

NotRowCall(地址合同,字节4接口ID)→uint256成功,uint256结果(内部)

检查哈希是否为ERC165接口(以28个零结尾)。

接口实现器集(地址地址地址,字节32接口哈希,地址实现器)

如果函数不存在,则不引发对协定的调用。

ManagerChanged(地址地址地址,地址newManager)

表示合同是“addr”的“interfaceHash”的“实现者”。

基本cookies

表示“newManager”是“addr”的新管理器的地址。

始终处于活动状态

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

分析cookies

我们使用可选的第三方分析cookies来了解您如何使用GitHub.com网站所以我们可以制造更好的产品。
您可以随时通过单击页面底部的Cookie首选项来更新您的选择。有关更多信息,请参阅我们的隐私声明。

implementsERC165Interface(address _contract, bytes4 _interfaceId) → bool (public)

implementsERC165InterfaceNoCache(address _contract, bytes4 _interfaceId) → bool (public)

我们使用基本Cookie来执行基本的网站功能,例如,它们用于让您登录。了解更多

isERC165Interface(bytes32 _interfaceHash) → bool (internal)

我们使用analytics Cookie来了解您如何使用我们的网站,以便我们能够使其变得更好,例如,它们用于收集有关您访问的页面以及完成一项任务需要多少次单击的信息。了解更多

noThrowCall(address _contract, bytes4 _interfaceId) → uint256 success, uint256 result (internal)

Make a call on a contract without throwing if the function does not exist.

InterfaceImplementerSet(address addr, bytes32 interfaceHash, address implementer)

Indicates a contract is the ‘implementer’ of ‘interfaceHash’ for ‘addr’.

ManagerChanged(address addr, address newManager)

Indicates ‘newManager’ is the address of the new manager for ‘addr’.

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

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

www.interchains.cc

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

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

提供最优质的资源集合

立即查看 了解详情