diff options
Diffstat (limited to 'contracts/chequebook/contract')
-rw-r--r-- | contracts/chequebook/contract/chequebook.go | 321 | ||||
-rw-r--r-- | contracts/chequebook/contract/chequebook.sol | 10 | ||||
-rw-r--r-- | contracts/chequebook/contract/code.go | 2 | ||||
-rw-r--r-- | contracts/chequebook/contract/mortal.sol | 10 | ||||
-rw-r--r-- | contracts/chequebook/contract/owned.sol | 15 |
5 files changed, 36 insertions, 322 deletions
diff --git a/contracts/chequebook/contract/chequebook.go b/contracts/chequebook/contract/chequebook.go index 47090152c..ce29b01f0 100644 --- a/contracts/chequebook/contract/chequebook.go +++ b/contracts/chequebook/contract/chequebook.go @@ -1,5 +1,5 @@ -// This file is an automatically generated Go binding. Do not modify as any -// change will likely be lost upon the next re-generation! +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. package contract @@ -14,10 +14,10 @@ import ( ) // ChequebookABI is the input ABI used to generate the binding from. -const ChequebookABI = `[{"constant":false,"inputs":[],"name":"kill","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"sent","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"beneficiary","type":"address"},{"name":"amount","type":"uint256"},{"name":"sig_v","type":"uint8"},{"name":"sig_r","type":"bytes32"},{"name":"sig_s","type":"bytes32"}],"name":"cash","outputs":[],"type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"deadbeat","type":"address"}],"name":"Overdraft","type":"event"}]` +const ChequebookABI = "[{\"constant\":false,\"inputs\":[],\"name\":\"kill\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"sent\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"beneficiary\",\"type\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\"},{\"name\":\"sig_v\",\"type\":\"uint8\"},{\"name\":\"sig_r\",\"type\":\"bytes32\"},{\"name\":\"sig_s\",\"type\":\"bytes32\"}],\"name\":\"cash\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"deadbeat\",\"type\":\"address\"}],\"name\":\"Overdraft\",\"type\":\"event\"}]" // ChequebookBin is the compiled bytecode used for deploying new contracts. -const ChequebookBin = `0x606060405260008054600160a060020a031916331790556101ff806100246000396000f3606060405260e060020a600035046341c0e1b581146100315780637bf786f814610059578063fbf788d614610071575b005b61002f60005433600160a060020a03908116911614156100bd57600054600160a060020a0316ff5b6100ab60043560016020526000908152604090205481565b61002f600435602435604435606435608435600160a060020a03851660009081526001602052604081205485116100bf575b505050505050565b60408051918252519081900360200190f35b565b50604080516c0100000000000000000000000030600160a060020a0390811682028352881602601482015260288101869052815190819003604801812080825260ff861660208381019190915282840186905260608301859052925190926001926080818101939182900301816000866161da5a03f11561000257505060405151600054600160a060020a0390811691161461015a576100a3565b600160a060020a038681166000908152600160205260409020543090911631908603106101b357604060008181208790559051600160a060020a0388169190819081818181818881f1935050505015156100a357610002565b60005460408051600160a060020a03929092168252517f2250e2993c15843b32621c89447cc589ee7a9f049c026986e545d3c2c0c6f9789181900360200190a185600160a060020a0316ff` +const ChequebookBin = `0x606060405260008054600160a060020a033316600160a060020a03199091161790556102ec806100306000396000f3006060604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b581146100585780637bf786f81461006b578063fbf788d61461009c575b005b341561006357600080fd5b6100566100ca565b341561007657600080fd5b61008a600160a060020a03600435166100f1565b60405190815260200160405180910390f35b34156100a757600080fd5b610056600160a060020a036004351660243560ff60443516606435608435610103565b60005433600160a060020a03908116911614156100ef57600054600160a060020a0316ff5b565b60016020526000908152604090205481565b600160a060020a0385166000908152600160205260408120548190861161012957600080fd5b3087876040516c01000000000000000000000000600160a060020a03948516810282529290931690910260148301526028820152604801604051809103902091506001828686866040516000815260200160405260006040516020015260405193845260ff90921660208085019190915260408085019290925260608401929092526080909201915160208103908084039060008661646e5a03f115156101cf57600080fd5b505060206040510351600054600160a060020a039081169116146101f257600080fd5b50600160a060020a03808716600090815260016020526040902054860390301631811161026257600160a060020a0387166000818152600160205260409081902088905582156108fc0290839051600060405180830381858888f19350505050151561025d57600080fd5b6102b7565b6000547f2250e2993c15843b32621c89447cc589ee7a9f049c026986e545d3c2c0c6f97890600160a060020a0316604051600160a060020a03909116815260200160405180910390a186600160a060020a0316ff5b505050505050505600a165627a7a7230582014e927522ca5cd8f68529ac4d3b9cdf36d40e09d8a33b70008248d1abebf79680029` // DeployChequebook deploys a new Ethereum contract, binding an instance of Chequebook to it. func DeployChequebook(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Chequebook, error) { @@ -226,316 +226,3 @@ func (_Chequebook *ChequebookSession) Kill() (*types.Transaction, error) { func (_Chequebook *ChequebookTransactorSession) Kill() (*types.Transaction, error) { return _Chequebook.Contract.Kill(&_Chequebook.TransactOpts) } - -// MortalABI is the input ABI used to generate the binding from. -const MortalABI = `[{"constant":false,"inputs":[],"name":"kill","outputs":[],"type":"function"}]` - -// MortalBin is the compiled bytecode used for deploying new contracts. -const MortalBin = `0x606060405260008054600160a060020a03191633179055605c8060226000396000f3606060405260e060020a600035046341c0e1b58114601a575b005b60186000543373ffffffffffffffffffffffffffffffffffffffff90811691161415605a5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b56` - -// DeployMortal deploys a new Ethereum contract, binding an instance of Mortal to it. -func DeployMortal(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Mortal, error) { - parsed, err := abi.JSON(strings.NewReader(MortalABI)) - if err != nil { - return common.Address{}, nil, nil, err - } - address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(MortalBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &Mortal{MortalCaller: MortalCaller{contract: contract}, MortalTransactor: MortalTransactor{contract: contract}}, nil -} - -// Mortal is an auto generated Go binding around an Ethereum contract. -type Mortal struct { - MortalCaller // Read-only binding to the contract - MortalTransactor // Write-only binding to the contract -} - -// MortalCaller is an auto generated read-only Go binding around an Ethereum contract. -type MortalCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// MortalTransactor is an auto generated write-only Go binding around an Ethereum contract. -type MortalTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// MortalSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type MortalSession struct { - Contract *Mortal // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// MortalCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type MortalCallerSession struct { - Contract *MortalCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// MortalTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type MortalTransactorSession struct { - Contract *MortalTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// MortalRaw is an auto generated low-level Go binding around an Ethereum contract. -type MortalRaw struct { - Contract *Mortal // Generic contract binding to access the raw methods on -} - -// MortalCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type MortalCallerRaw struct { - Contract *MortalCaller // Generic read-only contract binding to access the raw methods on -} - -// MortalTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type MortalTransactorRaw struct { - Contract *MortalTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewMortal creates a new instance of Mortal, bound to a specific deployed contract. -func NewMortal(address common.Address, backend bind.ContractBackend) (*Mortal, error) { - contract, err := bindMortal(address, backend, backend) - if err != nil { - return nil, err - } - return &Mortal{MortalCaller: MortalCaller{contract: contract}, MortalTransactor: MortalTransactor{contract: contract}}, nil -} - -// NewMortalCaller creates a new read-only instance of Mortal, bound to a specific deployed contract. -func NewMortalCaller(address common.Address, caller bind.ContractCaller) (*MortalCaller, error) { - contract, err := bindMortal(address, caller, nil) - if err != nil { - return nil, err - } - return &MortalCaller{contract: contract}, nil -} - -// NewMortalTransactor creates a new write-only instance of Mortal, bound to a specific deployed contract. -func NewMortalTransactor(address common.Address, transactor bind.ContractTransactor) (*MortalTransactor, error) { - contract, err := bindMortal(address, nil, transactor) - if err != nil { - return nil, err - } - return &MortalTransactor{contract: contract}, nil -} - -// bindMortal binds a generic wrapper to an already deployed contract. -func bindMortal(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) { - parsed, err := abi.JSON(strings.NewReader(MortalABI)) - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, parsed, caller, transactor), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_Mortal *MortalRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { - return _Mortal.Contract.MortalCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_Mortal *MortalRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Mortal.Contract.MortalTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Mortal *MortalRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Mortal.Contract.MortalTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_Mortal *MortalCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { - return _Mortal.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_Mortal *MortalTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Mortal.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Mortal *MortalTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Mortal.Contract.contract.Transact(opts, method, params...) -} - -// Kill is a paid mutator transaction binding the contract method 0x41c0e1b5. -// -// Solidity: function kill() returns() -func (_Mortal *MortalTransactor) Kill(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Mortal.contract.Transact(opts, "kill") -} - -// Kill is a paid mutator transaction binding the contract method 0x41c0e1b5. -// -// Solidity: function kill() returns() -func (_Mortal *MortalSession) Kill() (*types.Transaction, error) { - return _Mortal.Contract.Kill(&_Mortal.TransactOpts) -} - -// Kill is a paid mutator transaction binding the contract method 0x41c0e1b5. -// -// Solidity: function kill() returns() -func (_Mortal *MortalTransactorSession) Kill() (*types.Transaction, error) { - return _Mortal.Contract.Kill(&_Mortal.TransactOpts) -} - -// OwnedABI is the input ABI used to generate the binding from. -const OwnedABI = `[{"inputs":[],"type":"constructor"}]` - -// OwnedBin is the compiled bytecode used for deploying new contracts. -const OwnedBin = `0x606060405260008054600160a060020a0319163317905560068060226000396000f3606060405200` - -// DeployOwned deploys a new Ethereum contract, binding an instance of Owned to it. -func DeployOwned(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Owned, error) { - parsed, err := abi.JSON(strings.NewReader(OwnedABI)) - if err != nil { - return common.Address{}, nil, nil, err - } - address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(OwnedBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &Owned{OwnedCaller: OwnedCaller{contract: contract}, OwnedTransactor: OwnedTransactor{contract: contract}}, nil -} - -// Owned is an auto generated Go binding around an Ethereum contract. -type Owned struct { - OwnedCaller // Read-only binding to the contract - OwnedTransactor // Write-only binding to the contract -} - -// OwnedCaller is an auto generated read-only Go binding around an Ethereum contract. -type OwnedCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// OwnedTransactor is an auto generated write-only Go binding around an Ethereum contract. -type OwnedTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// OwnedSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type OwnedSession struct { - Contract *Owned // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// OwnedCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type OwnedCallerSession struct { - Contract *OwnedCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// OwnedTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type OwnedTransactorSession struct { - Contract *OwnedTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// OwnedRaw is an auto generated low-level Go binding around an Ethereum contract. -type OwnedRaw struct { - Contract *Owned // Generic contract binding to access the raw methods on -} - -// OwnedCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type OwnedCallerRaw struct { - Contract *OwnedCaller // Generic read-only contract binding to access the raw methods on -} - -// OwnedTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type OwnedTransactorRaw struct { - Contract *OwnedTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewOwned creates a new instance of Owned, bound to a specific deployed contract. -func NewOwned(address common.Address, backend bind.ContractBackend) (*Owned, error) { - contract, err := bindOwned(address, backend, backend) - if err != nil { - return nil, err - } - return &Owned{OwnedCaller: OwnedCaller{contract: contract}, OwnedTransactor: OwnedTransactor{contract: contract}}, nil -} - -// NewOwnedCaller creates a new read-only instance of Owned, bound to a specific deployed contract. -func NewOwnedCaller(address common.Address, caller bind.ContractCaller) (*OwnedCaller, error) { - contract, err := bindOwned(address, caller, nil) - if err != nil { - return nil, err - } - return &OwnedCaller{contract: contract}, nil -} - -// NewOwnedTransactor creates a new write-only instance of Owned, bound to a specific deployed contract. -func NewOwnedTransactor(address common.Address, transactor bind.ContractTransactor) (*OwnedTransactor, error) { - contract, err := bindOwned(address, nil, transactor) - if err != nil { - return nil, err - } - return &OwnedTransactor{contract: contract}, nil -} - -// bindOwned binds a generic wrapper to an already deployed contract. -func bindOwned(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) { - parsed, err := abi.JSON(strings.NewReader(OwnedABI)) - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, parsed, caller, transactor), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_Owned *OwnedRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { - return _Owned.Contract.OwnedCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_Owned *OwnedRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Owned.Contract.OwnedTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Owned *OwnedRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Owned.Contract.OwnedTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_Owned *OwnedCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { - return _Owned.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_Owned *OwnedTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Owned.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Owned *OwnedTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Owned.Contract.contract.Transact(opts, method, params...) -} diff --git a/contracts/chequebook/contract/chequebook.sol b/contracts/chequebook/contract/chequebook.sol index 8d6e85d11..c386cceed 100644 --- a/contracts/chequebook/contract/chequebook.sol +++ b/contracts/chequebook/contract/chequebook.sol @@ -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 <daniel@ethereum.org> @@ -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 { diff --git a/contracts/chequebook/contract/code.go b/contracts/chequebook/contract/code.go index b08e04e71..9d1fb169e 100644 --- a/contracts/chequebook/contract/code.go +++ b/contracts/chequebook/contract/code.go @@ -2,4 +2,4 @@ package contract // ContractDeployedCode is used to detect suicides. This constant needs to be // updated when the contract code is changed. -const ContractDeployedCode = "0x606060405260e060020a600035046341c0e1b581146100315780637bf786f814610059578063fbf788d614610071575b005b61002f60005433600160a060020a03908116911614156100bd57600054600160a060020a0316ff5b6100ab60043560016020526000908152604090205481565b61002f600435602435604435606435608435600160a060020a03851660009081526001602052604081205485116100bf575b505050505050565b60408051918252519081900360200190f35b565b50604080516c0100000000000000000000000030600160a060020a0390811682028352881602601482015260288101869052815190819003604801812080825260ff861660208381019190915282840186905260608301859052925190926001926080818101939182900301816000866161da5a03f11561000257505060405151600054600160a060020a0390811691161461015a576100a3565b600160a060020a038681166000908152600160205260409020543090911631908603106101b357604060008181208790559051600160a060020a0388169190819081818181818881f1935050505015156100a357610002565b60005460408051600160a060020a03929092168252517f2250e2993c15843b32621c89447cc589ee7a9f049c026986e545d3c2c0c6f9789181900360200190a185600160a060020a0316ff" +const ContractDeployedCode = "0x6060604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b581146100585780637bf786f81461006b578063fbf788d61461009c575b005b341561006357600080fd5b6100566100ca565b341561007657600080fd5b61008a600160a060020a03600435166100f1565b60405190815260200160405180910390f35b34156100a757600080fd5b610056600160a060020a036004351660243560ff60443516606435608435610103565b60005433600160a060020a03908116911614156100ef57600054600160a060020a0316ff5b565b60016020526000908152604090205481565b600160a060020a0385166000908152600160205260408120548190861161012957600080fd5b3087876040516c01000000000000000000000000600160a060020a03948516810282529290931690910260148301526028820152604801604051809103902091506001828686866040516000815260200160405260006040516020015260405193845260ff90921660208085019190915260408085019290925260608401929092526080909201915160208103908084039060008661646e5a03f115156101cf57600080fd5b505060206040510351600054600160a060020a039081169116146101f257600080fd5b50600160a060020a03808716600090815260016020526040902054860390301631811161026257600160a060020a0387166000818152600160205260409081902088905582156108fc0290839051600060405180830381858888f19350505050151561025d57600080fd5b6102b7565b6000547f2250e2993c15843b32621c89447cc589ee7a9f049c026986e545d3c2c0c6f97890600160a060020a0316604051600160a060020a03909116815260200160405180910390a186600160a060020a0316ff5b505050505050505600a165627a7a7230582014e927522ca5cd8f68529ac4d3b9cdf36d40e09d8a33b70008248d1abebf79680029" diff --git a/contracts/chequebook/contract/mortal.sol b/contracts/chequebook/contract/mortal.sol new file mode 100644 index 000000000..c43f1e4f7 --- /dev/null +++ b/contracts/chequebook/contract/mortal.sol @@ -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); + } +} diff --git a/contracts/chequebook/contract/owned.sol b/contracts/chequebook/contract/owned.sol new file mode 100644 index 000000000..ee9860d34 --- /dev/null +++ b/contracts/chequebook/contract/owned.sol @@ -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; + } +} |