-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1: configure additional mint fees for specific tokens (#460)
* v1: configure additional mint fees for specific tokens v1 Extend TokenMintConfiguration to specify additional fees, charged in $GALA, in addition to globally-configured fee quantities for mint operations for specific token classes. * add feeGateImplementations.ts changes for token-specific mint fees
- Loading branch information
1 parent
552e06f
commit 560337d
Showing
5 changed files
with
117 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (c) Gala Games Inc. All rights reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { ChainError, ErrorCode, TokenMintConfiguration } from "@gala-chain/api"; | ||
|
||
import { GalaChainContext } from "../types"; | ||
import { getObjectByKey } from "../utils"; | ||
|
||
export interface IFetchMintConfiguration { | ||
collection: string; | ||
category: string; | ||
type: string; | ||
additionalKey: string; | ||
} | ||
|
||
export async function fetchTokenMintConfiguration(ctx: GalaChainContext, data: IFetchMintConfiguration) { | ||
const { collection, category, type, additionalKey } = data; | ||
|
||
const mintConfiguration: TokenMintConfiguration | undefined = await getObjectByKey( | ||
ctx, | ||
TokenMintConfiguration, | ||
TokenMintConfiguration.getCompositeKeyFromParts(TokenMintConfiguration.INDEX_KEY, [ | ||
collection, | ||
category, | ||
type, | ||
additionalKey | ||
]) | ||
).catch((e) => { | ||
const chainError = ChainError.from(e); | ||
if (chainError.matches(ErrorCode.NOT_FOUND)) { | ||
return undefined; | ||
} else { | ||
throw chainError; | ||
} | ||
}); | ||
|
||
return mintConfiguration; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters