@PatrickCtyyx
2017-12-03T09:07:27.000000Z
字数 6477
阅读 487
BlockChain
SmartSponor 部署 JavaScript 代码:
var theminer = eth.accounts[3];
var therunner = eth.accounts[1];
var thesponsor = eth.accounts[0];
var thebenefactor = eth.accounts[2];
var _benefactor = thebenefactor;
var browser_ballot_sol_smartsponsorContract = web3.eth.contract([{"constant":true,"inputs":[],"name":"refunded","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getPot","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"complete","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"refund","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_message","type":"bytes32"}],"name":"pledge","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"benefactor","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"numPledges","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"pledges","outputs":[{"name":"amount","type":"uint256"},{"name":"eth_address","type":"address"},{"name":"message","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"drawdown","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_benefactor","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]);
var ss = browser_ballot_sol_smartsponsorContract.new(
_benefactor,
{
from: therunner,
data: '0x6060604052341561000f57600080fd5b60405160208061084a83398101604052808051906020019091905050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060006002819055506000600160146101000a81548160ff0219169083151502179055506000600160156101000a81548160ff02191690831515021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610750806100fa6000396000f3006060604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806312f53950146100a9578063403c9fa8146100d6578063522e1177146100ff578063590e1ae31461012c57806376bf8044146101415780638a81694c1461015d5780638da5cb5b146101b2578063a46f7d1914610207578063ac12408114610230578063e77ef21f146102a9575b600080fd5b34156100b457600080fd5b6100bc6102be565b604051808215151515815260200191505060405180910390f35b34156100e157600080fd5b6100e96102d1565b6040518082815260200191505060405180910390f35b341561010a57600080fd5b6101126102f0565b604051808215151515815260200191505060405180910390f35b341561013757600080fd5b61013f610303565b005b61015b60048080356000191690602001909190505061046b565b005b341561016857600080fd5b61017061056b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101bd57600080fd5b6101c5610591565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021257600080fd5b61021a6105b6565b6040518082815260200191505060405180910390f35b341561023b57600080fd5b61025160048080359060200190919050506105bc565b604051808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018260001916600019168152602001935050505060405180910390f35b34156102b457600080fd5b6102bc610606565b005b600160149054906101000a900460ff1681565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b600160159054906101000a900460ff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158061036d5750600160159054906101000a900460ff165b806103845750600160149054906101000a900460ff165b1561038e57600080fd5b600090505b600254811015610434576003600082815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc60036000848152602001908152602001600020600001549081150290604051600060405180830381858888f19350505050151561042957600080fd5b806001019050610393565b60018060146101000a81548160ff02191690831515021790555060018060156101000a81548160ff02191690831515021790555050565b60003414806104865750600160159054906101000a900460ff165b8061049d5750600160149054906101000a900460ff165b156104a757600080fd5b6060604051908101604052803481526020013373ffffffffffffffffffffffffffffffffffffffff16815260200182600019168152506003600060025481526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040820151816002019060001916905590505060026000815480929190600101919050555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b60036020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020154905083565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158061066e5750600160159054906101000a900460ff165b806106855750600160149054906101000a900460ff165b1561068f57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050151561070857600080fd5b60018060156101000a81548160ff0219169083151502179055505600a165627a7a723058201cd540f27d024eb8745fa1809d7ce97022c093247fc18dac9169e68eb4bfbf3e0029',
gas: '4700000'
}, function (e, contract){
console.log(e, contract);
if (typeof contract.address !== 'undefined') {
console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
}
})