Created
May 23, 2018 11:55
-
-
Save toonsevrin/26498311ee024afbca0d890badf5f4f8 to your computer and use it in GitHub Desktop.
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
Getting started: | |
1. Follow this tutorial: https://github.com/AssemblyScript/assemblyscript/wiki/Hello-World to get your environment setup | |
2. Change the scripts section of your package.json to the one provided in this gist (the only real difference is the --use abort= tag). | |
3. Use the module.ts provided in this gist for your module source (in the assembly directory). | |
4. "npm run build" will create your binaries (perhaps you have to mkdir build first though). | |
5. Uploading to eos requires an abi file, using one of another contract is completely fine though, as our contract does not use any action data. | |
=> After uploading the abi together with build/untouched.wasm you can push an action to your contract and Hello, World! will be printed. |
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
"scripts": { | |
"build": "asc assembly/module.ts -t build/untouched.wat -b build/untouched.wasm --sourceMap --measure --noAssert --use abort=", | |
} |
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
import "allocator/arena"; | |
/** | |
* Eos environment function to print a utf-8 encoded string, identified by its pointer, to the console. | |
* AssemblyScript strings are encoded in utf-16le so we first convert these to latin. | |
* | |
*/ | |
declare function prints(pointer: usize): void; | |
/** | |
* Entrypoint for the eos contract | |
* | |
*/ | |
export function apply(receiver: u64, code: u64, action: u64): void { | |
prints("Hello, World!".toUTF8()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment