cyberia 3.0.2 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{.env.production → .env.example} +20 -2
- package/.github/workflows/engine-cyberia.cd.yml +41 -10
- package/.github/workflows/engine-cyberia.ci.yml +53 -14
- package/.github/workflows/ghpkg.ci.yml +1 -1
- package/.github/workflows/gitlab.ci.yml +1 -1
- package/.github/workflows/hardhat.ci.yml +82 -0
- package/.github/workflows/npmpkg.ci.yml +37 -8
- package/.github/workflows/publish.ci.yml +5 -5
- package/.github/workflows/publish.cyberia.ci.yml +5 -5
- package/.github/workflows/pwa-microservices-template-page.cd.yml +3 -3
- package/.github/workflows/pwa-microservices-template-test.ci.yml +1 -1
- package/.github/workflows/release.cd.yml +3 -2
- package/.vscode/extensions.json +9 -8
- package/.vscode/settings.json +3 -2
- package/CHANGELOG.md +533 -290
- package/CLI-HELP.md +79 -53
- package/WHITE-PAPER.md +1540 -0
- package/bin/build.js +16 -11
- package/bin/cyberia.js +959 -8
- package/bin/deploy.js +103 -270
- package/bin/file.js +2 -1
- package/bin/index.js +959 -8
- package/bin/vs.js +3 -3
- package/conf.js +277 -77
- package/deployment.yaml +218 -4
- package/hardhat/.env.example +31 -0
- package/hardhat/README.md +531 -0
- package/hardhat/WHITE-PAPER.md +1540 -0
- package/hardhat/contracts/ObjectLayerToken.sol +391 -0
- package/hardhat/deployments/.gitkeep +0 -0
- package/hardhat/deployments/hardhat-ObjectLayerToken.json +11 -0
- package/hardhat/hardhat.config.js +136 -0
- package/hardhat/ignition/modules/ObjectLayerToken.js +21 -0
- package/hardhat/networks/besu-object-layer.network.json +138 -0
- package/hardhat/package-lock.json +7628 -0
- package/hardhat/package.json +45 -0
- package/hardhat/scripts/deployObjectLayerToken.js +98 -0
- package/hardhat/test/ObjectLayerToken.js +590 -0
- package/jsdoc.dd-cyberia.json +59 -0
- package/jsdoc.json +20 -13
- package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +1 -1
- package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +1 -1
- package/manifests/deployment/dd-cyberia-development/deployment.yaml +490 -0
- package/manifests/deployment/dd-cyberia-development/proxy.yaml +261 -0
- package/manifests/deployment/dd-cyberia-development/pv-pvc.yaml +132 -0
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +52 -52
- package/manifests/deployment/dd-test-development/proxy.yaml +4 -4
- package/manifests/pv-pvc-dd.yaml +1 -1
- package/package.json +60 -50
- package/proxy.yaml +128 -9
- package/pv-pvc.yaml +132 -0
- package/scripts/k3s-node-setup.sh +1 -1
- package/scripts/ports-ls.sh +2 -0
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.controller.js +3 -1
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.model.js +1 -2
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.service.js +40 -7
- package/src/api/document/document.service.js +1 -1
- package/src/api/file/file.controller.js +3 -1
- package/src/api/file/file.service.js +28 -5
- package/src/api/ipfs/ipfs.service.js +2 -2
- package/src/api/object-layer/object-layer.controller.js +6 -2
- package/src/api/object-layer/object-layer.model.js +67 -21
- package/src/api/object-layer/object-layer.router.js +668 -42
- package/src/api/object-layer/object-layer.service.js +10 -16
- package/src/api/object-layer-render-frames/object-layer-render-frames.model.js +1 -2
- package/src/api/user/user.router.js +10 -5
- package/src/api/user/user.service.js +7 -7
- package/src/cli/baremetal.js +6 -10
- package/src/cli/cloud-init.js +0 -3
- package/src/cli/db.js +54 -71
- package/src/cli/deploy.js +64 -12
- package/src/cli/env.js +5 -5
- package/src/cli/fs.js +0 -2
- package/src/cli/image.js +0 -3
- package/src/cli/index.js +41 -13
- package/src/cli/monitor.js +5 -6
- package/src/cli/repository.js +329 -46
- package/src/cli/run.js +210 -122
- package/src/cli/secrets.js +1 -3
- package/src/cli/ssh.js +1 -1
- package/src/client/Itemledger.index.js +1 -959
- package/src/client/Underpost.index.js +36 -0
- package/src/client/components/core/AgGrid.js +20 -5
- package/src/client/components/core/Alert.js +2 -2
- package/src/client/components/core/Content.js +22 -3
- package/src/client/components/core/Docs.js +30 -6
- package/src/client/components/core/FileExplorer.js +71 -4
- package/src/client/components/core/Input.js +1 -1
- package/src/client/components/core/Modal.js +22 -6
- package/src/client/components/core/PublicProfile.js +3 -3
- package/src/client/components/core/RichText.js +1 -2
- package/src/client/components/core/Router.js +34 -1
- package/src/client/components/core/Worker.js +1 -1
- package/src/client/components/cryptokoyn/CssCryptokoyn.js +63 -1
- package/src/client/components/cyberia/ObjectLayerEngineModal.js +145 -119
- package/src/client/components/cyberia/ObjectLayerEngineViewer.js +64 -6
- package/src/client/components/cyberia-portal/CommonCyberiaPortal.js +1 -0
- package/src/client/components/cyberia-portal/CssCyberiaPortal.js +44 -2
- package/src/client/components/cyberia-portal/LogInCyberiaPortal.js +0 -1
- package/src/client/components/cyberia-portal/MenuCyberiaPortal.js +64 -2
- package/src/client/components/cyberia-portal/RoutesCyberiaPortal.js +1 -0
- package/src/client/components/itemledger/CssItemledger.js +62 -0
- package/src/client/components/underpost/CommonUnderpost.js +29 -0
- package/src/client/components/underpost/CssUnderpost.js +281 -0
- package/src/client/components/underpost/CyberpunkBloggerUnderpost.js +879 -0
- package/src/client/components/underpost/DocumentSearchProvider.js +448 -0
- package/src/client/components/underpost/ElementsUnderpost.js +38 -0
- package/src/client/components/underpost/LabGalleryUnderpost.js +82 -0
- package/src/client/components/underpost/LogInUnderpost.js +23 -0
- package/src/client/components/underpost/LogOutUnderpost.js +15 -0
- package/src/client/components/underpost/MenuUnderpost.js +691 -0
- package/src/client/components/underpost/RoutesUnderpost.js +47 -0
- package/src/client/components/underpost/SettingsUnderpost.js +16 -0
- package/src/client/components/underpost/SignUpUnderpost.js +9 -0
- package/src/client/components/underpost/SocketIoUnderpost.js +54 -0
- package/src/client/components/underpost/TranslateUnderpost.js +10 -0
- package/src/client/public/cryptokoyn/assets/logo/base-icon.png +0 -0
- package/src/client/public/cryptokoyn/browserconfig.xml +12 -0
- package/src/client/public/cryptokoyn/microdata.json +85 -0
- package/src/client/public/cryptokoyn/site.webmanifest +57 -0
- package/src/client/public/cryptokoyn/sitemap +3 -3
- package/src/client/public/default/sitemap +3 -3
- package/src/client/public/itemledger/browserconfig.xml +2 -2
- package/src/client/public/itemledger/manifest.webmanifest +4 -4
- package/src/client/public/itemledger/microdata.json +71 -0
- package/src/client/public/itemledger/sitemap +3 -3
- package/src/client/public/itemledger/yandex-browser-manifest.json +2 -2
- package/src/client/public/test/sitemap +3 -3
- package/src/client/services/object-layer/object-layer.management.js +23 -4
- package/src/client/ssr/body/404.js +15 -11
- package/src/client/ssr/body/500.js +15 -11
- package/src/client/ssr/body/SwaggerDarkMode.js +285 -0
- package/src/client/ssr/body/UnderpostDefaultSplashScreen.js +83 -0
- package/src/client/ssr/head/PwaItemledger.js +60 -0
- package/src/client/ssr/head/UnderpostScripts.js +6 -0
- package/src/client/ssr/offline/NoNetworkConnection.js +11 -10
- package/src/client/ssr/pages/Test.js +11 -10
- package/src/client.build.js +0 -3
- package/src/client.dev.js +0 -3
- package/src/db/DataBaseProvider.js +17 -2
- package/src/db/mariadb/MariaDB.js +14 -9
- package/src/db/mongo/MongooseDB.js +17 -1
- package/src/index.js +1 -1
- package/src/proxy.js +0 -3
- package/src/runtime/express/Express.js +15 -9
- package/src/runtime/lampp/Lampp.js +6 -13
- package/src/server/auth.js +12 -14
- package/src/server/backup.js +2 -3
- package/src/server/besu-genesis-generator.js +1630 -0
- package/src/server/client-build-docs.js +126 -17
- package/src/server/client-build-live.js +9 -18
- package/src/server/client-build.js +203 -75
- package/src/server/client-dev-server.js +14 -13
- package/src/server/conf.js +376 -164
- package/src/server/cron.js +2 -1
- package/src/server/dns.js +28 -12
- package/src/server/downloader.js +0 -2
- package/src/server/logger.js +27 -9
- package/src/server/object-layer.js +92 -16
- package/src/server/peer.js +0 -2
- package/src/server/process.js +1 -50
- package/src/server/proxy.js +4 -8
- package/src/server/runtime.js +5 -8
- package/src/server/semantic-layer-generator.js +1 -0
- package/src/server/ssr.js +0 -3
- package/src/server/start.js +19 -12
- package/src/server/tls.js +0 -2
- package/src/server.js +0 -4
- package/.env.development +0 -43
- package/.env.test +0 -43
- package/hardhat/contracts/CryptoKoyn.sol +0 -59
- package/hardhat/contracts/ItemLedger.sol +0 -73
- package/hardhat/contracts/Lock.sol +0 -34
- package/hardhat/hardhat.config.cjs +0 -45
- package/hardhat/ignition/modules/Lock.js +0 -18
- package/hardhat/networks/cryptokoyn-itemledger.network.json +0 -29
- package/hardhat/scripts/deployCryptokoyn.cjs +0 -25
- package/hardhat/scripts/deployItemledger.cjs +0 -25
- package/hardhat/test/Lock.js +0 -126
- package/hardhat/white-paper.md +0 -581
- package/white-paper.md +0 -581
package/src/server/tls.js
CHANGED
|
@@ -7,10 +7,8 @@
|
|
|
7
7
|
import fs from 'fs-extra';
|
|
8
8
|
import https from 'https';
|
|
9
9
|
import path from 'path';
|
|
10
|
-
import dotenv from 'dotenv';
|
|
11
10
|
import { loggerFactory } from './logger.js';
|
|
12
11
|
|
|
13
|
-
dotenv.config();
|
|
14
12
|
const logger = loggerFactory(import.meta);
|
|
15
13
|
|
|
16
14
|
const DEFAULT_HOST = 'localhost';
|
package/src/server.js
CHANGED
|
@@ -3,15 +3,11 @@
|
|
|
3
3
|
// https://nodejs.org/api
|
|
4
4
|
// https://expressjs.com/en/4x/api.html
|
|
5
5
|
|
|
6
|
-
import dotenv from 'dotenv';
|
|
7
6
|
import { loggerFactory } from './server/logger.js';
|
|
8
7
|
import { buildClient } from './server/client-build.js';
|
|
9
8
|
import { buildRuntime } from './server/runtime.js';
|
|
10
9
|
import { ProcessController } from './server/process.js';
|
|
11
10
|
import { Config } from './server/conf.js';
|
|
12
|
-
|
|
13
|
-
dotenv.config();
|
|
14
|
-
|
|
15
11
|
await Config.build();
|
|
16
12
|
|
|
17
13
|
const logger = loggerFactory(import.meta);
|
package/.env.development
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
DEPLOY_ID=dd-default
|
|
2
|
-
NODE_ENV=development
|
|
3
|
-
PORT=4000
|
|
4
|
-
JWT_SECRET=test
|
|
5
|
-
REFRESH_EXPIRE_MINUTES=5
|
|
6
|
-
ACCESS_EXPIRE_MINUTES=1440
|
|
7
|
-
NODE_OPTIONS=--max-old-space-size=8192
|
|
8
|
-
TIME_ZONE=changethis
|
|
9
|
-
GITHUB_TOKEN=changethis
|
|
10
|
-
GITHUB_USERNAME=changethis
|
|
11
|
-
GITHUB_BACKUP_REPO=changethis
|
|
12
|
-
GITHUB_DNS_REPO=changethis
|
|
13
|
-
DEFAULT_DEPLOY_ID=dd-default
|
|
14
|
-
DEFAULT_DEPLOY_HOST=default.net
|
|
15
|
-
DEFAULT_DEPLOY_PATH=/
|
|
16
|
-
MARIADB_HOST=changethis
|
|
17
|
-
MARIADB_USER=changethis
|
|
18
|
-
MARIADB_PASSWORD=changethis
|
|
19
|
-
CLOUDINARY_CLOUD_NAME=changethis
|
|
20
|
-
CLOUDINARY_API_KEY=changethis
|
|
21
|
-
CLOUDINARY_API_SECRET=changethis
|
|
22
|
-
CLOUDINARY_PASSWORD=changethis
|
|
23
|
-
CLOUDINARY_EMAIL=admin@default.net
|
|
24
|
-
DB_PG_MAAS_NAME=changethis
|
|
25
|
-
DB_PG_MAAS_PASS=changethis
|
|
26
|
-
DB_PG_MAAS_USER=changethis
|
|
27
|
-
DB_PG_MAAS_HOST=127.0.0.1
|
|
28
|
-
DB_PG_MAAS_PORT=5432
|
|
29
|
-
MAAS_ADMIN_USERNAME=changethis
|
|
30
|
-
MAAS_API_KEY=changethis
|
|
31
|
-
MAAS_ADMIN_EMAIL=admin@default.net
|
|
32
|
-
MAAS_ADMIN_PASS=changethis
|
|
33
|
-
TFTP_ROOT=changethis
|
|
34
|
-
NETMASK=255.255.255.0
|
|
35
|
-
MAAS_DNS=8.8.8.8
|
|
36
|
-
MAAS_NTP_SERVER=changethis
|
|
37
|
-
NFS_EXPORT_PATH=changethis
|
|
38
|
-
NVIDIA_API_KEY=changethis
|
|
39
|
-
DEFAULT_ADMIN_EMAIL=admin@default.net
|
|
40
|
-
DEFAULT_ADMIN_PASSWORD=changethis
|
|
41
|
-
DEFAULT_SSH_PORT=22
|
|
42
|
-
BASE_API=api
|
|
43
|
-
DEV_PROXY_PORT_OFFSET=200
|
package/.env.test
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
DEPLOY_ID=dd-default
|
|
2
|
-
NODE_ENV=test
|
|
3
|
-
PORT=5000
|
|
4
|
-
JWT_SECRET=test
|
|
5
|
-
REFRESH_EXPIRE_MINUTES=5
|
|
6
|
-
ACCESS_EXPIRE_MINUTES=1440
|
|
7
|
-
NODE_OPTIONS=--max-old-space-size=8192
|
|
8
|
-
TIME_ZONE=changethis
|
|
9
|
-
GITHUB_TOKEN=changethis
|
|
10
|
-
GITHUB_USERNAME=changethis
|
|
11
|
-
GITHUB_BACKUP_REPO=changethis
|
|
12
|
-
GITHUB_DNS_REPO=changethis
|
|
13
|
-
DEFAULT_DEPLOY_ID=dd-default
|
|
14
|
-
DEFAULT_DEPLOY_HOST=default.net
|
|
15
|
-
DEFAULT_DEPLOY_PATH=/
|
|
16
|
-
MARIADB_HOST=changethis
|
|
17
|
-
MARIADB_USER=changethis
|
|
18
|
-
MARIADB_PASSWORD=changethis
|
|
19
|
-
CLOUDINARY_CLOUD_NAME=changethis
|
|
20
|
-
CLOUDINARY_API_KEY=changethis
|
|
21
|
-
CLOUDINARY_API_SECRET=changethis
|
|
22
|
-
CLOUDINARY_PASSWORD=changethis
|
|
23
|
-
CLOUDINARY_EMAIL=admin@default.net
|
|
24
|
-
DB_PG_MAAS_NAME=changethis
|
|
25
|
-
DB_PG_MAAS_PASS=changethis
|
|
26
|
-
DB_PG_MAAS_USER=changethis
|
|
27
|
-
DB_PG_MAAS_HOST=127.0.0.1
|
|
28
|
-
DB_PG_MAAS_PORT=5432
|
|
29
|
-
MAAS_ADMIN_USERNAME=changethis
|
|
30
|
-
MAAS_API_KEY=changethis
|
|
31
|
-
MAAS_ADMIN_EMAIL=admin@default.net
|
|
32
|
-
MAAS_ADMIN_PASS=changethis
|
|
33
|
-
TFTP_ROOT=changethis
|
|
34
|
-
NETMASK=255.255.255.0
|
|
35
|
-
MAAS_DNS=8.8.8.8
|
|
36
|
-
MAAS_NTP_SERVER=changethis
|
|
37
|
-
NFS_EXPORT_PATH=changethis
|
|
38
|
-
NVIDIA_API_KEY=changethis
|
|
39
|
-
DEFAULT_ADMIN_EMAIL=admin@default.net
|
|
40
|
-
DEFAULT_ADMIN_PASSWORD=changethis
|
|
41
|
-
DEFAULT_SSH_PORT=22
|
|
42
|
-
BASE_API=api
|
|
43
|
-
DEV_PROXY_PORT_OFFSET=200
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
// Compatible with OpenZeppelin Contracts ^5.0.0
|
|
3
|
-
pragma solidity ^0.8.20;
|
|
4
|
-
|
|
5
|
-
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
|
|
6
|
-
import '@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol';
|
|
7
|
-
import '@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol';
|
|
8
|
-
import '@openzeppelin/contracts/access/Ownable.sol';
|
|
9
|
-
import '@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @title CryptoKoyn Token
|
|
13
|
-
* @dev An ERC20 token with minting, burning, pausing, and permit functionalities.
|
|
14
|
-
*/
|
|
15
|
-
contract CryptoKoyn is ERC20, ERC20Burnable, ERC20Pausable, Ownable, ERC20Permit {
|
|
16
|
-
/**
|
|
17
|
-
* @dev Constructs a new CryptoKoyn token.
|
|
18
|
-
* @param initialOwner The initial owner of the token.
|
|
19
|
-
*/
|
|
20
|
-
constructor(address initialOwner) ERC20('CryptoKoyn', 'CKY') Ownable(initialOwner) ERC20Permit('CryptoKoyn') {
|
|
21
|
-
_mint(msg.sender, 10000000 * 10 ** decimals());
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @dev Pauses all token transfers.
|
|
26
|
-
* @dev Only the owner can call this function.
|
|
27
|
-
*/
|
|
28
|
-
function pause() public onlyOwner {
|
|
29
|
-
_pause();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @dev Unpauses all token transfers.
|
|
34
|
-
* @dev Only the owner can call this function.
|
|
35
|
-
*/
|
|
36
|
-
function unpause() public onlyOwner {
|
|
37
|
-
_unpause();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @dev Mints new tokens.
|
|
42
|
-
* @param to The recipient of the minted tokens.
|
|
43
|
-
* @param amount The amount of tokens to mint.
|
|
44
|
-
* @dev Only the owner can call this function.
|
|
45
|
-
*/
|
|
46
|
-
function mint(address to, uint256 amount) public onlyOwner {
|
|
47
|
-
_mint(to, amount);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @dev Overrides the `_update` function to ensure proper token transfer handling.
|
|
52
|
-
* @param from The sender of the tokens.
|
|
53
|
-
* @param to The recipient of the tokens.
|
|
54
|
-
* @param value The amount of tokens to transfer.
|
|
55
|
-
*/
|
|
56
|
-
function _update(address from, address to, uint256 value) internal override(ERC20, ERC20Pausable) {
|
|
57
|
-
super._update(from, to, value);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
// Compatible with OpenZeppelin Contracts ^5.0.0
|
|
3
|
-
pragma solidity ^0.8.20;
|
|
4
|
-
|
|
5
|
-
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
|
|
6
|
-
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
|
|
7
|
-
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol';
|
|
8
|
-
import '@openzeppelin/contracts/access/Ownable.sol';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @title ItemLedger
|
|
12
|
-
* @dev An ERC721 token contract for managing items, with minting and burning capabilities.
|
|
13
|
-
*/
|
|
14
|
-
contract ItemLedger is ERC721, ERC721Enumerable, ERC721Burnable, Ownable {
|
|
15
|
-
/**
|
|
16
|
-
* @dev Constructs a new ItemLedger contract.
|
|
17
|
-
* @param initialOwner The initial owner of the contract.
|
|
18
|
-
*/
|
|
19
|
-
constructor(address initialOwner) ERC721('ItemLedger', 'IL') Ownable(initialOwner) {}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @dev Sets the base URI for token URIs.
|
|
23
|
-
*/
|
|
24
|
-
function _baseURI() internal pure override returns (string memory) {
|
|
25
|
-
return 'IL';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @dev Mints a new NFT to a specified address.
|
|
30
|
-
* @param to The address to mint the NFT to.
|
|
31
|
-
* @param tokenId The ID of the token to be minted.
|
|
32
|
-
* @dev Only the owner can call this function.
|
|
33
|
-
*/
|
|
34
|
-
function safeMint(address to, uint256 tokenId) public onlyOwner {
|
|
35
|
-
_safeMint(to, tokenId);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// The following functions are overrides required by Solidity.
|
|
39
|
-
// They ensure proper interaction with the inherited ERC721 and ERC721Enumerable contracts.
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @dev Overrides the `_update` function to ensure proper token ownership updates.
|
|
43
|
-
* @param to The new owner of the token.
|
|
44
|
-
* @param tokenId The ID of the token.
|
|
45
|
-
* @param auth The authorized address for the transfer.
|
|
46
|
-
* @return The address of the previous owner.
|
|
47
|
-
*/
|
|
48
|
-
function _update(
|
|
49
|
-
address to,
|
|
50
|
-
uint256 tokenId,
|
|
51
|
-
address auth
|
|
52
|
-
) internal override(ERC721, ERC721Enumerable) returns (address) {
|
|
53
|
-
return super._update(to, tokenId, auth);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* @dev Overrides the `_increaseBalance` function to ensure proper token balance updates.
|
|
58
|
-
* @param account The account to increase the balance of.
|
|
59
|
-
* @param value The amount to increase the balance by.
|
|
60
|
-
*/
|
|
61
|
-
function _increaseBalance(address account, uint128 value) internal override(ERC721, ERC721Enumerable) {
|
|
62
|
-
super._increaseBalance(account, value);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* @dev Overrides the `supportsInterface` function to ensure proper interface checks.
|
|
67
|
-
* @param interfaceId The interface ID to check.
|
|
68
|
-
* @return True if the contract implements the interface, false otherwise.
|
|
69
|
-
*/
|
|
70
|
-
function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool) {
|
|
71
|
-
return super.supportsInterface(interfaceId);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: UNLICENSED
|
|
2
|
-
pragma solidity ^0.8.27;
|
|
3
|
-
|
|
4
|
-
// Uncomment this line to use console.log
|
|
5
|
-
// import "hardhat/console.sol";
|
|
6
|
-
|
|
7
|
-
contract Lock {
|
|
8
|
-
uint public unlockTime;
|
|
9
|
-
address payable public owner;
|
|
10
|
-
|
|
11
|
-
event Withdrawal(uint amount, uint when);
|
|
12
|
-
|
|
13
|
-
constructor(uint _unlockTime) payable {
|
|
14
|
-
require(
|
|
15
|
-
block.timestamp < _unlockTime,
|
|
16
|
-
"Unlock time should be in the future"
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
unlockTime = _unlockTime;
|
|
20
|
-
owner = payable(msg.sender);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function withdraw() public {
|
|
24
|
-
// Uncomment this line, and the import of "hardhat/console.sol", to print a log in your terminal
|
|
25
|
-
// console.log("Unlock time is %o and block timestamp is %o", unlockTime, block.timestamp);
|
|
26
|
-
|
|
27
|
-
require(block.timestamp >= unlockTime, "You can't withdraw yet");
|
|
28
|
-
require(msg.sender == owner, "You aren't the owner");
|
|
29
|
-
|
|
30
|
-
emit Withdrawal(address(this).balance, block.timestamp);
|
|
31
|
-
|
|
32
|
-
owner.transfer(address(this).balance);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// hardhat.config.js
|
|
2
|
-
require('@nomiclabs/hardhat-waffle');
|
|
3
|
-
require('@nomiclabs/hardhat-ethers');
|
|
4
|
-
require('@nomiclabs/hardhat-etherscan');
|
|
5
|
-
require('dotenv').config();
|
|
6
|
-
const fs = require('fs-extra');
|
|
7
|
-
|
|
8
|
-
/** @type import('hardhat/config').HardhatUserConfig */
|
|
9
|
-
module.exports = {
|
|
10
|
-
defaultNetwork: 'cryptokoyn-itemledger',
|
|
11
|
-
networks: {
|
|
12
|
-
hardhat: {},
|
|
13
|
-
'cryptokoyn-itemledger': {
|
|
14
|
-
// url: 'https://cryptokoyn.net/rpc/mainnet',
|
|
15
|
-
// url: 'https://itemledger.com/rpc/mainnet',
|
|
16
|
-
url: 'http://127.0.0.1:8545',
|
|
17
|
-
accounts: [fs.readFileSync(`../engine-private/eth-networks/cryptokoyn-itemledger/coinbase`, 'utf8')], // process.env.ETH_PRIVATE_KEY
|
|
18
|
-
chainId: 777771,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
// etherscan: {
|
|
22
|
-
// apiKey: "YOUR_ETHERSCAN_API_KEY", // Replace with your Etherscan API key
|
|
23
|
-
// },
|
|
24
|
-
// vanar: {
|
|
25
|
-
// apiKey: "YOUR_VANAR_API_KEY", // Replace with your VANAR API key
|
|
26
|
-
// },
|
|
27
|
-
solidity: {
|
|
28
|
-
version: '0.8.27',
|
|
29
|
-
settings: {
|
|
30
|
-
optimizer: {
|
|
31
|
-
enabled: true,
|
|
32
|
-
runs: 200,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
paths: {
|
|
37
|
-
sources: './contracts',
|
|
38
|
-
tests: './test',
|
|
39
|
-
cache: './cache',
|
|
40
|
-
artifacts: './artifacts',
|
|
41
|
-
},
|
|
42
|
-
mocha: {
|
|
43
|
-
timeout: 40000,
|
|
44
|
-
},
|
|
45
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// This setup uses Hardhat Ignition to manage smart contract deployments.
|
|
2
|
-
// Learn more about it at https://hardhat.org/ignition
|
|
3
|
-
|
|
4
|
-
const { buildModule } = require("@nomicfoundation/hardhat-ignition/modules");
|
|
5
|
-
|
|
6
|
-
const JAN_1ST_2030 = 1893456000;
|
|
7
|
-
const ONE_GWEI = 1_000_000_000n;
|
|
8
|
-
|
|
9
|
-
module.exports = buildModule("LockModule", (m) => {
|
|
10
|
-
const unlockTime = m.getParameter("unlockTime", JAN_1ST_2030);
|
|
11
|
-
const lockedAmount = m.getParameter("lockedAmount", ONE_GWEI);
|
|
12
|
-
|
|
13
|
-
const lock = m.contract("Lock", [unlockTime], {
|
|
14
|
-
value: lockedAmount,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
return { lock };
|
|
18
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"genesis": {
|
|
3
|
-
"config": {
|
|
4
|
-
"chainid": 777771,
|
|
5
|
-
"berlinBlock": 0,
|
|
6
|
-
"qbft": {
|
|
7
|
-
"epochlength": 30000,
|
|
8
|
-
"blockperiodseconds": 5,
|
|
9
|
-
"requesttimeoutseconds": 10
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
"nonce": "0x0",
|
|
13
|
-
"timestamp": "0x5b3d92d7",
|
|
14
|
-
"extraData": "0xf87aa00000000000000000000000000000000000000000000000000000000000000000f8549464a702e6263b7297a96638cac6ae65e6541f4169943923390ad55e90c237593b3b0e401f3b08a0318594aefdb9a738c9f433e5b6b212a6d62f6370c2f69294c7eeb9a4e00ce683cf93039b212648e01c6c6b78c080c0",
|
|
15
|
-
"gasLimit": "0x1fffffffffffff",
|
|
16
|
-
"difficulty": "0x1",
|
|
17
|
-
"mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
|
|
18
|
-
"coinbase": "0x44e298766B94B53AdA033FE920748a398CC7cE63",
|
|
19
|
-
"number": "0x0",
|
|
20
|
-
"gasUsed": "0x0",
|
|
21
|
-
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
22
|
-
},
|
|
23
|
-
"blockchain": {
|
|
24
|
-
"nodes": {
|
|
25
|
-
"generate": true,
|
|
26
|
-
"count": 4
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const { ethers, upgrades } = require('hardhat');
|
|
2
|
-
|
|
3
|
-
async function main() {
|
|
4
|
-
const [deployer] = await ethers.getSigners();
|
|
5
|
-
|
|
6
|
-
console.log('Deploying CryptoKoyn from account:', deployer.address);
|
|
7
|
-
|
|
8
|
-
const CryptoKoyn = await ethers.getContractFactory('CryptoKoyn');
|
|
9
|
-
|
|
10
|
-
const testToken = await CryptoKoyn.deploy(deployer.address);
|
|
11
|
-
|
|
12
|
-
console.log('CryptoKoyn deployed to:', testToken.address);
|
|
13
|
-
|
|
14
|
-
// Ensures that the deployment transaction is confirmed on the blockchain before proceeding,
|
|
15
|
-
// or wait closed blocks until the transaction is confirmed
|
|
16
|
-
console.log('Wait confirmed...', testToken.address);
|
|
17
|
-
await testToken.deployed();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
main()
|
|
21
|
-
.then(() => process.exit(0))
|
|
22
|
-
.catch((error) => {
|
|
23
|
-
console.error(error);
|
|
24
|
-
process.exit(1);
|
|
25
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const { ethers, upgrades } = require('hardhat');
|
|
2
|
-
|
|
3
|
-
async function main() {
|
|
4
|
-
const [deployer] = await ethers.getSigners();
|
|
5
|
-
|
|
6
|
-
console.log('Deploying ItemLedger from account:', deployer.address);
|
|
7
|
-
|
|
8
|
-
const ItemLedger = await ethers.getContractFactory('ItemLedger');
|
|
9
|
-
|
|
10
|
-
const testToken = await ItemLedger.deploy(deployer.address);
|
|
11
|
-
|
|
12
|
-
console.log('ItemLedger deployed to:', testToken.address);
|
|
13
|
-
|
|
14
|
-
// Ensures that the deployment transaction is confirmed on the blockchain before proceeding,
|
|
15
|
-
// or wait closed blocks until the transaction is confirmed
|
|
16
|
-
console.log('Wait confirmed...', testToken.address);
|
|
17
|
-
await testToken.deployed();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
main()
|
|
21
|
-
.then(() => process.exit(0))
|
|
22
|
-
.catch((error) => {
|
|
23
|
-
console.error(error);
|
|
24
|
-
process.exit(1);
|
|
25
|
-
});
|
package/hardhat/test/Lock.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
const {
|
|
2
|
-
time,
|
|
3
|
-
loadFixture,
|
|
4
|
-
} = require("@nomicfoundation/hardhat-toolbox/network-helpers");
|
|
5
|
-
const { anyValue } = require("@nomicfoundation/hardhat-chai-matchers/withArgs");
|
|
6
|
-
const { expect } = require("chai");
|
|
7
|
-
|
|
8
|
-
describe("Lock", function () {
|
|
9
|
-
// We define a fixture to reuse the same setup in every test.
|
|
10
|
-
// We use loadFixture to run this setup once, snapshot that state,
|
|
11
|
-
// and reset Hardhat Network to that snapshot in every test.
|
|
12
|
-
async function deployOneYearLockFixture() {
|
|
13
|
-
const ONE_YEAR_IN_SECS = 365 * 24 * 60 * 60;
|
|
14
|
-
const ONE_GWEI = 1_000_000_000;
|
|
15
|
-
|
|
16
|
-
const lockedAmount = ONE_GWEI;
|
|
17
|
-
const unlockTime = (await time.latest()) + ONE_YEAR_IN_SECS;
|
|
18
|
-
|
|
19
|
-
// Contracts are deployed using the first signer/account by default
|
|
20
|
-
const [owner, otherAccount] = await ethers.getSigners();
|
|
21
|
-
|
|
22
|
-
const Lock = await ethers.getContractFactory("Lock");
|
|
23
|
-
const lock = await Lock.deploy(unlockTime, { value: lockedAmount });
|
|
24
|
-
|
|
25
|
-
return { lock, unlockTime, lockedAmount, owner, otherAccount };
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
describe("Deployment", function () {
|
|
29
|
-
it("Should set the right unlockTime", async function () {
|
|
30
|
-
const { lock, unlockTime } = await loadFixture(deployOneYearLockFixture);
|
|
31
|
-
|
|
32
|
-
expect(await lock.unlockTime()).to.equal(unlockTime);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("Should set the right owner", async function () {
|
|
36
|
-
const { lock, owner } = await loadFixture(deployOneYearLockFixture);
|
|
37
|
-
|
|
38
|
-
expect(await lock.owner()).to.equal(owner.address);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("Should receive and store the funds to lock", async function () {
|
|
42
|
-
const { lock, lockedAmount } = await loadFixture(
|
|
43
|
-
deployOneYearLockFixture
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
expect(await ethers.provider.getBalance(lock.target)).to.equal(
|
|
47
|
-
lockedAmount
|
|
48
|
-
);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it("Should fail if the unlockTime is not in the future", async function () {
|
|
52
|
-
// We don't use the fixture here because we want a different deployment
|
|
53
|
-
const latestTime = await time.latest();
|
|
54
|
-
const Lock = await ethers.getContractFactory("Lock");
|
|
55
|
-
await expect(Lock.deploy(latestTime, { value: 1 })).to.be.revertedWith(
|
|
56
|
-
"Unlock time should be in the future"
|
|
57
|
-
);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
describe("Withdrawals", function () {
|
|
62
|
-
describe("Validations", function () {
|
|
63
|
-
it("Should revert with the right error if called too soon", async function () {
|
|
64
|
-
const { lock } = await loadFixture(deployOneYearLockFixture);
|
|
65
|
-
|
|
66
|
-
await expect(lock.withdraw()).to.be.revertedWith(
|
|
67
|
-
"You can't withdraw yet"
|
|
68
|
-
);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it("Should revert with the right error if called from another account", async function () {
|
|
72
|
-
const { lock, unlockTime, otherAccount } = await loadFixture(
|
|
73
|
-
deployOneYearLockFixture
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
// We can increase the time in Hardhat Network
|
|
77
|
-
await time.increaseTo(unlockTime);
|
|
78
|
-
|
|
79
|
-
// We use lock.connect() to send a transaction from another account
|
|
80
|
-
await expect(lock.connect(otherAccount).withdraw()).to.be.revertedWith(
|
|
81
|
-
"You aren't the owner"
|
|
82
|
-
);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it("Shouldn't fail if the unlockTime has arrived and the owner calls it", async function () {
|
|
86
|
-
const { lock, unlockTime } = await loadFixture(
|
|
87
|
-
deployOneYearLockFixture
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
// Transactions are sent using the first signer by default
|
|
91
|
-
await time.increaseTo(unlockTime);
|
|
92
|
-
|
|
93
|
-
await expect(lock.withdraw()).not.to.be.reverted;
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
describe("Events", function () {
|
|
98
|
-
it("Should emit an event on withdrawals", async function () {
|
|
99
|
-
const { lock, unlockTime, lockedAmount } = await loadFixture(
|
|
100
|
-
deployOneYearLockFixture
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
await time.increaseTo(unlockTime);
|
|
104
|
-
|
|
105
|
-
await expect(lock.withdraw())
|
|
106
|
-
.to.emit(lock, "Withdrawal")
|
|
107
|
-
.withArgs(lockedAmount, anyValue); // We accept any value as `when` arg
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
describe("Transfers", function () {
|
|
112
|
-
it("Should transfer the funds to the owner", async function () {
|
|
113
|
-
const { lock, unlockTime, lockedAmount, owner } = await loadFixture(
|
|
114
|
-
deployOneYearLockFixture
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
await time.increaseTo(unlockTime);
|
|
118
|
-
|
|
119
|
-
await expect(lock.withdraw()).to.changeEtherBalances(
|
|
120
|
-
[owner, lock],
|
|
121
|
-
[lockedAmount, -lockedAmount]
|
|
122
|
-
);
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
});
|