Skip to content

Commit

Permalink
Merge pull request #11 from Nodeguardians/develop
Browse files Browse the repository at this point in the history
Questplay MVP
  • Loading branch information
bryanwee023 committed Nov 18, 2022
2 parents 807a920 + 777d26f commit 02388d8
Show file tree
Hide file tree
Showing 36 changed files with 29,800 additions and 239 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/ci-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI Tests

on:
workflow_dispatch:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm link
- run: npm run test -- ${{ matrix.os }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
.vscode
artifacts
cache
.credentials
.env
18 changes: 18 additions & 0 deletions @ngquests/contracts/IValidator.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

interface IValidator {

/// @dev Returns address of contract belonging to `user` in part `k` of quest.
function deployments(address user, uint k) external view returns (address);


/// @dev Deploys CTF contract for user to interact with.
function deploy(uint k) external;


/// @dev Tests whether contract belonging to `user` in part `k` has been "captured".
/// Returns true if contract "captured", false otherwise.
function test(address user, uint k) external view returns (bool);

}
48 changes: 48 additions & 0 deletions @ngquests/contracts/Token.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

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

/// @dev Test token with minting capabilities
/// Clone-friendly for cheaper gas in CTF quests
contract Token is ERC20 {

string private _name;
string private _symbol;

address private owner;
bool private isInitialized;

modifier onlyOwner() {
require(msg.sender == owner, "Caller is not owner");
_;
}

constructor() ERC20("", "") { }

function initialize(
string memory name_,
string memory symbol_
) external {
require(!isInitialized, "Token already initialized");

_name = name_;
_symbol = symbol_;

owner = msg.sender;
isInitialized = true;
}

function mint(address to, uint256 amount) external onlyOwner {
_mint(to, amount);
}

function name() public view override returns (string memory) {
return _name;
}

function symbol() public view override returns (string memory) {
return _symbol;
}

}
11 changes: 11 additions & 0 deletions @ngquests/contracts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@ngquests/contracts",
"version": "0.1.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"No test specified\""
},
"author": "",
"license": "MIT"
}
7 changes: 7 additions & 0 deletions @ngquests/test-helpers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
get matchers () { return require('./src/matchers.js'); },
get events () { return require('./src/events.js'); },
get diamonds () { return require('./src/diamonds.js'); },
get ast () { return require('./src/ast.js'); },
get cheating () { return require('./src/cheating.js'); }
}
Loading

0 comments on commit 02388d8

Please sign in to comment.