ethereum 0.4.45 → 0.4.50

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce81f0ccd33fa2df00f5fba597d86078e2741ad9
4
- data.tar.gz: 172e0bc070a39588a23e2eca4297f50bebc49cfc
3
+ metadata.gz: f6f8651276b158f5f3357d1f6d735a464b9b9a82
4
+ data.tar.gz: 683902765b1b505cd1ccb0fa5edc930fb3bcf1c2
5
5
  SHA512:
6
- metadata.gz: 63056e204033d1a0606a685ea5097200527fddb3529c592626e2cd2bf70c050d1cc4619c7cf55988783d8fe50d7dea97ff2b55d329eb6ea47c1f50decf6726f4
7
- data.tar.gz: 77646073740221587848ba6ea950bb651c1a6c0f847bf3901a26e2548813e323a97093b7e2862403f27c21a00535c754177cbfde129c19c91f7ee6ecbd4dc35c
6
+ metadata.gz: 4ca471c406b9ff5e43f662e11a55522310a65b6b782cc27fcadf822ad80a314b39d4fba0990e6e72e5f85c63be8e14ce280012ba6ed0453f6cd0adc453933d95
7
+ data.tar.gz: bb7cc47cddc28c6bdcfdb074570bd93ee46dcaa134b6450755a0c5e1fc68c318b68afa5ebc5ce5e504d99a66f9b4945468cd370747f9ab94d0f48191e94e2a56
@@ -0,0 +1,4 @@
1
+ contract AuditorInterface {
2
+ // publish audit on asset
3
+ // publish audit on holdings
4
+ }
@@ -0,0 +1,14 @@
1
+ contract AuditorRegistry {
2
+
3
+ address config;
4
+ Directory.Data auditors;
5
+
6
+ function CustodianRegistry(address _conf) {
7
+ config = _conf;
8
+ }
9
+
10
+ function isAuditor(address _audt) public returns (bool) {
11
+ return Directory.contains(auditors, _audt);
12
+ }
13
+ }
14
+
@@ -0,0 +1,22 @@
1
+ import "contracts/Interface.sol";
2
+
3
+ contract CustodianInterface is Interface {
4
+
5
+ function CustodianInterface(address _config) {
6
+ owner = msg.sender;
7
+ config = _config;
8
+ }
9
+
10
+ function publishReceipt(address _gold, bytes32 _file) ifemployee {
11
+
12
+ }
13
+
14
+ function isRedeemable(address _gold) public returns (bool) {
15
+ return true;
16
+ }
17
+
18
+ }
19
+
20
+
21
+
22
+
@@ -0,0 +1,14 @@
1
+ contract CustodianRegistry {
2
+
3
+ address config;
4
+ Directory.Data custodians;
5
+
6
+ function CustodianRegistry(address _conf) {
7
+ config = _conf;
8
+ }
9
+
10
+ function isCustodian(address _cust) public returns (bool) {
11
+ return Directory.contains(custodians, _cust);
12
+ }
13
+
14
+ }
@@ -0,0 +1,56 @@
1
+ contract DigixConfiguration {
2
+
3
+ address owner;
4
+ Directory.Data admins;
5
+
6
+ mapping (bytes32 => address) configurations;
7
+
8
+ event SetOwner(address indexed owner, address indexed by);
9
+ event AddConfigEntry(bytes32 indexed key, address indexed val, address indexed by);
10
+ event RegisterAdmin(address indexed account, address indexed by);
11
+ event UnregisterAdmin(address indexed account, address indexed by);
12
+
13
+ function DigixConfiguration() {
14
+ owner = msg.sender;
15
+ }
16
+
17
+ modifier ifowner { if(msg.sender == owner) _ }
18
+ modifier ifadmin { if((msg.sender == owner) || isAdmin(msg.sender)) _ }
19
+
20
+ function getOwner() public constant returns (address) {
21
+ return owner;
22
+ }
23
+
24
+ function setOwner(address _newowner) ifowner {
25
+ address _oldaddress = owner;
26
+ owner = _newowner;
27
+ SetOwner(_newowner, msg.sender);
28
+ }
29
+
30
+ function addConfigEntry(bytes32 _key, address _val) ifowner {
31
+ address _oldaddress = configurations[_key];
32
+ configurations[_key] = _val;
33
+ AddConfigEntry(_key, _val, msg.sender);
34
+ }
35
+
36
+ function getConfigEntry(bytes32 _key) public constant returns (address) {
37
+ return configurations[_key];
38
+ }
39
+
40
+ function registerAdmin(address _acct) ifowner {
41
+ if (!Directory.insert(admins, _acct))
42
+ throw;
43
+ RegisterAdmin(_acct, msg.sender);
44
+ }
45
+
46
+ function unregisterAdmin(address _acct) ifowner {
47
+ if (!Directory.remove(admins, _acct))
48
+ throw;
49
+ UnregisterAdmin(_acct, msg.sender);
50
+ }
51
+
52
+ function isAdmin(address _acct) public returns (bool) {
53
+ return Directory.contains(admins, _acct);
54
+ }
55
+
56
+ }
@@ -0,0 +1,25 @@
1
+ library Directory {
2
+
3
+ struct Data { mapping(address => bool) entries; }
4
+
5
+ function insert(Data storage self, address acct) returns (bool) {
6
+ if (self.entries[acct])
7
+ return false;
8
+ self.entries[acct] = true;
9
+ return true;
10
+ }
11
+
12
+ function remove(Data storage self, address acct) returns (bool) {
13
+ if (!self.entries[acct])
14
+ return false;
15
+ self.entries[acct] = false;
16
+ return true;
17
+ }
18
+
19
+ function contains(Data storage self, address acct) returns (bool) {
20
+ return self.entries[acct];
21
+ }
22
+
23
+ }
24
+
25
+
@@ -0,0 +1,67 @@
1
+ contract Gold {
2
+
3
+ address config;
4
+ address owner;
5
+ uint lastfeecalc;
6
+ bool locked;
7
+
8
+ struct Detail {
9
+ address vendor;
10
+ address custodian;
11
+ uint status;
12
+ uint auditCount;
13
+ }
14
+
15
+ struct Info {
16
+ uint weight;
17
+ bytes32 serialNumber;
18
+ bytes32 vendorReceipt;
19
+ bytes32 custodianReceipt;
20
+ }
21
+
22
+ struct StorageFee {
23
+ uint due;
24
+ uint lastPayment;
25
+ }
26
+
27
+ Detail detail;
28
+ Info info;
29
+ StorageFee storagefee;
30
+
31
+ modifier ifowner { if(owner == msg.sender) _ }
32
+
33
+ event GoldAuditReport(bool indexed passed, address indexed document, address indexed auditor);
34
+
35
+ function Gold(uint _wt) {
36
+ owner = msg.sender;
37
+ detail.auditCount = 0;
38
+ detail.vendor = msg.sender;
39
+ info.weight = _wt;
40
+ storagefee.lastPayment = block.timestamp;
41
+ }
42
+
43
+ function lastCalculation() public returns (uint) {
44
+ return storagefee.lastPayment;
45
+ }
46
+
47
+ function timeSinceLastCalc() public returns (uint) {
48
+ return (block.timestamp - storagefee.lastPayment);
49
+ }
50
+
51
+ function mathTestDiv(uint _a, uint _b) public returns (uint) {
52
+ return (_a / _b);
53
+ }
54
+
55
+ function calculateFee(uint _days) public returns (uint) {
56
+ uint base = 1000000000000;
57
+ uint dailyRate = 10277777777;
58
+ var rate = dailyRate * _days;
59
+ var fee = (rate * info.weight);
60
+ return ((info.weight * base) - fee);
61
+ }
62
+
63
+ function mathTestMul(uint _a, uint _b) public returns (uint) {
64
+ return (_a * _b);
65
+ }
66
+
67
+ }
@@ -0,0 +1,49 @@
1
+ import "contracts/DigixConfiguration.sol";
2
+ import "contracts/Directory.sol";
3
+ import "contracts/VendorRegistry.sol";
4
+ import "contracts/CustodianRegistry.sol";
5
+ import "contracts/AuditorRegistry.sol";
6
+
7
+ contract GoldRegistry {
8
+
9
+ address config;
10
+
11
+ Directory.Data active;
12
+
13
+ function GoldRegistry(address _conf) {
14
+ config = _conf;
15
+ }
16
+
17
+ modifier ifvendor { if(isVendor(msg.sender)) _ }
18
+ modifier ifcustodian { if(isCustodian(msg.sender)) _ }
19
+ modifier ifauditor { if(isAuditor(msg.sender)) _ }
20
+
21
+ function vendorRegistry() public returns (address) {
22
+ return DigixConfiguration(config).getConfigEntry("registry/vendor");
23
+ }
24
+
25
+ function custodianRegistry() public returns (address) {
26
+ return DigixConfiguration(config).getConfigEntry("registry/custodian");
27
+ }
28
+
29
+ function auditorRegistry() public returns (address) {
30
+ return DigixConfiguration(config).getConfigEntry("registry/auditor");
31
+ }
32
+
33
+ function isVendor(address _vend) public returns (bool) {
34
+ return VendorRegistry(vendorRegistry()).isVendor(_vend);
35
+ }
36
+
37
+ function isCustodian(address _cust) public returns (bool) {
38
+ return CustodianRegistry(custodianRegistry()).isCustodian(_cust);
39
+ }
40
+
41
+ function isAuditor(address _audt) public returns (bool) {
42
+ return AuditorRegistry(custodianRegistry()).isAuditor(_audt);
43
+ }
44
+
45
+ function registerGold(address _gold) {
46
+
47
+ }
48
+
49
+ }
@@ -0,0 +1,3 @@
1
+ contract GoldTokenLedger {
2
+
3
+ }
@@ -0,0 +1,57 @@
1
+ import "contracts/VendorRegistry.sol";
2
+ import "contracts/CustodianRegistry.sol";
3
+ import "contracts/AuditorRegistry.sol";
4
+
5
+ contract Interface {
6
+
7
+ address owner;
8
+ address config;
9
+
10
+ Directory.Data employees;
11
+
12
+ modifier ifowner { if(owner == msg.sender) _ }
13
+ modifier ifemployee { if(isEmployee(msg.sender)) _ }
14
+
15
+ function registerEmployee(address _acct) ifowner {
16
+ if (!Directory.insert(employees, _acct))
17
+ throw;
18
+ }
19
+
20
+ function unregisterEmployee(address _acct) ifowner {
21
+ if (!Directory.remove(employees, _acct))
22
+ throw;
23
+ }
24
+
25
+ function isEmployee(address _acct) public returns (bool) {
26
+ return Directory.contains(employees, _acct);
27
+ }
28
+
29
+ function goldRegistry() public returns (address) {
30
+ return DigixConfiguration(config).getConfigEntry("registry/gold");
31
+ }
32
+
33
+ function vendorRegistry() public returns (address) {
34
+ return DigixConfiguration(config).getConfigEntry("registry/vendor");
35
+ }
36
+
37
+ function custodianRegistry() public returns (address) {
38
+ return DigixConfiguration(config).getConfigEntry("registry/custodian");
39
+ }
40
+
41
+ function auditorRegistry() public returns (address) {
42
+ return DigixConfiguration(config).getConfigEntry("registry/auditor");
43
+ }
44
+
45
+ function isCustodian(address _cust) public returns (bool) {
46
+ return CustodianRegistry(custodianRegistry()).isCustodian(_cust);
47
+ }
48
+
49
+ function isAuditor(address _adtr) public returns (bool) {
50
+ return AuditorRegistry(auditorRegistry()).isAuditor(_adtr);
51
+ }
52
+
53
+ function isVendor(address _vndr) public returns (bool) {
54
+ return VendorRegistry(vendorRegistry()).isVendor(_vndr);
55
+ }
56
+
57
+ }
@@ -0,0 +1,3 @@
1
+ contract Minter {
2
+
3
+ }
@@ -0,0 +1,3 @@
1
+ contract Recaster {
2
+
3
+ }
@@ -0,0 +1,25 @@
1
+ import "contracts/Interface.sol";
2
+ import "contracts/Gold.sol";
3
+
4
+ contract VendorInterface is Interface {
5
+
6
+ function VendorInterface(address _config) {
7
+ owner = msg.sender;
8
+ config = _config;
9
+ }
10
+
11
+ function registerGold(address _asset) ifemployee {
12
+ var b = _asset;
13
+ }
14
+
15
+ function uploadReceipt(address _asset, bytes32 _ipfsHash) ifemployee {
16
+
17
+ }
18
+
19
+ function assignCustodian(address _asset, address _custodian) ifemployee {
20
+
21
+ }
22
+
23
+ }
24
+
25
+
@@ -0,0 +1,51 @@
1
+ import "contracts/DigixConfiguration.sol";
2
+ import "contracts/Directory.sol";
3
+
4
+ contract VendorRegistry {
5
+
6
+ address config;
7
+ Directory.Data vendors;
8
+
9
+ struct Vendor {
10
+ bytes32 name;
11
+ }
12
+
13
+ mapping (address => Vendor) vendorNames;
14
+
15
+ modifier ifadmin { if(isAdmin(msg.sender)) _ }
16
+
17
+ function VendorRegistry(address _conf) {
18
+ config = _conf;
19
+ }
20
+
21
+ function isAdmin(address _acct) public returns (bool) {
22
+ return DigixConfiguration(config).isAdmin(_acct);
23
+ }
24
+
25
+ function getConfigAddress() public returns (address) {
26
+ return config;
27
+ }
28
+
29
+ function register(address _acct) ifadmin {
30
+ if (!Directory.insert(vendors, _acct))
31
+ throw;
32
+ }
33
+
34
+ function unregister(address _acct) ifadmin {
35
+ if (!Directory.remove(vendors, _acct))
36
+ throw;
37
+ }
38
+
39
+ function isVendor(address _acct) public returns (bool) {
40
+ return Directory.contains(vendors, _acct);
41
+ }
42
+
43
+ function setVendorName(address _vendor, bytes32 _name) ifadmin {
44
+ vendorNames[_vendor].name = _name;
45
+ }
46
+
47
+ function getVendorName(address _vendor) public returns (bytes32) {
48
+ return vendorNames[_vendor].name;
49
+ }
50
+
51
+ }
@@ -0,0 +1,106 @@
1
+ import "contracts/DigixbotUsers.sol";
2
+ import "contracts/DigixbotConfiguration.sol";
3
+
4
+ contract Coin {
5
+ function getBotContract() returns(address );
6
+ function getUserId(address _address) returns(bytes32 );
7
+ function withdrawCoin(bytes32 _user,uint256 _amount);
8
+ function depositCoin(bytes32 _uid,uint256 _amt);
9
+ function getBalance(bytes32 _uid) returns(uint256 );
10
+ function totalBalance() returns(uint256 );
11
+ function getConfig() returns(address );
12
+ function getUsersContract() returns(address );
13
+ function sendCoin(bytes32 _sender,bytes32 _recipient,uint256 _amt);
14
+ }
15
+
16
+ contract Digixbot {
17
+ address owner;
18
+ address config;
19
+
20
+ function Digixbot(address _config) {
21
+ owner = msg.sender;
22
+ config = _config;
23
+ }
24
+
25
+ modifier ifowner { if(msg.sender == owner) _ }
26
+
27
+ function getConfig() public returns (address) {
28
+ return config;
29
+ }
30
+
31
+ function addUser(bytes32 _userid) ifowner {
32
+ DigixbotUsers(getUsersContract()).addUser(_userid);
33
+ }
34
+
35
+ function setUserAccount(bytes32 _userid, address _account) ifowner {
36
+ bool _acctlock = accountLockCheck(_userid);
37
+ if (_acctlock == false) {
38
+ DigixbotUsers(getUsersContract()).setUserAccount(_userid, _account);
39
+ }
40
+ }
41
+
42
+ function getUserAccount(bytes32 _userid) public returns (address) {
43
+ return DigixbotUsers(getUsersContract()).getUserAccount(_userid);
44
+ }
45
+
46
+ function getUsersContract() public returns (address) {
47
+ return DigixbotConfiguration(config).getUsersContract();
48
+ }
49
+
50
+ function getCoinWallet(bytes4 _coin) public returns(address) {
51
+ return DigixbotConfiguration(config).getCoinWallet(_coin);
52
+ }
53
+
54
+ function userCheck(bytes32 _id) public returns(bool) {
55
+ return DigixbotUsers(getUsersContract()).userCheck(_id);
56
+ }
57
+
58
+ function sendCoin(bytes4 _coin, bytes32 _from, bytes32 _to, uint _amount) ifowner {
59
+ bool _tiplock = tipLockCheck(_from);
60
+ if (_tiplock == false) {
61
+ Coin(getCoinWallet(_coin)).sendCoin(_from, _to, _amount);
62
+ }
63
+ }
64
+
65
+ function withdrawCoin(bytes4 _coin, bytes32 _userid, uint _amount) ifowner {
66
+ Coin(getCoinWallet(_coin)).withdrawCoin(_userid, _amount);
67
+ }
68
+
69
+ function getCoinBalance(bytes4 _coin, bytes32 _userid) public returns(uint) {
70
+ return Coin(getCoinWallet(_coin)).getBalance(_userid);
71
+ }
72
+
73
+ function getTotalBalance(bytes4 _coin) public returns(uint) {
74
+ return Coin(getCoinWallet(_coin)).totalBalance();
75
+ }
76
+
77
+ function accountLockCheck(bytes32 _id) public returns (bool) {
78
+ return DigixbotUsers(getUsersContract()).accountLockCheck(_id);
79
+ }
80
+
81
+ function tipLockCheck(bytes32 _id) public returns (bool) {
82
+ return DigixbotUsers(getUsersContract()).tipLockCheck(_id);
83
+ }
84
+
85
+ function lockAccount(bytes32 _id) ifowner {
86
+ DigixbotUsers(getUsersContract()).lockAccount(_id);
87
+ }
88
+
89
+ function lockTip(bytes32 _id) ifowner {
90
+ DigixbotUsers(getUsersContract()).lockTip(_id);
91
+ }
92
+
93
+ function unlockAccount() {
94
+ address _userscontract = getUsersContract();
95
+ bytes32 _userid = DigixbotUsers(_userscontract).getUserId(msg.sender);
96
+ DigixbotUsers(_userscontract).unlockAccount(_userid);
97
+ }
98
+
99
+ function unlockTip() {
100
+ address _userscontract = getUsersContract();
101
+ bytes32 _userid = DigixbotUsers(_userscontract).getUserId(msg.sender);
102
+ DigixbotUsers(_userscontract).unlockTip(_userid);
103
+ }
104
+
105
+
106
+ }