Skip to content

Commit 167ca23

Browse files
committed
Add _ethpm_packages dir to each example
1 parent 6daa7a4 commit 167ca23

File tree

46 files changed

+680
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+680
-2
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,22 @@ complexity. Source for use case examples can be found in the
6565
[examples/](https://github.com/ethpm/ethpm-spec/blob/master/examples/)
6666
directory of this repository.
6767

68+
Each example directory contains..
69+
- `1.0.0.json`: ethpm v2 manifest (deprecated)
70+
- `1.0.0-pretty.json`: ethpm v2 manifest (pretty printed) (deprecated)
71+
- `v3.json`: ethpm v3 manifest
72+
- `v3-pretty.json`: ethpm v3 manifest (pretty printed)
73+
- `contracts/`: Directory containing the source contracts for the example
74+
- `_ethpm_packages/`: Example directory for how the v3 manifest should be written to disk (installed) by a framework according to the [write-to-disk spec](https://ethpm-cli.readthedocs.io/en/latest/disk.html#ethpm-packages).
75+
6876
## Specification
6977

7078
The EthPM package manifest format is formally specified as a
7179
[JSON-Schema](http://json-schema.org).
7280

73-
Please see [**Package Specification**](http://ethpm.github.io/ethpm-spec/package-spec.html)
81+
Please see [**Package Specification**](http://ethpm.github.io/ethpm-spec/v3-package-spec.html)
7482
for a natural-language description of this schema, or see
75-
[package.spec.json](https://github.com/ethpm/ethpm-spec/blob/master/spec/package.spec.json)
83+
[package.spec.json](https://github.com/ethpm/ethpm-spec/blob/master/spec/v3.spec.json)
7684
for the machine-readable version.
7785

7886
## Contributing
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.6.8;
3+
4+
5+
import {SafeSendLib} from "./SafeSendLib.sol";
6+
7+
8+
/// @title Contract for holding funds in escrow between two semi trusted parties.
9+
/// @author Piper Merriam <[email protected]>
10+
contract Escrow {
11+
using SafeSendLib for address;
12+
13+
address public sender;
14+
address public recipient;
15+
16+
constructor(address _recipient) public {
17+
sender = msg.sender;
18+
recipient = _recipient;
19+
}
20+
21+
/// @dev Releases the escrowed funds to the other party.
22+
/// @notice This will release the escrowed funds to the other party.
23+
function releaseFunds() public {
24+
if (msg.sender == sender) {
25+
recipient.sendOrThrow(address(this).balance);
26+
} else if (msg.sender == recipient) {
27+
sender.sendOrThrow(address(this).balance);
28+
} else {
29+
revert();
30+
}
31+
}
32+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.6.8;
3+
4+
5+
/// @title Library for safe sending of ether.
6+
/// @author Piper Merriam <[email protected]>
7+
library SafeSendLib {
8+
/// @dev Attempts to send the specified amount to the recipient throwing an error if it fails
9+
/// @param recipient The address that the funds should be to.
10+
/// @param value The amount in wei that should be sent.
11+
function sendOrThrow(address recipient, uint value) public returns (bool) {
12+
if (value > address(this).balance)
13+
revert();
14+
15+
if (!payable(recipient).send(value))
16+
revert();
17+
18+
return true;
19+
}
20+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"compilers":[{"contractTypes":["Escrow","SafeSendLib"],"name":"solc","settings":{"optimize":false},"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"}],"deploymentBytecode":{"bytecode":"0x608060405234801561001057600080fd5b506040516104e83803806104e88339818101604052602081101561003357600080fd5b8101908080519060200190929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610413806100d56000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806366d003ac1461004657806367e404ce1461009057806369d89575146100da575b600080fd5b61004e6100e4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61009861010a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100e261012f565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561028257600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16730000000000000000000000000000000000000000639341231c9091476040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060206040518083038186803b15801561024157600080fd5b505af4158015610255573d6000803e3d6000fd5b505050506040513d602081101561026b57600080fd5b8101908080519060200190929190505050506103db565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103d5576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16730000000000000000000000000000000000000000639341231c9091476040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060206040518083038186803b15801561039457600080fd5b505af41580156103a8573d6000803e3d6000fd5b505050506040513d60208110156103be57600080fd5b8101908080519060200190929190505050506103da565b600080fd5b5b56fea2646970667358221220c0256c8fdbb9d70e72b54b5dcae800eb0d0723c366103209d2e40e60b6f352e564736f6c63430006080033","linkReferences":[{"length":20,"name":"SafeSendLib","offsets":[660,999]}]},"devdoc":{"author":"Piper Merriam <[email protected]>","methods":{"releaseFunds()":{"details":"Releases the escrowed funds to the other party."}},"title":"Contract for holding funds in escrow between two semi trusted parties."},"runtimeBytecode":{"bytecode":"0x608060405234801561001057600080fd5b50600436106100415760003560e01c806366d003ac1461004657806367e404ce1461009057806369d89575146100da575b600080fd5b61004e6100e4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61009861010a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100e261012f565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561028257600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16730000000000000000000000000000000000000000639341231c9091476040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060206040518083038186803b15801561024157600080fd5b505af4158015610255573d6000803e3d6000fd5b505050506040513d602081101561026b57600080fd5b8101908080519060200190929190505050506103db565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103d5576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16730000000000000000000000000000000000000000639341231c9091476040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060206040518083038186803b15801561039457600080fd5b505af41580156103a8573d6000803e3d6000fd5b505050506040513d60208110156103be57600080fd5b8101908080519060200190929190505050506103da565b600080fd5b5b56fea2646970667358221220c0256c8fdbb9d70e72b54b5dcae800eb0d0723c366103209d2e40e60b6f352e564736f6c63430006080033","linkReferences":[{"length":20,"name":"SafeSendLib","offsets":[447,786]}]},"sourceId":"Escrow.sol"},"SafeSendLib":{"abi":[],"deploymentBytecode":{"bytecode":"0x610132610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361060335760003560e01c80639341231c146038575b600080fd5b818015604357600080fd5b50608d60048036036040811015605857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505060a7565b604051808215151515815260200191505060405180910390f35b60004782111560b557600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f1935050505060f257600080fd5b600190509291505056fea26469706673582212203471502f8b953b5622ae380d01fe3a6c574e1b7ae3ba80ebae95d88771f6714564736f6c63430006080033"},"devdoc":{"author":"Piper Merriam <[email protected]>","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."},"runtimeBytecode":{"bytecode":"0x730000000000000000000000000000000000000000301460806040526004361060335760003560e01c80639341231c146038575b600080fd5b818015604357600080fd5b50608d60048036036040811015605857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505060a7565b604051808215151515815260200191505060405180910390f35b60004782111560b557600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f1935050505060f257600080fd5b600190509291505056fea26469706673582212203471502f8b953b5622ae380d01fe3a6c574e1b7ae3ba80ebae95d88771f6714564736f6c63430006080033"},"sourceId":"SafeSendLib.sol"}},"deployments":{"blockchain://d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3/block/752820c0ad7abc1200f9ad42c4adc6fbb4bd44b5bed4667990e64565102c1ba6":{"Escrow":{"address":"0x41B8E7F94F92aE75266054f7029b2f5C30D19171","block":"0xe29b6d17dc4da99bbd985dd62c69cf70f3437c2c104eee24fa7a41d73e4a6524","contractType":"Escrow","runtimeBytecode":{"linkDependencies":[{"offsets":[447,786],"type":"reference","value":"SafeSendLib"}]},"transaction":"0x6f1bdf9e303c866dc74452cb418e05737c9b8c3a5ddfcd1c09509d5ec1fc23e9"},"SafeSendLib":{"address":"0x379EdD01a8c6E56649C092D2699eA877CC89414B","block":"0xb05e03a8ba4b744d5754f93fcb9c48e836fa624d9c2942c7081661a0e9e3134b","contractType":"SafeSendLib","transaction":"0x32a498696bd9924f34ac01f755c126d5628947f9935188098dc8eb6f7a30c418"}}},"manifest":"ethpm/3","name":"escrow","sources":{"./Escrow.sol":{"installPath":"./Escrow.sol","type":"solidity","urls":["ipfs://QmNLpdCi4UakwJ9rBoL7rDnEzNeA6f8uvKbiMhZVqTucu1"]},"./SafeSendLib.sol":{"installPath":"./SafeSendLib.sol","type":"solidity","urls":["ipfs://QmbEnqvCSAAYwQ474S1vCSBdMgdiRZ4gZWEmSmdXepXQJq"]}},"version":"1.0.0"}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"escrow": {
3+
"alias": "escrow",
4+
"install_uri": "ipfs://QmNpLojZo471M357NTUZ1qKDwjUZrfYctWhzPtNFEXcSaL",
5+
"registry_address": null,
6+
"resolved_content_hash": "QmNpLojZo471M357NTUZ1qKDwjUZrfYctWhzPtNFEXcSaL",
7+
"resolved_package_name": "escrow",
8+
"resolved_uri": "ipfs://QmNpLojZo471M357NTUZ1qKDwjUZrfYctWhzPtNFEXcSaL",
9+
"resolved_version": "1.0.0"
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"owned": {
3+
"alias": "owned",
4+
"install_uri": "ipfs://QmcxvhkJJVpbxEAa6cgW3B6XwPJb79w9GpNUv2P2THUzZR",
5+
"registry_address": null,
6+
"resolved_content_hash": "QmcxvhkJJVpbxEAa6cgW3B6XwPJb79w9GpNUv2P2THUzZR",
7+
"resolved_package_name": "owned",
8+
"resolved_uri": "ipfs://QmcxvhkJJVpbxEAa6cgW3B6XwPJb79w9GpNUv2P2THUzZR",
9+
"resolved_version": "1.0.0"
10+
}
11+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.6.8;
3+
4+
contract Owned {
5+
address owner;
6+
7+
modifier onlyOwner { require(msg.sender == owner); _; }
8+
9+
constructor() public {
10+
owner = msg.sender;
11+
}
12+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"manifest":"ethpm/3","meta":{"authors":["Piper Merriam <[email protected]>"],"description":"Reusable contracts which implement a privileged 'owner' model for authorization.","keywords":["authorization"],"license":"MIT","links":{"documentation":"ipfs://QmUYcVzTfSwJoigggMxeo2g5STWAgJdisQsqcXHws7b1FW"}},"name":"owned","sources":{"Owned.sol":{"installPath":"./Owned.sol","type":"solidity","urls":["ipfs://QmU8QUSt56ZoBDJgjjXvAZEPro9LmK1m2gjVG5Q4s9x29W"]}},"version":"1.0.0"}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"piper-coin": {
3+
"alias": "piper-coin",
4+
"install_uri": "ipfs://QmNbvXM5ig6Qtz6abRuG52KgjFqfXDyBCdRTz7QDENgxzv",
5+
"registry_address": null,
6+
"resolved_content_hash": "QmNbvXM5ig6Qtz6abRuG52KgjFqfXDyBCdRTz7QDENgxzv",
7+
"resolved_package_name": "piper-coin",
8+
"resolved_uri": "ipfs://QmNbvXM5ig6Qtz6abRuG52KgjFqfXDyBCdRTz7QDENgxzv",
9+
"resolved_version": "1.0.0"
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"standard-token": {
3+
"alias": "standard-token",
4+
"install_uri": "ipfs://QmQNffBrmbB3TuBCtYfYsJWJVLssatWXa3H6CkGeyNUySA",
5+
"registry_address": null,
6+
"resolved_content_hash": "QmQNffBrmbB3TuBCtYfYsJWJVLssatWXa3H6CkGeyNUySA",
7+
"resolved_package_name": "standard-token",
8+
"resolved_uri": "ipfs://QmQNffBrmbB3TuBCtYfYsJWJVLssatWXa3H6CkGeyNUySA",
9+
"resolved_version": "1.0.0"
10+
}
11+
}

0 commit comments

Comments
 (0)