BLD: removed dummy smart contract

This commit is contained in:
Frederic Fortier
2018-02-06 14:17:48 -05:00
parent 4c1a9b1dd7
commit 5ccddf6d21
9 changed files with 0 additions and 138 deletions
-18
View File
@@ -1,18 +0,0 @@
This module contains smart contracts for the data marketplace.
It was generated with Truffle. Truffle can be used to compile and test
the smart contracts. It's being tested on a test blockhain using Ganache.
Steps to test:
* Download and run Ganache
* Ensure that your Ganache endpoint matches `truffle.js`
* In this `marketplace` folder, run the following commands:
* `truffle compile`
* `truffle test`
* `truffle migrate --reset`
* `truffle console`
* From the console: `Marketplace.deployed()`
* The deployed method displays info about the deployed smart contract
including its address. Copy/paste the address into
`catalyst/marketplace/marketplace.py`.
* Run the catalyst marketplace unit tests:
`tests/marketplace/test_marketplace.py`
-19
View File
@@ -1,19 +0,0 @@
pragma solidity ^0.4.17;
contract Marketplace {
address[16] public subscribers;
// Subscribing to a data source
function subscribe(uint dataSourceId) public returns (uint) {
require(dataSourceId >= 0 && dataSourceId <= 15);
subscribers[dataSourceId] = msg.sender;
return dataSourceId;
}
// Retrieving the subscribers
function getSubscribers() public view returns (address[16]) {
return subscribers;
}
}
-23
View File
@@ -1,23 +0,0 @@
pragma solidity ^0.4.17;
contract Migrations {
address public owner;
uint public last_completed_migration;
modifier restricted() {
if (msg.sender == owner) _;
}
function Migrations() public {
owner = msg.sender;
}
function setCompleted(uint completed) public restricted {
last_completed_migration = completed;
}
function upgrade(address new_address) public restricted {
Migrations upgraded = Migrations(new_address);
upgraded.setCompleted(last_completed_migration);
}
}
-14
View File
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="FacetManager">
<facet type="Python" name="Python">
<configuration sdkName="Python 3.6.3 virtualenv at ~/Code/enigma/catalyst/python3" />
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Python 3.6.3 virtualenv at ~/Code/enigma/catalyst/python3 interpreter library" level="application" />
</component>
</module>
@@ -1,5 +0,0 @@
var Migrations = artifacts.require("./Migrations.sol");
module.exports = function(deployer) {
deployer.deploy(Migrations);
};
@@ -1,5 +0,0 @@
var Marketplace = artifacts.require ("Marketplace");
module.exports = function (deployer) {
deployer.deploy (Marketplace);
};
-39
View File
@@ -1,39 +0,0 @@
pragma solidity ^0.4.17;
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/Marketplace.sol";
contract TestMarketplace {
Marketplace marketplace = Marketplace(DeployedAddresses.Marketplace());
// Testing the subscribe() function
function testUserCanSubscribe() public {
uint returnedId = marketplace.subscribe(2);
uint expected = 2;
Assert.equal(returnedId, expected, "Data source 2 should be recorded.");
}
// Testing retrieval of a single subscriber
function testGetSubscriberAddressByDataSourceId() public {
// Expected owner is this contract
address expected = this;
address subscriber = marketplace.subscribers(2);
Assert.equal(subscriber, expected, "Subscriber of data source ID 2 should be recorded.");
}
// Testing retrieval of all subscribers
function testGetSubscriberAddressByDataSourceIdInArray() public {
// Expected subscriber is this contract
address expected = this;
// Store subscribers in memory rather than contract's storage
address[16] memory subscribers = marketplace.getSubscribers();
Assert.equal(subscribers[2], expected, "Subscriber of data source 2 should be recorded.");
}
}
-4
View File
@@ -1,4 +0,0 @@
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
};
-11
View File
@@ -1,11 +0,0 @@
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
networks: {
development: {
host: "localhost",
port: 7545,
network_id: "*" // Match any network id
}
}
};