Skip to content

Commit

Permalink
refactor naming fund to mint
Browse files Browse the repository at this point in the history
  • Loading branch information
makarychev committed Jul 28, 2024
1 parent e4ad0b7 commit 08d5b0a
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions app/src/idl/tokenlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,8 @@ export type Tokenlock = {
},
{
"code": 6003,
"name": "amountLessThanMinFunding",
"msg": "Amount < min funding"
"name": "amountLessThanMinMintingAmount",
"msg": "Amount < min minting amount"
},
{
"code": 6004,
Expand Down
4 changes: 2 additions & 2 deletions programs/tokenlock/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ pub enum TokenlockErrors {
#[msg("Min timelock amount must be greater or equal to 1")]
MinTimelockAmountLessThanOne,

#[msg("Amount < min funding")]
AmountLessThanMinFunding,
#[msg("Amount < min minting amount")]
AmountLessThanMinMintingAmount,

#[msg("Insufficient data space, Tokenlock account is full")]
InsufficientTokenLockDataSpace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub fn mint_release_schedule<'info>(

//check params
if amount < TokenLockDataWrapper::min_timelock_amount(&tokenlock_account_data) {
return Err(TokenlockErrors::AmountLessThanMinFunding.into());
return Err(TokenlockErrors::AmountLessThanMinMintingAmount.into());
}

if schedule_id >= TokenLockDataWrapper::schedule_count(&tokenlock_account_data) {
Expand Down
2 changes: 1 addition & 1 deletion tests/tokenlock/createReleaseSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ describe("TokenLockup create release schedule", () => {
assert(timelock != null && timelock.cancelableByCount === 0);
});

it("funder cannot cancel a non existent timelock", async () => {
it("mint authority cannot cancel a non existent timelock", async () => {
const scheduleId = await createReleaseSchedule(
tokenlockProgram,
tokenlockDataPubkey,
Expand Down
4 changes: 2 additions & 2 deletions tests/tokenlock/discriminatorValidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { fromDaysToSeconds } from "../helpers/datetime";
import { TOKEN_2022_PROGRAM_ID } from "@solana/spl-token";
import { getNowTs } from "../helpers/clock_helper";

describe("TokenLockup fund release schedues", () => {
describe("TokenLockup tokenlock discriminator tests", () => {
const testEnvironmentParams: TestEnvironmentParams = {
mint: {
decimals: 6,
Expand Down Expand Up @@ -216,7 +216,7 @@ describe("TokenLockup fund release schedues", () => {
}
});

it("fund release schedule with wrong tokenlock account", async () => {
it("mint release schedule with wrong tokenlock account", async () => {
const recipient1 = anchor.web3.Keypair.generate();
const recipient2 = anchor.web3.Keypair.generate();
const timelockPK1 = await getOrCreateTimelockAccount(
Expand Down
4 changes: 2 additions & 2 deletions tests/tokenlock/mintCancelableReleaseSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ describe("TokenLockup check cancelables", () => {
);
});

it("should emit an event with the correct scheduleId when the release schedule is funded and canceled", async () => {
it("should emit an event with the correct scheduleId when the release schedule is minted and canceled", async () => {
const scheduleId = await createReleaseSchedule(
tokenlockProgram,
tokenlockDataPubkey,
Expand Down Expand Up @@ -381,7 +381,7 @@ describe("TokenLockup check cancelables", () => {
assert(Number(timelockId) === 1);
});

describe("Check cancel timelock after funding with multi cancelable addresses", () => {
describe("Check cancel timelock after minting with multi cancelable addresses", () => {
let cancelerList = [];
let timelockId: number | string;

Expand Down
2 changes: 1 addition & 1 deletion tests/tokenlock/mintReleaseSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ describe("TokenLockup mint release schedues", () => {
mintPubkey,
testEnvironment.accessControlHelper.program.programId
);
assert(timelockId === "Amount < min funding");
assert(timelockId === "Amount < min minting amount");
});

it("cannot specify non existent schedule id", async () => {
Expand Down
16 changes: 8 additions & 8 deletions tests/tokenlock/transfer-negative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ describe("Transfer Negative cases", async () => {
assert(accInfo !== null);

const amount = 51;
const funderPretenderBalanceBeforeTransfer = (
const walletPretenderBalanceBeforeTransfer = (
await testEnvironment.mintHelper.getAccount(walletPretenderAcc)
).amount;
const authorityAccount =
Expand Down Expand Up @@ -351,12 +351,12 @@ describe("Transfer Negative cases", async () => {
`Error: unknown signer: ${walletPretender.publicKey.toBase58()}`
);
}
const funderPretenderBalanceAfterTransfer = (
const walletPretenderBalanceAfterTransfer = (
await testEnvironment.mintHelper.getAccount(walletPretenderAcc)
).amount;
assert(
funderPretenderBalanceBeforeTransfer ===
funderPretenderBalanceAfterTransfer
walletPretenderBalanceBeforeTransfer ===
walletPretenderBalanceAfterTransfer
);

const balanceEscrowAfterTransfer = (
Expand Down Expand Up @@ -395,7 +395,7 @@ describe("Transfer Negative cases", async () => {
assert(accInfo !== null);

const amount = 51;
const funderPretenderBalanceBeforeTransfer = (
const walletPretenderBalanceBeforeTransfer = (
await testEnvironment.mintHelper.getAccount(walletPretenderAcc)
).amount;
const authorityAccount =
Expand Down Expand Up @@ -447,12 +447,12 @@ describe("Transfer Negative cases", async () => {
`Error: unknown signer: ${walletPretender.publicKey.toBase58()}`
);
}
const funderPretenderBalanceAfterTransfer = (
const walletPretenderBalanceAfterTransfer = (
await testEnvironment.mintHelper.getAccount(walletPretenderAcc)
).amount;
assert(
funderPretenderBalanceBeforeTransfer ===
funderPretenderBalanceAfterTransfer
walletPretenderBalanceBeforeTransfer ===
walletPretenderBalanceAfterTransfer
);

const balanceEscrowAfterTransfer = (
Expand Down

0 comments on commit 08d5b0a

Please sign in to comment.