Skip to content

Commit

Permalink
šŸ’„šŸŽˆ ā† Adding context taken out in prev commit, and updating docs links
Browse files Browse the repository at this point in the history
  • Loading branch information
Gizmotronn committed Jan 8, 2023
1 parent 286700a commit c77311e
Show file tree
Hide file tree
Showing 17 changed files with 94 additions and 698 deletions.
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# sytizen-unity
[![.github/workflows/moralis.yml](https://github.com/Signal-K/sytizen/actions/workflows/moralis.yml/badge.svg?branch=ansible)](https://github.com/Signal-K/sytizen/actions/workflows/moralis.yml) <br />
Citizen Science (Sci-tizen) visualisation in the Unity.com engine


Check out our compass [here](http://ar.skinetics.tech/stellarios/compass) for more information about this product

# Contracts
<a href="https://thirdweb.com/goerli/0xCcaA1ABA77Bae6296D386C2F130c46FEc3E5A004?utm_source=contract_badge" target="_blank">
<img width="200" height="45" src="https://badges.thirdweb.com/contract?address=0xCcaA1ABA77Bae6296D386C2F130c46FEc3E5A004&theme=dark&chainId=5" alt="View contract" />
</a>

<!--
Move `/server` into a separate submodule (or `styizen` into a submodule in another repo)
Add react config (for frontend framework) to react, then move it into `signal-k/polygon`
-->

## Trader branch
This branch contains a connection between Supabase (our current hosting platform for this backend) and the rest our our Notebooks & API. Everything else has been stripped out of this branch.

Run `python3 -m venv .venv` to get started.

Note: Start integrating in API from signal-k/polygon

### Planti branch
Stripping everything out (e.g. `Ansible`/`Generator`) and just leaving the initial dashboard/game frontend. We'll merge it back with `Trader` later
[![.github/workflows/moralis.yml](https://github.com/Signal-K/sytizen/actions/workflows/moralis.yml/badge.svg?branch=ansible)](https://github.com/Signal-K/sytizen/actions/workflows/moralis.yml)
[![Node.js CI](https://github.com/Signal-K/sytizen/actions/workflows/node.js.yml/badge.svg)](https://github.com/Signal-K/sytizen/actions/workflows/node.js.yml)
[![Node.js CI](https://github.com/Signal-K/sytizen/actions/workflows/node.js.yml/badge.svg?branch=wb3-7--interacting-with-anomalies-from-smart)](https://github.com/Signal-K/sytizen/actions/workflows/node.js.yml)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/signal-k/sytizen/HEAD)
[![](https://github.com/Signal-K/sytizen/actions/workflows/node.js.yml/badge.svg?branch=wb3-7--interacting-with-anomalies-from-smart)](https://deepnote.com/workspace/star-sailors-49d2efda-376f-4329-9618-7f871ba16007/project/Supabase-Talk-ab6b31e5-13c3-4949-af38-1197d00bd4d1/notebook/Flask%20API-cb9219547b9e4e228b15cbf8a1aa9cf4#99de0381ef0d40ffaee2354354861bae)
[![](https://badges.thirdweb.com/contract?address=0xCcaA1ABA77Bae6296D386C2F130c46FEc3E5A004&theme=light&chainId=5)](https://thirdweb.com/goerli/0xCcaA1ABA77Bae6296D386C2F130c46FEc3E5A004?utm_source=contract_badge)

# Signal-K/Sytizen Repo
## Related repositories
* [Signal-K/polygon](https://github.com/Signal-K/polygon/issues/26) ā† Contract interactions
* [Signal-K/client](https://github.com/Signal-K/client) ā† Frontend for interactions with our contracts

## Documentation
All documentation is visible on [Notion](https://www.notion.so/skinetics/Sample-Planets-Contract-4c3bdcbca4b9450382f9cc4e72e081f7)

# Citizen Science Classifications
## Process
* User mints an anomaly that has appeared in their UI (for now, the webapp, later it will be the game as well)
* API searches for a token that has already been lazy minted with the TIC id of the anomaly (or the identifier of the candidate)
* If there is a token id that has the TIC Id, then claim a copy of that to the `msg.sender` (playerā€™s address) so they can manipulate it in-game
* If the TIC ID has never been minted before, lazy mint a new one with parameters fetched from the data source and send it to `msg.sender`
* Return the IPFS metadata
* Add some buttons that allow manipulations for the NFT (e.g. viewing (reading) metadata (e.g. image/video files, graphs).
* Graphs should be generated in a Jupyter notebook and returned in the Next app.
* User creates post (proposal [Proposal Board ā†’ Migration from Vite](https://www.notion.so/Proposal-Board-Migration-from-Vite-2e3ef95e384d4ac1875e0dbbe9a59337)) with the NFT ID for their anomaly and some extra metadata for their discoveries and proposal, and then users can vote
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createCampaign, dashboard, logout, payment, profile, withdraw } from '../../../../assets';

export const navlinks = [
export const navlinksProposals = [
{
name: 'dashboard',
imgUrl: dashboard,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ethers } from 'ethers';
const StateContext = createContext();

export const StateContextProvider = ({ children }) => {
const { contract } = useContract('0xCcaA1ABA77Bae6296D386C2F130c46FEc3E5A004');
const { contract } = useContract('0xed6e837Fda815FBf78E8E7266482c5Be80bC4bF9'); // Goerli contract -> will update to Polygon mainnet when in production
const { mutateAsync: createProposal } = useContractWrite(contract, 'createProposal'); // Call function & create a proposal, passing in params from the form
const address = useAddress();
const connect = useMetamask();
Expand Down
65 changes: 65 additions & 0 deletions Server/frontend/contracts/proposal.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

contract ClassificationProposal {
struct Classification {
// What types will this struct/campaign have?
address owner;
string title; // Title of the Proposal, type string
string description;
uint256 target; // How many coins to get the proposal to pass?
uint256 deadline;
uint256 amountCollected; // Goes towards target
string image; // image uri/url
address[] voters;
uint256[] votes; // Consider adding more components to match discussion in wb3-5 task
}

mapping(uint256 => Classification) public classifications;
uint256 public numberOfClassifications = 0;

function createProposal(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns (uint256) { // Returns id of the classification's proposal
Classification storage classification = classifications[numberOfClassifications]; // Populates the classifications array
require(classification.deadline < block.timestamp, "The deadline should be a date in the future"); // Maybe add another modifier to specify a minimum deadline period e.g. 1 day

classification.owner = _owner;
classification.title = _title;
classification.description = _description;
classification.target = _target;
classification.deadline = _deadline;
classification.amountCollected = 0;
classification.image = _image;

numberOfClassifications++;

return numberOfClassifications - 1;
}

function voteForProposal(uint256 _id) public payable { // Some crypto will be sent with the classificationID used as a param
uint256 amount = msg.value; // This amount is set by user (typically in frontend); the amount they'll be pledging towards a classification
Classification storage classification = classifications[_id];

classification.voters.push(msg.sender); // Push the address of user who voted
classification.votes.push(amount); // Amount of custom erc20 token pledged

(bool sent,) = payable(classification.owner).call{value: amount}("");
if (sent) {
classification.amountCollected = classification.amountCollected + amount;
}
}

function getVoters(uint256 _id) view public returns(address[] memory, uint256[] memory) { // Array of votes and number of voters
return (classifications[_id].voters, classifications[_id].votes);
}

function getProposals() public view returns(Classification[] memory) { // Retrieved from memory
Classification[] memory allClassifications = new Classification[](numberOfClassifications); // Empty array of empty structs referencing each classification/proposal

for (uint i = 0; i < numberOfClassifications; i++) {
Classification storage item = classifications[i];
allClassifications[i] = item; // Fetch the classification from storage and populate it in allClassifications
}

return allClassifications;
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { StateContextProvider } from "../../../context/proposals";
import { NavLinkProposals } from '../../../constants/proposals';
/*import { useContract, useContractRead } from "@thirdweb-dev/react";
export default function fetchProposalFromContract () {
Expand Down
16 changes: 0 additions & 16 deletions Server/frontend/pages/lens/components/Navbar.js

This file was deleted.

10 changes: 0 additions & 10 deletions Server/frontend/pages/lens/components/PostContent.js

This file was deleted.

27 changes: 0 additions & 27 deletions Server/frontend/pages/lens/components/PostFeed.jsx

This file was deleted.

130 changes: 0 additions & 130 deletions Server/frontend/pages/lens/components/WritePost.js

This file was deleted.

Loading

0 comments on commit c77311e

Please sign in to comment.