pragmasolidity^0.4.25;pragmaexperimentalABIEncoderV2;/**
@title ERC-**** 人力资本核算标准
@dev See https://github.com/freeworkculture/kazini/issues/11
Note: the ERC-165 identifier for this interface is 0xf23a6e61.
*/interfaceIERC_HUCAP{/**
@notice Compute the index value of an Agents BDI in the ecosystem.
@param _address Set the stance of an agent
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionupdateIndex()internalreturns(bool);/**
@notice Get the active/inactive and states of an Agent in the ecosystem.
@param _address Set the stance of an agent
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functioniam()viewpublicreturns(booliam_,IERC_HUCAP_TYPES.ISstate_);/**
@notice Fetch the bdi index value of an Agent in the ecosystem.
@param _address Set the stance of an agent
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionindex()viewpublicreturns(uint8index_);/**
@notice Count of Public Keys in key ring of an Agent in the ecosystem.
@param _address Set the stance of an agent
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionringLength()viewpublicreturns(uintringlength_);/**
@notice Get the PGP Public Key Id of an Agent in the ecosystem.
@param "" Set the stance of an agent
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionkeyId()viewpublicreturns(bytes32KEYID_);/**
@notice Get the merit data of an Agent in the ecosystem.
@param "" Set the stance of an agent
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionmerits()viewpublicreturns(uintexperience_,bytes32reputation_,bytes32talent_,uint8index_,bytes32hash_);/**
@notice Get the accreditation of an Agent in the ecosystem.
@param "" Set the stance of an agent
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionkbase()viewpublicreturns(IERC_HUCAP_TYPES.KBasekbase_);/**
@notice Get the desire of an Agent in the ecosystem.
@param _desire Pro-attitude
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functiondesire(bytes1_desire)viewexternalreturns(bytes32);/**
@notice Get the intention of an Agent in the ecosystem.
@param _intention Conduct-controlling pro-attitude
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionintention(bool_intention)viewexternalreturns(bytes32);/**
@notice Cycle the intention of an Agent in the ecosystem.
@param _intention Conduct-controlling pro-attitude
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionflipIntention()externalreturns(bool);/**
@notice Get the user data of an Agent in the ecosystem.
@param "" Conduct-controlling pro-attitude
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functiongetDoer()viewexternalreturns(bytes32fPrint,booliam_,bytes32email,bytes32fName,bytes32lName,uintage,bytes32data_);/**
@notice Get the belief data of an Agent in the ecosystem.
@param _kbase Source address
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functiongetBelief(IERC_HUCAP_TYPES.KBase_kbase)viewexternalreturns(bytes32country_,bytes32cAuthority_,bytes32score_);/**
@notice Get the desire data of an Agent in the ecosystem.
@param _desire Pro-attitides
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functiongetDesire(bytes1_desire)viewexternalreturns(bytes32,bool);/**
@notice Get the intention of an Agent in the ecosystem.
@param _intention Conduct-controlling pro-attitude
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functiongetIntention(bool_intention)viewexternalreturns(IERC_HUCAP_TYPES.IS,bytes32,uint256);/**
@notice Sign the Public Key of an Agent in the ecosystem.
@param _address Address of key to sign, must belong to an Agent
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionsign(address_address)publiconlyOwnerreturns(uint,boolsigned);/**
@notice Sign the Public Key of an Agent in the ecosystem.
@param "" internal helper function to add key in keyring
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionsign()externalonlyDoerreturns(uint,boolsigned);/**
@notice Revoke the Public Key of an Agent in the ecosystem.
@param _address Address of key to revoke, must belong to an Agent
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionrevoke(address_address)externalonlyDoerreturns(uint,boolrevoked);/**
@notice Revoke the Public Key of an Agent in the ecosystem.
@param "" internal helper function to remove key from keyring
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionrevoke()externalonlyDoerreturns(uint,boolrevoked);/**
@notice Set the trust level for a Public Key of an Agent in the ecosystem.
@param _level Degree of trust
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functiontrust(Trust_level)returns(bool);/**
@notice Increment the number of keys in the keyring of an Agent in the ecosystem.
@param _keyd Target key
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionincSigns(bytes32_keyd)externalProxyKeyreturns(uint);/**
@notice Decrement the number of keys in the keyring of an Agent in the ecosystem.
@param _keyd Target key
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functiondecSigns(bytes32_keyd)externalProxyKeyreturns(uint);/**
@notice Set the knowledge credentials of an Agent in the ecosystem.
@param _kbase Level of accreditation
@param _country Source country
@param _cAuthority Accreditation authority
@param _score Accreditation
@param _year Year of Accreditation
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionsetbdi(KBase_kbase,bytes32_country,bytes32_cAuthority,bytes32_score,uint_year)externalProxyBDIreturns(boolqualification_);/**
@notice Set the SNA metrics of an Agent in the ecosystem
@param _refMSD Minimum shortest distance
@param _refRank Rank of target key
@param _refSigned No of keys signed I have signed
@param _refSigs No. of keys that have signed my key
@param _refTrust Degree of tructThrows on any error rather than return a false flag to minimize user errors
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionsetbdi(uint_refMSD,uint_refRank,uint_refSigned,uint_refSigs,bytes32_refTrust)externalProxyBDIreturns(boolreputation_);/**
@notice Set the talents of an Agent in the ecosystem
@param _talent Agent's talent
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionsetbdi(bytes32_talent)externalProxyBDIreturns(booltalent_);/**
@notice Set the desires of an Agent in the ecosystem
@param _desire Pro-attitude
@param _goal A goal is an instatiated pro-attitude
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionsetbdi(bytes1_desire,Desire_goal)publiconlyDoerreturns(bool);/**
@notice Set the intention of an Agent in the ecosystem
@param _service Conducting-controlling pro-attitude
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionsetbdi(Intention_service)publiconlyDoerreturns(bool);/**
@notice Set the targeted intention of an Agent in the ecosystem.
@param _intention Conduct-controlling pro-attitude
@param _state Agent stance
@dev For the purpose of
Throws on any error rather than return a false flag to minimize user errors
*/functionintention(bool_intention,IERC_HUCAP_TYPES.IS_state)externalreturns(IERC_HUCAP_TYPES.IS);/* End of interface IERC_HUCAP */}
用户定义类型扩展接口
interfaceIERC_HUCAP_TYPES{/* Enums*/// Weights 1, 2, 4, 8, 16, 32, 64, 128 256
enumKBase{PRIMARY,SECONDARY,TERTIARY,CERTIFICATION,DIPLOMA,LICENSE,BACHELOR,MASTER,DOCTORATE}enumIS{CLOSED,CREATOR,CURATOR,ACTIVE,INACTIVE,RESERVED,PROVER}/* Structus */structClearance{bytes32Zero;bytes32Unknown;bytes32Generic;bytes32Poor;bytes32Casual;bytes32Partial;bytes32Complete;bytes32Ultimate;}/* End of interface IERC_HUCAP_TYPES */}
Web-of-trust 扩展接口
pragmasolidity^0.4.25;pragmaexperimentalABIEncoderV2;interfaceIERC_HUCAP_KEYSIGNING_EXTENSION{bytes32constantpublic_InterfaceId_ERC165_="CREATOR 0.0118 XOR OF ALL FUNCTIONS IN THE INTERFACE";// Complies to ERC165
// KEY MASKING TABLE
// bytes32 constant public MASK = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
// bytes32 constant public KEYID = 0xffffffffffffffffffffffffffffffffff90EBAC34FC40EAC30FC9CB464A2E56; // EXAMPLE PGP PUBLIC KEY ID
// bytes32 constant public KEY_CERTIFICATION = 0x01ffffffffffffff << 192; // “C” Key Certification
// bytes32 constant public SIGN_DATA = 0x02ffffffffffffff << 192; // “S” Sign Data
// bytes32 constant public ENCRYPT_COMMUNICATIONS = 0x04ffffffffffffff << 192; // “E” Encrypt Communications
// Clearance constant public Trust = 0x03ff << 192; // Trust: Unknown
// BYTES32 Value with
// Public Key Id, masking
// Key Certification masking
// Split Key masking
// Generic masking
// Ordinary masking
// Trust.Unknown masking
// bytes32 constant public DOER = 0x11ff10ff100f03ffff00ffffffffffffffff90EBAC34FC40EAC30FC9CB464A2E56;
bytes32constantpublicKEY_CERTIFICATION=0x01ffffffffffffff<<192;// “C” Key Certification
bytes32constantpublicSIGN_DATA=0x02ffffffffffffff<<192;// “S” Sign Data
bytes32constantpublicENCRYPT_COMMUNICATIONS=0x04ffffffffffffff<<192;// “E” Encrypt Communications
bytes32constantpublicENCRYPT_STORAGE=0x08ffffffffffffff<<192;// “E” Encrypt Storage
bytes32constantpublicSPLIT_KEY=0x10ffffffffffffff<<192;// Split key
bytes32constantpublicAUTHENTICATION=0x20ffffffffffffff<<192;// “A” Authentication
bytes32constantpublicMULTI_SIGNATURE=0x80ffffffffffffff<<192;// Held by more than one person
bytes32constantpublicTRUST_AMOUNT=0xffffffffffff00ff<<192;bytes32constantpublicBINARY_DOCUMENT=0xffff00ffffffffff<<192;// 0x00: Signature of a binary document.
bytes32constantpublicCANONICAL_DOCUMENT=0xffff01ffffffffff<<192;// 0x01: Signature of a canonical text document.
bytes32constantpublicSTANDALONE_SIGNATURE=0xffff02ffffffffff<<192;// 0x02: Standalone signature.
bytes32constantpublicGENERIC=0xffff10ffffffffff<<192;// 0x10: Generic certification of a User ID and Public-Key packet.
bytes32constantpublicPERSONA=0xffff11ffffffffff<<192;// 0x11: Persona certification of a User ID and Public-Key packet.
bytes32constantpublicCASUAL=0xffff12ffffffffff<<192;// 0x12: Casual certification of a User ID and Public-Key packet.
bytes32constantpublicPOSITIVE=0xffff13ffffffffff<<192;// 0x13: Positive certification of a User ID and Public-Key packet.
bytes32constantpublicSUBKEY_BINDING=0xffff18ffffffffff<<192;// 0x18: Subkey Binding Signature
bytes32constantpublicPRIMARY_KEY_BINDING=0xffff19ffffffffff<<192;// 0x19: Primary Key Binding Signature
bytes32constantpublicDIRECTLY_ON_KEY=0xffff1Fffffffffff<<192;// 0x1F: Signature directly on a key
bytes32constantpublicKEY_REVOCATION=0xffff20ffffffffff<<192;// 0x20: Key revocation signature
bytes32constantpublicSUBKEY_REVOCATION=0xffff28ffffffffff<<192;// 0x28: Subkey revocation signature
bytes32constantpublicCERTIFICATION_REVOCATION=0xffff30ffffffffff<<192;// 0x30: Certification revocation signature
bytes32constantpublicTIMESTAMP=0xffff40ffffffffff<<192;// 0x40: Timestamp signature.
bytes32constantpublicTHIRD_PARTY_CONFIRMATION=0xffff50ffffffffff<<192;// 0x50: Third-Party Confirmation signature.
bytes32constantpublicORDINARY=0xffffffff100fffff<<192;bytes32constantpublicINTRODUCER=0xffffffff010fffff<<192;bytes32constantpublicISSUER=0xffffffff001fffff<<192;// EDGES MASKING TABLE
ClearanceinternalTRUST=Clearance({Zero:0x01ff<<192,Unknown:0x03ff<<192,Generic:0x07ff<<192,Poor:0xF0ff<<192,Casual:0xF1ff<<192,Partial:0xF3ff<<192,Complete:0xF7ff<<192,Ultimate:0xFFff<<192});/**
/// @notice Cycle through state transition of an Agent in the ecosystem.
/// @param _address toggle on/off a doer agent
// @dev `anybody` can retrieve the talent data in the contract
*/functionflipTo(address_address)externalonlyOwnerreturns(IS);/**
/// @notice Turn Agent in the ecosystem to on/off.
/// @param _address toggle on/off a doer agent
// @dev `anybody` can retrieve the talent data in the contract
*/functiontoggle(address_address)externalonlyOwnerreturns(bool);/**
/// @notice Set the trust level of an Agent in the ecosystem.
/// @param _level toggle on/off a doer agent
// @dev `anybody` can retrieve the talent data in the contract
*/functiontrust(Trust_level)returns(bytes32Trust);eventLogCall(addressindexedfrom,addressindexedto,addressindexedorigin,bytes_data);/* End of interface IERC_HUCAP_KEYSIGNING_EXTENSION */}
人力资本核算扩展接口
pragmasolidity^0.4.25;pragmaexperimentalABIEncoderV2;interfaceIERC_HUCAP_TRACKUSERS_EXTENSION{/// @notice Instantiate an Agent in the ecosystem with default data.
/// @param _address initialise a doer agent
// @dev `anybody` can retrieve the talent data in the contract
functioninitAgent(Doers_address)externalonlyControlledreturns(bool);/// @notice Get the data by uuid of an Agent in the ecosystem.
/// @param _uuid Get the address of a unique uid
// @dev `anybody` can retrieve the talent data in the contract
*/functiongetAgent(bytes32_uuid)viewexternalreturns(address);/// @notice Get the data of all Talents in the ecosystem.
/// @param _address Query if address belongs to an agent
// @dev `anybody` can retrieve the talent data in the contract
*/functioniam(address_address)viewpublicreturns(bool);/// @notice Get the data of all Talents in the ecosystem.
/// @param _address Query if address belongs to a doer
// @dev `anybody` can retrieve the talent data in the contract
*/functionisDoer(address_address)viewpublicreturns(IS);/// @notice Get the number of doers that can be spawned by a Creators.
/// The query condition of the contract
// @dev `anybody` can retrieve the count data in the contract
*/functiongetAgent(address_address)viewpublicreturns(bytes32keyid_,ISstate_,boolactive_,uintmyDoers_);/// @notice Get the data of all Talents in the ecosystem.
/// @param _talent The talent whose frequency is being queried
// @dev `anybody` can retrieve the talent data in the contract
*/functiongetTalents(bytes32_talent)viewexternalreturns(uinttalentK_,uinttalentI_,uinttalentR_,uinttalentF_);/// @notice Increment a kind of talent in the ecosystem.
/// @param The talent whose frequency is being queried
// @dev `anybody` can retrieve the talent data in the contract
*/functionincTalent()payablepubliconlyDoerreturns(bool);/// @notice Decrement a kind of talent in the ecosystem..
/// @param The talent whose frequency is being queried
// @dev `anybody` can retrieve the talent data in the contract
*/functiondecTalent()payablepubliconlyDoerreturns(bool);/// @notice Set the Public-Key Id of an Agent in the ecosystem.
/// @param _address Set the Public-key Id of an agent
// @dev `anybody` can retrieve the talent data in the contract
*/functionsetAgent(address_address,bytes32_keyId)externalonlyControlledreturns(bytes32);/// @notice Transition the states of an Agent in the ecosystem.
/// @param _address Set the stance of an agent
// @dev `anybody` can retrieve the talent data in the contract
*/functionsetAgent(address_address,IS_state)externalonlyControlledreturns(IS);/// @notice Set the active status of an Agent in the ecosystem.
/// @param _address Toggle the true/false status of an agent
// @dev `anybody` can retrieve the talent data in the contract
*/functionsetAgent(address_address,bool_active)externalonlyControlledreturns(bool);/// @notice Set the data of all Intentions of Agents in the ecosystem.
/// @param _serviceId Track number of offers available
// @dev `anybody` can retrieve the talent data in the contract
*/functionsetAllPromises(bytes32_serviceId)externalonlyControlled;/* End of interface IERC_HUCAP_TRACKUSERS_EXTENSION */}