From 55b2f207afae1115396ae3001b6dc05d6d445291 Mon Sep 17 00:00:00 2001 From: hunjixin <16705420332lee@gmai.com> Date: Wed, 26 Jun 2024 12:46:35 +0000 Subject: [PATCH] feat: simply state loop in sc & fix typo --- hardhat/contracts/LilypadPow.sol | 26 +++-- pkg/web3/api.go | 34 ------ pkg/web3/bindings/pow/pow.go | 188 ++++++++++++++++--------------- 3 files changed, 109 insertions(+), 139 deletions(-) diff --git a/hardhat/contracts/LilypadPow.sol b/hardhat/contracts/LilypadPow.sol index 40748c2a..420adaf5 100644 --- a/hardhat/contracts/LilypadPow.sol +++ b/hardhat/contracts/LilypadPow.sol @@ -9,8 +9,8 @@ contract LilypadPow is Ownable, Initializable { address walletAddress; string nodeId; uint256 nonce; - uint256 start_timestap; - uint256 complete_timestap; //used to estimate hashrate of this submission + uint256 start_timestamp; + uint256 complete_timestamp; //used to estimate hashrate of this submission bytes32 challenge; //record this to provent user never change challenge uint256 difficulty; } @@ -29,7 +29,6 @@ contract LilypadPow is Ownable, Initializable { uint256 public targetDifficulty = 555460709263765739036470010701196062214039696708679004195670928130048; mapping(address => POWSubmission[]) public powSubmissions; - mapping(address => uint256) public minerSubmissionCount; //used for loop powsubmission address[] public miners; mapping(address => Challenge) public lastChallenges; @@ -45,10 +44,14 @@ contract LilypadPow is Ownable, Initializable { // https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable function initialize() public initializer {} - function getMiners() external view returns (address[] memory) { + function getMiners() public view returns (address[] memory) { return miners; } + function getMinerPosSubmissions(address addr) public view returns (POWSubmission[] memory) { + return powSubmissions[addr]; + } + // generateChallenge gen a byte32 value as challenge value, Sc store this one for verify function generateChallenge(string calldata nodeId) external { checkTimeWindow(); @@ -103,13 +106,10 @@ contract LilypadPow is Ownable, Initializable { validProofs++; - if (minerSubmissionCount[msg.sender] == 0) { - //first submit, append to miners + POWSubmission[] storage posSubmissions = powSubmissions[msg.sender]; + if (posSubmissions.length == 0) { miners.push(msg.sender); } - - minerSubmissionCount[msg.sender]++; //increase miner's valid proofs - POWSubmission[] storage posSubmissions = powSubmissions[msg.sender]; posSubmissions.push( POWSubmission( msg.sender, @@ -128,6 +128,7 @@ contract LilypadPow is Ownable, Initializable { msg.sender, nodeId, nonce, + lastChallenge.timestamp, block.timestamp, lastChallenge.challenge, lastChallenge.difficulty @@ -145,13 +146,14 @@ contract LilypadPow is Ownable, Initializable { } event ValidPOWSubmitted( - address indexed walletAddress, + address walletAddress, string nodeId, uint256 nonce, - uint256 timestamp, + uint256 start_timestamp, + uint256 complete_timestamp, bytes32 challenge, uint256 difficulty ); event GenerateChallenge(bytes32 challenge, uint256 difficulty); event NewPowRound(); -} +} \ No newline at end of file diff --git a/pkg/web3/api.go b/pkg/web3/api.go index 5db8604c..2dd525d9 100644 --- a/pkg/web3/api.go +++ b/pkg/web3/api.go @@ -308,40 +308,6 @@ type PowValidPOWSubmission struct { Difficulty *big.Int } -func (sdk *Web3SDK) GetPowSubmission(ctx context.Context) (map[common.Address][]PowValidPOWSubmission, error) { - miners, err := sdk.Contracts.Pow.GetMiners(sdk.CallOpts) - if err != nil { - return nil, err - } - - results := make(map[common.Address][]PowValidPOWSubmission) - for _, minerAddr := range miners { - validProofCount, err := sdk.Contracts.Pow.MinerSubmissionCount(sdk.CallOpts, minerAddr) - if err != nil { - return nil, err - } - - var powSubmissions []PowValidPOWSubmission - for i := uint64(0); i < validProofCount.Uint64(); i++ { //enough large - submission, err := sdk.Contracts.Pow.PowSubmissions(sdk.CallOpts, minerAddr, new(big.Int).SetUint64(i)) - if err != nil { - return nil, err - } - powSubmissions = append(powSubmissions, PowValidPOWSubmission{ - WalletAddress: submission.WalletAddress, - NodeId: submission.NodeId, - Nonce: submission.Nonce, - StartTimestap: submission.StartTimestap, - CompleteTimestap: submission.CompleteTimestap, - Challenge: submission.Challenge, - Difficulty: submission.Difficulty, - }) - } - results[minerAddr] = powSubmissions - } - return results, nil -} - func (sdk *Web3SDK) SendPowSignal(ctx context.Context) (*pow.PowNewPowRound, error) { tx, err := sdk.Contracts.Pow.TriggerNewPowRound(sdk.TransactOpts) if err != nil { diff --git a/pkg/web3/bindings/pow/pow.go b/pkg/web3/bindings/pow/pow.go index 443ad428..718d7d91 100644 --- a/pkg/web3/bindings/pow/pow.go +++ b/pkg/web3/bindings/pow/pow.go @@ -29,10 +29,21 @@ var ( _ = abi.ConvertType ) +// LilypadPowPOWSubmission is an auto generated low-level Go binding around an user-defined struct. +type LilypadPowPOWSubmission struct { + WalletAddress common.Address + NodeId string + Nonce *big.Int + StartTimestamp *big.Int + CompleteTimestamp *big.Int + Challenge [32]byte + Difficulty *big.Int +} + // PowMetaData contains all meta data concerning the Pow contract. var PowMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"challenge\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"difficulty\",\"type\":\"uint256\"}],\"name\":\"GenerateChallenge\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"NewPowRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"walletAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"nodeId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"challenge\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"difficulty\",\"type\":\"uint256\"}],\"name\":\"ValidPOWSubmitted\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"calculate_difficulty\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"difficulty\",\"type\":\"uint256\"}],\"name\":\"change_difficulty\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"checkTimeWindow\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"nodeId\",\"type\":\"string\"}],\"name\":\"generateChallenge\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMiners\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"lastChallenges\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"challenge\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"difficulty\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"nodeId\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"minerSubmissionCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"miners\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"powSubmissions\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"walletAddress\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"nodeId\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"start_timestap\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"complete_timestap\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"challenge\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"difficulty\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"nodeId\",\"type\":\"string\"}],\"name\":\"submitWork\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"targetDifficulty\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"triggerNewPowRound\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validProofs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"window_end\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"window_start\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x60806040527c149a6a3000000000000000000000000000000000000000000000000000600155348015610030575f80fd5b5061004d61004261005260201b60201c565b61005960201b60201c565b61011a565b5f33905090565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b611ffb806101275f395ff3fe608060405234801561000f575f80fd5b506004361061012a575f3560e01c80638da5cb5b116100ab578063b681f2fd1161006f578063b681f2fd14610303578063bfb660de1461030d578063da8accf914610317578063e0d152af14610333578063f2fde38b146103635761012a565b80638da5cb5b14610271578063a738bf8f1461028f578063ab098945146102ad578063adf0047c146102c9578063b28d87ea146102e55761012a565b80636189f3ac116100f25780636189f3ac146101ee578063715018a61461022157806378e979251461022b5780638129fc1c146102495780638b2db16e146102535761012a565b8063148c684a1461012e5780631633da6e1461015e5780632d68c3971461017c578063331bade11461019a5780634bbe05e4146101b8575b5f80fd5b610148600480360381019061014391906111b9565b61037f565b60405161015591906111fc565b60405180910390f35b610166610394565b60405161017391906112cc565b60405180910390f35b61018461041f565b60405161019191906111fc565b60405180910390f35b6101a261045c565b6040516101af91906111fc565b60405180910390f35b6101d260048036038101906101cd9190611316565b610462565b6040516101e59796959493929190611405565b60405180910390f35b610208600480360381019061020391906111b9565b61055f565b6040516102189493929190611479565b60405180910390f35b610229610611565b005b610233610624565b60405161024091906111fc565b60405180910390f35b61025161062a565b005b61025b61075f565b60405161026891906111fc565b60405180910390f35b610279610765565b60405161028691906114c3565b60405180910390f35b61029761078c565b6040516102a491906111fc565b60405180910390f35b6102c760048036038101906102c2919061153d565b610792565b005b6102e360048036038101906102de9190611588565b6108ee565b005b6102ed610900565b6040516102fa91906111fc565b60405180910390f35b61030b610906565b005b610315610956565b005b610331600480360381019061032c91906115b3565b61099c565b005b61034d60048036038101906103489190611588565b610f32565b60405161035a91906114c3565b60405180910390f35b61037d600480360381019061037891906111b9565b610f6d565b005b6003602052805f5260405f205f915090505481565b6060600480548060200260200160405190810160405280929190818152602001828054801561041557602002820191905f5260205f20905b815f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116103cc575b5050505050905090565b5f8060154461042e919061163d565b605a61043a919061169a565b905060648160015461044c91906116cd565b610456919061170e565b91505090565b60085481565b6002602052815f5260405f20818154811061047b575f80fd5b905f5260205f2090600702015f9150915050805f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010180546104c09061176b565b80601f01602080910402602001604051908101604052809291908181526020018280546104ec9061176b565b80156105375780601f1061050e57610100808354040283529160200191610537565b820191905f5260205f20905b81548152906001019060200180831161051a57829003601f168201915b5050505050908060020154908060030154908060040154908060050154908060060154905087565b6005602052805f5260405f205f91509050805f01549080600101549080600201805461058a9061176b565b80601f01602080910402602001604051908101604052809291908181526020018280546105b69061176b565b80156106015780601f106105d857610100808354040283529160200191610601565b820191905f5260205f20905b8154815290600101906020018083116105e457829003601f168201915b5050505050908060030154905084565b610619610fef565b6106225f61106d565b565b60075481565b5f8060159054906101000a900460ff1615905080801561065b575060015f60149054906101000a900460ff1660ff16105b80610689575061066a3061112e565b158015610688575060015f60149054906101000a900460ff1660ff16145b5b6106c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106bf9061180b565b60405180910390fd5b60015f60146101000a81548160ff021916908360ff16021790555080156107045760015f60156101000a81548160ff0219169083151502179055505b801561075c575f8060156101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249860016040516107539190611877565b60405180910390a15b50565b60015481565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60095481565b61079a610956565b5f426008543385856040516020016107b6959493929190611931565b6040516020818303038152906040528051906020012090505f6107d761041f565b9050604051806080016040528083815260200182815260200185858080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f8201169050808301925050505050505081526020014281525060055f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f820151815f01556020820151816001015560408201518160020190816108a19190611b3d565b50606082015181600301559050507f496186a9d930bac0744acdcd1d0c054b18283eecbe99d30bda98102d3d06b8ef82826040516108e0929190611c0c565b60405180910390a150505050565b6108f6610fef565b8060018190555050565b60065481565b61090e610fef565b43600881905550601e43610922919061169a565b6009819055507f10cc99616aca050d810fd487c95f968e516d0fa25318530ed50753153d060a1e60405160405180910390a1565b600954431061099a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099190611c7d565b60405180910390fd5b565b6109a4610956565b5f60055f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f206040518060800160405290815f820154815260200160018201548152602001600282018054610a109061176b565b80601f0160208091040260200160405190810160405280929190818152602001828054610a3c9061176b565b8015610a875780601f10610a5e57610100808354040283529160200191610a87565b820191905f5260205f20905b815481529060010190602001808311610a6a57829003601f168201915b5050505050815260200160038201548152505090505f8160600151600854338686604051602001610abc959493929190611931565b60405160208183030381529060405280519060200120905080825f015114610b19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b1090611d0b565b60405180910390fd5b5f8186604051602001610b2d929190611d49565b6040516020818303038152906040528051906020012090508260200151815f1c10610b8d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b8490611de4565b60405180910390fd5b60065f815480929190610b9f90611e02565b91905055505f60035f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205403610c4957600433908060018154018082558091505060019003905f5260205f20015f9091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b60035f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f815480929190610c9690611e02565b91905055505f60025f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f209050806040518060e001604052803373ffffffffffffffffffffffffffffffffffffffff16815260200188888080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f82011690508083019250505050505050815260200189815260200186606001518152602001428152602001865f015181526020018660200151815250908060018154018082558091505060019003905f5260205f2090600702015f909190919091505f820151815f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001019081610df29190611b3d565b5060408201518160020155606082015181600301556080820151816004015560a0820151816005015560c08201518160060155505060405180608001604052805f801b81526020015f815260200160405180602001604052805f81525081526020015f81525060055f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f820151815f0155602082015181600101556040820151816002019081610ebc9190611b3d565b50606082015181600301559050503373ffffffffffffffffffffffffffffffffffffffff167f5ea61d67e3236a79ab8c3c29f810e2c408b0a6b1e19f4e0da2fcd6362129c86087878a42895f01518a60200151604051610f2196959493929190611e75565b60405180910390a250505050505050565b60048181548110610f41575f80fd5b905f5260205f20015f915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610f75610fef565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610fe3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fda90611f3f565b60405180910390fd5b610fec8161106d565b50565b610ff7611150565b73ffffffffffffffffffffffffffffffffffffffff16611015610765565b73ffffffffffffffffffffffffffffffffffffffff161461106b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106290611fa7565b60405180910390fd5b565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b5f33905090565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6111888261115f565b9050919050565b6111988161117e565b81146111a2575f80fd5b50565b5f813590506111b38161118f565b92915050565b5f602082840312156111ce576111cd611157565b5b5f6111db848285016111a5565b91505092915050565b5f819050919050565b6111f6816111e4565b82525050565b5f60208201905061120f5f8301846111ed565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6112478161117e565b82525050565b5f611258838361123e565b60208301905092915050565b5f602082019050919050565b5f61127a82611215565b611284818561121f565b935061128f8361122f565b805f5b838110156112bf5781516112a6888261124d565b97506112b183611264565b925050600181019050611292565b5085935050505092915050565b5f6020820190508181035f8301526112e48184611270565b905092915050565b6112f5816111e4565b81146112ff575f80fd5b50565b5f81359050611310816112ec565b92915050565b5f806040838503121561132c5761132b611157565b5b5f611339858286016111a5565b925050602061134a85828601611302565b9150509250929050565b61135d8161117e565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f5b8381101561139a57808201518184015260208101905061137f565b5f8484015250505050565b5f601f19601f8301169050919050565b5f6113bf82611363565b6113c9818561136d565b93506113d981856020860161137d565b6113e2816113a5565b840191505092915050565b5f819050919050565b6113ff816113ed565b82525050565b5f60e0820190506114185f83018a611354565b818103602083015261142a81896113b5565b905061143960408301886111ed565b61144660608301876111ed565b61145360808301866111ed565b61146060a08301856113f6565b61146d60c08301846111ed565b98975050505050505050565b5f60808201905061148c5f8301876113f6565b61149960208301866111ed565b81810360408301526114ab81856113b5565b90506114ba60608301846111ed565b95945050505050565b5f6020820190506114d65f830184611354565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f8401126114fd576114fc6114dc565b5b8235905067ffffffffffffffff81111561151a576115196114e0565b5b602083019150836001820283011115611536576115356114e4565b5b9250929050565b5f806020838503121561155357611552611157565b5b5f83013567ffffffffffffffff8111156115705761156f61115b565b5b61157c858286016114e8565b92509250509250929050565b5f6020828403121561159d5761159c611157565b5b5f6115aa84828501611302565b91505092915050565b5f805f604084860312156115ca576115c9611157565b5b5f6115d786828701611302565b935050602084013567ffffffffffffffff8111156115f8576115f761115b565b5b611604868287016114e8565b92509250509250925092565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f611647826111e4565b9150611652836111e4565b92508261166257611661611610565b5b828206905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6116a4826111e4565b91506116af836111e4565b92508282019050808211156116c7576116c661166d565b5b92915050565b5f6116d7826111e4565b91506116e2836111e4565b92508282026116f0816111e4565b915082820484148315176117075761170661166d565b5b5092915050565b5f611718826111e4565b9150611723836111e4565b92508261173357611732611610565b5b828204905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061178257607f821691505b6020821081036117955761179461173e565b5b50919050565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c7265615f8201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b5f6117f5602e8361136d565b91506118008261179b565b604082019050919050565b5f6020820190508181035f830152611822816117e9565b9050919050565b5f819050919050565b5f60ff82169050919050565b5f819050919050565b5f61186161185c61185784611829565b61183e565b611832565b9050919050565b61187181611847565b82525050565b5f60208201905061188a5f830184611868565b92915050565b5f819050919050565b6118aa6118a5826111e4565b611890565b82525050565b5f8160601b9050919050565b5f6118c6826118b0565b9050919050565b5f6118d7826118bc565b9050919050565b6118ef6118ea8261117e565b6118cd565b82525050565b5f81905092915050565b828183375f83830152505050565b5f61191883856118f5565b93506119258385846118ff565b82840190509392505050565b5f61193c8288611899565b60208201915061194c8287611899565b60208201915061195c82866118de565b60148201915061196d82848661190d565b91508190509695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302611a057fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826119ca565b611a0f86836119ca565b95508019841693508086168417925050509392505050565b5f611a41611a3c611a37846111e4565b61183e565b6111e4565b9050919050565b5f819050919050565b611a5a83611a27565b611a6e611a6682611a48565b8484546119d6565b825550505050565b5f90565b611a82611a76565b611a8d818484611a51565b505050565b5b81811015611ab057611aa55f82611a7a565b600181019050611a93565b5050565b601f821115611af557611ac6816119a9565b611acf846119bb565b81016020851015611ade578190505b611af2611aea856119bb565b830182611a92565b50505b505050565b5f82821c905092915050565b5f611b155f1984600802611afa565b1980831691505092915050565b5f611b2d8383611b06565b9150826002028217905092915050565b611b4682611363565b67ffffffffffffffff811115611b5f57611b5e61197c565b5b611b69825461176b565b611b74828285611ab4565b5f60209050601f831160018114611ba5575f8415611b93578287015190505b611b9d8582611b22565b865550611c04565b601f198416611bb3866119a9565b5f5b82811015611bda57848901518255600182019150602085019450602081019050611bb5565b86831015611bf75784890151611bf3601f891682611b06565b8355505b6001600288020188555050505b505050505050565b5f604082019050611c1f5f8301856113f6565b611c2c60208301846111ed565b9392505050565b7f70726f6f662077696e646f77732068617320636c6f73656400000000000000005f82015250565b5f611c6760188361136d565b9150611c7282611c33565b602082019050919050565b5f6020820190508181035f830152611c9481611c5b565b9050919050565b7f576f726b207375626d6974206e6f7420636f6d70617461626c652077697468205f8201527f6368616c6c656e67650000000000000000000000000000000000000000000000602082015250565b5f611cf560298361136d565b9150611d0082611c9b565b604082019050919050565b5f6020820190508181035f830152611d2281611ce9565b9050919050565b5f819050919050565b611d43611d3e826113ed565b611d29565b82525050565b5f611d548285611d32565b602082019150611d648284611899565b6020820191508190509392505050565b7f576f726b20646f6573206e6f74206d65657420646966666963756c74792074615f8201527f7267657400000000000000000000000000000000000000000000000000000000602082015250565b5f611dce60248361136d565b9150611dd982611d74565b604082019050919050565b5f6020820190508181035f830152611dfb81611dc2565b9050919050565b5f611e0c826111e4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611e3e57611e3d61166d565b5b600182019050919050565b5f611e54838561136d565b9350611e618385846118ff565b611e6a836113a5565b840190509392505050565b5f60a0820190508181035f830152611e8e81888a611e49565b9050611e9d60208301876111ed565b611eaa60408301866111ed565b611eb760608301856113f6565b611ec460808301846111ed565b979650505050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f20615f8201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b5f611f2960268361136d565b9150611f3482611ecf565b604082019050919050565b5f6020820190508181035f830152611f5681611f1d565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725f82015250565b5f611f9160208361136d565b9150611f9c82611f5d565b602082019050919050565b5f6020820190508181035f830152611fbe81611f85565b905091905056fea2646970667358221220002b1ebdb585e17e08f0977dc32ad64b9a814d8558b7e275e5695116e236ec0c64736f6c63430008150033", + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"challenge\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"difficulty\",\"type\":\"uint256\"}],\"name\":\"GenerateChallenge\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"NewPowRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"walletAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"nodeId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"start_timestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"complete_timestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"challenge\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"difficulty\",\"type\":\"uint256\"}],\"name\":\"ValidPOWSubmitted\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"calculate_difficulty\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"difficulty\",\"type\":\"uint256\"}],\"name\":\"change_difficulty\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"checkTimeWindow\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"nodeId\",\"type\":\"string\"}],\"name\":\"generateChallenge\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"getMinerPosSubmissions\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"walletAddress\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"nodeId\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"start_timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"complete_timestamp\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"challenge\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"difficulty\",\"type\":\"uint256\"}],\"internalType\":\"structLilypadPow.POWSubmission[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMiners\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"lastChallenges\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"challenge\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"difficulty\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"nodeId\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"miners\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"powSubmissions\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"walletAddress\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"nodeId\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"start_timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"complete_timestamp\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"challenge\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"difficulty\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"nodeId\",\"type\":\"string\"}],\"name\":\"submitWork\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"targetDifficulty\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"triggerNewPowRound\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validProofs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"window_end\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"window_start\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + Bin: "0x60806040527c149a6a3000000000000000000000000000000000000000000000000000600155348015610030575f80fd5b5061004d61004261005260201b60201c565b61005960201b60201c565b61011a565b5f33905090565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6122f180620001285f395ff3fe608060405234801561000f575f80fd5b506004361061012a575f3560e01c80638da5cb5b116100ab578063b681f2fd1161006f578063b681f2fd14610303578063bfb660de1461030d578063da8accf914610317578063e0d152af14610333578063f2fde38b146103635761012a565b80638da5cb5b14610271578063a738bf8f1461028f578063ab098945146102ad578063adf0047c146102c9578063b28d87ea146102e55761012a565b80636189f3ac116100f25780636189f3ac146101ee578063715018a61461022157806378e979251461022b5780638129fc1c146102495780638b2db16e146102535761012a565b80631633da6e1461012e5780632d68c3971461014c578063331bade11461016a5780634bbe05e41461018857806354bfd759146101be575b5f80fd5b61013661037f565b604051610143919061133e565b60405180910390f35b61015461040a565b6040516101619190611376565b60405180910390f35b610172610447565b60405161017f9190611376565b60405180910390f35b6101a2600480360381019061019d91906113eb565b61044d565b6040516101b597969594939291906114da565b60405180910390f35b6101d860048036038101906101d3919061154e565b61054a565b6040516101e59190611733565b60405180910390f35b6102086004803603810190610203919061154e565b6106f9565b6040516102189493929190611753565b60405180910390f35b6102296107ab565b005b6102336107be565b6040516102409190611376565b60405180910390f35b6102516107c4565b005b61025b6108f9565b6040516102689190611376565b60405180910390f35b6102796108ff565b604051610286919061179d565b60405180910390f35b610297610926565b6040516102a49190611376565b60405180910390f35b6102c760048036038101906102c29190611817565b61092c565b005b6102e360048036038101906102de9190611862565b610a88565b005b6102ed610a9a565b6040516102fa9190611376565b60405180910390f35b61030b610aa0565b005b610315610af0565b005b610331600480360381019061032c919061188d565b610b36565b005b61034d60048036038101906103489190611862565b611032565b60405161035a919061179d565b60405180910390f35b61037d6004803603810190610378919061154e565b61106d565b005b6060600380548060200260200160405190810160405280929190818152602001828054801561040057602002820191905f5260205f20905b815f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116103b7575b5050505050905090565b5f806015446104199190611917565b605a6104259190611974565b905060648160015461043791906119a7565b61044191906119e8565b91505090565b60075481565b6002602052815f5260405f208181548110610466575f80fd5b905f5260205f2090600702015f9150915050805f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010180546104ab90611a45565b80601f01602080910402602001604051908101604052809291908181526020018280546104d790611a45565b80156105225780601f106104f957610100808354040283529160200191610522565b820191905f5260205f20905b81548152906001019060200180831161050557829003601f168201915b5050505050908060020154908060030154908060040154908060050154908060060154905087565b606060025f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20805480602002602001604051908101604052809291908181526020015f905b828210156106ee578382905f5260205f2090600702016040518060e00160405290815f82015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201805461062d90611a45565b80601f016020809104026020016040519081016040528092919081815260200182805461065990611a45565b80156106a45780601f1061067b576101008083540402835291602001916106a4565b820191905f5260205f20905b81548152906001019060200180831161068757829003601f168201915b5050505050815260200160028201548152602001600382015481526020016004820154815260200160058201548152602001600682015481525050815260200190600101906105a8565b505050509050919050565b6004602052805f5260405f205f91509050805f01549080600101549080600201805461072490611a45565b80601f016020809104026020016040519081016040528092919081815260200182805461075090611a45565b801561079b5780601f106107725761010080835404028352916020019161079b565b820191905f5260205f20905b81548152906001019060200180831161077e57829003601f168201915b5050505050908060030154905084565b6107b36110ef565b6107bc5f61116d565b565b60065481565b5f8060159054906101000a900460ff161590508080156107f5575060015f60149054906101000a900460ff1660ff16105b8061082357506108043061122e565b158015610822575060015f60149054906101000a900460ff1660ff16145b5b610862576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085990611ae5565b60405180910390fd5b60015f60146101000a81548160ff021916908360ff160217905550801561089e5760015f60156101000a81548160ff0219169083151502179055505b80156108f6575f8060156101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249860016040516108ed9190611b51565b60405180910390a15b50565b60015481565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60085481565b610934610af0565b5f42600754338585604051602001610950959493929190611c0b565b6040516020818303038152906040528051906020012090505f61097161040a565b9050604051806080016040528083815260200182815260200185858080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f8201169050808301925050505050505081526020014281525060045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f820151815f0155602082015181600101556040820151816002019081610a3b9190611e17565b50606082015181600301559050507f496186a9d930bac0744acdcd1d0c054b18283eecbe99d30bda98102d3d06b8ef8282604051610a7a929190611ee6565b60405180910390a150505050565b610a906110ef565b8060018190555050565b60055481565b610aa86110ef565b43600781905550601e43610abc9190611974565b6008819055507f10cc99616aca050d810fd487c95f968e516d0fa25318530ed50753153d060a1e60405160405180910390a1565b6008544310610b34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b2b90611f57565b60405180910390fd5b565b610b3e610af0565b5f60045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f206040518060800160405290815f820154815260200160018201548152602001600282018054610baa90611a45565b80601f0160208091040260200160405190810160405280929190818152602001828054610bd690611a45565b8015610c215780601f10610bf857610100808354040283529160200191610c21565b820191905f5260205f20905b815481529060010190602001808311610c0457829003601f168201915b5050505050815260200160038201548152505090505f8160600151600754338686604051602001610c56959493929190611c0b565b60405160208183030381529060405280519060200120905080825f015114610cb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caa90611fe5565b60405180910390fd5b5f8186604051602001610cc7929190612023565b6040516020818303038152906040528051906020012090508260200151815f1c10610d27576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1e906120be565b60405180910390fd5b60055f815480929190610d39906120dc565b91905055505f60025f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2090505f818054905003610dea57600333908060018154018082558091505060019003905f5260205f20015f9091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b806040518060e001604052803373ffffffffffffffffffffffffffffffffffffffff16815260200188888080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f82011690508083019250505050505050815260200189815260200186606001518152602001428152602001865f015181526020018660200151815250908060018154018082558091505060019003905f5260205f2090600702015f909190919091505f820151815f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001019081610f019190611e17565b5060408201518160020155606082015181600301556080820151816004015560a0820151816005015560c08201518160060155505060405180608001604052805f801b81526020015f815260200160405180602001604052805f81525081526020015f81525060045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f820151815f0155602082015181600101556040820151816002019081610fcb9190611e17565b50606082015181600301559050507f172b7d59e60446d8dfc98985344fb883c871ef150b1db4d1592bcb67699037323387878a8860600151428a5f01518b6020015160405161102198979695949392919061214f565b60405180910390a150505050505050565b60038181548110611041575f80fd5b905f5260205f20015f915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6110756110ef565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036110e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110da90612235565b60405180910390fd5b6110ec8161116d565b50565b6110f7611250565b73ffffffffffffffffffffffffffffffffffffffff166111156108ff565b73ffffffffffffffffffffffffffffffffffffffff161461116b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111629061229d565b60405180910390fd5b565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b5f33905090565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6112a982611280565b9050919050565b6112b98161129f565b82525050565b5f6112ca83836112b0565b60208301905092915050565b5f602082019050919050565b5f6112ec82611257565b6112f68185611261565b935061130183611271565b805f5b8381101561133157815161131888826112bf565b9750611323836112d6565b925050600181019050611304565b5085935050505092915050565b5f6020820190508181035f83015261135681846112e2565b905092915050565b5f819050919050565b6113708161135e565b82525050565b5f6020820190506113895f830184611367565b92915050565b5f80fd5b5f80fd5b6113a08161129f565b81146113aa575f80fd5b50565b5f813590506113bb81611397565b92915050565b6113ca8161135e565b81146113d4575f80fd5b50565b5f813590506113e5816113c1565b92915050565b5f80604083850312156114015761140061138f565b5b5f61140e858286016113ad565b925050602061141f858286016113d7565b9150509250929050565b6114328161129f565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f5b8381101561146f578082015181840152602081019050611454565b5f8484015250505050565b5f601f19601f8301169050919050565b5f61149482611438565b61149e8185611442565b93506114ae818560208601611452565b6114b78161147a565b840191505092915050565b5f819050919050565b6114d4816114c2565b82525050565b5f60e0820190506114ed5f83018a611429565b81810360208301526114ff818961148a565b905061150e6040830188611367565b61151b6060830187611367565b6115286080830186611367565b61153560a08301856114cb565b61154260c0830184611367565b98975050505050505050565b5f602082840312156115635761156261138f565b5b5f611570848285016113ad565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f82825260208201905092915050565b5f6115bc82611438565b6115c681856115a2565b93506115d6818560208601611452565b6115df8161147a565b840191505092915050565b6115f38161135e565b82525050565b611602816114c2565b82525050565b5f60e083015f83015161161d5f8601826112b0565b506020830151848203602086015261163582826115b2565b915050604083015161164a60408601826115ea565b50606083015161165d60608601826115ea565b50608083015161167060808601826115ea565b5060a083015161168360a08601826115f9565b5060c083015161169660c08601826115ea565b508091505092915050565b5f6116ac8383611608565b905092915050565b5f602082019050919050565b5f6116ca82611579565b6116d48185611583565b9350836020820285016116e685611593565b805f5b85811015611721578484038952815161170285826116a1565b945061170d836116b4565b925060208a019950506001810190506116e9565b50829750879550505050505092915050565b5f6020820190508181035f83015261174b81846116c0565b905092915050565b5f6080820190506117665f8301876114cb565b6117736020830186611367565b8181036040830152611785818561148a565b90506117946060830184611367565b95945050505050565b5f6020820190506117b05f830184611429565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f8401126117d7576117d66117b6565b5b8235905067ffffffffffffffff8111156117f4576117f36117ba565b5b6020830191508360018202830111156118105761180f6117be565b5b9250929050565b5f806020838503121561182d5761182c61138f565b5b5f83013567ffffffffffffffff81111561184a57611849611393565b5b611856858286016117c2565b92509250509250929050565b5f602082840312156118775761187661138f565b5b5f611884848285016113d7565b91505092915050565b5f805f604084860312156118a4576118a361138f565b5b5f6118b1868287016113d7565b935050602084013567ffffffffffffffff8111156118d2576118d1611393565b5b6118de868287016117c2565b92509250509250925092565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f6119218261135e565b915061192c8361135e565b92508261193c5761193b6118ea565b5b828206905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61197e8261135e565b91506119898361135e565b92508282019050808211156119a1576119a0611947565b5b92915050565b5f6119b18261135e565b91506119bc8361135e565b92508282026119ca8161135e565b915082820484148315176119e1576119e0611947565b5b5092915050565b5f6119f28261135e565b91506119fd8361135e565b925082611a0d57611a0c6118ea565b5b828204905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680611a5c57607f821691505b602082108103611a6f57611a6e611a18565b5b50919050565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c7265615f8201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b5f611acf602e83611442565b9150611ada82611a75565b604082019050919050565b5f6020820190508181035f830152611afc81611ac3565b9050919050565b5f819050919050565b5f60ff82169050919050565b5f819050919050565b5f611b3b611b36611b3184611b03565b611b18565b611b0c565b9050919050565b611b4b81611b21565b82525050565b5f602082019050611b645f830184611b42565b92915050565b5f819050919050565b611b84611b7f8261135e565b611b6a565b82525050565b5f8160601b9050919050565b5f611ba082611b8a565b9050919050565b5f611bb182611b96565b9050919050565b611bc9611bc48261129f565b611ba7565b82525050565b5f81905092915050565b828183375f83830152505050565b5f611bf28385611bcf565b9350611bff838584611bd9565b82840190509392505050565b5f611c168288611b73565b602082019150611c268287611b73565b602082019150611c368286611bb8565b601482019150611c47828486611be7565b91508190509695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302611cdf7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82611ca4565b611ce98683611ca4565b95508019841693508086168417925050509392505050565b5f611d1b611d16611d118461135e565b611b18565b61135e565b9050919050565b5f819050919050565b611d3483611d01565b611d48611d4082611d22565b848454611cb0565b825550505050565b5f90565b611d5c611d50565b611d67818484611d2b565b505050565b5b81811015611d8a57611d7f5f82611d54565b600181019050611d6d565b5050565b601f821115611dcf57611da081611c83565b611da984611c95565b81016020851015611db8578190505b611dcc611dc485611c95565b830182611d6c565b50505b505050565b5f82821c905092915050565b5f611def5f1984600802611dd4565b1980831691505092915050565b5f611e078383611de0565b9150826002028217905092915050565b611e2082611438565b67ffffffffffffffff811115611e3957611e38611c56565b5b611e438254611a45565b611e4e828285611d8e565b5f60209050601f831160018114611e7f575f8415611e6d578287015190505b611e778582611dfc565b865550611ede565b601f198416611e8d86611c83565b5f5b82811015611eb457848901518255600182019150602085019450602081019050611e8f565b86831015611ed15784890151611ecd601f891682611de0565b8355505b6001600288020188555050505b505050505050565b5f604082019050611ef95f8301856114cb565b611f066020830184611367565b9392505050565b7f70726f6f662077696e646f77732068617320636c6f73656400000000000000005f82015250565b5f611f41601883611442565b9150611f4c82611f0d565b602082019050919050565b5f6020820190508181035f830152611f6e81611f35565b9050919050565b7f576f726b207375626d6974206e6f7420636f6d70617461626c652077697468205f8201527f6368616c6c656e67650000000000000000000000000000000000000000000000602082015250565b5f611fcf602983611442565b9150611fda82611f75565b604082019050919050565b5f6020820190508181035f830152611ffc81611fc3565b9050919050565b5f819050919050565b61201d612018826114c2565b612003565b82525050565b5f61202e828561200c565b60208201915061203e8284611b73565b6020820191508190509392505050565b7f576f726b20646f6573206e6f74206d65657420646966666963756c74792074615f8201527f7267657400000000000000000000000000000000000000000000000000000000602082015250565b5f6120a8602483611442565b91506120b38261204e565b604082019050919050565b5f6020820190508181035f8301526120d58161209c565b9050919050565b5f6120e68261135e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361211857612117611947565b5b600182019050919050565b5f61212e8385611442565b935061213b838584611bd9565b6121448361147a565b840190509392505050565b5f60e0820190506121625f83018b611429565b818103602083015261217581898b612123565b90506121846040830188611367565b6121916060830187611367565b61219e6080830186611367565b6121ab60a08301856114cb565b6121b860c0830184611367565b9998505050505050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f20615f8201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b5f61221f602683611442565b915061222a826121c5565b604082019050919050565b5f6020820190508181035f83015261224c81612213565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725f82015250565b5f612287602083611442565b915061229282612253565b602082019050919050565b5f6020820190508181035f8301526122b48161227b565b905091905056fea2646970667358221220032f4fb0ab1219d91d75aff0d56aabaa226dd1f7f6a0b457ab66acdf99e4773a64736f6c63430008150033", } // PowABI is the input ABI used to generate the binding from. @@ -262,6 +273,37 @@ func (_Pow *PowCallerSession) CheckTimeWindow() error { return _Pow.Contract.CheckTimeWindow(&_Pow.CallOpts) } +// GetMinerPosSubmissions is a free data retrieval call binding the contract method 0x54bfd759. +// +// Solidity: function getMinerPosSubmissions(address addr) view returns((address,string,uint256,uint256,uint256,bytes32,uint256)[]) +func (_Pow *PowCaller) GetMinerPosSubmissions(opts *bind.CallOpts, addr common.Address) ([]LilypadPowPOWSubmission, error) { + var out []interface{} + err := _Pow.contract.Call(opts, &out, "getMinerPosSubmissions", addr) + + if err != nil { + return *new([]LilypadPowPOWSubmission), err + } + + out0 := *abi.ConvertType(out[0], new([]LilypadPowPOWSubmission)).(*[]LilypadPowPOWSubmission) + + return out0, err + +} + +// GetMinerPosSubmissions is a free data retrieval call binding the contract method 0x54bfd759. +// +// Solidity: function getMinerPosSubmissions(address addr) view returns((address,string,uint256,uint256,uint256,bytes32,uint256)[]) +func (_Pow *PowSession) GetMinerPosSubmissions(addr common.Address) ([]LilypadPowPOWSubmission, error) { + return _Pow.Contract.GetMinerPosSubmissions(&_Pow.CallOpts, addr) +} + +// GetMinerPosSubmissions is a free data retrieval call binding the contract method 0x54bfd759. +// +// Solidity: function getMinerPosSubmissions(address addr) view returns((address,string,uint256,uint256,uint256,bytes32,uint256)[]) +func (_Pow *PowCallerSession) GetMinerPosSubmissions(addr common.Address) ([]LilypadPowPOWSubmission, error) { + return _Pow.Contract.GetMinerPosSubmissions(&_Pow.CallOpts, addr) +} + // GetMiners is a free data retrieval call binding the contract method 0x1633da6e. // // Solidity: function getMiners() view returns(address[]) @@ -348,37 +390,6 @@ func (_Pow *PowCallerSession) LastChallenges(arg0 common.Address) (struct { return _Pow.Contract.LastChallenges(&_Pow.CallOpts, arg0) } -// MinerSubmissionCount is a free data retrieval call binding the contract method 0x148c684a. -// -// Solidity: function minerSubmissionCount(address ) view returns(uint256) -func (_Pow *PowCaller) MinerSubmissionCount(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { - var out []interface{} - err := _Pow.contract.Call(opts, &out, "minerSubmissionCount", arg0) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// MinerSubmissionCount is a free data retrieval call binding the contract method 0x148c684a. -// -// Solidity: function minerSubmissionCount(address ) view returns(uint256) -func (_Pow *PowSession) MinerSubmissionCount(arg0 common.Address) (*big.Int, error) { - return _Pow.Contract.MinerSubmissionCount(&_Pow.CallOpts, arg0) -} - -// MinerSubmissionCount is a free data retrieval call binding the contract method 0x148c684a. -// -// Solidity: function minerSubmissionCount(address ) view returns(uint256) -func (_Pow *PowCallerSession) MinerSubmissionCount(arg0 common.Address) (*big.Int, error) { - return _Pow.Contract.MinerSubmissionCount(&_Pow.CallOpts, arg0) -} - // Miners is a free data retrieval call binding the contract method 0xe0d152af. // // Solidity: function miners(uint256 ) view returns(address) @@ -443,27 +454,27 @@ func (_Pow *PowCallerSession) Owner() (common.Address, error) { // PowSubmissions is a free data retrieval call binding the contract method 0x4bbe05e4. // -// Solidity: function powSubmissions(address , uint256 ) view returns(address walletAddress, string nodeId, uint256 nonce, uint256 start_timestap, uint256 complete_timestap, bytes32 challenge, uint256 difficulty) +// Solidity: function powSubmissions(address , uint256 ) view returns(address walletAddress, string nodeId, uint256 nonce, uint256 start_timestamp, uint256 complete_timestamp, bytes32 challenge, uint256 difficulty) func (_Pow *PowCaller) PowSubmissions(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (struct { - WalletAddress common.Address - NodeId string - Nonce *big.Int - StartTimestap *big.Int - CompleteTimestap *big.Int - Challenge [32]byte - Difficulty *big.Int + WalletAddress common.Address + NodeId string + Nonce *big.Int + StartTimestamp *big.Int + CompleteTimestamp *big.Int + Challenge [32]byte + Difficulty *big.Int }, error) { var out []interface{} err := _Pow.contract.Call(opts, &out, "powSubmissions", arg0, arg1) outstruct := new(struct { - WalletAddress common.Address - NodeId string - Nonce *big.Int - StartTimestap *big.Int - CompleteTimestap *big.Int - Challenge [32]byte - Difficulty *big.Int + WalletAddress common.Address + NodeId string + Nonce *big.Int + StartTimestamp *big.Int + CompleteTimestamp *big.Int + Challenge [32]byte + Difficulty *big.Int }) if err != nil { return *outstruct, err @@ -472,8 +483,8 @@ func (_Pow *PowCaller) PowSubmissions(opts *bind.CallOpts, arg0 common.Address, outstruct.WalletAddress = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) outstruct.NodeId = *abi.ConvertType(out[1], new(string)).(*string) outstruct.Nonce = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) - outstruct.StartTimestap = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) - outstruct.CompleteTimestap = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) + outstruct.StartTimestamp = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + outstruct.CompleteTimestamp = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) outstruct.Challenge = *abi.ConvertType(out[5], new([32]byte)).(*[32]byte) outstruct.Difficulty = *abi.ConvertType(out[6], new(*big.Int)).(**big.Int) @@ -483,30 +494,30 @@ func (_Pow *PowCaller) PowSubmissions(opts *bind.CallOpts, arg0 common.Address, // PowSubmissions is a free data retrieval call binding the contract method 0x4bbe05e4. // -// Solidity: function powSubmissions(address , uint256 ) view returns(address walletAddress, string nodeId, uint256 nonce, uint256 start_timestap, uint256 complete_timestap, bytes32 challenge, uint256 difficulty) +// Solidity: function powSubmissions(address , uint256 ) view returns(address walletAddress, string nodeId, uint256 nonce, uint256 start_timestamp, uint256 complete_timestamp, bytes32 challenge, uint256 difficulty) func (_Pow *PowSession) PowSubmissions(arg0 common.Address, arg1 *big.Int) (struct { - WalletAddress common.Address - NodeId string - Nonce *big.Int - StartTimestap *big.Int - CompleteTimestap *big.Int - Challenge [32]byte - Difficulty *big.Int + WalletAddress common.Address + NodeId string + Nonce *big.Int + StartTimestamp *big.Int + CompleteTimestamp *big.Int + Challenge [32]byte + Difficulty *big.Int }, error) { return _Pow.Contract.PowSubmissions(&_Pow.CallOpts, arg0, arg1) } // PowSubmissions is a free data retrieval call binding the contract method 0x4bbe05e4. // -// Solidity: function powSubmissions(address , uint256 ) view returns(address walletAddress, string nodeId, uint256 nonce, uint256 start_timestap, uint256 complete_timestap, bytes32 challenge, uint256 difficulty) +// Solidity: function powSubmissions(address , uint256 ) view returns(address walletAddress, string nodeId, uint256 nonce, uint256 start_timestamp, uint256 complete_timestamp, bytes32 challenge, uint256 difficulty) func (_Pow *PowCallerSession) PowSubmissions(arg0 common.Address, arg1 *big.Int) (struct { - WalletAddress common.Address - NodeId string - Nonce *big.Int - StartTimestap *big.Int - CompleteTimestap *big.Int - Challenge [32]byte - Difficulty *big.Int + WalletAddress common.Address + NodeId string + Nonce *big.Int + StartTimestamp *big.Int + CompleteTimestamp *big.Int + Challenge [32]byte + Difficulty *big.Int }, error) { return _Pow.Contract.PowSubmissions(&_Pow.CallOpts, arg0, arg1) } @@ -1437,43 +1448,34 @@ func (it *PowValidPOWSubmittedIterator) Close() error { // PowValidPOWSubmitted represents a ValidPOWSubmitted event raised by the Pow contract. type PowValidPOWSubmitted struct { - WalletAddress common.Address - NodeId string - Nonce *big.Int - Timestamp *big.Int - Challenge [32]byte - Difficulty *big.Int - Raw types.Log // Blockchain specific contextual infos + WalletAddress common.Address + NodeId string + Nonce *big.Int + StartTimestamp *big.Int + CompleteTimestamp *big.Int + Challenge [32]byte + Difficulty *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterValidPOWSubmitted is a free log retrieval operation binding the contract event 0x5ea61d67e3236a79ab8c3c29f810e2c408b0a6b1e19f4e0da2fcd6362129c860. +// FilterValidPOWSubmitted is a free log retrieval operation binding the contract event 0x172b7d59e60446d8dfc98985344fb883c871ef150b1db4d1592bcb6769903732. // -// Solidity: event ValidPOWSubmitted(address indexed walletAddress, string nodeId, uint256 nonce, uint256 timestamp, bytes32 challenge, uint256 difficulty) -func (_Pow *PowFilterer) FilterValidPOWSubmitted(opts *bind.FilterOpts, walletAddress []common.Address) (*PowValidPOWSubmittedIterator, error) { - - var walletAddressRule []interface{} - for _, walletAddressItem := range walletAddress { - walletAddressRule = append(walletAddressRule, walletAddressItem) - } +// Solidity: event ValidPOWSubmitted(address walletAddress, string nodeId, uint256 nonce, uint256 start_timestamp, uint256 complete_timestamp, bytes32 challenge, uint256 difficulty) +func (_Pow *PowFilterer) FilterValidPOWSubmitted(opts *bind.FilterOpts) (*PowValidPOWSubmittedIterator, error) { - logs, sub, err := _Pow.contract.FilterLogs(opts, "ValidPOWSubmitted", walletAddressRule) + logs, sub, err := _Pow.contract.FilterLogs(opts, "ValidPOWSubmitted") if err != nil { return nil, err } return &PowValidPOWSubmittedIterator{contract: _Pow.contract, event: "ValidPOWSubmitted", logs: logs, sub: sub}, nil } -// WatchValidPOWSubmitted is a free log subscription operation binding the contract event 0x5ea61d67e3236a79ab8c3c29f810e2c408b0a6b1e19f4e0da2fcd6362129c860. +// WatchValidPOWSubmitted is a free log subscription operation binding the contract event 0x172b7d59e60446d8dfc98985344fb883c871ef150b1db4d1592bcb6769903732. // -// Solidity: event ValidPOWSubmitted(address indexed walletAddress, string nodeId, uint256 nonce, uint256 timestamp, bytes32 challenge, uint256 difficulty) -func (_Pow *PowFilterer) WatchValidPOWSubmitted(opts *bind.WatchOpts, sink chan<- *PowValidPOWSubmitted, walletAddress []common.Address) (event.Subscription, error) { - - var walletAddressRule []interface{} - for _, walletAddressItem := range walletAddress { - walletAddressRule = append(walletAddressRule, walletAddressItem) - } +// Solidity: event ValidPOWSubmitted(address walletAddress, string nodeId, uint256 nonce, uint256 start_timestamp, uint256 complete_timestamp, bytes32 challenge, uint256 difficulty) +func (_Pow *PowFilterer) WatchValidPOWSubmitted(opts *bind.WatchOpts, sink chan<- *PowValidPOWSubmitted) (event.Subscription, error) { - logs, sub, err := _Pow.contract.WatchLogs(opts, "ValidPOWSubmitted", walletAddressRule) + logs, sub, err := _Pow.contract.WatchLogs(opts, "ValidPOWSubmitted") if err != nil { return nil, err } @@ -1505,9 +1507,9 @@ func (_Pow *PowFilterer) WatchValidPOWSubmitted(opts *bind.WatchOpts, sink chan< }), nil } -// ParseValidPOWSubmitted is a log parse operation binding the contract event 0x5ea61d67e3236a79ab8c3c29f810e2c408b0a6b1e19f4e0da2fcd6362129c860. +// ParseValidPOWSubmitted is a log parse operation binding the contract event 0x172b7d59e60446d8dfc98985344fb883c871ef150b1db4d1592bcb6769903732. // -// Solidity: event ValidPOWSubmitted(address indexed walletAddress, string nodeId, uint256 nonce, uint256 timestamp, bytes32 challenge, uint256 difficulty) +// Solidity: event ValidPOWSubmitted(address walletAddress, string nodeId, uint256 nonce, uint256 start_timestamp, uint256 complete_timestamp, bytes32 challenge, uint256 difficulty) func (_Pow *PowFilterer) ParseValidPOWSubmitted(log types.Log) (*PowValidPOWSubmitted, error) { event := new(PowValidPOWSubmitted) if err := _Pow.contract.UnpackLog(event, "ValidPOWSubmitted", log); err != nil {