Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TeddySwap Integration #69

Merged
merged 14 commits into from
Dec 20, 2023
Merged

TeddySwap Integration #69

merged 14 commits into from
Dec 20, 2023

Conversation

Sluder
Copy link
Member

@Sluder Sluder commented Nov 30, 2023

No description provided.

@Sluder Sluder changed the title TeddySwap init TeddySwap Integration Nov 30, 2023
tests/teddyswap.test.ts Outdated Show resolved Hide resolved
src/dex/teddyswap.ts Outdated Show resolved Hide resolved
}

const relevantAssets = utxo.assetBalances.filter((assetBalance) => {
const assetName = (assetBalance.asset as Asset).assetName;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const assetName = (assetBalance.asset as Asset).assetName;
const assetName = assetBalance.asset === 'lovelace' ? 'lovelace' : assetBalance.assetName;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

: assetBalance.asset.assetName;

Is asset not required here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is! My comment was wrong but the code reflects the correct path now

@ItsDaveB
Copy link
Collaborator

Nice! 🚀

src/dex/teddyswap.ts Outdated Show resolved Hide resolved
@Sluder Sluder marked this pull request as ready for review December 14, 2023 13:40
@@ -100,6 +109,20 @@ export class DefinitionBuilder {
* Recursively pull parameters from datum using definition template.
*/
private extractParameters(definedDefinition: DefinitionField, templateDefinition: DefinitionField, foundParameters: DatumParameters = {}): DatumParameters {
if (templateDefinition instanceof Function) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds support for datum mappings to include dynamic pulling/pushing of parameters. One example would be an order datum not including a stake key, which will result in a different datum. Not all DEXs support this atm, but will push a fix after this PR is in

quantity: batcherFee?.value + deposit.value,
},
],
datum: datumBuilder.getCbor(),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline?

@@ -210,6 +210,7 @@ export class Minswap extends BaseDex {
},
],
datum: datumBuilder.getCbor(),
isInlineDatum: false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice approach!

Copy link
Collaborator

@ItsDaveB ItsDaveB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 🚀

@Sluder Sluder merged commit 493635d into master Dec 20, 2023
0 of 2 checks passed
@Sluder Sluder deleted the sluder/teddyswap branch December 20, 2023 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants