This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
message CreateBlogReq { | |
Blog blog = 1; // Blog id blank | |
} | |
message CreateBlogRes { | |
Blog blog = 1; // Blog id filled in | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
message Blog { | |
string id = 1; | |
string author_id = 2; | |
string title = 3; | |
string content= 4; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service BlogService { | |
rpc CreateBlog(CreateBlogReq) returns (CreateBlogRes); | |
rpc ReadBlog(ReadBlogReq) returns (ReadBlogRes); | |
rpc UpdateBlog(UpdateBlogReq) returns (UpdateBlogRes); | |
rpc DeleteBlog(DeleteBlogReq) returns (DeleteBlogRes); | |
rpc ListBlogs(ListBlogReq) returns (stream ListBlogRes); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const DummyMaster = artifacts.require('DummyMaster') | |
const Dummy = artifacts.require('Dummy') | |
const DummyInterface = artifacts.require('DummyInterface') | |
contract('Test Proxies', async () => { | |
let dummyMaster, dummy | |
before(async () => { | |
dummyMaster = await DummyMaster.new() | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract DummyInterface { | |
function increment() external; | |
function get() external view returns (uint); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract Dummy { | |
address impl; | |
constructor (address _impl) public { | |
impl = _impl; | |
} | |
function () public { | |
require(msg.sig != 0x0); | |
address _impl = impl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract DummyMaster { | |
// resolver needs to be the first in storage to match the Proxy contract storage ordering | |
address impl; | |
uint count; | |
function increment() public { | |
count = count + 1; | |
} | |
function get() external view returns (uint) { | |
return count; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
contract BountyProxy { | |
using BountyLibrary for BountyLibrary.Bounty; | |
BountyLibrary.Bounty bounty; | |
address impl; | |
constructor(bytes32 _reference, address _issuer, uint _deadline, address _lib) public payable { | |
impl = _lib; | |
bounty.init(_reference, _issuer, _deadline); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Web3 = require('web3') | |
const BountyLibrary = artifacts.require('BountyLibrary') | |
const BountyFactory3 = artifacts.require('BountyFactory3') | |
const BountyProxy = artifacts.require('BountyProxy') | |
const web3 = new Web3('http://localhost:7545') | |
module.exports = (deployer, networks, accounts) => { | |
deployer.then(async _ => { | |
const bountyLibrary = await deployer.deploy(BountyLibrary) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
contract BountyProxy { | |
address impl; | |
using BountyLibrary for BountyLibrary.Bounty; | |
BountyLibrary.Bounty bounty; | |
constructor(bytes32 _reference, address _issuer, uint _deadline, address _lib) public payable { | |
impl = _lib; | |
bounty.init(_reference, _issuer, _deadline); |