Skip to content
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
12 changes: 8 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Private key for the account that will deploy the contracts
# IMPORTANT: Never commit your actual .env file with real private keys to version control!
# Format: 0x followed by 64 hexadecimal characters
PRIVATE_KEY=0x0000000000000000000000000000000000000000000000000000000000000000
# Rayls Devnet
RPC_URL=https://devnet-rpc.rayls.com
CHAIN_ID=123123

# Wallets (NUNCA commitar chaves reais; use apenas no .env local)
PRIVATE_KEY_OWNER=PASTE_OWNER_PRIVATE_KEY_HERE
PRIVATE_KEY_USER_A=PASTE_USER_A_PRIVATE_KEY_HERE
PRIVATE_KEY_USER_B=PASTE_USER_B_PRIVATE_KEY_HERE
74 changes: 74 additions & 0 deletions entrega/ENTREGA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# QA Engineering Challenge — Entrega

Repositório: https://github.com/clebergrunge87/qa-engineering-challenge-rayls

## Pré-requisitos
- Node.js 20+
- npm

## Setup (rodar na raiz do projeto)

### 1) Instalar dependências
```bash
npm install
```

2) Configurar variáveis de ambiente (NÃO commitar .env)

O repositório possui o template .env.example.

Crie o .env localmente (ele já está no .gitignore) e preencha com os valores solicitados sem commitar chaves.

Exemplo (Windows PowerShell):

```
Copy-Item .env.example .env -Force
notepad .env
```

Preencher no .env local:

RPC_URL=https://devnet-rpc.rayls.com

CHAIN_ID=123123

PRIVATE_KEY_OWNER=<private key recebida por e-mail>

PRIVATE_KEY_USER_A=<private key da conta A>

PRIVATE_KEY_USER_B=<private key da conta B>

3) Rodar testes localmente (Hardhat local)

```
npx hardhat test
```

4) Rodar testes na Rayls Devnet

```
npx hardhat test --network rayls_devnet
```

Observação — instabilidade do RPC (devnet)

Ao executar na devnet, podem ocorrer falhas intermitentes do endpoint RPC (ex.: 521/522),
resultando em erros como:

HH110: Invalid JSON-RPC response...

Evidências:

notas/RPC_ISSUE.md

notas/RPC_ISSUE_522.md

Arquivos principais

Contrato: contracts/RaylsToken.sol

Testes: test/RaylsToken.test.ts

Config: hardhat.config.ts

Template env: .env.example
58 changes: 19 additions & 39 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,49 +1,29 @@
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import * as dotenv from "dotenv";
import "dotenv/config";

dotenv.config();
const RPC_URL = process.env.RPC_URL || "";
const CHAIN_ID = process.env.CHAIN_ID ? Number(process.env.CHAIN_ID) : 0;

// NUNCA commitar chaves. Elas ficam só no .env local (que já está no .gitignore).
const PRIVATE_KEY_OWNER = process.env.PRIVATE_KEY_OWNER || "";
const PRIVATE_KEY_USER_A = process.env.PRIVATE_KEY_USER_A || "";
const PRIVATE_KEY_USER_B = process.env.PRIVATE_KEY_USER_B || "";

// Hardhat costuma exigir private key como 0x + 64 hex
const with0x = (k: string) => (k.startsWith("0x") ? k : `0x${k}`);
const accounts = [PRIVATE_KEY_OWNER, PRIVATE_KEY_USER_A, PRIVATE_KEY_USER_B]
.filter(Boolean)
.map(with0x);

