Skip to content

Commit 83fb4ad

Browse files
authored
Merge pull request #10 from flyq/master
test contract
2 parents 9729400 + e9f7e93 commit 83fb4ad

File tree

5 files changed

+2785
-12
lines changed

5 files changed

+2785
-12
lines changed

contracts/Ethereum/contracts/Billboard.sol

+13-3
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ contract Billboard {
4141
art = IERC721Full(_artwork);
4242
art.setup();
4343
artist = _artist;
44-
state[0] = StewardState.forcelosed;
45-
state[1] = StewardState.forcelosed;
44+
state[1] = StewardState.forcelosed;
45+
state[2] = StewardState.forcelosed;
4646
}
4747

4848
event LogBuy(address indexed owner, uint256 indexed price);
@@ -131,7 +131,17 @@ contract Billboard {
131131
require(state[id] != StewardState.forcelosed, "forcelosed");
132132
deposit[id] = deposit[id].add(msg.value);
133133
}
134-
134+
135+
function mint(uint256 amount) public {
136+
require(msg.sender == artist, "only artist can add artwork");
137+
art.mint(amount);
138+
139+
uint256 index = art.totalSupply().add(1);
140+
for (uint256 i = 0; i < amount; i++) {
141+
state[index.add(i)] = StewardState.forcelosed;
142+
}
143+
}
144+
135145
function buy(uint256 _newPrice, uint256 id) public payable collectPatronage(id) {
136146
require(_newPrice > 0, "Price is zero");
137147
require(msg.value > price[id], "Not enough"); // >, coz need to have at least something for deposit

contracts/Ethereum/contracts/ERC721Full.sol

+12-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,17 @@ contract ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata {
2222

2323
steward = msg.sender;
2424
// mint artwork
25-
_mint(steward, 0); // mint
26-
_mint(steward, 1); // mint
27-
_setTokenURI(42, "https://thisartworkisalwaysonsale.com/metadata");
25+
_mint(steward, 1); // mint
26+
_mint(steward, 2); // mint
27+
// _setTokenURI(42, "https://thisartworkisalwaysonsale.com/metadata");
28+
}
29+
30+
function mint(uint256 amount) public {
31+
require(msg.sender == steward, "only steward contract can do");
32+
33+
uint256 index = totalSupply().add(1);
34+
for (uint256 i = 0; i < amount; i++) {
35+
_mint(steward, index.add(i));
36+
}
2837
}
2938
}

contracts/Ethereum/contracts/interfaces/IERC721.sol

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ contract IERC721 is IERC165 {
1212
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
1313

1414
function setup() public;
15+
function mint(uint256 amount) public;
1516

1617
function balanceOf(address owner) public view returns (uint256 balance);
1718
function ownerOf(uint256 tokenId) public view returns (address owner);
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
/* globals artifacts */
22
var ArtSteward = artifacts.require("./ArtSteward.sol");
33
var Artwork = artifacts.require("./ERC721Full.sol");
4-
var BillBoard = artifacts.require("./BillBoard.sol");
4+
var BillBoard = artifacts.require("./Billboard.sol");
55

6-
const deploymentAccount = '0xE8B21A66d89401254045bAb95B474B52B6faC351'; //[0] address from mnemonic
7-
const artistAccount = '0xE8B21A66d89401254045bAb95B474B52B6faC351'; // artist account [on mainnet & rinkeby]
6+
const deploymentAccount = '0xcEB8dE81eb8Cfa9ECFA36a3fAc625643d39d31fd'; //[0] address from mnemonic
7+
const artistAccount = '0xcEB8dE81eb8Cfa9ECFA36a3fAc625643d39d31fd'; // artist account [on mainnet & rinkeby]
88

99
module.exports = function(deployer, network, accounts) {
1010
if(network === "ropsten" || network === "rinkeby" || network === "rinkeby-fork" || network === "mainnet" || network === "mainnet-fork") {
1111
// deploy with mnemonic provider
1212
deployer.deploy(Artwork, "This Artwork Is Always OnSale", "TAIAOS").then((deployedArtwork) => {
13-
console.log(deployedArtwork.address);
13+
console.log(deployedArtwork.address);
14+
console.log(artistAccount);
1415
return deployer.deploy(BillBoard, artistAccount, deployedArtwork.address);
1516
});
1617
} else {
1718
// development deploy
1819
deployer.deploy(Artwork, "ThisArtworkIsAlwaysOnSale", "TAIAOS").then((deployedArtwork) => {
19-
return deployer.deploy(ArtSteward, accounts[0], deployedArtwork.address);
20+
return deployer.deploy(ArtSteward, artistAccount, deployedArtwork.address);
2021
});
2122
}
2223

23-
};
24+
};

0 commit comments

Comments
 (0)