mirror of https://github.com/logos-co/staking.git
create test script
This commit is contained in:
parent
ff4bdf65f3
commit
82ebd1301e
|
@ -0,0 +1,17 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity 0.8.20;
|
||||
|
||||
import "@openzeppelin/contracts/access/Ownable.sol";
|
||||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||
|
||||
contract Token is Ownable, ERC20 {
|
||||
|
||||
constructor() ERC20("Status", "SNT") {
|
||||
|
||||
}
|
||||
|
||||
function mint(address _destination, uint256 _amount) external onlyOwner {
|
||||
_mint(_destination, _amount);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
239
package.json
239
package.json
|
@ -1,228 +1,29 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"hardhat": "^2.14.0"
|
||||
},
|
||||
"name": "staking",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"abort-controller": "^3.0.0",
|
||||
"abstract-level": "^1.0.3",
|
||||
"adm-zip": "^0.4.16",
|
||||
"aes-js": "^3.0.0",
|
||||
"agent-base": "^6.0.2",
|
||||
"aggregate-error": "^3.1.0",
|
||||
"ansi-colors": "^4.1.3",
|
||||
"ansi-escapes": "^4.3.2",
|
||||
"ansi-regex": "^5.0.1",
|
||||
"ansi-styles": "^3.2.1",
|
||||
"anymatch": "^3.1.3",
|
||||
"argparse": "^2.0.1",
|
||||
"balanced-match": "^1.0.2",
|
||||
"base-x": "^3.0.9",
|
||||
"base64-js": "^1.5.1",
|
||||
"bech32": "^1.1.4",
|
||||
"bigint-crypto-utils": "^3.2.2",
|
||||
"binary-extensions": "^2.2.0",
|
||||
"blakejs": "^1.2.1",
|
||||
"bn.js": "^5.2.1",
|
||||
"brace-expansion": "^1.1.11",
|
||||
"braces": "^3.0.2",
|
||||
"brorand": "^1.1.0",
|
||||
"browser-level": "^1.0.1",
|
||||
"browser-stdout": "^1.3.1",
|
||||
"browserify-aes": "^1.2.0",
|
||||
"bs58": "^4.0.1",
|
||||
"bs58check": "^2.1.2",
|
||||
"buffer": "^6.0.3",
|
||||
"buffer-from": "^1.1.2",
|
||||
"buffer-xor": "^1.0.3",
|
||||
"busboy": "^1.6.0",
|
||||
"bytes": "^3.1.2",
|
||||
"call-bind": "^1.0.2",
|
||||
"camelcase": "^6.3.0",
|
||||
"case": "^1.6.3",
|
||||
"catering": "^2.1.1",
|
||||
"chalk": "^2.4.2",
|
||||
"chokidar": "^3.5.3",
|
||||
"ci-info": "^2.0.0",
|
||||
"cipher-base": "^1.0.4",
|
||||
"classic-level": "^1.3.0",
|
||||
"clean-stack": "^2.2.0",
|
||||
"cliui": "^7.0.4",
|
||||
"color-convert": "^1.9.3",
|
||||
"color-name": "^1.1.3",
|
||||
"command-exists": "^1.2.9",
|
||||
"commander": "^3.0.2",
|
||||
"concat-map": "^0.0.1",
|
||||
"cookie": "^0.4.2",
|
||||
"crc-32": "^1.2.2",
|
||||
"create-hash": "^1.2.0",
|
||||
"create-hmac": "^1.1.7",
|
||||
"debug": "^4.3.4",
|
||||
"decamelize": "^4.0.0",
|
||||
"depd": "^2.0.0",
|
||||
"diff": "^5.0.0",
|
||||
"elliptic": "^6.5.4",
|
||||
"emoji-regex": "^8.0.0",
|
||||
"enquirer": "^2.3.6",
|
||||
"env-paths": "^2.2.1",
|
||||
"escalade": "^3.1.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
"ethereum-cryptography": "^1.2.0",
|
||||
"ethereumjs-abi": "^0.6.8",
|
||||
"ethereumjs-util": "^6.2.1",
|
||||
"ethers": "^5.7.2",
|
||||
"ethjs-util": "^0.1.6",
|
||||
"event-target-shim": "^5.0.1",
|
||||
"evp_bytestokey": "^1.0.3",
|
||||
"fill-range": "^7.0.1",
|
||||
"find-up": "^2.1.0",
|
||||
"flat": "^5.0.2",
|
||||
"follow-redirects": "^1.15.2",
|
||||
"fp-ts": "^1.19.3",
|
||||
"fs-extra": "^7.0.1",
|
||||
"fs.realpath": "^1.0.0",
|
||||
"function-bind": "^1.1.1",
|
||||
"functional-red-black-tree": "^1.0.1",
|
||||
"get-caller-file": "^2.0.5",
|
||||
"get-intrinsic": "^1.2.1",
|
||||
"glob": "^7.2.0",
|
||||
"glob-parent": "^5.1.2",
|
||||
"graceful-fs": "^4.2.11",
|
||||
"has": "^1.0.3",
|
||||
"has-flag": "^3.0.0",
|
||||
"has-proto": "^1.0.1",
|
||||
"has-symbols": "^1.0.3",
|
||||
"hash-base": "^3.1.0",
|
||||
"hash.js": "^1.1.7",
|
||||
"he": "^1.2.0",
|
||||
"hmac-drbg": "^1.0.1",
|
||||
"http-errors": "^2.0.0",
|
||||
"https-proxy-agent": "^5.0.1",
|
||||
"iconv-lite": "^0.4.24",
|
||||
"ieee754": "^1.2.1",
|
||||
"immutable": "^4.3.0",
|
||||
"indent-string": "^4.0.0",
|
||||
"inflight": "^1.0.6",
|
||||
"inherits": "^2.0.4",
|
||||
"io-ts": "^1.10.4",
|
||||
"is-binary-path": "^2.1.0",
|
||||
"is-buffer": "^2.0.5",
|
||||
"is-extglob": "^2.1.1",
|
||||
"is-fullwidth-code-point": "^3.0.0",
|
||||
"is-glob": "^4.0.3",
|
||||
"is-hex-prefixed": "^1.0.0",
|
||||
"is-number": "^7.0.0",
|
||||
"is-plain-obj": "^2.1.0",
|
||||
"is-unicode-supported": "^0.1.0",
|
||||
"js-sdsl": "^4.4.0",
|
||||
"js-sha3": "^0.8.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"jsonfile": "^4.0.0",
|
||||
"keccak": "^3.0.3",
|
||||
"klaw": "^1.3.1",
|
||||
"level": "^8.0.0",
|
||||
"level-supports": "^4.0.1",
|
||||
"level-transcoder": "^1.0.1",
|
||||
"locate-path": "^2.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"log-symbols": "^4.1.0",
|
||||
"lru_map": "^0.3.3",
|
||||
"lru-cache": "^5.1.1",
|
||||
"mcl-wasm": "^0.7.9",
|
||||
"md5.js": "^1.3.5",
|
||||
"memory-level": "^1.0.0",
|
||||
"memorystream": "^0.3.1",
|
||||
"minimalistic-assert": "^1.0.1",
|
||||
"minimalistic-crypto-utils": "^1.0.1",
|
||||
"minimatch": "^3.1.2",
|
||||
"mnemonist": "^0.38.5",
|
||||
"module-error": "^1.0.2",
|
||||
"ms": "^2.1.2",
|
||||
"nanoid": "^3.3.3",
|
||||
"napi-macros": "^2.2.2",
|
||||
"node-addon-api": "^2.0.2",
|
||||
"node-gyp-build": "^4.6.0",
|
||||
"normalize-path": "^3.0.0",
|
||||
"object-inspect": "^1.12.3",
|
||||
"obliterator": "^2.0.4",
|
||||
"once": "^1.4.0",
|
||||
"openzeppelin-contracts": "^4.0.0",
|
||||
"os-tmpdir": "^1.0.2",
|
||||
"p-limit": "^1.3.0",
|
||||
"p-locate": "^2.0.0",
|
||||
"p-map": "^4.0.0",
|
||||
"p-try": "^1.0.0",
|
||||
"path-exists": "^3.0.0",
|
||||
"path-is-absolute": "^1.0.1",
|
||||
"path-parse": "^1.0.7",
|
||||
"pbkdf2": "^3.1.2",
|
||||
"picomatch": "^2.3.1",
|
||||
"qs": "^6.11.1",
|
||||
"queue-microtask": "^1.2.3",
|
||||
"randombytes": "^2.1.0",
|
||||
"raw-body": "^2.5.2",
|
||||
"readable-stream": "^3.6.2",
|
||||
"readdirp": "^3.6.0",
|
||||
"require-directory": "^2.1.1",
|
||||
"require-from-string": "^2.0.2",
|
||||
"resolve": "^1.17.0",
|
||||
"rimraf": "^2.7.1",
|
||||
"ripemd160": "^2.0.2",
|
||||
"rlp": "^2.2.7",
|
||||
"run-parallel-limit": "^1.1.0",
|
||||
"rustbn.js": "^0.2.0",
|
||||
"safe-buffer": "^5.1.2",
|
||||
"safer-buffer": "^2.1.2",
|
||||
"scrypt-js": "^3.0.1",
|
||||
"secp256k1": "^4.0.3",
|
||||
"semver": "^6.3.0",
|
||||
"serialize-javascript": "^6.0.0",
|
||||
"setimmediate": "^1.0.5",
|
||||
"setprototypeof": "^1.2.0",
|
||||
"sha.js": "^2.4.11",
|
||||
"side-channel": "^1.0.4",
|
||||
"solc": "^0.7.3",
|
||||
"source-map": "^0.6.1",
|
||||
"source-map-support": "^0.5.21",
|
||||
"stacktrace-parser": "^0.1.10",
|
||||
"statuses": "^2.0.1",
|
||||
"streamsearch": "^1.1.0",
|
||||
"string_decoder": "^1.3.0",
|
||||
"string-width": "^4.2.3",
|
||||
"strip-ansi": "^6.0.1",
|
||||
"strip-hex-prefix": "^1.0.0",
|
||||
"strip-json-comments": "^3.1.1",
|
||||
"supports-color": "^5.5.0",
|
||||
"tmp": "^0.0.33",
|
||||
"to-regex-range": "^5.0.1",
|
||||
"toidentifier": "^1.0.1",
|
||||
"tslib": "^1.14.1",
|
||||
"tsort": "^0.0.1",
|
||||
"tweetnacl": "^1.0.3",
|
||||
"tweetnacl-util": "^0.15.1",
|
||||
"type-fest": "^0.21.3",
|
||||
"undici": "^5.22.1",
|
||||
"universalify": "^0.1.2",
|
||||
"unpipe": "^1.0.0",
|
||||
"util-deprecate": "^1.0.2",
|
||||
"uuid": "^8.3.2",
|
||||
"workerpool": "^6.2.1",
|
||||
"wrap-ansi": "^7.0.0",
|
||||
"wrappy": "^1.0.2",
|
||||
"ws": "^7.5.9",
|
||||
"y18n": "^5.0.8",
|
||||
"yallist": "^3.1.1",
|
||||
"yargs": "^16.2.0",
|
||||
"yargs-parser": "^20.2.4",
|
||||
"yargs-unparser": "^2.0.0",
|
||||
"yocto-queue": "^0.1.0"
|
||||
"description": "",
|
||||
"main": "hardhat.config.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"description": ""
|
||||
"devDependencies": {
|
||||
"@ethersproject/abi": "^5.7.0",
|
||||
"@ethersproject/providers": "^5.7.2",
|
||||
"@nomicfoundation/hardhat-chai-matchers": "^1.0.5",
|
||||
"@nomicfoundation/hardhat-network-helpers": "^1.0.8",
|
||||
"@nomicfoundation/hardhat-toolbox": "^2.0.2",
|
||||
"@nomiclabs/hardhat-ethers": "^2.2.1",
|
||||
"@nomiclabs/hardhat-etherscan": "^3.1.4",
|
||||
"@openzeppelin/contracts": "^4.9.2",
|
||||
"chai": "^4.3.7",
|
||||
"ethers": "^5.7.2",
|
||||
"hardhat": "^2.12.5",
|
||||
"hardhat-gas-reporter": "^1.0.9",
|
||||
"solidity-coverage": "^0.8.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
const { expect } = require("chai");
|
||||
const { ethers } = require("hardhat");
|
||||
const {
|
||||
loadFixture
|
||||
} = require("@nomicfoundation/hardhat-network-helpers");
|
||||
var i = 0;
|
||||
var j = 0;
|
||||
describe("StakeManager contract", function () {
|
||||
async function deployTokenFixture() {
|
||||
const [owner, addr1, addr2, addr3] = await ethers.getSigners();
|
||||
const testToken = await ethers.deployContract("Token");
|
||||
await testToken.mint(addr1.address, 12 * 10^18);
|
||||
await testToken.mint(addr2.address, 24 * 10^18);
|
||||
await testToken.mint(addr3.address, 36 * 10^18);
|
||||
return { testToken, owner, addr1, addr2, addr3 };
|
||||
}
|
||||
|
||||
async function deployStakeManager() {
|
||||
const { testToken, owner } = await loadFixture(deployTokenFixture);
|
||||
const stakeManager = await ethers.deployContract("StakeManager", [testToken.address, "0x0000000000000000000000000000000000000000"]);
|
||||
return { stakeManager, testToken, owner };
|
||||
}
|
||||
|
||||
|
||||
it("Deployment should be initialized zero", async function () {
|
||||
const { stakeManager, testToken, owner } = await loadFixture(deployStakeManager);
|
||||
expect(await stakeManager.totalSupply()).to.equal(0);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue