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
21 changes: 0 additions & 21 deletions src/api/types/LaunchpadDtos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,6 @@ export class CreateTokenSaleDTO extends SubmitCallDTO {
@BigNumberProperty()
public preBuyQuantity: BigNumber;

@IsString()
@IsOptional()
public websiteUrl?: string;

@IsString()
@IsOptional()
public telegramUrl?: string;

@IsString()
@IsOptional()
public twitterUrl?: string;

@IsOptional()
@IsInt()
public saleStartTime?: number;
Expand Down Expand Up @@ -176,15 +164,6 @@ export class CreateSaleResDto {
@IsNotEmpty()
public description: string;

@IsOptional()
public websiteUrl?: string;

@IsOptional()
public telegramUrl?: string;

@IsOptional()
public twitterUrl?: string;

@IsNotEmpty()
public initialBuyQuantity: string;

Expand Down
88 changes: 1 addition & 87 deletions src/chaincode/launchpad/createSale.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ describe("createSale", () => {
"TestCollection",
"TestCategory"
);
createSaleDto.websiteUrl = "https://example.com";
createSaleDto.uniqueKey = randomUniqueKey();

const signedDto = createSaleDto.signed(users.testUser1.privateKey);
Expand All @@ -54,60 +53,6 @@ describe("createSale", () => {
expect(response.Data?.isFinalized).toBe(false);
});

it("should create token sale with telegram URL", async () => {
// Given
const { ctx, contract } = fixture(LaunchpadContract).registeredUsers(users.testUser1);

const createSaleDto = new CreateTokenSaleDTO(
"Telegram Token",
"TG",
"A token with telegram link",
"https://example.com/tg.png",
new BigNumber(0),
"TelegramCollection",
"SocialCategory"
);
createSaleDto.telegramUrl = "https://t.me/testtoken";
createSaleDto.uniqueKey = randomUniqueKey();

const signedDto = createSaleDto.signed(users.testUser1.privateKey);

// When
const response = await contract.CreateSale(ctx, signedDto);

// Then
expect(response.Status).toBe(1);
expect(response.Data?.telegramUrl).toBe("https://t.me/testtoken");
expect(response.Data?.websiteUrl).toBe("");
expect(response.Data?.twitterUrl).toBe("");
});

it("should create token sale with twitter URL", async () => {
// Given
const { ctx, contract } = fixture(LaunchpadContract).registeredUsers(users.testUser1);

const createSaleDto = new CreateTokenSaleDTO(
"Twitter Token",
"TWT",
"A token with twitter link",
"https://example.com/twt.png",
new BigNumber(0),
"TwitterCollection",
"SocialCategory"
);
createSaleDto.twitterUrl = "https://twitter.com/testtoken";
createSaleDto.uniqueKey = randomUniqueKey();

const signedDto = createSaleDto.signed(users.testUser1.privateKey);

// When
const response = await contract.CreateSale(ctx, signedDto);

// Then
expect(response.Status).toBe(1);
expect(response.Data?.twitterUrl).toBe("https://twitter.com/testtoken");
});

it("should create token sale with pre-buy amount", async () => {
// Given - Setup GALA token for pre-buy (matching LaunchpadSale nativeToken)
const galaClass = plainToInstance(TokenClass, {
Expand Down Expand Up @@ -162,7 +107,6 @@ describe("createSale", () => {
"PreBuyCollection",
"PreBuyCategory"
);
createSaleDto.websiteUrl = "https://example.com";
createSaleDto.uniqueKey = randomUniqueKey();

const signedDto = createSaleDto.signed(users.testUser1.privateKey);
Expand All @@ -188,7 +132,6 @@ describe("createSale", () => {
"LowerCollection",
"LowerCategory"
);
createSaleDto.websiteUrl = "https://example.com";
createSaleDto.uniqueKey = randomUniqueKey();

const signedDto = createSaleDto.signed(users.testUser1.privateKey);
Expand All @@ -201,35 +144,7 @@ describe("createSale", () => {
expect(response.Data?.symbol).toBe("LOWER"); // Should be converted to uppercase
});

it("should create sale with all social media URLs", async () => {
// Given
const { ctx, contract } = fixture(LaunchpadContract).registeredUsers(users.testUser1);

const createSaleDto = new CreateTokenSaleDTO(
"Social Token",
"SOC",
"A fully connected social token",
"https://example.com/soc.png",
new BigNumber(0),
"SocialCollection",
"FullSocialCategory"
);
createSaleDto.websiteUrl = "https://socialtoken.com";
createSaleDto.telegramUrl = "https://t.me/socialtoken";
createSaleDto.twitterUrl = "https://twitter.com/socialtoken";
createSaleDto.uniqueKey = randomUniqueKey();

const signedDto = createSaleDto.signed(users.testUser1.privateKey);

// When
const response = await contract.CreateSale(ctx, signedDto);

// Then
expect(response.Status).toBe(1);
expect(response.Data?.websiteUrl).toBe("https://socialtoken.com");
expect(response.Data?.telegramUrl).toBe("https://t.me/socialtoken");
expect(response.Data?.twitterUrl).toBe("https://twitter.com/socialtoken");
});
// Social links are now handled off-chain (DB source of truth); chain no longer returns them.

it("should create sale with custom token image", async () => {
// Given
Expand All @@ -244,7 +159,6 @@ describe("createSale", () => {
"ImageCollection",
"ImageCategory"
);
createSaleDto.websiteUrl = "https://example.com";
createSaleDto.uniqueKey = randomUniqueKey();

const signedDto = createSaleDto.signed(users.testUser1.privateKey);
Expand Down
10 changes: 1 addition & 9 deletions src/chaincode/launchpad/createSale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ConflictError, DefaultError, TokenInstanceKey, asValidUserAlias } from "@gala-chain/api";
import { ConflictError, TokenInstanceKey, asValidUserAlias } from "@gala-chain/api";
import {
GalaChainContext,
createTokenClass,
Expand All @@ -30,7 +30,6 @@ import {
NativeTokenQuantityDto,
SaleStatus
} from "../../api/types";
import { PreConditionFailedError } from "../../api/utils/error";
import { buyWithNative } from "./buyWithNative";

/**
Expand Down Expand Up @@ -62,10 +61,6 @@ export async function createSale(
let isSaleFinalized = false;
// Validate input parameters

if (!launchpadDetails.websiteUrl && !launchpadDetails.telegramUrl && !launchpadDetails.twitterUrl) {
throw new PreConditionFailedError("Token sale creation requires atleast one social link.");
}

launchpadDetails.tokenSymbol = launchpadDetails.tokenSymbol.toUpperCase();

// Define the token class key
Expand Down Expand Up @@ -165,9 +160,6 @@ export async function createSale(
tokenName: launchpadDetails.tokenName,
symbol: launchpadDetails.tokenSymbol,
description: launchpadDetails.tokenDescription,
websiteUrl: launchpadDetails.websiteUrl ? launchpadDetails.websiteUrl : "",
telegramUrl: launchpadDetails.telegramUrl ? launchpadDetails.telegramUrl : "",
twitterUrl: launchpadDetails.twitterUrl ? launchpadDetails.twitterUrl : "",
initialBuyQuantity: launchpadDetails.preBuyQuantity.toFixed(),
vaultAddress: vaultAddress,
creatorAddress: ctx.callingUser,
Expand Down
Loading