diff --git a/gitlab-pages/docs/advanced/entrypoints-contracts.md b/gitlab-pages/docs/advanced/entrypoints-contracts.md index 0aef5b6bf..273537c77 100644 --- a/gitlab-pages/docs/advanced/entrypoints-contracts.md +++ b/gitlab-pages/docs/advanced/entrypoints-contracts.md @@ -79,31 +79,28 @@ In our case, we have a `counter.ligo` contract that accepts a parameter of type -```pascaligo group=dup -// counter.types.ligo -type action is -| Increment of int -| Decrement of int -| Reset of unit -``` - -```pascaligo group=d +```pascaligo // counter.ligo type action is | Increment of int | Decrement of int | Reset of unit + ``` ```pascaligo skip // proxy.ligo -#include "counter.types.ligo" -const address: address = ("KT19wgxcuXG9VH4Af5Tpm1vqEKdaMFpznXT3": address); +type action is +| Increment of int +| Decrement of int +| Reset of unit + +const dest: address = ("KT19wgxcuXG9VH4Af5Tpm1vqEKdaMFpznXT3": address); function proxy(const param: action; const store: unit): (list(operation) * unit) is block { - const counter: contract(action) = get_contract(address); + const counter: contract(action) = get_contract(dest); // re-use the param passed to the proxy in the subsequent transaction // e.g.: // const mockParam: action = Increment(5); @@ -111,4 +108,59 @@ function proxy(const param: action; const store: unit): (list(operation) * unit) const opList: list(operation) = list op; end; } with (opList, store) ``` - \ No newline at end of file + +```cameligo +// counter.mligo +type action = +| Increment of int +| Decrement of int +| Reset of unit + +// ... +``` + +```cameligo +// proxy.mligo + +type action = +| Increment of int +| Decrement of int +| Reset of unit + +let dest: address = ("KT19wgxcuXG9VH4Af5Tpm1vqEKdaMFpznXT3": address) + +let proxy (param, storage: action * unit): operation list * unit = + let counter: action contract = Operation.get_contract dest in + let op: operation = Operation.transaction param 0mutez counter in + [op], storage +``` + + +```reasonligo +// counter.religo + +type action = + | Increment(int) + | Decrement(int) + | Reset(unit); + +// ... +``` + +```reasonligo +// proxy.religo + +type action = + | Increment(int) + | Decrement(int) + | Reset(unit); + +let dest: address = ("KT19wgxcuXG9VH4Af5Tpm1vqEKdaMFpznXT3": address); + +let proxy = (param_s: (action, unit)): (list(operation), unit) => + let counter: contract(action) = Operation.get_contract(dest); + let op: operation = Operation.transaction(param_s[0], 0mutez, counter); + ([op], param_s[1]); +``` + +