Skip to content

Commit

Permalink
start to expose payment parameters as input parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
H34D committed Jun 14, 2023
1 parent a742975 commit 96be523
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 40 deletions.
28 changes: 21 additions & 7 deletions src/modules/sbt/ASBT/asbt.ts
Expand Up @@ -13,13 +13,27 @@ export class MasaASBT extends MasaSBTs {
* @param limit
* @param adminAddress
*/
public deploy = (
name: string,
symbol: string,
baseTokenUri: string,
limit: number = 1,
adminAddress?: string
) => deployASBT(this.masa, name, symbol, baseTokenUri, limit, adminAddress);
public deploy = ({
name,
symbol,
baseTokenUri,
limit = 1,
adminAddress,
}: {
name: string;
symbol: string;
baseTokenUri: string;
limit?: number;
adminAddress?: string;
}) =>
deployASBT({
masa: this.masa,
name,
symbol,
baseTokenUri,
limit,
adminAddress,
});

/**
*
Expand Down
37 changes: 27 additions & 10 deletions src/modules/sbt/ASBT/deploy.ts
Expand Up @@ -9,14 +9,25 @@ import { Messages } from "../../../collections";
import type { DeployResult, MasaInterface } from "../../../interface";
import PaymentParamsStruct = PaymentGateway.PaymentParamsStruct;

export const deployASBT = async (
masa: MasaInterface,
name: string,
symbol: string,
baseTokenUri: string,
limit: number = 1,
adminAddress?: string
): Promise<DeployResult<PaymentParamsStruct> | undefined> => {
export const deployASBT = async ({
masa,
name,
symbol,
baseTokenUri,
limit = 1,
adminAddress,
paymentOptions,
}: {
masa: MasaInterface;
name: string;
symbol: string;
baseTokenUri: string;
limit?: number;
adminAddress?: string;
paymentOptions?: {
projectFeeReceiver: string;
};
}): Promise<DeployResult<PaymentParamsStruct> | undefined> => {
let result: DeployResult<PaymentParamsStruct> | undefined;

adminAddress = adminAddress || (await masa.config.signer.getAddress());
Expand Down Expand Up @@ -55,11 +66,17 @@ export const deployASBT = async (
baseTokenUri,
masa.contracts.instances.SoulboundIdentityContract.address,
{
// get this from the sdk
swapRouter: constants.AddressZero,
// get this from the sdk
wrappedNativeToken: constants.AddressZero,
// get this from the sdk
stableCoin: constants.AddressZero,
masaToken: constants.AddressZero,
projectFeeReceiver: constants.AddressZero,
masaToken:
masa.config.network?.addresses.tokens?.MASA || constants.AddressZero,
projectFeeReceiver:
paymentOptions?.projectFeeReceiver || constants.AddressZero,
// get this from the sdk
protocolFeeReceiver: constants.AddressZero,
protocolFeeAmount: 0,
protocolFeePercent: 0,
Expand Down
40 changes: 29 additions & 11 deletions src/modules/sbt/SSSBT/deploy.ts
Expand Up @@ -10,15 +10,27 @@ import { Messages } from "../../../collections";
import type { DeployResult, MasaInterface } from "../../../interface";
import PaymentParamsStruct = PaymentGateway.PaymentParamsStruct;

export const deploySSSBT = async (
masa: MasaInterface,
name: string,
symbol: string,
baseTokenUri: string,
limit: number = 1,
authorityAddress?: string,
adminAddress?: string
): Promise<DeployResult<PaymentParamsStruct> | undefined> => {
export const deploySSSBT = async ({
masa,
name,
symbol,
baseTokenUri,
limit = 1,
authorityAddress,
adminAddress,
paymentOptions,
}: {
masa: MasaInterface;
name: string;
symbol: string;
baseTokenUri: string;
limit: number;
authorityAddress?: string;
adminAddress?: string;
paymentOptions?: {
projectFeeReceiver: string;
};
}): Promise<DeployResult<PaymentParamsStruct> | undefined> => {
let result: DeployResult<PaymentParamsStruct> | undefined;
const signerAddress = await masa.config.signer.getAddress();

Expand Down Expand Up @@ -59,11 +71,17 @@ export const deploySSSBT = async (
baseTokenUri,
masa.contracts.instances.SoulboundIdentityContract.address,
{
// get this from the sdk
swapRouter: constants.AddressZero,
// get this from the sdk
wrappedNativeToken: constants.AddressZero,
// get this from the sdk
stableCoin: constants.AddressZero,
masaToken: constants.AddressZero,
projectFeeReceiver: constants.AddressZero,
masaToken:
masa.config.network?.addresses.tokens?.MASA || constants.AddressZero,
projectFeeReceiver:
paymentOptions?.projectFeeReceiver || constants.AddressZero,
// get this from the sdk
protocolFeeReceiver: constants.AddressZero,
protocolFeeAmount: 0,
protocolFeePercent: 0,
Expand Down
31 changes: 19 additions & 12 deletions src/modules/sbt/SSSBT/sssbt.ts
Expand Up @@ -14,23 +14,30 @@ export class MasaSSSBT extends MasaSBTs {
* @param limit
* @param adminAddress
*/
deploy = (
name: string,
symbol: string,
baseTokenUri: string,
limit: number = 1,
authorityAddress: string,
adminAddress?: string
) =>
deploySSSBT(
this.masa,
deploy = ({
name,
symbol,
baseTokenUri,
limit = 1,
authorityAddress,
adminAddress,
}: {
name: string;
symbol: string;
baseTokenUri: string;
limit?: number;
authorityAddress: string;
adminAddress?: string;
}) =>
deploySSSBT({
masa: this.masa,
name,
symbol,
baseTokenUri,
limit,
authorityAddress,
adminAddress
);
adminAddress,
});

/**
*
Expand Down

0 comments on commit 96be523

Please sign in to comment.