Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ genesis:
address: ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5
balance: "100000000000000"
sbtc-balance: "1000000000"
- name: wallet_10
address: ST3FFKYTTB975A3JC3F99MM7TXZJ406R3GKE6JV56
balance: "200000000000000"
sbtc-balance: "1000000000"
- name: wallet_2
address: ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG
balance: "100000000000000"
Expand Down
219 changes: 211 additions & 8 deletions contrib/core-contract-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions contrib/core-contract-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@clarigen/test": "2.1.3",
"@hirosystems/clarinet-sdk": "2.16.0",
"@stacks/clarunit": "0.0.1",
"@stacks/rendezvous": "^0.7.4",
"@stacks/stacking": "^6.13.2",
"@stacks/transactions": "^6.13.0",
"chokidar-cli": "^3.0.0",
Expand Down
6 changes: 6 additions & 0 deletions contrib/core-contract-tests/settings/Devnet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,9 @@ balance = 100_000_000_000_000
# stx_address: STNHKEPYEPJ8ET55ZZ0M5A34J0R3N5FM2CMMMAZ6
# btc_address: mjSrB3wS4xab3kYqFktwBzfTdPg367ZJ2d

[accounts.wallet_10]
mnemonic = "kiss denial decade slide spawn medal twist lamp evidence economy torch alter witness paper rule snack cushion hill sugar fury public innocent almost divide"
balance = 200_000_000_000_000
# secret_key: 5b897659452b9f3642be69aee75dc3cc84b2386d55ece1312affdbb80a3b2a7d01
# stx_address: ST3FFKYTTB975A3JC3F99MM7TXZJ406R3GKE6JV56
# btc_address: n1qwmgbzf1YeHDW6cTxxEwuqnjbqauvKJ1
6 changes: 4 additions & 2 deletions contrib/core-contract-tests/tests/pox-4/pox-4.prop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { assert, describe, expect, it } from "vitest";
import { createHash } from "crypto";

// Contract Consts
const INITIAL_TOTAL_LIQ_SUPPLY = 1_000_000_000_000_000;
const MIN_AMOUNT_USTX = 125_000_000_000n;
const INITIAL_TOTAL_LIQ_SUPPLY = 1_200_000_000_000_000;
const MIN_AMOUNT_USTX = 150_000_000_000n;
const TESTNET_PREPARE_CYCLE_LENGTH = 50;
const TESTNET_REWARD_CYCLE_LENGTH = 1050;
const TESTNET_STACKING_THRESHOLD_25 = 8000;
Expand Down Expand Up @@ -53,6 +53,8 @@ const privateKeyMapping: {
"6a1a754ba863d7bab14adbbc3f8ebb090af9e871ace621d3e5ab634e1422885e01",
STNHKEPYEPJ8ET55ZZ0M5A34J0R3N5FM2CMMMAZ6:
"de433bdfa14ec43aa1098d5be594c8ffb20a31485ff9de2923b2689471c401b801",
ST3FFKYTTB975A3JC3F99MM7TXZJ406R3GKE6JV56:
'5b897659452b9f3642be69aee75dc3cc84b2386d55ece1312affdbb80a3b2a7d01',
};

const sha256 = (data: Buffer): Buffer =>
Expand Down
41 changes: 41 additions & 0 deletions contrib/core-contract-tests/tests/sip-031/commands/Claim.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import fc from "fast-check";
import type { Model, Real } from "./types";
import {
calculateClaimable,
getWalletNameByAddress,
logCommand,
trackCommandRun,
} from "./utils";
import { expect } from "vitest";
import { txOk } from "@clarigen/test";

export const Claim = (accounts: Real["accounts"]) =>
fc.record({
sender: fc.constantFrom(
...Object.values(accounts).map((x) => x.address),
),
}).map((r) => ({
check: (model: Readonly<Model>) => {
const claimable = calculateClaimable(model);
return model.initialized === true && model.recipient === r.sender &&
claimable > 0n;
},
run: (model: Model, real: Real) => {
trackCommandRun(model, "claim");

const expectedClaim = calculateClaimable(model);
const receipt = txOk(real.contracts.sip031.claim(), r.sender);
expect(receipt.value).toBe(expectedClaim);

model.balance -= expectedClaim;
model.totalClaimed += expectedClaim;

logCommand({
sender: getWalletNameByAddress(r.sender),
status: "ok",
action: "claim",
value: `amount ${expectedClaim}`,
});
},
toString: () => `claim`,
}));
Loading