diff options
author | Denton Liu <liu.denton+github@gmail.com> | 2016-08-17 03:10:40 +0800 |
---|---|---|
committer | Denton Liu <liu.denton+github@gmail.com> | 2016-08-19 22:34:50 +0800 |
commit | bf430709d531bdc066a13f1b638f7fb8c63caf67 (patch) | |
tree | 974fcae1f886db0e9e3662e2f063451344e926de | |
parent | e00f802f725e284af453d70a48d450a4d5c9925e (diff) | |
download | dexon-solidity-bf430709d531bdc066a13f1b638f7fb8c63caf67.tar dexon-solidity-bf430709d531bdc066a13f1b638f7fb8c63caf67.tar.gz dexon-solidity-bf430709d531bdc066a13f1b638f7fb8c63caf67.tar.bz2 dexon-solidity-bf430709d531bdc066a13f1b638f7fb8c63caf67.tar.lz dexon-solidity-bf430709d531bdc066a13f1b638f7fb8c63caf67.tar.xz dexon-solidity-bf430709d531bdc066a13f1b638f7fb8c63caf67.tar.zst dexon-solidity-bf430709d531bdc066a13f1b638f7fb8c63caf67.zip |
Add back standard contracts
-rw-r--r-- | std/Coin | 9 | ||||
-rw-r--r-- | std/CoinReg | 6 | ||||
-rw-r--r-- | std/Config | 6 | ||||
-rw-r--r-- | std/NameReg | 6 | ||||
-rw-r--r-- | std/coin | 9 | ||||
-rw-r--r-- | std/configUser | 5 | ||||
-rw-r--r-- | std/mortal | 8 | ||||
-rw-r--r-- | std/named | 9 | ||||
-rw-r--r-- | std/owned | 13 | ||||
-rw-r--r-- | std/service | 8 | ||||
-rw-r--r-- | std/std | 6 |
11 files changed, 85 insertions, 0 deletions
diff --git a/std/Coin b/std/Coin new file mode 100644 index 00000000..aca30e6b --- /dev/null +++ b/std/Coin @@ -0,0 +1,9 @@ +contract Coin { + function isApprovedFor(address _target, address _proxy) constant returns (bool _r) {} + function isApproved(address _proxy) constant returns (bool _r) {} + function sendCoinFrom(address _from, uint256 _val, address _to) {} + function coinBalanceOf(address _a) constant returns (uint256 _r) {} + function sendCoin(uint256 _val, address _to) {} + function coinBalance() constant returns (uint256 _r) {} + function approve(address _a) {} +} diff --git a/std/CoinReg b/std/CoinReg new file mode 100644 index 00000000..58400a98 --- /dev/null +++ b/std/CoinReg @@ -0,0 +1,6 @@ +contract CoinReg{ + function count() constant returns (uint256 r) {} + function info(uint256 i) constant returns (address addr, bytes3 name, uint256 denom) {} + function register(bytes3 name, uint256 denom) {} + function unregister() {} +} diff --git a/std/Config b/std/Config new file mode 100644 index 00000000..868e07df --- /dev/null +++ b/std/Config @@ -0,0 +1,6 @@ +contract Config { + function lookup(uint256 service) constant returns (address a) {} + function kill() {} + function unregister(uint256 id) {} + function register(uint256 id, address service) {} +} diff --git a/std/NameReg b/std/NameReg new file mode 100644 index 00000000..48fd6c6e --- /dev/null +++ b/std/NameReg @@ -0,0 +1,6 @@ +contract NameReg { + function register(bytes32 name) {} + function addressOf(bytes32 name) constant returns (address addr) {} + function unregister() {} + function nameOf(address addr) constant returns (bytes32 name) {} +} diff --git a/std/coin b/std/coin new file mode 100644 index 00000000..691fdd66 --- /dev/null +++ b/std/coin @@ -0,0 +1,9 @@ +import "CoinReg"; +import "Config"; +import "configUser"; + +contract coin is configUser { + function coin(bytes3 name, uint denom) { + CoinReg(Config(configAddr()).lookup(3)).register(name, denom); + } +} diff --git a/std/configUser b/std/configUser new file mode 100644 index 00000000..15a91621 --- /dev/null +++ b/std/configUser @@ -0,0 +1,5 @@ +contract configUser { + function configAddr() constant returns (address a) { + return 0xc6d9d2cd449a754c494264e1809c50e34d64562b; + } +} diff --git a/std/mortal b/std/mortal new file mode 100644 index 00000000..f304f044 --- /dev/null +++ b/std/mortal @@ -0,0 +1,8 @@ +import "owned"; + +contract mortal is owned { + function kill() { + if (msg.sender == owner) + selfdestruct(owner); + } +} diff --git a/std/named b/std/named new file mode 100644 index 00000000..f077c62a --- /dev/null +++ b/std/named @@ -0,0 +1,9 @@ +import "Config"; +import "NameReg"; +import "configUser"; + +contract named is configUser { + function named(bytes32 name) { + NameReg(Config(configAddr()).lookup(1)).register(name); + } +} diff --git a/std/owned b/std/owned new file mode 100644 index 00000000..37f0ecb9 --- /dev/null +++ b/std/owned @@ -0,0 +1,13 @@ +contract owned { + address owner; + + modifier onlyowner() { + if (msg.sender == owner) { + _ + } + } + + function owned() { + owner = msg.sender; + } +} diff --git a/std/service b/std/service new file mode 100644 index 00000000..31ef8da7 --- /dev/null +++ b/std/service @@ -0,0 +1,8 @@ +import "Config"; +import "configUser"; + +contract service is configUser { + function service(uint _n) { + Config(configAddr()).register(_n, this); + } +} diff --git a/std/std b/std/std new file mode 100644 index 00000000..0340f578 --- /dev/null +++ b/std/std @@ -0,0 +1,6 @@ +import "owned"; +import "mortal"; +import "Config"; +import "configUser"; +import "NameReg"; +import "named"; |