-
Notifications
You must be signed in to change notification settings - Fork 287
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
233fc38
commit 418afcc
Showing
10 changed files
with
104 additions
and
73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
magic-contract/* | ||
!magic-contract/introduction.md | ||
iscutils |
60 changes: 0 additions & 60 deletions
60
docs/build/isc/v1.0.0-rc.6/docs/reference/magic-contract.md
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
docs/build/isc/v1.0.0-rc.6/docs/reference/magic-contract/introduction.md
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,38 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
import DocCardList from '@theme/DocCardList'; | ||
|
||
# Introduction | ||
|
||
This section documents the magic contract and all it's interfaces: | ||
|
||
<DocCardList /> | ||
|
||
<!-- TODO: Remove --> | ||
## Call a Native Contract | ||
|
||
You can call native contracts using [`ISC.sandbox.call`](https://github.com/iotaledger/wasp/blob/develop/packages/vm/core/evm/iscmagic/ISCSandbox.sol#L56): | ||
|
||
```solidity | ||
pragma solidity >=0.8.5; | ||
import "@iota/iscmagic/ISC.sol"; | ||
contract MyEVMContract { | ||
event EntropyEvent(bytes32 entropy); | ||
function callInccounter() public { | ||
ISCDict memory params = ISCDict(new ISCDictItem[](1)); | ||
bytes memory int64Encoded42 = hex"2A00000000000000"; | ||
params.items[0] = ISCDictItem("counter", int64Encoded42); | ||
ISCAssets memory allowance; | ||
ISC.sandbox.call(ISC.util.hn("inccounter"), ISC.util.hn("incCounter"), params, allowance); | ||
} | ||
} | ||
``` | ||
|
||
`ISC.util.hn` is used to get the `hname` of the `inccounter` contract and the | ||
`incCounter` entry point. You can also call view entry points using | ||
[ISC.sandbox.callView](https://github.com/iotaledger/wasp/blob/develop/packages/vm/core/evm/iscmagic/ISCSandbox.sol#L59). |
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,16 @@ | ||
#!/bin/sh | ||
|
||
# Create temporaty directory to work in | ||
mkdir tmp | ||
cd tmp | ||
|
||
# Download and copy docs | ||
curl -sL https://s3.eu-central-1.amazonaws.com/files.iota.org/iota-wiki/wasp/1.0/iscmagic.tar.gz | tar xzv | ||
cp -Rv docs/iscmagic/* ../docs/build/isc/v1.0.0-rc.6/docs/reference/magic-contract/ | ||
|
||
curl -sL https://s3.eu-central-1.amazonaws.com/files.iota.org/iota-wiki/wasp/1.0/iscutils.tar.gz | tar xzv | ||
cp -Rv docs/iscutils ../docs/build/isc/v1.0.0-rc.6/docs/reference/ | ||
|
||
# Return to root and cleanup | ||
cd - | ||
rm -rf tmp |
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