Last active
August 22, 2018 18:33
-
-
Save kyriediculous/d2286a8a580d28a3903395490b15bcaa to your computer and use it in GitHub Desktop.
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) | |
BountyFactory3.link('BountyLibrary', bountyLibrary.address) | |
const bountyFactory3 = await deployer.deploy(BountyFactory3) | |
console.log('----PROXY STORAGE----') | |
const proxyCreate = await bountyFactory3.createBounty("http://api.bitbucket.com/3043040340304", 1579899795886000, bountyLibrary.address, {value: 5000000000}) | |
const bounty3 = BountyProxy.at(await bountyFactory3.bounties(0)) | |
const submitProposalParams = web3.eth.abi.encodeParameters(["bytes32"], [web3.utils.utf8ToHex("http://040340304")]) | |
const submitProposalSig = web3.utils.soliditySha3("submitProposal(BountyLibrary.Bounty storage, bytes32)") | |
const proxySubmit = await bounty3.forward(submitProposalSig, submitProposalParams, {from: accounts[0]}) | |
const getSig = web3.utils.soliditySha3("getBounty(BountyLib.Bounty storage)") | |
const getParams = web3.eth.abi.encodeParameters(["bytes32"], [web3.utils.utf8ToHex("")]) | |
console.log(await bounty3.forward.call(getSig, getParams)) | |
console.log(`Create bounty: ${proxyCreate.receipt.gasUsed} gas`) | |
console.log(`Submit proposal: ${proxySubmit.receipt.gasUsed} gas`) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment