-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
864e307
commit 7b3f725
Showing
14 changed files
with
212 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
```k | ||
module MX-RUST-MODULES-CALL-VALUE | ||
imports private COMMON-K-CELL | ||
imports private MX-COMMON-SYNTAX | ||
imports private MX-RUST-REPRESENTATION | ||
imports private MX-RUST-REPRESENTATION-CONVERSIONS | ||
imports private RUST-EXECUTION-CONFIGURATION | ||
imports private RUST-SHARED-SYNTAX | ||
syntax Identifier ::= "MxRust#CallValue" [token] | ||
syntax MxRustStructType ::= "callValueType" [function, total] | ||
rule callValueType | ||
=> rustStructType | ||
( MxRust#CallValue | ||
, .MxRustStructFields | ||
) | ||
rule | ||
normalizedMethodCall | ||
( MxRust#CallValue | ||
, #token("new", "Identifier"):Identifier | ||
, .PtrList | ||
) | ||
=> mxRustNewStruct | ||
( callValueType | ||
, .CallParamsList | ||
) | ||
rule | ||
normalizedMethodCall | ||
( MxRust#CallValue | ||
, #token("single_fungible_esdt", "Identifier"):Identifier | ||
, ( ptr(_SelfId:Int) | ||
, .PtrList | ||
) | ||
) | ||
=> MX#managedGetMultiESDTCallValue(.MxValueList) | ||
~> getSingleEsdt | ||
~> mxToRustTyped((str, #token("BigUint", "Identifier"))) | ||
syntax MxRustInstruction ::= "getSingleEsdt" | ||
rule .MxEsdtTransferList ~> getSingleEsdt => #exception(UserError, "incorrect number of ESDT transfers") | ||
rule _, _, _:MxEsdtTransferList ~> getSingleEsdt => #exception(UserError, "incorrect number of ESDT transfers") | ||
rule ( mxTransferValue(... token: _:String, nonce: Nonce:Int, value: _:Int) | ||
, .MxEsdtTransferList | ||
~> getSingleEsdt | ||
) | ||
=> #exception(UserError, "fungible ESDT token expected") | ||
requires Nonce =/=Int 0 | ||
rule ( mxTransferValue(... token: TokenId:String, nonce: 0, value: Value:Int) | ||
, .MxEsdtTransferList | ||
~> getSingleEsdt | ||
) | ||
=> mxListValue(mxStringValue(TokenId), mxIntValue(Value)) | ||
endmodule | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
setBalance("Owner", "MyToken", 0, 1234); | ||
setCallee("Owner"); | ||
|
||
push mxListValue(); | ||
push mxStringValue("getTransfer"); | ||
push mxIntValue(0); | ||
push mxTransfersValue(mxTransferValue("MyToken", 0, 10)); | ||
push mxIntValue(0); | ||
push mxStringValue("TestContract"); | ||
call 6 MX#managedExecuteOnDestContext; | ||
check_eq mxIntValue(0); | ||
|
||
push_return_value; | ||
check_eq mxListValue( mxStringValue("MyToken") , mxIntValue(10)) |
Oops, something went wrong.