Skip to content

Commit 763a864

Browse files
committed
test imports
1 parent fd5eca6 commit 763a864

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

test_app/app/contracts/ownable.sol

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
pragma solidity ^0.4.11;
2+
3+
/**
4+
* @title Ownable
5+
* @dev The Ownable contract has an owner address, and provides basic authorization control
6+
* functions, this simplifies the implementation of "user permissions".
7+
*/
8+
contract Ownable {
9+
address public owner;
10+
11+
12+
/**
13+
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
14+
* account.
15+
*/
16+
function Ownable() {
17+
owner = msg.sender;
18+
}
19+
20+
21+
/**
22+
* @dev Throws if called by any account other than the owner.
23+
*/
24+
modifier onlyOwner() {
25+
if (msg.sender != owner) {
26+
throw;
27+
}
28+
_;
29+
}
30+
31+
32+
/**
33+
* @dev Allows the current owner to transfer control of the contract to a newOwner.
34+
* @param newOwner The address to transfer ownership to.
35+
*/
36+
function transferOwnership(address newOwner) onlyOwner {
37+
if (newOwner != address(0)) {
38+
owner = newOwner;
39+
}
40+
}
41+
42+
}

test_app/app/contracts/simple_storage.sol

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
pragma solidity ^0.4.7;
2-
contract SimpleStorage {
2+
3+
import "ownable.sol";
4+
5+
contract SimpleStorage is Ownable {
36
uint public storedData;
47

58
function() payable { }
@@ -12,7 +15,7 @@ contract SimpleStorage {
1215
storedData = x;
1316
}
1417

15-
function set2(uint x, uint unusedGiveWarning) {
18+
function set2(uint x, uint unusedGiveWarning) onlyOwner {
1619
storedData = x;
1720
}
1821

test_app/config/contracts.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
],
1818
"gas": "auto",
1919
"contracts": {
20+
"Ownable": {
21+
"deploy": false
22+
},
2023
"SimpleStorage": {
2124
"args": [
2225
100

0 commit comments

Comments
 (0)