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

Add token factory #17

Merged
merged 1 commit into from
Jul 27, 2024
Merged
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
13 changes: 13 additions & 0 deletions token-factory/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# EditorConfig is awesome: https://EditorConfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = false

[*.ral]
indent_size = 4
2 changes: 2 additions & 0 deletions token-factory/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/dist/
**/templates/
16 changes: 16 additions & 0 deletions token-factory/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": [
"prettier",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"header/header": ["off"]
},
"parserOptions": {
"project": "tsconfig.json",
"ecmaVersion": 2020,
"sourceType": "module"
},
"parser": "@typescript-eslint/parser"
}
1 change: 1 addition & 0 deletions token-factory/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.ral linguist-language=Rust
25 changes: 25 additions & 0 deletions token-factory/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
node_modules/

# Dotfiles
.vscode
.DS_Store

# Files generated by devnet
/dev/*
!dev/user.conf

# Files generated by executing smart contracts
/artifacts/

# Config files
license-header.js
/configs/

# Tests
coverage/

# GitHub Actions
.github/

src/**/*.test.ts
**/fixtures/
31 changes: 31 additions & 0 deletions token-factory/.project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"fullNodeVersion": "v3.4.0",
"compilerOptionsUsed": {
"ignoreUnusedConstantsWarnings": false,
"ignoreUnusedVariablesWarnings": false,
"ignoreUnusedFieldsWarnings": false,
"ignoreUnusedPrivateFunctionsWarnings": false,
"ignoreUpdateFieldsCheckWarnings": false,
"ignoreCheckExternalCallerWarnings": false
},
"infos": {
"IFungibleToken": {
"sourceFile": "../node_modules/@alephium/web3/std/fungible_token_interface.ral",
"sourceCodeHash": "62910bf11e1eeb6cb2fd468626ff606a9b06306b2b81590c3b10f6deb5966bde",
"bytecodeDebugPatch": "",
"codeHashDebug": ""
},
"Token": {
"sourceFile": "token.ral",
"sourceCodeHash": "2207cc091daddadfd553b2edb23aa385afdb8426e48e4f123e68998fa1e25c49",
"bytecodeDebugPatch": "",
"codeHashDebug": "03cbbd308bd80bfe297a4bc92ee1db1f4803983033792c0ec9d4b69220ad4d3e"
},
"TokenFactory": {
"sourceFile": "token_factory.ral",
"sourceCodeHash": "2c02acea850e989532f385c88e4494b5f1be10f602a770044903c4dc505d85ad",
"bytecodeDebugPatch": "=6-2+69=11-1+f=114+16087e0240204372656174656420746f6b656e20636f6e747261637420776974682049443a2000=6",
"codeHashDebug": "dc5e2968a9cbada3c13e298932547a0e1a84766db741b66f3178b6adb39c7702"
}
}
}
25 changes: 25 additions & 0 deletions token-factory/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# My dApp Template

## Install

```
npm install
```

## Start a local devnet for testing and development

Please refer to the documentation here: https://wiki.alephium.org/full-node/devnet

## Compile

Compile the TypeScript files into JavaScript:

```
npx @alephium/cli@latest compile
```

## Testing

```
npx @alephium/cli@latest test
```
27 changes: 27 additions & 0 deletions token-factory/alephium.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Configuration } from '@alephium/cli'
import { Number256 } from '@alephium/web3'

const configuration: Configuration<undefined> = {
networks: {
devnet: {
nodeUrl: 'http://127.0.0.1:22973',
// here we could configure which address groups to deploy the contract
privateKeys: 'a642942e67258589cd2b1822c631506632db5a12aabcf413604e785300d762a5',
settings: undefined
},

testnet: {
nodeUrl: process.env.NODE_URL as string,
privateKeys: process.env.PRIVATE_KEYS === undefined ? [] : process.env.PRIVATE_KEYS.split(','),
settings: undefined
},

mainnet: {
nodeUrl: process.env.NODE_URL as string,
privateKeys: process.env.PRIVATE_KEYS === undefined ? [] : process.env.PRIVATE_KEYS.split(','),
settings: undefined
}
}
}

export default configuration
84 changes: 84 additions & 0 deletions token-factory/artifacts/Token.ral.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"version": "v3.4.0",
"name": "Token",
"bytecode": "050509121b4024403b010000000102ce0002010000000102ce0102010000000102ce0202010000000102a00002010301010009d300396b9ba00016002ba100b4b11600bd",
"codeHash": "03cbbd308bd80bfe297a4bc92ee1db1f4803983033792c0ec9d4b69220ad4d3e",
"fieldsSig": {
"names": [
"symbol",
"name",
"decimals",
"totalSupply",
"__stdInterfaceId"
],
"types": [
"ByteVec",
"ByteVec",
"U256",
"U256",
"ByteVec"
],
"isMutable": [
false,
false,
false,
true,
false
]
},
"eventsSig": [],
"functions": [
{
"name": "getSymbol",
"paramNames": [],
"paramTypes": [],
"paramIsMutable": [],
"returnTypes": [
"ByteVec"
]
},
{
"name": "getName",
"paramNames": [],
"paramTypes": [],
"paramIsMutable": [],
"returnTypes": [
"ByteVec"
]
},
{
"name": "getDecimals",
"paramNames": [],
"paramTypes": [],
"paramIsMutable": [],
"returnTypes": [
"U256"
]
},
{
"name": "getTotalSupply",
"paramNames": [],
"paramTypes": [],
"paramIsMutable": [],
"returnTypes": [
"U256"
]
},
{
"name": "burn",
"paramNames": [
"tokenAmount"
],
"paramTypes": [
"U256"
],
"paramIsMutable": [
false
],
"returnTypes": []
}
],
"constants": [],
"enums": [],
"stdInterfaceId": "0001"
}
46 changes: 46 additions & 0 deletions token-factory/artifacts/TokenFactory.ral.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"version": "v3.4.0",
"name": "TokenFactory",
"bytecode": "0101404201030409011dd3b1e680a5b417041600160116021406414c50480001130464160313016417061705160017071604d1a21607ce001605160616031604c91708160802",
"codeHash": "7f7ea9c90000311d95b1e183fddece83bfb77be3e29c85724bd0eec82f18f21b",
"fieldsSig": {
"names": [
"tokenTemplate"
],
"types": [
"Token"
],
"isMutable": [
false
]
},
"eventsSig": [],
"functions": [
{
"name": "createToken",
"paramNames": [
"symbol",
"name",
"decimals",
"totalSupply"
],
"paramTypes": [
"ByteVec",
"ByteVec",
"U256",
"U256"
],
"paramIsMutable": [
false,
false,
false,
false
],
"returnTypes": [
"Token"
]
}
],
"constants": [],
"enums": []
}
Loading
Loading