Skip to content

PLT-5466 - Fix JS version of the CFD with oracle#27

Merged
hrajchert merged 1 commit intomainfrom
hrajchert/PLT-5466-JS-CFD-ORACLE
May 11, 2023
Merged

PLT-5466 - Fix JS version of the CFD with oracle#27
hrajchert merged 1 commit intomainfrom
hrajchert/PLT-5466-JS-CFD-ORACLE

Conversation

@hrajchert
Copy link
Copy Markdown
Collaborator

This PR fixes the JS example of the contract for difference with oracle.

There were 2 issues, a parenthesis missing in the JS file, and I had to patch a non-merkleized version of purescript-marlowe with this fix

@hrajchert hrajchert requested review from jhbertra and paluh May 2, 2023 19:03
Comment thread packages.dhall
Comment on lines +212 to +214
-- THIS COMMIT IS A BRANCH-OFF MAIN WITHOUT MERKLEIZATION AND WITH SOME DECODING
-- FIX. WE NEED TO UPGRADE THE PLAYGROUND TO HANDLE MERKLEIZATION
"f97fb0fa7f23bc4631e6acafadd52c3303ea77e9"
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This commit corresponds to this PR applied to the latest commit without merkelization. The commit is present in this branch

Comment on lines +1631 to +1636
set -e
echo building project using sources from nix store...
purs compile ${builtins.toString (
builtins.map getStoreGlob (builtins.attrValues inputs)
)} "$@"
echo done.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Was this an auto-formatting change?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes

function recordEndPrice(name: ValueId, choiceId1: ChoiceId, choiceId2: ChoiceId,
continuation: Contract): Contract {
return Let(name, DivValue(MulValue(priceBeginning, MulValue(ChoiceValue(choiceId1), ChoiceValue(choiceId2))), (Constant 10_000_000_000_000_000n)),
return Let(name, DivValue(MulValue(priceBeginning, MulValue(ChoiceValue(choiceId1), ChoiceValue(choiceId2))), (Constant (10_000_000_000_000_000n))),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What does this do?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It stores a value in the state to be used later to calculate the difference. The particular change was to add some missing parentheses in the Constant constructor

@hrajchert hrajchert merged commit 33f3927 into main May 11, 2023
@palas palas deleted the hrajchert/PLT-5466-JS-CFD-ORACLE branch May 22, 2023 00:26
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.

2 participants