diff --git a/changelog.d/20231020_213005_hrajchert_plt_3331_change_ada_block.md b/changelog.d/20231020_213005_hrajchert_plt_3331_change_ada_block.md new file mode 100644 index 0000000000..3a049eae6c --- /dev/null +++ b/changelog.d/20231020_213005_hrajchert_plt_3331_change_ada_block.md @@ -0,0 +1,4 @@ +### Changed + +- Change ada block to lovelace +- Change timeout gap on TimeParams from 5 to 10 minutes diff --git a/marlowe-playground-client/src/Examples/JS/Contracts.purs b/marlowe-playground-client/src/Examples/JS/Contracts.purs index 82d1dae793..8454e04e58 100644 --- a/marlowe-playground-client/src/Examples/JS/Contracts.purs +++ b/marlowe-playground-client/src/Examples/JS/Contracts.purs @@ -33,7 +33,7 @@ escrow = function deposit(timeout: Timeout, timeoutContinuation: Contract, continuation: Contract): Contract { - return When([Case(Deposit(seller, buyer, ada, price), continuation)], + return When([Case(Deposit(seller, buyer, lovelace, price), continuation)], timeout, timeoutContinuation); } @@ -47,16 +47,16 @@ escrow = } function sellerToBuyer(continuation: Contract): Contract { - return Pay(seller, Account(buyer), ada, price, continuation); + return Pay(seller, Account(buyer), lovelace, price, continuation); } function paySeller(continuation: Contract): Contract { - return Pay(buyer, Party(seller), ada, price, continuation); + return Pay(buyer, Party(seller), lovelace, price, continuation); } - const refundBuyer: Contract = explicitRefunds ? Pay(buyer, Party(buyer), ada, price, Close) : Close; + const refundBuyer: Contract = explicitRefunds ? Pay(buyer, Party(buyer), lovelace, price, Close) : Close; - const refundSeller: Contract = explicitRefunds ? Pay(seller, Party(seller), ada, price, Close) : Close; + const refundSeller: Contract = explicitRefunds ? Pay(seller, Party(seller), lovelace, price, Close) : Close; const contract: Contract = deposit(depositTimeout, Close, @@ -102,19 +102,19 @@ escrowWithCollateral = const answerTimeout: Timeout = TimeParam("Complaint deadline"); function depositCollateral(party: Party, timeout: Timeout, timeoutContinuation: Contract, continuation: Contract): Contract { - return When([Case(Deposit(party, party, ada, collateral), continuation)], + return When([Case(Deposit(party, party, lovelace, collateral), continuation)], timeout, timeoutContinuation); } function burnCollaterals(continuation: Contract): Contract { - return Pay(seller, Party(burnAddress), ada, collateral, - Pay(buyer, Party(burnAddress), ada, collateral, + return Pay(seller, Party(burnAddress), lovelace, collateral, + Pay(buyer, Party(burnAddress), lovelace, collateral, continuation)); } function deposit(timeout: Timeout, timeoutContinuation: Contract, continuation: Contract): Contract { - return When([Case(Deposit(seller, buyer, ada, price), continuation)], + return When([Case(Deposit(seller, buyer, lovelace, price), continuation)], timeout, timeoutContinuation); } @@ -134,12 +134,12 @@ escrowWithCollateral = } function sellerToBuyer(continuation: Contract): Contract { - return Pay(seller, Account(buyer), ada, price, continuation); + return Pay(seller, Account(buyer), lovelace, price, continuation); } function refundSellerCollateral(continuation: Contract): Contract { if (explicitRefunds) { - return Pay(seller, Party(seller), ada, collateral, continuation); + return Pay(seller, Party(seller), lovelace, collateral, continuation); } else { return continuation; } @@ -147,7 +147,7 @@ escrowWithCollateral = function refundBuyerCollateral(continuation: Contract): Contract { if (explicitRefunds) { - return Pay(buyer, Party(buyer), ada, collateral, continuation); + return Pay(buyer, Party(buyer), lovelace, collateral, continuation); } else { return continuation; } @@ -157,9 +157,9 @@ escrowWithCollateral = return refundSellerCollateral(refundBuyerCollateral(continuation)); } - const refundBuyer: Contract = explicitRefunds ? Pay(buyer, Party(buyer), ada, price, Close) : Close; + const refundBuyer: Contract = explicitRefunds ? Pay(buyer, Party(buyer), lovelace, price, Close) : Close; - const refundSeller: Contract = explicitRefunds ? Pay(seller, Party(seller), ada, price, Close) : Close; + const refundSeller: Contract = explicitRefunds ? Pay(seller, Party(seller), lovelace, price, Close) : Close; const contract: Contract = depositCollateral(seller, sellerCollateralTimeout, Close, @@ -193,8 +193,8 @@ zeroCouponBond = const maturityExchangeTimeout: Timeout = TimeParam("Payback deadline"); function transfer(timeout: Timeout, from: Party, to: Party, amount: Value, continuation: Contract): Contract { - return When([Case(Deposit(from, from, ada, amount), - Pay(from, Party(to), ada, amount, continuation))], + return When([Case(Deposit(from, from, lovelace, amount), + Pay(from, Party(to), lovelace, amount, continuation))], timeout, Close); } @@ -231,26 +231,26 @@ couponBondGuaranteed = function deposit(amount: Value, by: Party, toAccount: Party, timeout: ETimeout, timeoutContinuation: Contract, continuation: Contract): Contract { - return When([Case(Deposit(toAccount, by, ada, amount), continuation)], + return When([Case(Deposit(toAccount, by, lovelace, amount), continuation)], timeout, timeoutContinuation); } function refundGuarantor(amount: Value, continuation: Contract): Contract { - return Pay(investor, Party(guarantor), ada, amount, continuation) + return Pay(investor, Party(guarantor), lovelace, amount, continuation) } function transfer(amount: Value, from: Party, to: Party, timeout: ETimeout, timeoutContinuation: Contract, continuation: Contract): Contract { return deposit(amount, from, to, timeout, timeoutContinuation, - Pay(to, Party(to), ada, amount, + Pay(to, Party(to), lovelace, amount, continuation)) } function giveCollateralToLender(amount: Value): Contract { if (explicitRefunds) { - return Pay(investor, Party(investor), ada, amount, + return Pay(investor, Party(investor), lovelace, amount, Close); } else { return Close; @@ -302,7 +302,7 @@ swap = const adaProvider: SwapParty = { party: Role("Ada provider"), - currency: ada, + currency: lovelace, amount: amountOfLovelace } @@ -367,7 +367,7 @@ contractForDifferences = function initialDeposit(by: Party, deposit: Value, timeout: ETimeout, timeoutContinuation: Contract, continuation: Contract): Contract { - return When([Case(Deposit(by, by, ada, deposit), continuation)], + return When([Case(Deposit(by, by, lovelace, deposit), continuation)], timeout, timeoutContinuation); } @@ -395,12 +395,12 @@ contractForDifferences = } function transferUpToDeposit(from: Party, payerDeposit: Value, to: Party, amount: Value, continuation: Contract): Contract { - return Pay(from, Account(to), ada, Cond(ValueLT(amount, payerDeposit), amount, payerDeposit), continuation); + return Pay(from, Account(to), lovelace, Cond(ValueLT(amount, payerDeposit), amount, payerDeposit), continuation); } function refund(who: Party, amount: Value, continuation: Contract): Contract { if (explicitRefunds) { - return Pay(who, Party(who), ada, amount, + return Pay(who, Party(who), lovelace, amount, continuation); } else { return continuation; @@ -480,7 +480,7 @@ contractForDifferencesWithOracle = function initialDeposit(by: Party, deposit: Value, timeout: ETimeout, timeoutContinuation: Contract, continuation: Contract): Contract { - return When([Case(Deposit(by, by, ada, deposit), continuation)], + return When([Case(Deposit(by, by, lovelace, deposit), continuation)], timeout, timeoutContinuation); } @@ -514,12 +514,12 @@ contractForDifferencesWithOracle = } function transferUpToDeposit(from: Party, payerDeposit: Value, to: Party, amount: Value, continuation: Contract): Contract { - return Pay(from, Account(to), ada, Cond(ValueLT(amount, payerDeposit), amount, payerDeposit), continuation); + return Pay(from, Account(to), lovelace, Cond(ValueLT(amount, payerDeposit), amount, payerDeposit), continuation); } function refund(who: Party, amount: Value, continuation: Contract): Contract { if (explicitRefunds) { - return Pay(who, Party(who), ada, amount, + return Pay(who, Party(who), lovelace, amount, continuation); } else { return continuation; diff --git a/marlowe-playground-client/src/Language/Javascript/MarloweJS.ts b/marlowe-playground-client/src/Language/Javascript/MarloweJS.ts index f2dc2c30fd..8c3aa8c331 100644 --- a/marlowe-playground-client/src/Language/Javascript/MarloweJS.ts +++ b/marlowe-playground-client/src/Language/Javascript/MarloweJS.ts @@ -55,7 +55,11 @@ export const Token = function ( } }; +/** + * @deprecated in favour of lovelace + */ export const ada: Token = { currency_symbol: "", token_name: "" }; +export const lovelace: Token = { currency_symbol: "", token_name: "" }; type ValueId = string; diff --git a/marlowe-playground-client/src/Marlowe/Blockly.purs b/marlowe-playground-client/src/Marlowe/Blockly.purs index 74e4e56722..562e4e6e94 100644 --- a/marlowe-playground-client/src/Marlowe/Blockly.purs +++ b/marlowe-playground-client/src/Marlowe/Blockly.purs @@ -639,7 +639,7 @@ toDefinition blockType@(TokenType AdaTokenType) = BlockDefinition $ merge { type: show AdaTokenType - , message0: "ada" + , message0: "lovelace" , args0: [] , colour: blockColour blockType , output: Just "token" diff --git a/marlowe-playground-client/src/Page/BlocklyEditor/State.purs b/marlowe-playground-client/src/Page/BlocklyEditor/State.purs index 919fb5926f..c76382c14e 100644 --- a/marlowe-playground-client/src/Page/BlocklyEditor/State.purs +++ b/marlowe-playground-client/src/Page/BlocklyEditor/State.purs @@ -189,7 +189,7 @@ processBlocklyCode metadata = do maybeUpdateTemplateContent = case Holes.fromTerm holesContract of Just (contract :: Extended.Contract) -> Template.updateTemplateContent currentTime - (Minutes 5.0) + (Minutes 30.0) (OMap.keys metadata.timeParameterDescriptions) (Template.getPlaceholderIds contract) Nothing -> identity diff --git a/marlowe-playground-client/src/Page/HaskellEditor/State.purs b/marlowe-playground-client/src/Page/HaskellEditor/State.purs index 5494c43123..5ec43c7a11 100644 --- a/marlowe-playground-client/src/Page/HaskellEditor/State.purs +++ b/marlowe-playground-client/src/Page/HaskellEditor/State.purs @@ -143,7 +143,7 @@ handleAction metadata Compile = do over (_analysisState <<< _templateContent) ( Template.updateTemplateContent currentTime - (Minutes 5.0) + (Minutes 30.0) (OMap.keys metadata.timeParameterDescriptions) (getPlaceholderIds contract) ) diff --git a/marlowe-playground-client/src/Page/JavascriptEditor/State.purs b/marlowe-playground-client/src/Page/JavascriptEditor/State.purs index 1cede0b3cc..45941c7ec5 100644 --- a/marlowe-playground-client/src/Page/JavascriptEditor/State.purs +++ b/marlowe-playground-client/src/Page/JavascriptEditor/State.purs @@ -201,7 +201,7 @@ handleAction metadata Compile = do over (_analysisState <<< _templateContent) ( updateTemplateContent currentTime - (Minutes 5.0) + (Minutes 30.0) (OMap.keys metadata.timeParameterDescriptions) (getPlaceholderIds contract) ) @@ -268,7 +268,7 @@ analyze doAnalyze = do decorationHeader :: String decorationHeader = """import { - Address, Role, Account, Party, ada, AvailableMoney, Constant, ConstantParam, + Address, Role, Account, Party, ada, lovelace, AvailableMoney, Constant, ConstantParam, NegValue, AddValue, SubValue, MulValue, DivValue, ChoiceValue, TimeIntervalStart, TimeIntervalEnd, UseValue, Cond, AndObs, OrObs, NotObs, ChoseSomething, ValueGE, ValueGT, ValueLT, ValueLE, ValueEQ, TrueObs, FalseObs, Deposit, diff --git a/marlowe-playground-client/src/Page/MarloweEditor/State.purs b/marlowe-playground-client/src/Page/MarloweEditor/State.purs index 86dfbd42af..0733175f26 100644 --- a/marlowe-playground-client/src/Page/MarloweEditor/State.purs +++ b/marlowe-playground-client/src/Page/MarloweEditor/State.purs @@ -268,7 +268,7 @@ processMarloweCode metadata text = do Just contract -> Template.updateTemplateContent currentTime - (Minutes 5.0) + (Minutes 30.0) (OMap.keys metadata.timeParameterDescriptions) (Template.getPlaceholderIds contract) void $ H.request _marloweEditorPageSlot unit $ Monaco.SetModelMarkers diff --git a/marlowe-playground-client/src/Simulator/State.purs b/marlowe-playground-client/src/Simulator/State.purs index cff8111494..a8c6543ff5 100644 --- a/marlowe-playground-client/src/Simulator/State.purs +++ b/marlowe-playground-client/src/Simulator/State.purs @@ -142,7 +142,7 @@ simulationNotStarted initialTime termContract metadata prevTemplateContent = tc@(TemplateContent { timeContent, valueContent }) = initializeTemplateContentWithIncreasingTime initialTime - (Minutes 5.0) + (Minutes 30.0) (OMap.keys metadata.timeParameterDescriptions) (getPlaceholderIds termContract) templateContent = case prevTemplateContent of diff --git a/marlowe-playground-client/test/BridgeTests.purs b/marlowe-playground-client/test/BridgeTests.purs index b47dd97ed1..940c14c31a 100644 --- a/marlowe-playground-client/test/BridgeTests.purs +++ b/marlowe-playground-client/test/BridgeTests.purs @@ -62,7 +62,7 @@ serializationTest = it "Contract Serialization" do -- A simple test that runs the Escrow contract to completion let - ada = Token "" "" + lovelace = Token "" "" aliceAddr = Address "addr_test1vz3vyrrh3pavu8xescvnunn4h27cny70645etn2ulnnqnssrz8utc" @@ -80,9 +80,9 @@ serializationTest = contract = Assert TrueObs ( When - [ Case (Deposit aliceAddr aliceAddr ada valueExpr) + [ Case (Deposit aliceAddr aliceAddr lovelace valueExpr) ( Let (ValueId "x") valueExpr - ( Pay aliceAddr (Party bobRole) ada + ( Pay aliceAddr (Party bobRole) lovelace ( Cond TrueObs (UseValue (ValueId "x")) (UseValue (ValueId "y")) ) diff --git a/marlowe-playground-client/test/Marlowe/ContractTests.purs b/marlowe-playground-client/test/Marlowe/ContractTests.purs index 3e9620fbe3..a1a78bb6a4 100644 --- a/marlowe-playground-client/test/Marlowe/ContractTests.purs +++ b/marlowe-playground-client/test/Marlowe/ContractTests.purs @@ -139,8 +139,8 @@ buyer = Role "Buyer" arbiter :: Party arbiter = Role "Mediator" -ada :: Token -ada = Token "" "" +lovelace :: Token +lovelace = Token "" "" filledEscrow :: Term T.Contract filledEscrow = @@ -288,7 +288,7 @@ escrowSimpleFlow = it "Escrow simple flow" do -- A simple test that runs the Escrow contract to completion let - deposit = IDeposit seller buyer ada (BigInt.fromInt 450) + deposit = IDeposit seller buyer lovelace (BigInt.fromInt 450) choice1 = IChoice ((ChoiceId "Report problem") buyer) (BigInt.fromInt 1) diff --git a/marlowe-playground-client/test/Marlowe/Holes/SemanticTest.purs b/marlowe-playground-client/test/Marlowe/Holes/SemanticTest.purs index 9801537190..11de5f741e 100644 --- a/marlowe-playground-client/test/Marlowe/Holes/SemanticTest.purs +++ b/marlowe-playground-client/test/Marlowe/Holes/SemanticTest.purs @@ -73,8 +73,8 @@ buyer = Role "Buyer" arbiter :: Party arbiter = Role "Mediator" -ada :: Token -ada = Token "" "" +lovelace :: Token +lovelace = Token "" "" escrowPrice :: BigInt escrowPrice = fromInt 1500 @@ -97,26 +97,26 @@ escrowFlows = List.fromFoldable [ "Everything is alright" /\ List.fromFoldable - [ transaction $ S.IDeposit seller buyer ada escrowPrice + [ transaction $ S.IDeposit seller buyer lovelace escrowPrice , transaction $ S.IChoice (S.ChoiceId "Everything is alright" buyer) zero ] , "Seller confirm problem" /\ List.fromFoldable - [ transaction $ S.IDeposit seller buyer ada escrowPrice + [ transaction $ S.IDeposit seller buyer lovelace escrowPrice , transaction $ S.IChoice (S.ChoiceId "Report problem" buyer) one , transaction $ S.IChoice (S.ChoiceId "Confirm problem" seller) one ] , "Dismiss claim" /\ List.fromFoldable - [ transaction $ S.IDeposit seller buyer ada escrowPrice + [ transaction $ S.IDeposit seller buyer lovelace escrowPrice , transaction $ S.IChoice (S.ChoiceId "Report problem" buyer) one , transaction $ S.IChoice (S.ChoiceId "Dispute problem" seller) zero , transaction $ S.IChoice (S.ChoiceId "Dismiss claim" arbiter) zero ] , "Mediator confirm problem" /\ List.fromFoldable - [ transaction $ S.IDeposit seller buyer ada escrowPrice + [ transaction $ S.IDeposit seller buyer lovelace escrowPrice , transaction $ S.IChoice (S.ChoiceId "Report problem" buyer) one , transaction $ S.IChoice (S.ChoiceId "Dispute problem" seller) zero , transaction $ S.IChoice (S.ChoiceId "Confirm problem" arbiter) one @@ -125,7 +125,7 @@ escrowFlows = /\ List.singleton ( multipleInputs $ List.fromFoldable - [ S.IDeposit seller buyer ada escrowPrice + [ S.IDeposit seller buyer lovelace escrowPrice , S.IChoice (S.ChoiceId "Report problem" buyer) one , S.IChoice (S.ChoiceId "Dispute problem" seller) zero , S.IChoice (S.ChoiceId "Confirm problem" arbiter) one @@ -133,7 +133,7 @@ escrowFlows = ) , "Invalid input" /\ List.fromFoldable - [ transaction $ S.IDeposit arbiter arbiter ada escrowPrice + [ transaction $ S.IDeposit arbiter arbiter lovelace escrowPrice ] , "Timeout 1" /\ List.fromFoldable @@ -141,7 +141,7 @@ escrowFlows = ] , "Timeout 2" /\ List.fromFoldable - [ transaction $ S.IDeposit seller buyer ada escrowPrice + [ transaction $ S.IDeposit seller buyer lovelace escrowPrice , timeout (unsafeInstantFromInt 181) ] -- Because the slot 10 is lower than the first timeout (60), this "timeout" should @@ -149,7 +149,7 @@ escrowFlows = , "Everything is alright (with non significant timeout)" /\ List.fromFoldable [ timeout (unsafeInstantFromInt 10) - , transaction $ S.IDeposit seller buyer ada escrowPrice + , transaction $ S.IDeposit seller buyer lovelace escrowPrice , transaction $ S.IChoice (S.ChoiceId "Everything is alright" buyer) zero ] @@ -195,8 +195,8 @@ contractForDifferencesFlows = List.fromFoldable [ "Decrease in price" /\ List.fromFoldable - [ transaction $ S.IDeposit party party ada cfdPrice - , transaction $ S.IDeposit counterparty counterparty ada cfdPrice + [ transaction $ S.IDeposit party party lovelace cfdPrice + , transaction $ S.IDeposit counterparty counterparty lovelace cfdPrice , timeout (unsafeInstantFromInt 35) , transaction $ S.IChoice (S.ChoiceId "Price in first window" oracle) (fromInt 90000000) @@ -206,8 +206,8 @@ contractForDifferencesFlows = ] , "Increase in price" /\ List.fromFoldable - [ transaction $ S.IDeposit party party ada cfdPrice - , transaction $ S.IDeposit counterparty counterparty ada cfdPrice + [ transaction $ S.IDeposit party party lovelace cfdPrice + , transaction $ S.IDeposit counterparty counterparty lovelace cfdPrice , timeout (unsafeInstantFromInt 35) , transaction $ S.IChoice (S.ChoiceId "Price in first window" oracle) (fromInt 90000000) @@ -217,8 +217,8 @@ contractForDifferencesFlows = ] , "Same price" /\ List.fromFoldable - [ transaction $ S.IDeposit party party ada cfdPrice - , transaction $ S.IDeposit counterparty counterparty ada cfdPrice + [ transaction $ S.IDeposit party party lovelace cfdPrice + , transaction $ S.IDeposit counterparty counterparty lovelace cfdPrice , timeout (unsafeInstantFromInt 35) , transaction $ S.IChoice (S.ChoiceId "Price in first window" oracle) (fromInt 90000000) diff --git a/marlowe-playground-server/README.md b/marlowe-playground-server/README.md index 45aaea1076..cd05e24ad4 100644 --- a/marlowe-playground-server/README.md +++ b/marlowe-playground-server/README.md @@ -3,6 +3,7 @@ The Marlowe Playground consists of a Purescript front-end and a Haskell backend. The backend is split into 3 components, [./marlowe-symbolic](../marlowe-symbolic) which runs symbolic analysis on Marlowe contracts, [./web-ghc](../web-ghc) which is a web service that runs GHC source code and [./marlowe-playground-server](../marlowe-playground-server) which contains other endpoints such as the Actus generators. These components are deployed to different places however a local webserver can be run that makes all these endpoints available on localhost. ## Configure a github application + In order to have github integration and be able to load and store the project as `gists`, you need to create a new OAuth application. You can do this by filling [this form](https://github.com/settings/applications/new) ![New OAuth application](docs/img/create-new-oauth.png) @@ -26,8 +27,9 @@ openssl rand -hex 40 ## Running local server Once the environment variables are created, the server can be run with the following command: + ```bash -[nix-shell] $ marlowe-playground-server +[nix-shell] $ start-backend ``` You can now reach the server on [http://localhost:8080]() however you probably want to run the web front-end, see the [Marlowe Playground Client](../marlowe-playground-client/README.md) for instructions on how to do this. diff --git a/web-common-marlowe/src/Examples/PureScript/ContractForDifferences.purs b/web-common-marlowe/src/Examples/PureScript/ContractForDifferences.purs index 602b0a48fc..12c2458a34 100644 --- a/web-common-marlowe/src/Examples/PureScript/ContractForDifferences.purs +++ b/web-common-marlowe/src/Examples/PureScript/ContractForDifferences.purs @@ -119,8 +119,8 @@ defaultTimeContent = , "Second window deadline" /\ unsafeInstantFromInt 1800000 ] -ada :: Token -ada = Token "" "" +lovelace :: Token +lovelace = Token "" "" party :: Party party = Role "Party" @@ -151,7 +151,7 @@ increaseInPrice = ValueId "Increase in price" initialDeposit :: Party -> Value -> Timeout -> Contract -> Contract -> Contract initialDeposit by deposit timeout timeoutContinuation continuation = - When [ Case (Deposit by by ada deposit) continuation ] + When [ Case (Deposit by by lovelace deposit) continuation ] timeout timeoutContinuation @@ -176,7 +176,7 @@ recordDifference name choiceId1 choiceId2 = Let name (SubValue (ChoiceValue choiceId1) (ChoiceValue choiceId2)) transferUpToDeposit :: Party -> Value -> Party -> Value -> Contract -> Contract -transferUpToDeposit from payerDeposit to amount = Pay from (Account to) ada +transferUpToDeposit from payerDeposit to amount = Pay from (Account to) lovelace (Cond (ValueLT amount payerDeposit) amount payerDeposit) contract :: Contract diff --git a/web-common-marlowe/src/Examples/PureScript/ContractForDifferencesWithOracle.purs b/web-common-marlowe/src/Examples/PureScript/ContractForDifferencesWithOracle.purs index d7a5d1ffcc..4cf515c528 100644 --- a/web-common-marlowe/src/Examples/PureScript/ContractForDifferencesWithOracle.purs +++ b/web-common-marlowe/src/Examples/PureScript/ContractForDifferencesWithOracle.purs @@ -111,8 +111,8 @@ metadata = ) } -ada :: Token -ada = Token "" "" +lovelace :: Token +lovelace = Token "" "" party :: Party party = Role "Party" @@ -149,7 +149,7 @@ increaseInPrice = ValueId "Increase in price" initialDeposit :: Party -> Value -> Timeout -> Contract -> Contract -> Contract initialDeposit by deposit timeout timeoutContinuation continuation = - When [ Case (Deposit by by ada deposit) continuation ] + When [ Case (Deposit by by lovelace deposit) continuation ] timeout timeoutContinuation @@ -184,7 +184,7 @@ recordDifference :: ValueId -> Value -> Value -> Contract -> Contract recordDifference name val1 val2 = Let name (SubValue val1 val2) transferUpToDeposit :: Party -> Value -> Party -> Value -> Contract -> Contract -transferUpToDeposit from payerDeposit to amount = Pay from (Account to) ada +transferUpToDeposit from payerDeposit to amount = Pay from (Account to) lovelace (Cond (ValueLT amount payerDeposit) amount payerDeposit) contract :: Contract diff --git a/web-common-marlowe/src/Examples/PureScript/CouponBondGuaranteed.purs b/web-common-marlowe/src/Examples/PureScript/CouponBondGuaranteed.purs index 173de38f97..533dfea7dd 100644 --- a/web-common-marlowe/src/Examples/PureScript/CouponBondGuaranteed.purs +++ b/web-common-marlowe/src/Examples/PureScript/CouponBondGuaranteed.purs @@ -64,8 +64,8 @@ metadata = ) } -ada :: Token -ada = Token "" "" +lovelace :: Token +lovelace = Token "" "" guarantor :: Party guarantor = Role "Guarantor" @@ -93,19 +93,20 @@ lastInstalment = AddValue instalment principal deposit :: Value -> Party -> Party -> Timeout -> Contract -> Contract -> Contract deposit amount by toAccount timeout timeoutContinuation continuation = - When [ Case (Deposit toAccount by ada amount) continuation ] + When [ Case (Deposit toAccount by lovelace amount) continuation ] timeout timeoutContinuation refundGuarantor :: Value -> Contract -> Contract -refundGuarantor amount continuation = Pay investor (Party guarantor) ada amount +refundGuarantor amount continuation = Pay investor (Party guarantor) lovelace + amount continuation transfer :: Value -> Party -> Party -> Timeout -> Contract -> Contract -> Contract transfer amount from to timeout timeoutContinuation continuation = deposit amount from to timeout timeoutContinuation - $ Pay to (Party to) ada amount + $ Pay to (Party to) lovelace amount continuation contract :: Contract diff --git a/web-common-marlowe/src/Examples/PureScript/Escrow.purs b/web-common-marlowe/src/Examples/PureScript/Escrow.purs index 6b64355fd3..c7bf575a81 100644 --- a/web-common-marlowe/src/Examples/PureScript/Escrow.purs +++ b/web-common-marlowe/src/Examples/PureScript/Escrow.purs @@ -134,8 +134,8 @@ metadata = ) } -ada :: Token -ada = Token "" "" +lovelace :: Token +lovelace = Token "" "" buyer :: Party buyer = Role "Buyer" @@ -171,7 +171,7 @@ choice choiceName chooser choiceValue continuation = deposit :: Timeout -> Contract -> Contract -> Contract deposit timeout timeoutContinuation continuation = - When [ Case (Deposit seller buyer ada price) continuation ] + When [ Case (Deposit seller buyer lovelace price) continuation ] timeout timeoutContinuation @@ -191,10 +191,10 @@ choices timeout chooser timeoutContinuation list = timeoutContinuation sellerToBuyer :: Contract -> Contract -sellerToBuyer = Pay seller (Account buyer) ada price +sellerToBuyer = Pay seller (Account buyer) lovelace price paySeller :: Contract -> Contract -paySeller = Pay buyer (Party seller) ada price +paySeller = Pay buyer (Party seller) lovelace price fullExtendedContract :: Contract fullExtendedContract = diff --git a/web-common-marlowe/src/Examples/PureScript/EscrowWithCollateral.purs b/web-common-marlowe/src/Examples/PureScript/EscrowWithCollateral.purs index cef6a73904..59b758a189 100644 --- a/web-common-marlowe/src/Examples/PureScript/EscrowWithCollateral.purs +++ b/web-common-marlowe/src/Examples/PureScript/EscrowWithCollateral.purs @@ -137,8 +137,8 @@ metadata = ) } -ada :: Token -ada = Token "" "" +lovelace :: Token +lovelace = Token "" "" buyer :: Party buyer = Role "Buyer" @@ -173,19 +173,19 @@ answerTimeout = TimeParam "Complaint deadline" depositCollateral :: Party -> Timeout -> Contract -> Contract -> Contract depositCollateral party timeout timeoutContinuation continuation = - When [ Case (Deposit party party ada collateral) continuation ] + When [ Case (Deposit party party lovelace collateral) continuation ] timeout timeoutContinuation burnCollaterals :: Contract -> Contract burnCollaterals continuation = - Pay seller (Party burnAddress) ada collateral - $ Pay buyer (Party burnAddress) ada collateral + Pay seller (Party burnAddress) lovelace collateral + $ Pay buyer (Party burnAddress) lovelace collateral $ continuation deposit :: Timeout -> Contract -> Contract -> Contract deposit timeout timeoutContinuation continuation = - When [ Case (Deposit seller buyer ada price) continuation ] + When [ Case (Deposit seller buyer lovelace price) continuation ] timeout timeoutContinuation @@ -213,7 +213,7 @@ choices timeout chooser timeoutContinuation list = timeoutContinuation sellerToBuyer :: Contract -> Contract -sellerToBuyer = Pay seller (Account buyer) ada price +sellerToBuyer = Pay seller (Account buyer) lovelace price fullExtendedContract :: Contract fullExtendedContract = diff --git a/web-common-marlowe/src/Examples/PureScript/Swap.purs b/web-common-marlowe/src/Examples/PureScript/Swap.purs index b2e7c40bd9..7eca521ec2 100644 --- a/web-common-marlowe/src/Examples/PureScript/Swap.purs +++ b/web-common-marlowe/src/Examples/PureScript/Swap.purs @@ -92,8 +92,8 @@ metadata = ) } -ada :: Token -ada = Token "" "" +lovelace :: Token +lovelace = Token "" "" lovelacePerAda :: Value lovelacePerAda = Constant (fromInt 1000000) @@ -125,7 +125,7 @@ type SwapParty = adaProvider :: SwapParty adaProvider = { party: Role "Ada provider" - , currency: ada + , currency: lovelace , amount: amountOfLovelace } diff --git a/web-common-marlowe/src/Examples/PureScript/ZeroCouponBond.purs b/web-common-marlowe/src/Examples/PureScript/ZeroCouponBond.purs index d2f0ccc115..9c11e9212f 100644 --- a/web-common-marlowe/src/Examples/PureScript/ZeroCouponBond.purs +++ b/web-common-marlowe/src/Examples/PureScript/ZeroCouponBond.purs @@ -89,8 +89,8 @@ metadata = ) } -ada :: Token -ada = Token "" "" +lovelace :: Token +lovelace = Token "" "" discountedPrice :: Value discountedPrice = ConstantParam "Amount" @@ -113,8 +113,8 @@ maturityExchangeTimeout = TimeParam "Payback deadline" transfer :: Timeout -> Party -> Party -> Value -> Contract -> Contract transfer timeout from to amount continuation = When - [ Case (Deposit from from ada amount) - (Pay from (Party to) ada amount continuation) + [ Case (Deposit from from lovelace amount) + (Pay from (Party to) lovelace amount continuation) ] timeout Close