diff --git a/gitlab-pages/docs/language-basics/tezos-specific.md b/gitlab-pages/docs/language-basics/tezos-specific.md index 4d7ea1f0b..8aa60fb5d 100644 --- a/gitlab-pages/docs/language-basics/tezos-specific.md +++ b/gitlab-pages/docs/language-basics/tezos-specific.md @@ -12,7 +12,7 @@ Michelson provides the `PACK` and `UNPACK` instructions for data serialization. `PACK` converts Michelson data structures to a binary format, and `UNPACK` reverses it. This functionality can be accessed from within LIGO. -> ⚠️ An `UNPACK` isn't *quite* an `eval`, but it should be kept in mind that if you're deserializing untrusted input certain types could be problematic. If you deserialize an `operation` from an untrusted source and then execute it, [you are running eval on user input](https://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html). +> ⚠️ `PACK` and `UNPACK` are features of Michelson that are intended to be used by people that really know what they're doing. There are several failure cases (such as `UNPACK`ing a lambda from an untrusted source), most of which are beyond the scope of this document. Don't use these functions without doing your homework first. @@ -119,3 +119,28 @@ let check_signature = (param: (key, signature, bytes)) : bool => { +## Getting The Contract's Own Address + +Often you want to get the address of the contract being executed. You can do it with +`self_address`. + +> ⚠️ Due to limitations in Michelson, self_address is only allowed in top-level expressions. Using it in a function will cause an error. + + + + +```pascaligo +const current_addr : address = self_address; +``` + + +```cameligo +let current_addr : address = Current.self_address +``` + + +```reasonligo +let current_addr : address = Current.self_address; +``` + + diff --git a/src/test/md_file_tests.ml b/src/test/md_file_tests.ml index 0401648d0..a201b6dd4 100644 --- a/src/test/md_file_tests.ml +++ b/src/test/md_file_tests.ml @@ -104,6 +104,7 @@ let md_files = [ "/gitlab-pages/docs/language-basics/operators.md"; "/gitlab-pages/docs/language-basics/unit-option-pattern-matching.md"; "/gitlab-pages/docs/language-basics/loops.md"; + "/gitlab-pages/docs/language-basics/tezos-specific.md"; "/gitlab-pages/docs/contributors/big-picture/back-end.md"; "/gitlab-pages/docs/contributors/big-picture/vendors.md"; "/gitlab-pages/docs/contributors/big-picture/front-end.md";