forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
all: update generated code (ethereum#15808)
* core/types, core/vm, eth, tests: regenerate gencodec files * Makefile: update devtools target Install protoc-gen-go and print reminders about npm, solc and protoc. Also switch to github.com/kevinburke/go-bindata because it's more maintained. * contracts/ens: update contracts and regenerate with solidity v0.4.19 The newer upstream version of the FIFSRegistrar contract doesn't set the resolver anymore. The resolver is now deployed separately. * contracts/release: regenerate with solidity v0.4.19 * contracts/chequebook: fix fallback and regenerate with solidity v0.4.19 The contract didn't have a fallback function, payments would be rejected when compiled with newer solidity. References to 'mortal' and 'owned' use the local file system so we can compile without network access. * p2p/discv5: regenerate with recent stringer * cmd/faucet: regenerate * dashboard: regenerate * eth/tracers: regenerate * internal/jsre/deps: regenerate * dashboard: avoid sed -i because it's not portable * accounts/usbwallet/internal/trezor: fix go generate warnings
- Loading branch information
Showing
42 changed files
with
2,086 additions
and
1,378 deletions.
There are no files selected for viewing
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
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
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
pragma solidity ^0.4.18; | ||
|
||
import "https://github.com/ethereum/solidity/std/mortal.sol"; | ||
import "./mortal.sol"; | ||
|
||
/// @title Chequebook for Ethereum micropayments | ||
/// @author Daniel A. Nagy <[email protected]> | ||
|
@@ -11,6 +11,9 @@ contract chequebook is mortal { | |
/// @notice Overdraft event | ||
event Overdraft(address deadbeat); | ||
|
||
// Allow sending ether to the chequebook. | ||
function() public payable { } | ||
|
||
/// @notice Cash cheque | ||
/// | ||
/// @param beneficiary beneficiary address | ||
|
@@ -19,8 +22,7 @@ contract chequebook is mortal { | |
/// @param sig_r signature parameter r | ||
/// @param sig_s signature parameter s | ||
/// The digital signature is calculated on the concatenated triplet of contract address, beneficiary address and cumulative amount | ||
function cash(address beneficiary, uint256 amount, | ||
uint8 sig_v, bytes32 sig_r, bytes32 sig_s) { | ||
function cash(address beneficiary, uint256 amount, uint8 sig_v, bytes32 sig_r, bytes32 sig_s) public { | ||
// Check if the cheque is old. | ||
// Only cheques that are more recent than the last cashed one are considered. | ||
require(amount > sent[beneficiary]); | ||
|
@@ -31,7 +33,7 @@ contract chequebook is mortal { | |
// and the cumulative amount on the last cashed cheque to beneficiary. | ||
uint256 diff = amount - sent[beneficiary]; | ||
if (diff <= this.balance) { | ||
// update the cumulative amount before sending | ||
// update the cumulative amount before sending | ||
sent[beneficiary] = amount; | ||
beneficiary.transfer(diff); | ||
} else { | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
pragma solidity ^0.4.0; | ||
|
||
import "./owned.sol"; | ||
|
||
contract mortal is owned { | ||
function kill() public { | ||
if (msg.sender == owner) | ||
selfdestruct(owner); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
pragma solidity ^0.4.0; | ||
|
||
contract owned { | ||
address owner; | ||
|
||
modifier onlyowner() { | ||
if (msg.sender == owner) { | ||
_; | ||
} | ||
} | ||
|
||
function owned() public { | ||
owner = msg.sender; | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
pragma solidity ^0.4.0; | ||
|
||
contract AbstractENS { | ||
function owner(bytes32 node) constant returns(address); | ||
function resolver(bytes32 node) constant returns(address); | ||
function ttl(bytes32 node) constant returns(uint64); | ||
function setOwner(bytes32 node, address owner); | ||
function setSubnodeOwner(bytes32 node, bytes32 label, address owner); | ||
function setResolver(bytes32 node, address resolver); | ||
function setTTL(bytes32 node, uint64 ttl); | ||
|
||
// Logged when the owner of a node assigns a new owner to a subnode. | ||
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner); | ||
|
||
// Logged when the owner of a node transfers ownership to a new account. | ||
event Transfer(bytes32 indexed node, address owner); | ||
|
||
// Logged when the resolver for a node changes. | ||
event NewResolver(bytes32 indexed node, address resolver); | ||
|
||
// Logged when the TTL of a node changes | ||
event NewTTL(bytes32 indexed node, uint64 ttl); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
pragma solidity ^0.4.0; | ||
|
||
import './AbstractENS.sol'; | ||
|
||
/** | ||
* The ENS registry contract. | ||
*/ | ||
contract ENS is AbstractENS { | ||
struct Record { | ||
address owner; | ||
address resolver; | ||
uint64 ttl; | ||
} | ||
|
||
mapping(bytes32=>Record) records; | ||
|
||
// Permits modifications only by the owner of the specified node. | ||
modifier only_owner(bytes32 node) { | ||
if (records[node].owner != msg.sender) throw; | ||
_; | ||
} | ||
|
||
/** | ||
* Constructs a new ENS registrar. | ||
*/ | ||
function ENS() { | ||
records[0].owner = msg.sender; | ||
} | ||
|
||
/** | ||
* Returns the address that owns the specified node. | ||
*/ | ||
function owner(bytes32 node) constant returns (address) { | ||
return records[node].owner; | ||
} | ||
|
||
/** | ||
* Returns the address of the resolver for the specified node. | ||
*/ | ||
function resolver(bytes32 node) constant returns (address) { | ||
return records[node].resolver; | ||
} | ||
|
||
/** | ||
* Returns the TTL of a node, and any records associated with it. | ||
*/ | ||
function ttl(bytes32 node) constant returns (uint64) { | ||
return records[node].ttl; | ||
} | ||
|
||
/** | ||
* Transfers ownership of a node to a new address. May only be called by the current | ||
* owner of the node. | ||
* @param node The node to transfer ownership of. | ||
* @param owner The address of the new owner. | ||
*/ | ||
function setOwner(bytes32 node, address owner) only_owner(node) { | ||
Transfer(node, owner); | ||
records[node].owner = owner; | ||
} | ||
|
||
/** | ||
* Transfers ownership of a subnode sha3(node, label) to a new address. May only be | ||
* called by the owner of the parent node. | ||
* @param node The parent node. | ||
* @param label The hash of the label specifying the subnode. | ||
* @param owner The address of the new owner. | ||
*/ | ||
function setSubnodeOwner(bytes32 node, bytes32 label, address owner) only_owner(node) { | ||
var subnode = sha3(node, label); | ||
NewOwner(node, label, owner); | ||
records[subnode].owner = owner; | ||
} | ||
|
||
/** | ||
* Sets the resolver address for the specified node. | ||
* @param node The node to update. | ||
* @param resolver The address of the resolver. | ||
*/ | ||
function setResolver(bytes32 node, address resolver) only_owner(node) { | ||
NewResolver(node, resolver); | ||
records[node].resolver = resolver; | ||
} | ||
|
||
/** | ||
* Sets the TTL for the specified node. | ||
* @param node The node to update. | ||
* @param ttl The TTL in seconds. | ||
*/ | ||
function setTTL(bytes32 node, uint64 ttl) only_owner(node) { | ||
NewTTL(node, ttl); | ||
records[node].ttl = ttl; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
pragma solidity ^0.4.0; | ||
|
||
import './AbstractENS.sol'; | ||
|
||
/** | ||
* A registrar that allocates subdomains to the first person to claim them. | ||
*/ | ||
contract FIFSRegistrar { | ||
AbstractENS ens; | ||
bytes32 rootNode; | ||
|
||
modifier only_owner(bytes32 subnode) { | ||
var node = sha3(rootNode, subnode); | ||
var currentOwner = ens.owner(node); | ||
|
||
if (currentOwner != 0 && currentOwner != msg.sender) throw; | ||
|
||
_; | ||
} | ||
|
||
/** | ||
* Constructor. | ||
* @param ensAddr The address of the ENS registry. | ||
* @param node The node that this registrar administers. | ||
*/ | ||
function FIFSRegistrar(AbstractENS ensAddr, bytes32 node) { | ||
ens = ensAddr; | ||
rootNode = node; | ||
} | ||
|
||
/** | ||
* Register a name, or change the owner of an existing registration. | ||
* @param subnode The hash of the label to register. | ||
* @param owner The address of the new owner. | ||
*/ | ||
function register(bytes32 subnode, address owner) only_owner(subnode) { | ||
ens.setSubnodeOwner(rootNode, subnode, owner); | ||
} | ||
} |
Oops, something went wrong.