调用另一个合同的合同
2 个回答
- 投票数
-
- 2019-02-03
迈克尔逊的一个例子
签订一份合同
parameter (option string) ; storage (contract string) ; code { UNPAIR ; DIP { DUP } ; IF_SOME { } { PUSH string "hello, world" } ; PUSH mutez 0 ; SWAP ; TRANSFER_TOKENS ; NIL operation ; SWAP ; CONS ; PAIR }
和另一个
parameter string ; storage string ; code { UNPAIR ; SWAP ; DROP ; NIL operation ; PAIR ; }
第一个合同采用可选的字符串参数,并使用该字符串或未输入的" hello,world"在其存储中调用合同.第二个合同将字符串作为输入并将其放入存储中.
An example in Michelson
Take one contract
parameter (option string) ; storage (contract string) ; code { UNPAIR ; DIP { DUP } ; IF_SOME { } { PUSH string "hello, world" } ; PUSH mutez 0 ; SWAP ; TRANSFER_TOKENS ; NIL operation ; SWAP ; CONS ; PAIR }
and another
parameter string ; storage string ; code { UNPAIR ; SWAP ; DROP ; NIL operation ; PAIR ; }
The first contract takes an optional string parameter and calls the contract in its storage with that string, or "hello, world" if none was provided. The second contract takes a string as input and puts it in its storage.
-
-
如果答案的规模不太大,在Stack Exchange上最好提供内联响应,而不是仅指向指向某些外部资源的链接.原因是因为链接较弱并且可能会随着时间而过期,因此您的答案将来可能会失效.On Stack Exchange it is better to offer responses inline rather than just pointing to a link to some external resources if the size of the answer is not too big. The reason is because links are weak and can expire over time so your answer may become invalid sometime in the future.
- 0
- 2019-02-03
- Ezy
-
玩合同也很有用,谢谢!It is also useful to play with the contracts, thanks!
- 0
- 2019-02-05
- FFF
-
有人可以举一个叫另一个智能合约的迈克尔逊智能合约示例吗?
一些实际的实现将大有帮助.
非常感谢