const config: HardhatUserConfig = {
solidity: {
version: "0.8.20",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
solidity: "0.8.28",
networks: {
rayls: {
url: "https://devnet-rpc.rayls.com",
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [],
chainId: 123123, // Update this if you know the actual chain ID
rayls_devnet: {
url: RPC_URL,
chainId: CHAIN_ID,
accounts,
},
localhost: {
url: "http://127.0.0.1:8545",
},
},
etherscan: {
apiKey: {
rayls: "no-api-key-needed",
},
customChains: [
{
network: "rayls",
chainId: 123123,
urls: {
apiURL: "https://devnet-explorer.rayls.com/api",
browserURL: "https://devnet-explorer.rayls.com"
}
}
]
},
paths: {
sources: "./contracts",
tests: "./test",
cache: "./cache",
artifacts: "./artifacts",
},
};

Expand Down
9 changes: 9 additions & 0 deletions notas/COMANDOS_QUANDO_LIBERAR.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Quando liberarem acesso ao Azure DevOps:

cd C:\qa-challenge

git clone https://dev.azure.com/parfin/PS/_git/vault-contract-poc

cd vault-contract-poc

npm install
33 changes: 33 additions & 0 deletions notas/README_NOTAS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
QA Engineering Challenge - Notas (Cleber)

1) Repositório:
- URL: https://dev.azure.com/parfin/PS/_git/vault-contract-poc
- Status acesso: aguardando liberação

2) Rede (Rayls Devnet):
- RPC_URL: https://devnet-rpc.rayls.com
- CHAIN_ID: 123123
- Explorer: https://devnet-explorer.rayls.com/
- MetaMask: erro ao validar RPC (remove https / não obtém chainId). Resolver depois.

3) Contas exigidas (3):
- OWNER/DEPLOYER: 0x416679D111Db8c02C658321D27cdFFaCdD3B8F19
- USER_A: 0xD07c86AB9Ebb23cB58B616bF1cc3e96A2E433f5A
- USER_B: 0x15b22844743481B5a7eA4eba8e861Bb8351c4280

“Private key do OWNER veio por e-mail e será usada no .env como PRIVATE_KEY_OWNER (não commitar).”
Obs: não registrar private keys aqui. Somente lembrar de criar/guardar em .env local.

4) Cenários obrigatórios do teste (E2E):
- Deployment & Ownership (owner = deployer)
- Access control mint (owner minta; userB não pode)
- Allowance (approve + transferFrom + validar saldos/allowance)
- Burn (userB burn e totalSupply reduz)

5) Checklist quando liberar o repo:
- [ ] git clone
- [ ] npm install
- [ ] criar .env
- [ ] configurar hardhat.config.ts para rayls_devnet
- [ ] rodar testes: npx hardhat test --network rayls_devnet
- [ ] PR com instruções e evidências
38 changes: 38 additions & 0 deletions notas/RPC_ISSUE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
\# RPC issue (rayls\_devnet)



Data/Hora: 01/02/2026

Projeto: qa-engineering-challenge-rayls



\## Comando

npx hardhat console --network rayls\_devnet



\## Ação

await ethers.provider.getBlockNumber()



\## Resultado

HH110: Invalid JSON-RPC response received: error code: 521



Observação:

O projeto compila e o console inicia, mas a chamada ao RPC falha com 521 (instabilidade do endpoint).

RPC configurado: https://devnet-rpc.rayls.com

CHAIN\_ID: 123123



48 changes: 48 additions & 0 deletions notas/RPC_ISSUE_522.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
\# RPC issue (rayls\_devnet) — error 522



Data/Hora: 01/02/2026

Projeto: qa-engineering-challenge-rayls



\## Comando

npx hardhat test --network rayls\_devnet



\## Resultado

HH110: Invalid JSON-RPC response received: error code: 522



Observação:

Localmente (Hardhat network) os testes passam: `npx hardhat test` -> 14 passing.

O erro ocorre somente ao apontar para o RPC da devnet.



# RPC Issue (Rayls Devnet) — Error 522 / HH110

Data/Hora: 2026-02-01 (America/Sao_Paulo)

Comando executado:
```powershell
npx hardhat test --network rayls_devnet
```


Resultado:
HardhatError: HH110: Invalid JSON-RPC response received: error code: 522

Observação:

Os testes locais (hardhat network) rodam com sucesso: npx hardhat test

A falha ocorre antes do deploy/testes iniciarem (hook before each), devido à instabilidade do endpoint RPC.
4 changes: 2 additions & 2 deletions test/RaylsToken.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ describe("RaylsToken", function () {

describe("Deployment", function () {
it("Should set the right name and symbol", async function () {
expect(await token.name()).to.equal("Rayls Token");
expect(await token.symbol()).to.equal("RAYLS");
expect(await token.name()).to.equal("Rayls Test Token");
expect(await token.symbol()).to.equal("RYLSTEST");
});

it("Should set the right decimals", async function () {
Expand Down