The Social Contract is a relationship map between addresses. Keys are hashed
and used to index the mapping. Values are stored raw for retrieval.
Anticipated Common Use Cases:
set (self, self, 'profile:avatar', 'nftAddress,tokenId');
get (contract, contract, 'keyList');
set (contract, user, 'member', 'true');
set (user, contract, 'member' 'true');
isMutual (contract, user, 'member');
approve (contract, 'reputation', true);
canEdit (contract, user, 'reputation');
set(user, contract, 'reputation', '100'); from contract
set(contract, user, 'reputation', '100'); from contract
Function ToC:
set(address _sender, address _recipient, string memory _key, string memory _value)
get(address _sender, address _recipient, string memory _key) returns (string memory)
isMutual( address _sender, address _recipient, string memory _key) returns (bool)
approve(address _recipient, string memory _key, bool _value)
canEdit(address _sender, address _recipient, string memory _key) returns (bool)
Social
Deployment
โ Should set the right owner
Self Attestation
โ Should set and get correct value for self, on self
โ Should emit EdgeAdded
โ Should change value for self, on self
Unilateral Attestation
โ Should set and get correct value for another address, on self
โ Should change value for another address, on self
โ Should fail to set value for self, on another address
Bidirectional Attestation
โ Should set and confirm mutual attestation
โ Should emit EdgeAdded twice
โ Should not confirm mutual attestation on unilateral attestation
โ Should not confirm mutual attestation if a mutual attestation changes
Unilateral Attestation with Approval
โ Should grant permission to a specific key
โ Should emit ApprovalChanged
โ Should fail to set value to a specific key on a remote address, without approval
โ Should set value to a specific key on a remote address, after approved
โ Should set value to a specific key on a remote address, if ApproveAll
ยท-------------------------|---------------------------|-------------|-----------------------------ยท
| Solc version: 0.8.9 ยท Optimizer enabled: true ยท Runs: 300 ยท Block limit: 30000000 gas โ
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท
| Methods โ
ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
| Contract ยท Method ยท Min ยท Max ยท Avg ยท # calls ยท usd (avg) โ
ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
| Social ยท approve ยท 48259 ยท 48367 ยท 48340 ยท 4 ยท - โ
ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
| Social ยท set ยท 35672 ยท 56561 ยท 49464 ยท 22 ยท - โ
ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
| Deployments ยท ยท % of limit ยท โ
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
| Social ยท - ยท - ยท 579666 ยท 1.9 % ยท - โ
ยท-------------------------|-------------|-------------|-------------|---------------|-------------ยท
This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a script that deploys that contract.
Try running some of the following tasks:
npx hardhat help
npx hardhat test
GAS_REPORT=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.ts