Skip to content

Commit c906a8f

Browse files
author
sam bacha
committed
docs(readme): init
1 parent d464c64 commit c906a8f

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

README.md

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
1-
[![Build Status](https://travis-ci.org/celer-network/pb3-gen-sol.svg?branch=master)](https://travis-ci.org/celer-network/pb3-gen-sol)
2-
# Overview
1+
# pb3-gen-sol
32

4-
pb3-gen-sol is a proto3 to solidity library generator that supports proto3 native types and uses field option for solidity native types. Both the message and generated code are more efficient than other solutions. It also includes a library to decode protobuf wireformat. Currently it generates decoders, with encoder support planned.
3+
4+
pb3-gen-sol is a proto3 to solidity library generator that supports
5+
proto3 native types and uses field option for solidity native types.
6+
Both the message and generated code are more efficient than other
7+
solutions. It also includes a library to decode protobuf wireformat.
8+
Currently it generates decoders, with encoder support planned.
59

610
## Usage
711
### .proto files
812
Example:
913
```protobuf
1014
syntax = "proto3";
11-
// package name is used for both generated .sol file name and library name
15+
// package name is used for both generated .sol file name and library
16+
name
1217
package mytest;
1318
1419
import "google/protobuf/descriptor.proto";
1520
extend google.protobuf.FieldOptions {
16-
string soltype = 54321; // must > 1001 and not conflict with other extensions
21+
string soltype = 54321; // must > 1001 and not conflict with other
22+
extensions
1723
}
1824
1925
message MyMsg {
2026
bytes addr = 1 [ (soltype) = "address" ];
2127
uint32 num = 2 [ (soltype) = "uint8" ];
22-
bool has_moon = 3; // for matching native types, no need for soltype option
28+
bool has_moon = 3; // for matching native types, no need for
29+
soltype option
2330
}
2431
```
2532
Check .proto files under test folder for more examples.
@@ -33,19 +40,19 @@ $ export PATH=$PWD:$PATH
3340
$ protoc --sol_out=. [list of proto files]
3441
```
3542

36-
proto files can have different package names, and generated .sol file name is proto package name.
43+
proto files can have different package names, and generated .sol file
44+
name is proto package name.
3745

3846
## Params
39-
- `msg`: only generate solidity struct and decode functions for msg name. Multiple can be specified.
40-
- `importpb`: default false, if set to true, generated .sol file will import pb.sol instead of embed library pb in the file
47+
- `msg`: only generate solidity struct and decode functions for msg
48+
name. Multiple can be specified.
49+
- `importpb`: default false, if set to true, generated .sol file will
50+
import pb.sol instead of embed library pb in the file
4151

4252
Example:
4353

44-
```$ protoc --sol_out=msg=Msg1,msg=Msg2,msg=Msg3,importpb=true:test/solidity/contracts/lib/ test/test.proto```
45-
46-
## Kwown Issues
47-
- No support for int32/int64
48-
- Support embedded message/enum, but no nested message/enum definition
54+
```$ protoc
55+
--sol_out=msg=Msg1,msg=Msg2,msg=Msg3,importpb=true:test/solidity/contracts/lib/
56+
test/test.proto
57+
```
4958

50-
# Contributors
51-
- [stevenlcf](https://github.com/stevenlcf)

0 commit comments

Comments
 (0)