More Beginner Marlowe Meadow Questions

Pay as a % of a CommitCash Amount

Since @adatainment was so helpful in my last thread about Meadow. I thought I would continue with more of my noobish inquiries in this thread in case it’s helpful to others beginners beside just myself.

#1 I get the impression that more tiles will likely be added to the graphical side of Meadow in the future as more features are added to Marlowe and Meadow. I also notice how Meadow is tricking me into being exposed to tiny bits and pieces of Haskell that I otherwise wouldn’t encounter (I see what you’re doing there IOHK). A good example of this is the discussion on Haskell style comments in the Fay Editor (and use of the Fay Editor, generally) in my other thread. But, in the meantime, and short of a point in time in the future when I become more familiar with coding in Fay [here’s where I actually ask my question after much rambling]:

what would be the best way to create a payout in Meadow that is a fixed percentage of a cash commit (e.g. I want to pay 90% of a certain cash commit to one party and 10% of that cash commit to another)?

I see that there is a “greater than” tile and an addition tile. I also understand that I could possibly concoct a way to laboriously code my way through every reasonably possible integer with the “greater than” and addition tile to get to a certain %. But, I’m thinking there’s got to be an easier way to do simple math in Marlowe? Is there a math category of tiles that just hasn’t been added yet that I can access on the code editor side?

Again, thanks in advance for any help and apologies for these ultra noobish questions. I’m just eager to learn.

1 Like

I ended up eventually finding this:

I noticed lines 200 and 215 that describe a MulValue function that seems to allow multiplication. I tried using this function in the Fay Editor and directly in the main code section of meadow in as many possible ways as I could think of, but I couldn’t seem to use it in a way that would compile in the Fay Editor or produce tiles in the graphical meadow interface.

I’m guessing I’m just using MulValue incorrectly. But, if anyone knows whether it’s just not supported in Meadow yet, if it will one day be a graphical tile, or how to use it correctly; I’d love to hear about it.

I’m finding myself spending more and more time in the Fay Editor and in beginner Haskell tutorials in the hopes of using Fay more effectively. That makes me think maybe I should just jump over to Plutus, but I’m probably just not understanding the best way to use Meadow.

Thanks for any advice!

Okay, I think I tentatively found an answer to my question by combining two things:
a) an ultra noobish level of familiarity with Haskell gleaned form; and
b) watching what Sebastian does at 10:30-11:00 in this video:

It looks like I can just go into Fay and lay out a definition of an integer as equivalent to the % of the cashCommit that I’m after.

That almost seems too easy. Will test it out ASAP.

1 Like

Unbelievably, I think that worked! Hopefully, this thread will somehow be helpful if anybody else runs into this “lack of math in Meadow” problem.


Hey, Plutus! I think we’re gonna be friends.

Today I’ve been working in Plutus Playground instead of Meadow since the @bobert sample Jelly Bean Guessing Game gave me such a better view into how Plutus works . I’ve put down (i.e. stolen and modified) about 70 lines of code in Plutus. I’m sure it’s riddled with super obvious mistakes. But, I’ve been able to do/understand a lot of things in Plutus that I hadn’t been able to do in Marlowe. There are also some things that I was able to do in Marlowe that I don’t yet understand in Plutus. This might seem lame and routine to everybody else, but it’s a huge win for me. I was so excited to check out the @bobert sample contract that I started looking at 5am this morning and then started back in as soon as I got back from work at about 5:30pm.

Next up is going to be figuring out how to replicate some of my Marlowe work over into Plutus.

Noob question incoming:
Does anyone know any easy way to convert Marlowe code to Plutus? I am under the impression that they both compile to Plutus Core. Maybe that means there is some way to go from Marlowe to Plutus Core and then back to Plutus? I’m guessing it doesn’t work that way and I just need to keep improving my skills in Plutus until I can code the same things whole cloth in Plutus.

Glad to hear you are really taking advantage of the examples @JBlock

Technically we were told at PlutusFest that Marlowe is currently a Plutus Smart Contract (though Meadow came out before Plutus so I assume they mean that is what they intend to do) but will end up eventually with the ability to translate Marlowe -> Plutus.


@bobert Thanks for the info and the examples. Massively appreciated!!!

Hi @JBlock, have you used the new Meadow yet?

Thanks for pointing this out. I know I’m reading your post five months late. I also don’t think I’ve touched Marlowe in 10ish months. The new Meadow looks interesting. I like the ease of going from Haskell to Marlowe to Blockly. It’s been so long that I can’t really remember how much that was a thing or how easy/not easy it was in the old Meadow.

I mainly played around with Plutus (very noobishly) this last Spring. Then I realized I really needed to learn Haskell. So, I bought a Haskell book and the new Plutus book just in time for the super busy season at (my real) work to hit. Now, things are slowing down again and I’m returning to the Haskell learning so that I can hopefully be on the right track to slowly understanding Haskell & Plutus. I’m basically starting from zero. But, it’ll be cool to also play around with Marlowe while I’m doing that.