Skip to content

Commit b3ccbfc

Browse files
authored
Merge pull request #31 from massalabs/add_test_call_coins
Add test get call coins.
2 parents 2aee3a7 + f105d88 commit b3ccbfc

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { generateEvent, Context} from "@massalabs/massa-as-sdk";
2+
3+
export function test(param: StaticArray<u8>): void {
4+
generateEvent("Caller_Address : " + Context.caller().toByteString() + " || tokens sent to the SC during the call : " + Context.transferedCoins().toString());
5+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/** ****************************
2+
* Bytecode to send to the massa network that push the `helloworld`
3+
* smartcontract.
4+
*
5+
* N.B. The entry file of your Massa Smart Contract program should be named
6+
* `src/main.ts`, the command `yarn bundle` will produce an `build/main.wasm`
7+
* which is ready to be send on Massa network node!
8+
**/
9+
10+
import {createSC, generateEvent, getOpData, getOpKeys} from "@massalabs/massa-as-sdk";
11+
12+
export function main(_args: string): void {
13+
// Create every SC available in the ExecuteSC operation datastore
14+
const keys = getOpKeys();
15+
keys.forEach(function (key) {
16+
const bytecode = getOpData(key);
17+
const address = createSC(bytecode);
18+
generateEvent(address.toByteString());
19+
});
20+
21+
}

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
"build_:set_bytecode_fail_1": "asc assembly/massa/set_bytecode_fail/smart-contract.ts --transform json-as/transform --target release --exportRuntime --runtime stub --outFile build/massa/smart-contract.wasm",
2727
"build_:set_bytecode_fail_2": "asc assembly/massa/set_bytecode_fail/main.ts --transform json-as/transform --target release --exportRuntime --runtime stub --outFile build/massa/set_bytecode_fail.wasm",
2828
"build:set_bytecode_fail": "run-s build_:set_bytecode_fail_*",
29+
"build_:get_call_coins_1": "asc assembly/massa/get_call_coins/call_coins.ts --target release --exportRuntime --runtime stub --outFile build/massa/get_call_coins_test.wasm",
30+
"build_:get_call_coins_2": "asc assembly/massa/get_call_coins/main.ts --target release --exportRuntime --runtime stub --outFile build/massa/get_call_coins_main.wasm",
31+
"build:get_call_coins": "run-s build_:get_call_coins_*",
2932
"build_:nested_call_1": "asc assembly/massa/nested_call/test.ts --transform json-as/transform --target release --exportRuntime --runtime stub --outFile build/massa/test.wasm",
3033
"build_:nested_call_2": "asc assembly/massa/nested_call/main.ts --transform json-as/transform --target release --exportRuntime --runtime stub --outFile build/massa/nested_call.wasm",
3134
"build:nested_call": "run-s build_:nested_call_*",

0 commit comments

Comments
 (0)