Skip to content

Commit

Permalink
Merge pull request #158 from njgheorghita/metadata
Browse files Browse the repository at this point in the history
Add example metadata compiler output for smart contract examples
  • Loading branch information
njgheorghita authored Jul 9, 2020
2 parents 6daa7a4 + 3ff820e commit b50b61d
Show file tree
Hide file tree
Showing 25 changed files with 34 additions and 11 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ complexity. Source for use case examples can be found in the
[examples/](https://github.com/ethpm/ethpm-spec/blob/master/examples/)
directory of this repository.

Each example directory contains..
- `1.0.0.json`: ethpm v2 manifest (deprecated)
- `1.0.0-pretty.json`: ethpm v2 manifest (pretty printed) (deprecated)
- `v3.json`: ethpm v3 manifest
- `v3-pretty.json`: ethpm v3 manifest (pretty printed)
- `contracts/`: Directory containing the source contracts for the example
- `metadata/`: Directory containing example ethpm compliant [compiler metadata output](https://solidity.readthedocs.io/en/latest/metadata.html) for each example contract

## Specification

The EthPM package manifest format is formally specified as a
Expand Down
1 change: 1 addition & 0 deletions examples/escrow/metadata/escrow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"compilers":[{"contractTypes":["Escrow"],"name":"solc","settings":{"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[]},"version":"0.6.8+commit.0bbfe453"}],"contractTypes":{"Escrow":{"abi":[{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"recipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"releaseFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sender","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}],"devdoc":{"author":"Piper Merriam <pipermerriam@gmail.com>","methods":{"releaseFunds()":{"details":"Releases the escrowed funds to the other party."}},"title":"Contract for holding funds in escrow between two semi trusted parties."},"userdoc":{"methods":{"releaseFunds()":{"notice":"This will release the escrowed funds to the other party."}}}}},"manifest":"ethpm/3","sources":{"Escrow.sol":{"checksum":{"algorithm":"keccak256","hash":"0x1f5de85c9182f10b821606d00fbaaf95fe672c73f3eab961c83b791c7c38a31e"},"installPath":"./Escrow.sol","license":"MIT","type":"solidity","urls":["bzz-raw://456de283c50b9eaebfd1f9425f25a8f51506542e9617e3259e20d4919d923874","dweb:/ipfs/QmNLpdCi4UakwJ9rBoL7rDnEzNeA6f8uvKbiMhZVqTucu1"]},"SafeSendLib.sol":{"checksum":{"algorithm":"keccak256","hash":"0xad8a6c582251d77d022d1426e45b28c5c5609576bd0a8bf0dd6b3d36ceadb2a4"},"installPath":"./SafeSendLib.sol","license":"MIT","type":"solidity","urls":["bzz-raw://39f49be8b8939d1fd0fa855b75ad24327c09d5e72826d24f15344f7f0e805b7e","dweb:/ipfs/QmbEnqvCSAAYwQ474S1vCSBdMgdiRZ4gZWEmSmdXepXQJq"]}}}
1 change: 1 addition & 0 deletions examples/escrow/metadata/safe-send-lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"compilers":[{"contractTypes":["SafeSendLib"],"name":"solc","settings":{"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[]},"version":"0.6.8+commit.0bbfe453"}],"contractTypes":{"SafeSendLib":{"abi":[],"devdoc":{"author":"Piper Merriam <pipermerriam@gmail.com>","methods":{"sendOrThrow(address,uint256)":{"details":"Attempts to send the specified amount to the recipient throwing an error if it fails","params":{"recipient":"The address that the funds should be to.","value":"The amount in wei that should be sent."}}},"title":"Library for safe sending of ether."},"userdoc":{"methods":{}}}},"manifest":"ethpm/3","sources":{"SafeSendLib.sol":{"checksum":{"algorithm":"keccak256","hash":"0xad8a6c582251d77d022d1426e45b28c5c5609576bd0a8bf0dd6b3d36ceadb2a4"},"installPath":"./SafeSendLib.sol","license":"MIT","type":"solidity","urls":["bzz-raw://39f49be8b8939d1fd0fa855b75ad24327c09d5e72826d24f15344f7f0e805b7e","dweb:/ipfs/QmbEnqvCSAAYwQ474S1vCSBdMgdiRZ4gZWEmSmdXepXQJq"]}}}
1 change: 1 addition & 0 deletions examples/owned/metadata/owned.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"compilers":[{"contractTypes":["Owned"],"name":"solc","settings":{"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[]},"version":"0.6.8+commit.0bbfe453"}],"contractTypes":{"Owned":{"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"}],"devdoc":{"methods":{}},"userdoc":{"methods":{}}}},"manifest":"ethpm/3","sources":{"Owned.sol":{"checksum":{"algorithm":"keccak256","hash":"0x945179c4c48e9ff8e6a387d0f109f45f35d3ba91af9eef28c9ecd3126eec44a3"},"installPath":"./Owned.sol","license":"MIT","type":"solidity","urls":["bzz-raw://4bcfddce5141a8c816b7316de4b7625147e8c84166a893deec3171196611cdfa","dweb:/ipfs/QmU8QUSt56ZoBDJgjjXvAZEPro9LmK1m2gjVG5Q4s9x29W"]}}}
1 change: 1 addition & 0 deletions examples/safe-math-lib/metadata/safe-math-lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"compilers":[{"contractTypes":["SafeMathLib"],"name":"solc","settings":{"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[]},"version":"0.6.8+commit.0bbfe453"}],"contractTypes":{"SafeMathLib":{"abi":[{"inputs":[{"internalType":"uint256","name":"a","type":"uint256"},{"internalType":"uint256","name":"b","type":"uint256"}],"name":"safeAdd","outputs":[{"internalType":"uint256","name":"c","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"a","type":"uint256"},{"internalType":"uint256","name":"b","type":"uint256"}],"name":"safeSub","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"}],"devdoc":{"author":"Piper Merriam <pipermerriam@gmail.com>","methods":{"safeAdd(uint256,uint256)":{"details":"Adds a and b, throwing an error if the operation would cause an overflow.","params":{"a":"The first number to add","b":"The second number to add"}},"safeSub(uint256,uint256)":{"details":"Subtracts b from a, throwing an error if the operation would cause an underflow.","params":{"a":"The number to be subtracted from","b":"The amount that should be subtracted"}}},"title":"Safe Math Library"},"userdoc":{"methods":{}}}},"manifest":"ethpm/3","sources":{"SafeMathLib.sol":{"checksum":{"algorithm":"keccak256","hash":"0x4d674e5734cd1451d7aca956e3d12ae273ceda8755c832b58d90969ffc6d3c17"},"installPath":"./SafeMathLib.sol","license":"MIT","type":"solidity","urls":["bzz-raw://efc0fe47747aa4139ad61d55b20efb0b2a6d9103323803b4d508481958217b7c","dweb:/ipfs/QmeyYahfHxPSoytQ2rPH2JUURin24sPvaMo6o6tKghwkAg"]}}}
1 change: 1 addition & 0 deletions examples/standard-token/metadata/abstract-token.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"compilers":[{"contractTypes":["Token"],"name":"solc","settings":{"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[]},"version":"0.6.8+commit.0bbfe453"}],"contractTypes":{"Token":{"abi":[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"remaining","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"supply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"author":"Stefan George - <stefan.george@consensys.net>","methods":{},"title":"Abstract token contract - Functions to be implemented by token contracts."},"userdoc":{"methods":{},"notice":"Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20"}}},"manifest":"ethpm/3","sources":{"AbstractToken.sol":{"checksum":{"algorithm":"keccak256","hash":"0xab42c23627c75c3fa92e6435b245fc3771c7c424c7feb4ffc99b12aeb662f997"},"installPath":"./AbstractToken.sol","license":"MIT","type":"solidity","urls":["bzz-raw://47b6603fb029c7b972bf21c1704ca628c4810634cda8eed8859afed798857c96","dweb:/ipfs/QmSBYuGKSH2veDepMbFQu3XVStYRCvuqFjUV7YCPufeHJz"]}}}
1 change: 1 addition & 0 deletions examples/standard-token/metadata/standard-token.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"compilers":[{"contractTypes":["StandardToken"],"name":"solc","settings":{"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[]},"version":"0.6.8+commit.0bbfe453"}],"contractTypes":{"StandardToken":{"abi":[{"inputs":[{"internalType":"uint256","name":"_totalSupply","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"remaining","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"author":"Stefan George - <stefan.george@consensys.net>","methods":{"allowance(address,address)":{"details":"Returns number of allowed tokens for given address.","params":{"_owner":"Address of token owner.","_spender":"Address of token spender."}},"approve(address,uint256)":{"details":"Sets approved amount of tokens for spender. Returns success.","params":{"_spender":"Address of allowed account.","_value":"Number of approved tokens."}},"balanceOf(address)":{"details":"Returns number of tokens owned by given address.","params":{"_owner":"Address of token owner."}},"transfer(address,uint256)":{"details":"Transfers sender's tokens to a given address. Returns success.","params":{"_to":"Address of token receiver.","_value":"Number of tokens to transfer."}},"transferFrom(address,address,uint256)":{"details":"Allows allowed third party to transfer tokens from one address to another. Returns success.","params":{"_from":"Address from where tokens are withdrawn.","_to":"Address to where tokens are sent.","_value":"Number of tokens to transfer."}}},"title":"Standard token contract"},"userdoc":{"methods":{}}}},"manifest":"ethpm/3","sources":{"AbstractToken.sol":{"checksum":{"algorithm":"keccak256","hash":"0xab42c23627c75c3fa92e6435b245fc3771c7c424c7feb4ffc99b12aeb662f997"},"installPath":"./AbstractToken.sol","license":"MIT","type":"solidity","urls":["bzz-raw://47b6603fb029c7b972bf21c1704ca628c4810634cda8eed8859afed798857c96","dweb:/ipfs/QmSBYuGKSH2veDepMbFQu3XVStYRCvuqFjUV7YCPufeHJz"]},"StandardToken.sol":{"checksum":{"algorithm":"keccak256","hash":"0xff79ded4ad8e86320abfe51b9b98aba598ff6b071bc84cf45f4b74ec028063ca"},"installPath":"./StandardToken.sol","license":"MIT","type":"solidity","urls":["bzz-raw://f428e1fdb75ab6b33f76241a113d8cfd473a272ed7c194a6d405fbf2d835ea33","dweb:/ipfs/QmUofKBtNJVaqoSAtnHfrarJyyLm1oMUTAK4yCtnmYMJVy"]}}}
2 changes: 1 addition & 1 deletion examples/transferable/contracts/Transferable.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.8;

import {Owned} from "owned/contracts/Owned.sol";
import {Owned} from "owned/Owned.sol";

contract Transferable is Owned {
event OwnerChanged(address indexed prevOwner, address indexed newOwner);
Expand Down
1 change: 1 addition & 0 deletions examples/transferable/metadata/owned.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"compilers":[{"contractTypes":["Owned"],"name":"solc","settings":{"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[]},"version":"0.6.8+commit.0bbfe453"}],"contractTypes":{"Owned":{"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"}],"devdoc":{"methods":{}},"userdoc":{"methods":{}}}},"manifest":"ethpm/3","sources":{"owned/Owned.sol":{"checksum":{"algorithm":"keccak256","hash":"0x945179c4c48e9ff8e6a387d0f109f45f35d3ba91af9eef28c9ecd3126eec44a3"},"installPath":"./owned/Owned.sol","license":"MIT","type":"solidity","urls":["bzz-raw://4bcfddce5141a8c816b7316de4b7625147e8c84166a893deec3171196611cdfa","dweb:/ipfs/QmU8QUSt56ZoBDJgjjXvAZEPro9LmK1m2gjVG5Q4s9x29W"]}}}
1 change: 1 addition & 0 deletions examples/transferable/metadata/transferable.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"compilers":[{"contractTypes":["Transferable"],"name":"solc","settings":{"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[]},"version":"0.6.8+commit.0bbfe453"}],"contractTypes":{"Transferable":{"abi":[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"prevOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"methods":{}},"userdoc":{"methods":{}}}},"manifest":"ethpm/3","sources":{"Transferable.sol":{"checksum":{"algorithm":"keccak256","hash":"0x0c96a155eed70772ce4500af8b4f9d63713ef6136f65a98b038236390a7d4e94"},"installPath":"./Transferable.sol","license":"MIT","type":"solidity","urls":["bzz-raw://97326467c62e74567c3000fbb436c6528f5c956666a28a81a266c31b72dfad20","dweb:/ipfs/QmVrpBNDizFkkYiD5NQtEy15VGgEGycBbEBRRax2HifucM"]},"owned/Owned.sol":{"checksum":{"algorithm":"keccak256","hash":"0x945179c4c48e9ff8e6a387d0f109f45f35d3ba91af9eef28c9ecd3126eec44a3"},"installPath":"./owned/Owned.sol","license":"MIT","type":"solidity","urls":["bzz-raw://4bcfddce5141a8c816b7316de4b7625147e8c84166a893deec3171196611cdfa","dweb:/ipfs/QmU8QUSt56ZoBDJgjjXvAZEPro9LmK1m2gjVG5Q4s9x29W"]}}}
2 changes: 1 addition & 1 deletion examples/transferable/v3-pretty.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"type": "solidity",
"installPath": "./Transferable.sol",
"urls": [
"ipfs://QmdWB74Ca8tyXtS3UxzJqcvETv3LLkacX2ywfJfNNWVnYt"
"ipfs://QmVrpBNDizFkkYiD5NQtEy15VGgEGycBbEBRRax2HifucM"
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion examples/transferable/v3.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"buildDependencies":{"owned":"ipfs://QmcxvhkJJVpbxEAa6cgW3B6XwPJb79w9GpNUv2P2THUzZR"},"manifest":"ethpm/3","meta":{"authors":["Piper Merriam <pipermerriam@gmail.com>"],"description":"Reusable contracts which implement a privileged 'owner' model for authorization with functionality for transfering ownership.","keywords":["authorization"],"license":"MIT"},"name":"transferable","sources":{"Transferable.sol":{"installPath":"./Transferable.sol","type":"solidity","urls":["ipfs://QmdWB74Ca8tyXtS3UxzJqcvETv3LLkacX2ywfJfNNWVnYt"]}},"version":"1.0.0"}
{"buildDependencies":{"owned":"ipfs://QmcxvhkJJVpbxEAa6cgW3B6XwPJb79w9GpNUv2P2THUzZR"},"manifest":"ethpm/3","meta":{"authors":["Piper Merriam <pipermerriam@gmail.com>"],"description":"Reusable contracts which implement a privileged 'owner' model for authorization with functionality for transfering ownership.","keywords":["authorization"],"license":"MIT"},"name":"transferable","sources":{"Transferable.sol":{"installPath":"./Transferable.sol","type":"solidity","urls":["ipfs://QmVrpBNDizFkkYiD5NQtEy15VGgEGycBbEBRRax2HifucM"]}},"version":"1.0.0"}
2 changes: 1 addition & 1 deletion examples/wallet-with-send/contracts/WalletWithSend.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.6.8;


import {Wallet} from "./wallet/contracts/Wallet.sol";
import {Wallet} from "./wallet/Wallet.sol";


/// @title Wallet contract with simple send and approval spending functionality
Expand Down
1 change: 1 addition & 0 deletions examples/wallet-with-send/metadata/owned.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"compilers":[{"contractTypes":["Owned"],"name":"solc","settings":{"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[]},"version":"0.6.8+commit.0bbfe453"}],"contractTypes":{"Owned":{"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"}],"devdoc":{"methods":{}},"userdoc":{"methods":{}}}},"manifest":"ethpm/3","sources":{"wallet/owned/Owned.sol":{"checksum":{"algorithm":"keccak256","hash":"0x945179c4c48e9ff8e6a387d0f109f45f35d3ba91af9eef28c9ecd3126eec44a3"},"installPath":"./wallet/owned/Owned.sol","license":"MIT","type":"solidity","urls":["bzz-raw://4bcfddce5141a8c816b7316de4b7625147e8c84166a893deec3171196611cdfa","dweb:/ipfs/QmU8QUSt56ZoBDJgjjXvAZEPro9LmK1m2gjVG5Q4s9x29W"]}}}
Loading

0 comments on commit b50b61d

Please sign in to comment.