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

Token Creator #68

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 0 additions & 68 deletions Project_Name/.gitignore

This file was deleted.

24 changes: 0 additions & 24 deletions Project_Name/LICENSE

This file was deleted.

33 changes: 0 additions & 33 deletions Project_Name/Readme.md

This file was deleted.

2 changes: 0 additions & 2 deletions Project_Name/assets/index.md

This file was deleted.

2 changes: 0 additions & 2 deletions Project_Name/codebase/index.md

This file was deleted.

2 changes: 2 additions & 0 deletions Token_Creator/.env-template
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALCHEMY_API_KEY=""
ALCHEMY_DEPLOYMENT_KEY=""
9 changes: 9 additions & 0 deletions Token_Creator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
.env

#Hardhat files
/cache
/artifacts

# Build Artifacts
/frontend/dist/*
15 changes: 15 additions & 0 deletions Token_Creator/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
“Commons Clause” License Condition v1.0

The Software is provided to you by the Licensor under the License, as defined below, subject to the following condition.

Without limiting other conditions in the License, the grant of rights under the License will not include, and the License does not grant to you, the right to Sell the Software.

For purposes of the foregoing, “Sell” means practicing any or all of the rights granted to you under the License to provide to third parties, for a fee or other consideration (including without limitation fees for hosting or consulting/ support services related to the Software), a product or service whose value derives, entirely or substantially, from the functionality of the Software. Any license notice or attribution required by the License must also include this Commons Clause License Condition notice.

cLabs is allowed to use this application as a submission to their hackathon.

Software: TokenCreator

License: Apache 2.0

Licensor: Open Currency Technology Seehausen UG (haftungsbeschraenkz)
81 changes: 81 additions & 0 deletions Token_Creator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Token Creator

Demo: https://opencurrency.technology

Slides: https://docs.google.com/presentation/d/1FpLr_8vX_74b75cVOrYYXd6qb3pGNBmdAwYj2vtZwWo/edit?usp=sharing

Medium: https://valentinseehausen.medium.com/learnings-from-my-first-blockchain-app-dapp-the-tokencreator-f92dfe6516e6

## Description

The TokenCreater provides a frontend to seamlessly issue and manage tokens.
By this it enables **everyone**, indepent of technical skills, to create, mint,
manage, monitor and destroy tokens. It abtracts the technical details away
and offers a simple dashboard with easy to use forms.

TokenCreator solidity functionalities to create new smart contracts with another
smart contracts. Every user **owns** the smart contract of every token created by
her. TokenCreator offers one type of token right now, the *SimpleToken*. The
roadmap includes adding more tokens and finally allow users to experiment with
different attributes and parametes. The ultimate goal is to foster financial
inclusion by supporting community and complementary currencies.

TokenCreater is still in the MVP-phase, tokens can be issued on different
testnets. TokenCreator is heavily inspired by [Celo's Make Crypto Mobile
Hackathon](https://mobiledefi.devpost.com/) and aims to be a recognized
submission and optimally gain funding for a short runway of a few weeks to test
the market hypothesis (i.e. test is demand for token creators is high enough
for a business case).

## Team members
Valentin Seehausen, fullstack developer

## Hackathon track
Infrastructure (or DeFi)

## Starter Kit

Based on [Hardhat Vue.js Starter Template](https://github.com/remote-gildor/hardhat-web3-vue-starter).
A starter template for Ethereum dApps that uses the following tools:
## install

Run installations in both root and in the frontend folder:

```bash
yarn
cd frontend && yarn
```

## Run Vue app

```bash
cd frontend && yarn serve
```

## Tests

### Solidity/Hardhat

```bash
npx hardhat test
```

## Deployment to Celo alfajores testnet

```bash
npx hardhat run scripts/deploy.js --network alfajores
```

## Deployment to local hardhat network

```bash
npx run node
# open a new terminal and run:
npx hardhat run scripts/deploy.js --network localhost
```

## Verify on Etherscan

```bash
npx hardhat --network mainnet etherscan-verify --api-key <apikey>
```
Binary file added Token_Creator/assets/chain-alert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Token_Creator/assets/web3modal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions Token_Creator/contracts/TokenCreator.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "./factories/SimpleToken.sol";

struct Token {
string tokenName;
string tokenSymbol;
uint256 tokenInitialSupply;
string tokenType;
address tokenAddress;
}

/**
* @title A Creator for Tokens
* @dev Currently only creates SimpleToken
*/
contract TokenCreator is Ownable {
mapping(address => Token[]) public tokensOfOwner;

event CreatedSimpleToken(
SimpleToken SimpleToken,
address owner,
uint256 initialSupply,
string name,
string symbol
);

/**
* @dev creates SimpleToken contract
*/
function createSimpleToken(
uint256 initialSupply,
string memory name,
string memory symbol
) public {
SimpleToken simpleToken = new SimpleToken(
msg.sender,
initialSupply,
name,
symbol
);
tokensOfOwner[msg.sender].push(
Token(
name,
symbol,
initialSupply,
"SimpleToken",
address(simpleToken)
)
);
emit CreatedSimpleToken(
simpleToken,
msg.sender,
initialSupply,
name,
symbol
);
}

/**
* @dev Returns an array of Tokens for an owner
*/
function getTokensOfOwner(address owner)
external
view
returns (Token[] memory contracts)
{
return tokensOfOwner[owner];
}
}
21 changes: 21 additions & 0 deletions Token_Creator/contracts/factories/SimpleToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// contracts/GLDToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

/**
* @dev Generates a simple ERC20 token
*
* Token is owned by address
*/
contract SimpleToken is ERC20 {
constructor(
address owner,
uint256 initialSupply,
string memory name,
string memory symbol
) ERC20(name, symbol) {
_mint(owner, initialSupply);
}
}
30 changes: 30 additions & 0 deletions Token_Creator/contracts/optimization/database_1.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

struct Contract {
string name;
address contractAddress;
}

/**
* @dev This Database saves an array of contracts for each owner
*/
contract Database1 {
mapping(address => Contract[]) public contractsOfOwner;

function addContract(
address owner,
string memory name,
address contractAddress
) public {
contractsOfOwner[owner].push(Contract(name, contractAddress));
}

function getContractsOfOwner(address owner)
external
view
returns (Contract[] memory contracts)
{
return contractsOfOwner[owner];
}
}
Loading