Skip to content

Commit 66f0060

Browse files
committed
Draft implementation of a Curation Market for AI Jobs
1 parent 5ce41b8 commit 66f0060

File tree

2 files changed

+43
-23
lines changed

2 files changed

+43
-23
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SingularityNetwork
2-
Includes contracts, migrations, tests, user interface and webpack build pipeline.
2+
Includes contracts, migrations, tests
33

44
## Design Specifications
55

contracts/market/Market.sol

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,45 @@
1-
/* pragma solidity ^0.4.18;
1+
pragma solidity ^0.4.18;
22

3+
import "zeppelin-solidity/contracts/math/SafeMath.sol";
4+
import "../tokens/SingularityNetToken.sol";
35

4-
contract Market {
5-
6-
address public owner;
7-
mapping (address => uint256) public jobs;
8-
9-
function Market() public {
10-
owner = msg.sender;
11-
}
12-
13-
function ask() public {
14-
15-
}
166

17-
function sell() public {
18-
19-
}
20-
21-
function stake() pure {
22-
23-
}
24-
25-
} */
7+
contract Market {
8+
using SafeMath
9+
for uint256;
10+
11+
SingularityNetToken public token;
12+
address public owner;
13+
// amount of AGI at stake
14+
uint256 public pool = 0;
15+
// supply of MintedToken
16+
uint256 public totalSupply = 0;
17+
// next price multiplier in AGI for minting next token
18+
uint256 public nextPrice = 1 * (10 ** 8);
19+
20+
//Balances of MintedToken
21+
mapping(address => uint256) public balances;
22+
23+
function Market(address _token) public {
24+
owner = msg.sender;
25+
token = SingularityNetToken(_token);
26+
}
27+
28+
function ask() public {
29+
// We want to add 1 AGI. Use cogs instead?
30+
require(token.transferFrom(msg.sender, address(this), nextPrice));
31+
pool = pool.add(nextPrice);
32+
//Minting
33+
uint256 mintedToken = 1;
34+
balances[msg.sender] = mintedToken;
35+
totalSupply = totalSupply.add(mintedToken);
36+
//Update the rate
37+
nextPrice = nextPrice.add(1 * (10 ** 8));
38+
}
39+
40+
function claimFunds() {
41+
require(owner == msg.sender);
42+
token.transfer(owner, token.balanceOf(address(this)));
43+
}
44+
45+
}

0 commit comments

Comments
 (0)