Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smart contract (on Polygon) + dAbPI #3

Closed
2 of 3 tasks
Gizmotronn opened this issue Feb 1, 2022 · 5 comments
Closed
2 of 3 tasks

Smart contract (on Polygon) + dAbPI #3

Gizmotronn opened this issue Feb 1, 2022 · 5 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@Gizmotronn
Copy link
Member

Gizmotronn commented Feb 1, 2022

https://github.com/signal-k/dabpi/issues/6

Creating a smart contract for an online game (which will interact with Moralis and our own DB for Signal-K/Unity-Demo#5)

  • Finish smart contract
  • Set up inheritance
  • Deploy to rinkeby + Mumbai testnet
@Gizmotronn Gizmotronn added the documentation Improvements or additions to documentation label Feb 1, 2022
@Gizmotronn Gizmotronn self-assigned this Feb 1, 2022
Gizmotronn added a commit that referenced this issue Feb 1, 2022
@Gizmotronn
Copy link
Member Author

I am just calling the tokens "Credits" with shortname "SKK" (SignalKineticsKoin), 'Credit' derives from the currency in Star Wars. Not sure what we'll call the main currency later -> maybe 'gears' or something robotics?? Also, I'm looking into multiple currencies.

@Gizmotronn
Copy link
Member Author

@Gizmotronn
Copy link
Member Author

#7 ->
Screen Shot 2022-02-07 at 9 53 59 pm

Slack msg

@Gizmotronn
Copy link
Member Author

@Gizmotronn
Copy link
Member Author

Auth configured for smart contract!

Screen Shot 2022-02-10 at 3 33 12 pm

blockchainActions.js:

// Constants
import Web3 from "web3";
import GearToken from "../../build/contracts/GearToken.json";
//Log
//import { fetchData} from "../data/dataActions";

const connectRequest = () => {
    return {
      type: "CONNECTION_REQUEST",
    };
};
  
const connectSuccess = (payload) => {
    return {
      type: "CONNECTION_SUCCESS",
      payload: payload,
    };
};
  
const connectFailed = (payload) => {
    return {
      type: "CONNECTION_FAILED",
      payload: payload,
    };
};
  
const updateAccountRequest = (payload) => {
    return {
      type: "UPDATE_ACCOUNT",
      payload: payload,
    };
};
  
export const connect = () => {
    return async (dispatch) => {
      dispatch(connectRequest());
      if (window.ethereum) {
        let web3 = new Web3(window.ethereum);
        try {
          const accounts = await window.ethereum.request({
            method: "eth_accounts",
          });
          const networkId = await window.ethereum.request({
            method: "net_version",
          });
          console.log(networkId);
          if (networkId == 137) {
            const gearToken = new web3.eth.Contract(
                GearToken.abi,
                "0xbDE17f0284769996613652642dCab1db36Fcb54E"
            );
            dispatch(
                connectSuccess({
                    account: accounts[0],
                    gearToken: gearToken,
                    web3: web3
                })
            );
            // Add listeners start
            window.ethereum.on("accountsChanged", (accounts) => {
              dispatch(updateAccount(accounts[0]));
            });
            window.ethereum.on("chainChanged", () => {
              window.location.reload();
            });
            // Add listeners end
          } else {
            dispatch(connectFailed("Change network to Polygon."));
          }
        } catch (err) {
          dispatch(connectFailed("Something went wrong."));
        }
      } else {
        dispatch(connectFailed("Install Metamask."));
      }
    };
};
  
export const updateAccount = (account) => {
    return async (dispatch) => {
      dispatch(updateAccountRequest({ account: account }));
      //dispatch(fetchData(account));
    };
};

app.js:

import React, {useEffect} from "react";
import logo from './logo.svg';
import './App.css';
import {useDispatch, useSelector} from "react-redux";
import {connect} from "./redux/blockchain/blockchainActions";
import * as s from "./styles/globalStyles";

function App() {
  const dispatch = useDispatch();
  const blockchain = useSelector(state => state.blockchain);

  console.table(blockchain);

  useEffect(() => {
  }, [dispatch]);

  return <s.Screen>
    {blockchain.account !== "" || blockchain.gearToken !== null ? (
    <s.Container flex={1} ai={"center"} jc={"center"}>
      <s.TextTitle>
        Connect to our game
      </s.TextTitle>
      <s.SpacerSmall />
      <button onClick={(e) => {
        e.preventDefault(); // prevent default form submit
        dispatch(connect());
      }}>CONNECT</button>
    </s.Container>
    ) : (
      <s.Container ai={"center"} style={{ padding: "24px" }}>
        <s.TextTitle>
          Welcome to our game
        </s.TextTitle>
        <s.SpacerSmall />
      </s.Container>
    )}
  </s.Screen>
}

export default App;

Gizmotronn added a commit that referenced this issue Feb 24, 2022
Gizmotronn added a commit that referenced this issue Feb 25, 2022
Gizmotronn added a commit that referenced this issue Feb 28, 2022
Gizmotronn added a commit that referenced this issue Feb 28, 2022
Gizmotronn added a commit to Signal-K/sytizen that referenced this issue Jan 20, 2023
…pyter for matplotlib manipulations

https://www.notion.so/skinetics/January-Week-3-8dcc344a601842959a025940a90c1cc4#6b761b8a793041e1972ad2ecba5b93f0

NFT integration:
#18
#6
#1
Signal-K/Silfur#28 -> contract calls

Frontend API interaction:
#16
Signal-K/Silfur#29 -> handled with Supabase in Gizmotronn/comments@9e70ab0
Signal-K/Silfur#26
Signal-K/Silfur#25 -> starting to implement proposals board in Next with Supabase, then will build in contract calls for web3/eth interaction
Signal-K/Silfur#24
Signal-K/Silfur#22 -> minting will now be handled by a minimal UI & the API wrapper in Server/thirdweb_handler & moralis_handler
Signal-K/Silfur#21 -> custom post types and fields are in Signal-K/client@4cff28c & Signal-K/client@5ce80a5 & Signal-K/client@c950d66, so we're starting off with building it on postgres before adding Lens interactions
Signal-K/Silfur#3
Gizmotronn added a commit to Signal-K/client that referenced this issue Feb 20, 2023
Users can now navigate to `/planets/{$planetID}` to see information relating to their planet, including datasets, articles, a sandbox, basic stats/info, a gallery, and a generator.

Generator:
Signal-K/sytizen#18
Right now it's just the same generator script, but eventually it will take in the fields like radius from the table the page itself is generated from. We'll update the frontend fields to use a UI based on the <Card /> component we've designed for the Profile pages. users will be able to edit these fields and create a fork of the anomaly in its dataset sandbox for use in their own projects, and this can be part of the "XP" demo for "citizen science points" to mimic the behaviour of the reputation erc20 token:

Now that staking has been re-added, time to close #18

Signal-K/sytizen#16 Profile pages
Signal-K/sytizen#13
Signal-K/sytizen#6 -> Generator & staking
Signal-K/sytizen#1 -> sandbox & generator
Signal-K/Unity-Demo#28
Signal-K/Unity-Demo#5
Signal-K/starsailors#4 -> user input on anomalies
Signal-K/Silfur#26
Signal-K/Silfur#25 -> Some small changes with the Thirdweb module behaviour, still yet to commence full re-integration now though
Signal-K/Silfur#24
Signal-K/Silfur#22 -> Replacing "mint" FOR NOW with just a "claim" button that sends the planet to your supabase table inventory (array/foreign key in 'profiles' table

Signal-K/Silfur#21
Signal-K/Silfur#12 -> Keep an eye on this, but for now this is deprecated
Signal-K/Silfur#3 -> Again keep an eye on the original card game contract, but until we commence the full re-integration of the smart contracts, this is not needed

Signal-K/Silfur#30 -> This is working a treat
Signal-K/Silfur#29 -> Now need to add true threaded comments & integrate it with sandbox items

Full notes available here: https://www.notion.so/skinetics/February-Flow-Planets-8c864b66147c447f82136772336e9bc6?pvs=4#09b8260b2360412683ef5935309fd011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Status: Done
Development

No branches or pull requests

1 participant