mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add back standard contracts
This commit is contained in:
parent
e00f802f72
commit
bf430709d5
9
std/Coin
Normal file
9
std/Coin
Normal file
@ -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) {}
|
||||
}
|
6
std/CoinReg
Normal file
6
std/CoinReg
Normal file
@ -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() {}
|
||||
}
|
6
std/Config
Normal file
6
std/Config
Normal file
@ -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) {}
|
||||
}
|
6
std/NameReg
Normal file
6
std/NameReg
Normal file
@ -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) {}
|
||||
}
|
9
std/coin
Normal file
9
std/coin
Normal file
@ -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);
|
||||
}
|
||||
}
|
5
std/configUser
Normal file
5
std/configUser
Normal file
@ -0,0 +1,5 @@
|
||||
contract configUser {
|
||||
function configAddr() constant returns (address a) {
|
||||
return 0xc6d9d2cd449a754c494264e1809c50e34d64562b;
|
||||
}
|
||||
}
|
8
std/mortal
Normal file
8
std/mortal
Normal file
@ -0,0 +1,8 @@
|
||||
import "owned";
|
||||
|
||||
contract mortal is owned {
|
||||
function kill() {
|
||||
if (msg.sender == owner)
|
||||
selfdestruct(owner);
|
||||
}
|
||||
}
|
9
std/named
Normal file
9
std/named
Normal file
@ -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);
|
||||
}
|
||||
}
|
13
std/owned
Normal file
13
std/owned
Normal file
@ -0,0 +1,13 @@
|
||||
contract owned {
|
||||
address owner;
|
||||
|
||||
modifier onlyowner() {
|
||||
if (msg.sender == owner) {
|
||||
_
|
||||
}
|
||||
}
|
||||
|
||||
function owned() {
|
||||
owner = msg.sender;
|
||||
}
|
||||
}
|
8
std/service
Normal file
8
std/service
Normal file
@ -0,0 +1,8 @@
|
||||
import "Config";
|
||||
import "configUser";
|
||||
|
||||
contract service is configUser {
|
||||
function service(uint _n) {
|
||||
Config(configAddr()).register(_n, this);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user