Skip to content

Instantly share code, notes, and snippets.

@vlzhr
Created January 15, 2023 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vlzhr/ccaca5089a028bcf76d8015297998e71 to your computer and use it in GitHub Desktop.
Save vlzhr/ccaca5089a028bcf76d8015297998e71 to your computer and use it in GitHub Desktop.
Calling Puzzle Aggregator from Ride script
# given code shows how you can invoke Puzzle Aggregator on-chain
# aggregator allows to exchange any token to any supported by PuzzleSwap.org
# you can modify any of these 4 parameters
let asset0Bytes = unit # asset you pay
let asset1Str = "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p" # asset you want to receive
let amountToExchange = 1000000
let recipientStr = this.toString()
strict swapInv = invoke(Address(base58'3PLPCb3wF2H2gtzohoAjeWcGaMKEiJvtE5X'),
"exchangeAndSendTo",
[assetFromStr, recipientStr],
[AttachedPayment(assetToBytes, amountToExchange)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment