From 08d463582e2277c2d20d7c32f39c442f980e37a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Costin=20Caraba=C8=99?= Date: Thu, 27 Oct 2022 00:40:33 +0300 Subject: [PATCH] Neversea SC --- Cargo.toml | 4 +- README.md | 10 ++ adder/interaction/Adder.erdjs.md | 22 ----- adder/interaction/devnet.snippets.sh | 25 ----- adder/interaction/playground.py | 97 ------------------ adder/interaction/testnet.snippets.sh | 26 ----- adder/mandos/adder.scen.json | 99 ------------------- adder/meta/src/main.rs | 3 - adder/src/adder.rs | 23 ----- adder/tests/adder_mandos_go_test.rs | 4 - adder/tests/adder_mandos_rs_test.rs | 14 --- adder/tests/adder_test.rs | 19 ---- {adder => neversea}/.gitignore | 0 {adder => neversea}/Cargo.toml | 8 +- {adder => neversea}/README.md | 0 {adder => neversea}/elrond.json | 0 {adder => neversea}/meta/Cargo.toml | 6 +- neversea/meta/src/main.rs | 3 + neversea/src/neversea.rs | 30 ++++++ {adder => neversea}/testnet.toml | 0 .../wallets/observers/observerKey00.pem | 0 .../wallets/observers/observerKey01.pem | 0 .../wallets/observers/observerKey02.pem | 0 .../wallets/observers/observerKey03.pem | 0 .../wallets/observers/observerKey04.pem | 0 .../wallets/observers/observerKey05.pem | 0 .../wallets/observers/observerKey06.pem | 0 .../wallets/observers/observerKey07.pem | 0 .../wallets/observers/observerKey08.pem | 0 .../wallets/observers/observerKey09.pem | 0 .../wallets/observers/observerKey10.pem | 0 .../wallets/observers/observerKey11.pem | 0 {adder => neversea}/wallets/users/alice.json | 0 {adder => neversea}/wallets/users/alice.pem | 0 {adder => neversea}/wallets/users/bob.json | 0 {adder => neversea}/wallets/users/bob.pem | 0 {adder => neversea}/wallets/users/carol.json | 0 {adder => neversea}/wallets/users/carol.pem | 0 {adder => neversea}/wallets/users/dan.json | 0 {adder => neversea}/wallets/users/dan.pem | 0 {adder => neversea}/wallets/users/eve.json | 0 {adder => neversea}/wallets/users/eve.pem | 0 {adder => neversea}/wallets/users/frank.json | 0 {adder => neversea}/wallets/users/frank.pem | 0 {adder => neversea}/wallets/users/grace.json | 0 {adder => neversea}/wallets/users/grace.pem | 0 {adder => neversea}/wallets/users/heidi.json | 0 {adder => neversea}/wallets/users/heidi.pem | 0 {adder => neversea}/wallets/users/ivan.json | 0 {adder => neversea}/wallets/users/ivan.pem | 0 {adder => neversea}/wallets/users/judy.json | 0 {adder => neversea}/wallets/users/judy.pem | 0 .../wallets/users/mallory.json | 0 {adder => neversea}/wallets/users/mallory.pem | 0 {adder => neversea}/wallets/users/mike.json | 0 {adder => neversea}/wallets/users/mike.pem | 0 .../wallets/users/mnemonic.txt | 0 .../wallets/users/password.txt | 0 .../wallets/validators/mnemonic.txt | 0 .../wallets/validators/password.txt | 0 .../wallets/validators/validatorKey00.pem | 0 .../wallets/validators/validatorKey01.pem | 0 .../wallets/validators/validatorKey02.pem | 0 .../wallets/validators/validatorKey03.pem | 0 .../wallets/validators/validatorKey04.pem | 0 .../wallets/validators/validatorKey05.pem | 0 .../wallets/validators/validatorKey06.pem | 0 .../wallets/validators/validatorKey07.pem | 0 .../wallets/validators/validatorKey08.pem | 0 .../wallets/validators/validatorKey09.pem | 0 .../wallets/validators/validatorKey10.pem | 0 .../wallets/validators/validatorKey11.pem | 0 .../wallets/validators/wallet00.json | 0 .../wallets/validators/wallet00.pem | 0 .../wallets/validators/wallet01.json | 0 .../wallets/validators/wallet01.pem | 0 .../wallets/validators/wallet02.json | 0 .../wallets/validators/wallet02.pem | 0 .../wallets/validators/wallet03.json | 0 .../wallets/validators/wallet03.pem | 0 .../wallets/validators/wallet04.json | 0 .../wallets/validators/wallet04.pem | 0 .../wallets/validators/wallet05.json | 0 .../wallets/validators/wallet05.pem | 0 .../wallets/validators/wallet06.json | 0 .../wallets/validators/wallet06.pem | 0 .../wallets/validators/wallet07.json | 0 .../wallets/validators/wallet07.pem | 0 .../wallets/validators/wallet08.json | 0 .../wallets/validators/wallet08.pem | 0 .../wallets/validators/wallet09.json | 0 .../wallets/validators/wallet09.pem | 0 .../wallets/validators/wallet10.json | 0 .../wallets/validators/wallet10.pem | 0 .../wallets/validators/wallet11.json | 0 .../wallets/validators/wallet11.pem | 0 {adder => neversea}/wasm/Cargo.toml | 0 {adder => neversea}/wasm/src/lib.rs | 0 98 files changed, 52 insertions(+), 341 deletions(-) delete mode 100644 adder/interaction/Adder.erdjs.md delete mode 100644 adder/interaction/devnet.snippets.sh delete mode 100644 adder/interaction/playground.py delete mode 100644 adder/interaction/testnet.snippets.sh delete mode 100644 adder/mandos/adder.scen.json delete mode 100644 adder/meta/src/main.rs delete mode 100644 adder/src/adder.rs delete mode 100644 adder/tests/adder_mandos_go_test.rs delete mode 100644 adder/tests/adder_mandos_rs_test.rs delete mode 100644 adder/tests/adder_test.rs rename {adder => neversea}/.gitignore (100%) rename {adder => neversea}/Cargo.toml (65%) rename {adder => neversea}/README.md (100%) rename {adder => neversea}/elrond.json (100%) rename {adder => neversea}/meta/Cargo.toml (69%) create mode 100644 neversea/meta/src/main.rs create mode 100644 neversea/src/neversea.rs rename {adder => neversea}/testnet.toml (100%) rename {adder => neversea}/wallets/observers/observerKey00.pem (100%) rename {adder => neversea}/wallets/observers/observerKey01.pem (100%) rename {adder => neversea}/wallets/observers/observerKey02.pem (100%) rename {adder => neversea}/wallets/observers/observerKey03.pem (100%) rename {adder => neversea}/wallets/observers/observerKey04.pem (100%) rename {adder => neversea}/wallets/observers/observerKey05.pem (100%) rename {adder => neversea}/wallets/observers/observerKey06.pem (100%) rename {adder => neversea}/wallets/observers/observerKey07.pem (100%) rename {adder => neversea}/wallets/observers/observerKey08.pem (100%) rename {adder => neversea}/wallets/observers/observerKey09.pem (100%) rename {adder => neversea}/wallets/observers/observerKey10.pem (100%) rename {adder => neversea}/wallets/observers/observerKey11.pem (100%) rename {adder => neversea}/wallets/users/alice.json (100%) rename {adder => neversea}/wallets/users/alice.pem (100%) rename {adder => neversea}/wallets/users/bob.json (100%) rename {adder => neversea}/wallets/users/bob.pem (100%) rename {adder => neversea}/wallets/users/carol.json (100%) rename {adder => neversea}/wallets/users/carol.pem (100%) rename {adder => neversea}/wallets/users/dan.json (100%) rename {adder => neversea}/wallets/users/dan.pem (100%) rename {adder => neversea}/wallets/users/eve.json (100%) rename {adder => neversea}/wallets/users/eve.pem (100%) rename {adder => neversea}/wallets/users/frank.json (100%) rename {adder => neversea}/wallets/users/frank.pem (100%) rename {adder => neversea}/wallets/users/grace.json (100%) rename {adder => neversea}/wallets/users/grace.pem (100%) rename {adder => neversea}/wallets/users/heidi.json (100%) rename {adder => neversea}/wallets/users/heidi.pem (100%) rename {adder => neversea}/wallets/users/ivan.json (100%) rename {adder => neversea}/wallets/users/ivan.pem (100%) rename {adder => neversea}/wallets/users/judy.json (100%) rename {adder => neversea}/wallets/users/judy.pem (100%) rename {adder => neversea}/wallets/users/mallory.json (100%) rename {adder => neversea}/wallets/users/mallory.pem (100%) rename {adder => neversea}/wallets/users/mike.json (100%) rename {adder => neversea}/wallets/users/mike.pem (100%) rename {adder => neversea}/wallets/users/mnemonic.txt (100%) rename {adder => neversea}/wallets/users/password.txt (100%) rename {adder => neversea}/wallets/validators/mnemonic.txt (100%) rename {adder => neversea}/wallets/validators/password.txt (100%) rename {adder => neversea}/wallets/validators/validatorKey00.pem (100%) rename {adder => neversea}/wallets/validators/validatorKey01.pem (100%) rename {adder => neversea}/wallets/validators/validatorKey02.pem (100%) rename {adder => neversea}/wallets/validators/validatorKey03.pem (100%) rename {adder => neversea}/wallets/validators/validatorKey04.pem (100%) rename {adder => neversea}/wallets/validators/validatorKey05.pem (100%) rename {adder => neversea}/wallets/validators/validatorKey06.pem (100%) rename {adder => neversea}/wallets/validators/validatorKey07.pem (100%) rename {adder => neversea}/wallets/validators/validatorKey08.pem (100%) rename {adder => neversea}/wallets/validators/validatorKey09.pem (100%) rename {adder => neversea}/wallets/validators/validatorKey10.pem (100%) rename {adder => neversea}/wallets/validators/validatorKey11.pem (100%) rename {adder => neversea}/wallets/validators/wallet00.json (100%) rename {adder => neversea}/wallets/validators/wallet00.pem (100%) rename {adder => neversea}/wallets/validators/wallet01.json (100%) rename {adder => neversea}/wallets/validators/wallet01.pem (100%) rename {adder => neversea}/wallets/validators/wallet02.json (100%) rename {adder => neversea}/wallets/validators/wallet02.pem (100%) rename {adder => neversea}/wallets/validators/wallet03.json (100%) rename {adder => neversea}/wallets/validators/wallet03.pem (100%) rename {adder => neversea}/wallets/validators/wallet04.json (100%) rename {adder => neversea}/wallets/validators/wallet04.pem (100%) rename {adder => neversea}/wallets/validators/wallet05.json (100%) rename {adder => neversea}/wallets/validators/wallet05.pem (100%) rename {adder => neversea}/wallets/validators/wallet06.json (100%) rename {adder => neversea}/wallets/validators/wallet06.pem (100%) rename {adder => neversea}/wallets/validators/wallet07.json (100%) rename {adder => neversea}/wallets/validators/wallet07.pem (100%) rename {adder => neversea}/wallets/validators/wallet08.json (100%) rename {adder => neversea}/wallets/validators/wallet08.pem (100%) rename {adder => neversea}/wallets/validators/wallet09.json (100%) rename {adder => neversea}/wallets/validators/wallet09.pem (100%) rename {adder => neversea}/wallets/validators/wallet10.json (100%) rename {adder => neversea}/wallets/validators/wallet10.pem (100%) rename {adder => neversea}/wallets/validators/wallet11.json (100%) rename {adder => neversea}/wallets/validators/wallet11.pem (100%) rename {adder => neversea}/wasm/Cargo.toml (100%) rename {adder => neversea}/wasm/src/lib.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 77cb342..858229d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,6 @@ resolver = "2" members = [ - "adder", - "adder/meta" + "neversea", + "neversea/meta" ] diff --git a/README.md b/README.md index 8703123..1949743 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,13 @@ Template for creating smart contracts. ## Using the template ### clone or click `use this template` feature + +# Never Sea Festival Smart Contract + +You are the Never Sea Festival 2023 organizers and you decide to create the registration via blockchain. +Starting from this Smart Contract template you have to add more features to coordinate the event. + +* Compile and deploy the Smart Contract template === +* Modify the registration fee to enable Early Bird and Full price access === +* Modify the registration endpoint to enable VIP access === +* Create a feature to enable 50% discount vouchers for friends and partners === diff --git a/adder/interaction/Adder.erdjs.md b/adder/interaction/Adder.erdjs.md deleted file mode 100644 index 8df942b..0000000 --- a/adder/interaction/Adder.erdjs.md +++ /dev/null @@ -1,22 +0,0 @@ -# Adder - -First [set up a node terminal](../../../../tutorial/src/interaction/interaction-basic.md). - -```javascript -let erdjs = await require('@elrondnetwork/erdjs'); -let { erdSys, wallets: { alice } } = await erdjs.setupInteractive("local-testnet"); - -let adder = await erdSys.loadWrapper("contracts/examples/adder"); - -// Deploy the adder contract with an initial value of 42 -await adder.sender(alice).gas(20_000_000).call.deploy(42); - -// Check that the sum is 42 -await adder.query.getSum().then((sum) => sum.toString()); - -await adder.gas(3_000_000).call.add(30); - -// Check that the sum is 72 -await adder.query.getSum().then((sum) => sum.toString()); - -``` diff --git a/adder/interaction/devnet.snippets.sh b/adder/interaction/devnet.snippets.sh deleted file mode 100644 index 3efe2db..0000000 --- a/adder/interaction/devnet.snippets.sh +++ /dev/null @@ -1,25 +0,0 @@ -ALICE="${USERS}/alice.pem" -ADDRESS=$(erdpy data load --key=address-devnet) -DEPLOY_TRANSACTION=$(erdpy data load --key=deployTransaction-devnet) - -deploy() { - erdpy --verbose contract deploy --project=${PROJECT} --recall-nonce --pem=${ALICE} --gas-limit=50000000 --arguments 0 --send --outfile="deploy-devnet.interaction.json" || return - - TRANSACTION=$(erdpy data parse --file="deploy-devnet.interaction.json" --expression="data['emittedTransactionHash']") - ADDRESS=$(erdpy data parse --file="deploy-devnet.interaction.json" --expression="data['contractAddress']") - - erdpy data store --key=address-devnet --value=${ADDRESS} - erdpy data store --key=deployTransaction-devnet --value=${TRANSACTION} - - echo "" - echo "Smart contract address: ${ADDRESS}" -} - -add() { - read -p "Enter number: " NUMBER - erdpy --verbose contract call ${ADDRESS} --recall-nonce --pem=${ALICE} --gas-limit=50000000 --function="add" --arguments ${NUMBER} --send -} - -getSum() { - erdpy --verbose contract query ${ADDRESS} --function="getSum" -} diff --git a/adder/interaction/playground.py b/adder/interaction/playground.py deleted file mode 100644 index 5ae1e7b..0000000 --- a/adder/interaction/playground.py +++ /dev/null @@ -1,97 +0,0 @@ -import logging -from argparse import ArgumentParser -from pathlib import Path - -from erdpy import config -from erdpy.accounts import Account -from erdpy.contracts import SmartContract -from erdpy.environments import TestnetEnvironment -from erdpy.projects import ProjectRust -from erdpy.proxy import ElrondProxy - -logger = logging.getLogger("examples") - -if __name__ == '__main__': - parser = ArgumentParser() - parser.add_argument("--proxy", help="Proxy URL", default=config.get_proxy()) - parser.add_argument("--contract", help="Existing contract address") - parser.add_argument("--pem", help="PEM file", required=True) - args = parser.parse_args() - - logging.basicConfig(level=logging.INFO) - - proxy = ElrondProxy(args.proxy) - network = proxy.get_network_config() - chain = network.chain_id - gas_price = network.min_gas_price - tx_version = network.min_tx_version - - environment = TestnetEnvironment(args.proxy) - user = Account(pem_file=args.pem) - - project = ProjectRust(Path(__file__).parent.parent) - bytecode = project.get_bytecode() - - # We initialize the smart contract with an actual address if IF was previously deployed, - # so that we can start to interact with it ("query_flow") - contract = SmartContract(address=args.contract) - - def deploy_flow(): - global contract - - # For deploy, we initialize the smart contract with the compiled bytecode - contract = SmartContract(bytecode=bytecode) - - tx, address = environment.deploy_contract( - contract=contract, - owner=user, - arguments=["0x0064"], - gas_price=gas_price, - gas_limit=50000000, - value=None, - chain=chain, - version=tx_version - ) - - logger.info("Tx hash: %s", tx) - logger.info("Contract address: %s", address.bech32()) - - def get_sum_flow(): - answer = environment.query_contract(contract, "getSum") - logger.info(f"Answer: {answer}") - - def add_flow(number): - environment.execute_contract( - contract=contract, - caller=user, - function="add", - arguments=[number], - gas_price=gas_price, - gas_limit=50000000, - value=None, - chain=chain, - version=tx_version - ) - - user.sync_nonce(ElrondProxy(args.proxy)) - - while True: - print("Let's run a flow.") - print("1. Deploy") - print("2. Query getSum()") - print("3. Add()") - - try: - choice = int(input("Choose:\n")) - except Exception: - break - - if choice == 1: - environment.run_flow(deploy_flow) - user.nonce += 1 - elif choice == 2: - environment.run_flow(get_sum_flow) - elif choice == 3: - number = int(input("Enter number:")) - environment.run_flow(lambda: add_flow(number)) - user.nonce += 1 diff --git a/adder/interaction/testnet.snippets.sh b/adder/interaction/testnet.snippets.sh deleted file mode 100644 index 9838bb0..0000000 --- a/adder/interaction/testnet.snippets.sh +++ /dev/null @@ -1,26 +0,0 @@ -ALICE="${USERS}/alice.pem" -ADDRESS=$(erdpy data load --key=address-testnet) -DEPLOY_TRANSACTION=$(erdpy data load --key=deployTransaction-testnet) -PROXY=https://testnet-api.elrond.com - -deploy() { - erdpy --verbose contract deploy --project=${PROJECT} --recall-nonce --pem=${ALICE} --gas-limit=50000000 --arguments 0 --send --outfile="deploy-testnet.interaction.json" --proxy=${PROXY} --chain=T || return - - TRANSACTION=$(erdpy data parse --file="deploy-testnet.interaction.json" --expression="data['emittedTransactionHash']") - ADDRESS=$(erdpy data parse --file="deploy-testnet.interaction.json" --expression="data['contractAddress']") - - erdpy data store --key=address-testnet --value=${ADDRESS} - erdpy data store --key=deployTransaction-testnet --value=${TRANSACTION} - - echo "" - echo "Smart contract address: ${ADDRESS}" -} - -add() { - read -p "Enter number: " NUMBER - erdpy --verbose contract call ${ADDRESS} --recall-nonce --pem=${ALICE} --gas-limit=5000000 --function="add" --arguments ${NUMBER} --send --proxy=${PROXY} --chain=T -} - -getSum() { - erdpy --verbose contract query ${ADDRESS} --function="getSum" --proxy=${PROXY} -} diff --git a/adder/mandos/adder.scen.json b/adder/mandos/adder.scen.json deleted file mode 100644 index fdc464b..0000000 --- a/adder/mandos/adder.scen.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "name": "adder", - "comment": "add then check", - "gasSchedule": "v3", - "steps": [ - { - "step": "setState", - "accounts": { - "address:owner": { - "nonce": "1", - "balance": "0" - } - }, - "newAddresses": [ - { - "creatorAddress": "address:owner", - "creatorNonce": "1", - "newAddress": "sc:adder" - } - ] - }, - { - "step": "scDeploy", - "txId": "1", - "tx": { - "from": "address:owner", - "contractCode": "file:../output/adder.wasm", - "arguments": [ - "5" - ], - "gasLimit": "5,000,000", - "gasPrice": "0" - }, - "expect": { - "out": [], - "status": "", - "logs": "*", - "gas": "*", - "refund": "*" - } - }, - { - "step": "scQuery", - "txId": "2", - "tx": { - "to": "sc:adder", - "function": "getSum", - "arguments": [] - }, - "expect": { - "out": [ - "5" - ], - "status": "", - "logs": [] - } - }, - { - "step": "scCall", - "txId": "3", - "tx": { - "from": "address:owner", - "to": "sc:adder", - "function": "add", - "arguments": [ - "3" - ], - "gasLimit": "5,000,000", - "gasPrice": "0" - }, - "expect": { - "out": [], - "status": "", - "logs": "*", - "gas": "*", - "refund": "*" - } - }, - { - "step": "checkState", - "accounts": { - "address:owner": { - "nonce": "*", - "balance": "0", - "storage": {}, - "code": "" - }, - "sc:adder": { - "nonce": "0", - "balance": "0", - "storage": { - "str:sum": "8" - }, - "code": "file:../output/adder.wasm" - } - } - } - ] -} \ No newline at end of file diff --git a/adder/meta/src/main.rs b/adder/meta/src/main.rs deleted file mode 100644 index 85e1b64..0000000 --- a/adder/meta/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - elrond_wasm_debug::meta::perform::(); -} diff --git a/adder/src/adder.rs b/adder/src/adder.rs deleted file mode 100644 index 5da13ce..0000000 --- a/adder/src/adder.rs +++ /dev/null @@ -1,23 +0,0 @@ -#![no_std] - -elrond_wasm::imports!(); - -/// One of the simplest smart contracts possible, -/// it holds a single variable in storage, which anyone can increment. -#[elrond_wasm::derive::contract] -pub trait Adder { - #[view(getSum)] - #[storage_mapper("sum")] - fn sum(&self) -> SingleValueMapper; - - #[init] - fn init(&self, initial_value: BigUint) { - self.sum().set(initial_value); - } - - /// Add desired amount to the storage variable. - #[endpoint] - fn add(&self, value: BigUint) { - self.sum().update(|sum| *sum += value); - } -} diff --git a/adder/tests/adder_mandos_go_test.rs b/adder/tests/adder_mandos_go_test.rs deleted file mode 100644 index d41a502..0000000 --- a/adder/tests/adder_mandos_go_test.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[test] -fn adder_go() { - elrond_wasm_debug::mandos_go("mandos/adder.scen.json"); -} diff --git a/adder/tests/adder_mandos_rs_test.rs b/adder/tests/adder_mandos_rs_test.rs deleted file mode 100644 index 96e64c8..0000000 --- a/adder/tests/adder_mandos_rs_test.rs +++ /dev/null @@ -1,14 +0,0 @@ -use elrond_wasm_debug::*; - -fn world() -> BlockchainMock { - let mut blockchain = BlockchainMock::new(); - blockchain.set_current_dir_from_workspace("adder"); - - blockchain.register_contract_builder("file:output/adder.wasm", adder::ContractBuilder); - blockchain -} - -#[test] -fn adder_rs() { - elrond_wasm_debug::mandos_rs("mandos/adder.scen.json", world()); -} diff --git a/adder/tests/adder_test.rs b/adder/tests/adder_test.rs deleted file mode 100644 index 51a2c3c..0000000 --- a/adder/tests/adder_test.rs +++ /dev/null @@ -1,19 +0,0 @@ -use adder::*; -use elrond_wasm::types::BigUint; -use elrond_wasm_debug::DebugApi; - -#[test] -fn test_add() { - let _ = DebugApi::dummy(); - - let adder = adder::contract_obj::(); - - adder.init(BigUint::from(5u32)); - assert_eq!(BigUint::from(5u32), adder.sum().get()); - - let _ = adder.add(BigUint::from(7u32)); - assert_eq!(BigUint::from(12u32), adder.sum().get()); - - let _ = adder.add(BigUint::from(1u32)); - assert_eq!(BigUint::from(13u32), adder.sum().get()); -} diff --git a/adder/.gitignore b/neversea/.gitignore similarity index 100% rename from adder/.gitignore rename to neversea/.gitignore diff --git a/adder/Cargo.toml b/neversea/Cargo.toml similarity index 65% rename from adder/Cargo.toml rename to neversea/Cargo.toml index 394d8cf..ebc2943 100644 --- a/adder/Cargo.toml +++ b/neversea/Cargo.toml @@ -1,15 +1,15 @@ [package] -name = "adder" +name = "neversea" version = "0.0.0" authors = [ "you",] edition = "2018" publish = false [lib] -path = "src/adder.rs" +path = "src/neversea.rs" [dependencies.elrond-wasm] -version = "0.30.0" +version = "0.36.0" [dev-dependencies.elrond-wasm-debug] -version = "0.30.0" +version = "0.36.0" diff --git a/adder/README.md b/neversea/README.md similarity index 100% rename from adder/README.md rename to neversea/README.md diff --git a/adder/elrond.json b/neversea/elrond.json similarity index 100% rename from adder/elrond.json rename to neversea/elrond.json diff --git a/adder/meta/Cargo.toml b/neversea/meta/Cargo.toml similarity index 69% rename from adder/meta/Cargo.toml rename to neversea/meta/Cargo.toml index 6a19133..7592361 100644 --- a/adder/meta/Cargo.toml +++ b/neversea/meta/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "adder-meta" +name = "neversea-meta" version = "0.0.0" edition = "2018" publish = false @@ -7,8 +7,8 @@ authors = [ "you",] [dev-dependencies] -[dependencies.adder] +[dependencies.neversea] path = ".." [dependencies.elrond-wasm-debug] -version = "0.30.0" +version = "0.36.0" diff --git a/neversea/meta/src/main.rs b/neversea/meta/src/main.rs new file mode 100644 index 0000000..067c8eb --- /dev/null +++ b/neversea/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + elrond_wasm_debug::meta::perform::(); +} diff --git a/neversea/src/neversea.rs b/neversea/src/neversea.rs new file mode 100644 index 0000000..8e1bc1d --- /dev/null +++ b/neversea/src/neversea.rs @@ -0,0 +1,30 @@ +#![no_std] + +elrond_wasm::imports!(); + +#[elrond_wasm::derive::contract] +pub trait Neversea { + #[init] + fn init(&self, initial_registration_fee: BigUint) { + self.registration_fee().set(BigUint::from(initial_registration_fee)); + } + + /// Add desired amount to the storage variable. + #[endpoint] + fn register(&self) { + let caller = self.blockchain().get_caller(); + let payment_amount = self.call_value().egld_value(); + require!(payment_amount == BigUint::from(self.registration_fee().get()), "Registration fee is incorrect; please check and try again"); + self.participants().insert(caller); + } + + #[view(getParticipants)] + #[storage_mapper("participants")] + fn participants(&self) -> UnorderedSetMapper; + + #[view(getRegistrationFee)] + #[storage_mapper("registration_fee")] + fn registration_fee(&self) -> SingleValueMapper; + + +} diff --git a/adder/testnet.toml b/neversea/testnet.toml similarity index 100% rename from adder/testnet.toml rename to neversea/testnet.toml diff --git a/adder/wallets/observers/observerKey00.pem b/neversea/wallets/observers/observerKey00.pem similarity index 100% rename from adder/wallets/observers/observerKey00.pem rename to neversea/wallets/observers/observerKey00.pem diff --git a/adder/wallets/observers/observerKey01.pem b/neversea/wallets/observers/observerKey01.pem similarity index 100% rename from adder/wallets/observers/observerKey01.pem rename to neversea/wallets/observers/observerKey01.pem diff --git a/adder/wallets/observers/observerKey02.pem b/neversea/wallets/observers/observerKey02.pem similarity index 100% rename from adder/wallets/observers/observerKey02.pem rename to neversea/wallets/observers/observerKey02.pem diff --git a/adder/wallets/observers/observerKey03.pem b/neversea/wallets/observers/observerKey03.pem similarity index 100% rename from adder/wallets/observers/observerKey03.pem rename to neversea/wallets/observers/observerKey03.pem diff --git a/adder/wallets/observers/observerKey04.pem b/neversea/wallets/observers/observerKey04.pem similarity index 100% rename from adder/wallets/observers/observerKey04.pem rename to neversea/wallets/observers/observerKey04.pem diff --git a/adder/wallets/observers/observerKey05.pem b/neversea/wallets/observers/observerKey05.pem similarity index 100% rename from adder/wallets/observers/observerKey05.pem rename to neversea/wallets/observers/observerKey05.pem diff --git a/adder/wallets/observers/observerKey06.pem b/neversea/wallets/observers/observerKey06.pem similarity index 100% rename from adder/wallets/observers/observerKey06.pem rename to neversea/wallets/observers/observerKey06.pem diff --git a/adder/wallets/observers/observerKey07.pem b/neversea/wallets/observers/observerKey07.pem similarity index 100% rename from adder/wallets/observers/observerKey07.pem rename to neversea/wallets/observers/observerKey07.pem diff --git a/adder/wallets/observers/observerKey08.pem b/neversea/wallets/observers/observerKey08.pem similarity index 100% rename from adder/wallets/observers/observerKey08.pem rename to neversea/wallets/observers/observerKey08.pem diff --git a/adder/wallets/observers/observerKey09.pem b/neversea/wallets/observers/observerKey09.pem similarity index 100% rename from adder/wallets/observers/observerKey09.pem rename to neversea/wallets/observers/observerKey09.pem diff --git a/adder/wallets/observers/observerKey10.pem b/neversea/wallets/observers/observerKey10.pem similarity index 100% rename from adder/wallets/observers/observerKey10.pem rename to neversea/wallets/observers/observerKey10.pem diff --git a/adder/wallets/observers/observerKey11.pem b/neversea/wallets/observers/observerKey11.pem similarity index 100% rename from adder/wallets/observers/observerKey11.pem rename to neversea/wallets/observers/observerKey11.pem diff --git a/adder/wallets/users/alice.json b/neversea/wallets/users/alice.json similarity index 100% rename from adder/wallets/users/alice.json rename to neversea/wallets/users/alice.json diff --git a/adder/wallets/users/alice.pem b/neversea/wallets/users/alice.pem similarity index 100% rename from adder/wallets/users/alice.pem rename to neversea/wallets/users/alice.pem diff --git a/adder/wallets/users/bob.json b/neversea/wallets/users/bob.json similarity index 100% rename from adder/wallets/users/bob.json rename to neversea/wallets/users/bob.json diff --git a/adder/wallets/users/bob.pem b/neversea/wallets/users/bob.pem similarity index 100% rename from adder/wallets/users/bob.pem rename to neversea/wallets/users/bob.pem diff --git a/adder/wallets/users/carol.json b/neversea/wallets/users/carol.json similarity index 100% rename from adder/wallets/users/carol.json rename to neversea/wallets/users/carol.json diff --git a/adder/wallets/users/carol.pem b/neversea/wallets/users/carol.pem similarity index 100% rename from adder/wallets/users/carol.pem rename to neversea/wallets/users/carol.pem diff --git a/adder/wallets/users/dan.json b/neversea/wallets/users/dan.json similarity index 100% rename from adder/wallets/users/dan.json rename to neversea/wallets/users/dan.json diff --git a/adder/wallets/users/dan.pem b/neversea/wallets/users/dan.pem similarity index 100% rename from adder/wallets/users/dan.pem rename to neversea/wallets/users/dan.pem diff --git a/adder/wallets/users/eve.json b/neversea/wallets/users/eve.json similarity index 100% rename from adder/wallets/users/eve.json rename to neversea/wallets/users/eve.json diff --git a/adder/wallets/users/eve.pem b/neversea/wallets/users/eve.pem similarity index 100% rename from adder/wallets/users/eve.pem rename to neversea/wallets/users/eve.pem diff --git a/adder/wallets/users/frank.json b/neversea/wallets/users/frank.json similarity index 100% rename from adder/wallets/users/frank.json rename to neversea/wallets/users/frank.json diff --git a/adder/wallets/users/frank.pem b/neversea/wallets/users/frank.pem similarity index 100% rename from adder/wallets/users/frank.pem rename to neversea/wallets/users/frank.pem diff --git a/adder/wallets/users/grace.json b/neversea/wallets/users/grace.json similarity index 100% rename from adder/wallets/users/grace.json rename to neversea/wallets/users/grace.json diff --git a/adder/wallets/users/grace.pem b/neversea/wallets/users/grace.pem similarity index 100% rename from adder/wallets/users/grace.pem rename to neversea/wallets/users/grace.pem diff --git a/adder/wallets/users/heidi.json b/neversea/wallets/users/heidi.json similarity index 100% rename from adder/wallets/users/heidi.json rename to neversea/wallets/users/heidi.json diff --git a/adder/wallets/users/heidi.pem b/neversea/wallets/users/heidi.pem similarity index 100% rename from adder/wallets/users/heidi.pem rename to neversea/wallets/users/heidi.pem diff --git a/adder/wallets/users/ivan.json b/neversea/wallets/users/ivan.json similarity index 100% rename from adder/wallets/users/ivan.json rename to neversea/wallets/users/ivan.json diff --git a/adder/wallets/users/ivan.pem b/neversea/wallets/users/ivan.pem similarity index 100% rename from adder/wallets/users/ivan.pem rename to neversea/wallets/users/ivan.pem diff --git a/adder/wallets/users/judy.json b/neversea/wallets/users/judy.json similarity index 100% rename from adder/wallets/users/judy.json rename to neversea/wallets/users/judy.json diff --git a/adder/wallets/users/judy.pem b/neversea/wallets/users/judy.pem similarity index 100% rename from adder/wallets/users/judy.pem rename to neversea/wallets/users/judy.pem diff --git a/adder/wallets/users/mallory.json b/neversea/wallets/users/mallory.json similarity index 100% rename from adder/wallets/users/mallory.json rename to neversea/wallets/users/mallory.json diff --git a/adder/wallets/users/mallory.pem b/neversea/wallets/users/mallory.pem similarity index 100% rename from adder/wallets/users/mallory.pem rename to neversea/wallets/users/mallory.pem diff --git a/adder/wallets/users/mike.json b/neversea/wallets/users/mike.json similarity index 100% rename from adder/wallets/users/mike.json rename to neversea/wallets/users/mike.json diff --git a/adder/wallets/users/mike.pem b/neversea/wallets/users/mike.pem similarity index 100% rename from adder/wallets/users/mike.pem rename to neversea/wallets/users/mike.pem diff --git a/adder/wallets/users/mnemonic.txt b/neversea/wallets/users/mnemonic.txt similarity index 100% rename from adder/wallets/users/mnemonic.txt rename to neversea/wallets/users/mnemonic.txt diff --git a/adder/wallets/users/password.txt b/neversea/wallets/users/password.txt similarity index 100% rename from adder/wallets/users/password.txt rename to neversea/wallets/users/password.txt diff --git a/adder/wallets/validators/mnemonic.txt b/neversea/wallets/validators/mnemonic.txt similarity index 100% rename from adder/wallets/validators/mnemonic.txt rename to neversea/wallets/validators/mnemonic.txt diff --git a/adder/wallets/validators/password.txt b/neversea/wallets/validators/password.txt similarity index 100% rename from adder/wallets/validators/password.txt rename to neversea/wallets/validators/password.txt diff --git a/adder/wallets/validators/validatorKey00.pem b/neversea/wallets/validators/validatorKey00.pem similarity index 100% rename from adder/wallets/validators/validatorKey00.pem rename to neversea/wallets/validators/validatorKey00.pem diff --git a/adder/wallets/validators/validatorKey01.pem b/neversea/wallets/validators/validatorKey01.pem similarity index 100% rename from adder/wallets/validators/validatorKey01.pem rename to neversea/wallets/validators/validatorKey01.pem diff --git a/adder/wallets/validators/validatorKey02.pem b/neversea/wallets/validators/validatorKey02.pem similarity index 100% rename from adder/wallets/validators/validatorKey02.pem rename to neversea/wallets/validators/validatorKey02.pem diff --git a/adder/wallets/validators/validatorKey03.pem b/neversea/wallets/validators/validatorKey03.pem similarity index 100% rename from adder/wallets/validators/validatorKey03.pem rename to neversea/wallets/validators/validatorKey03.pem diff --git a/adder/wallets/validators/validatorKey04.pem b/neversea/wallets/validators/validatorKey04.pem similarity index 100% rename from adder/wallets/validators/validatorKey04.pem rename to neversea/wallets/validators/validatorKey04.pem diff --git a/adder/wallets/validators/validatorKey05.pem b/neversea/wallets/validators/validatorKey05.pem similarity index 100% rename from adder/wallets/validators/validatorKey05.pem rename to neversea/wallets/validators/validatorKey05.pem diff --git a/adder/wallets/validators/validatorKey06.pem b/neversea/wallets/validators/validatorKey06.pem similarity index 100% rename from adder/wallets/validators/validatorKey06.pem rename to neversea/wallets/validators/validatorKey06.pem diff --git a/adder/wallets/validators/validatorKey07.pem b/neversea/wallets/validators/validatorKey07.pem similarity index 100% rename from adder/wallets/validators/validatorKey07.pem rename to neversea/wallets/validators/validatorKey07.pem diff --git a/adder/wallets/validators/validatorKey08.pem b/neversea/wallets/validators/validatorKey08.pem similarity index 100% rename from adder/wallets/validators/validatorKey08.pem rename to neversea/wallets/validators/validatorKey08.pem diff --git a/adder/wallets/validators/validatorKey09.pem b/neversea/wallets/validators/validatorKey09.pem similarity index 100% rename from adder/wallets/validators/validatorKey09.pem rename to neversea/wallets/validators/validatorKey09.pem diff --git a/adder/wallets/validators/validatorKey10.pem b/neversea/wallets/validators/validatorKey10.pem similarity index 100% rename from adder/wallets/validators/validatorKey10.pem rename to neversea/wallets/validators/validatorKey10.pem diff --git a/adder/wallets/validators/validatorKey11.pem b/neversea/wallets/validators/validatorKey11.pem similarity index 100% rename from adder/wallets/validators/validatorKey11.pem rename to neversea/wallets/validators/validatorKey11.pem diff --git a/adder/wallets/validators/wallet00.json b/neversea/wallets/validators/wallet00.json similarity index 100% rename from adder/wallets/validators/wallet00.json rename to neversea/wallets/validators/wallet00.json diff --git a/adder/wallets/validators/wallet00.pem b/neversea/wallets/validators/wallet00.pem similarity index 100% rename from adder/wallets/validators/wallet00.pem rename to neversea/wallets/validators/wallet00.pem diff --git a/adder/wallets/validators/wallet01.json b/neversea/wallets/validators/wallet01.json similarity index 100% rename from adder/wallets/validators/wallet01.json rename to neversea/wallets/validators/wallet01.json diff --git a/adder/wallets/validators/wallet01.pem b/neversea/wallets/validators/wallet01.pem similarity index 100% rename from adder/wallets/validators/wallet01.pem rename to neversea/wallets/validators/wallet01.pem diff --git a/adder/wallets/validators/wallet02.json b/neversea/wallets/validators/wallet02.json similarity index 100% rename from adder/wallets/validators/wallet02.json rename to neversea/wallets/validators/wallet02.json diff --git a/adder/wallets/validators/wallet02.pem b/neversea/wallets/validators/wallet02.pem similarity index 100% rename from adder/wallets/validators/wallet02.pem rename to neversea/wallets/validators/wallet02.pem diff --git a/adder/wallets/validators/wallet03.json b/neversea/wallets/validators/wallet03.json similarity index 100% rename from adder/wallets/validators/wallet03.json rename to neversea/wallets/validators/wallet03.json diff --git a/adder/wallets/validators/wallet03.pem b/neversea/wallets/validators/wallet03.pem similarity index 100% rename from adder/wallets/validators/wallet03.pem rename to neversea/wallets/validators/wallet03.pem diff --git a/adder/wallets/validators/wallet04.json b/neversea/wallets/validators/wallet04.json similarity index 100% rename from adder/wallets/validators/wallet04.json rename to neversea/wallets/validators/wallet04.json diff --git a/adder/wallets/validators/wallet04.pem b/neversea/wallets/validators/wallet04.pem similarity index 100% rename from adder/wallets/validators/wallet04.pem rename to neversea/wallets/validators/wallet04.pem diff --git a/adder/wallets/validators/wallet05.json b/neversea/wallets/validators/wallet05.json similarity index 100% rename from adder/wallets/validators/wallet05.json rename to neversea/wallets/validators/wallet05.json diff --git a/adder/wallets/validators/wallet05.pem b/neversea/wallets/validators/wallet05.pem similarity index 100% rename from adder/wallets/validators/wallet05.pem rename to neversea/wallets/validators/wallet05.pem diff --git a/adder/wallets/validators/wallet06.json b/neversea/wallets/validators/wallet06.json similarity index 100% rename from adder/wallets/validators/wallet06.json rename to neversea/wallets/validators/wallet06.json diff --git a/adder/wallets/validators/wallet06.pem b/neversea/wallets/validators/wallet06.pem similarity index 100% rename from adder/wallets/validators/wallet06.pem rename to neversea/wallets/validators/wallet06.pem diff --git a/adder/wallets/validators/wallet07.json b/neversea/wallets/validators/wallet07.json similarity index 100% rename from adder/wallets/validators/wallet07.json rename to neversea/wallets/validators/wallet07.json diff --git a/adder/wallets/validators/wallet07.pem b/neversea/wallets/validators/wallet07.pem similarity index 100% rename from adder/wallets/validators/wallet07.pem rename to neversea/wallets/validators/wallet07.pem diff --git a/adder/wallets/validators/wallet08.json b/neversea/wallets/validators/wallet08.json similarity index 100% rename from adder/wallets/validators/wallet08.json rename to neversea/wallets/validators/wallet08.json diff --git a/adder/wallets/validators/wallet08.pem b/neversea/wallets/validators/wallet08.pem similarity index 100% rename from adder/wallets/validators/wallet08.pem rename to neversea/wallets/validators/wallet08.pem diff --git a/adder/wallets/validators/wallet09.json b/neversea/wallets/validators/wallet09.json similarity index 100% rename from adder/wallets/validators/wallet09.json rename to neversea/wallets/validators/wallet09.json diff --git a/adder/wallets/validators/wallet09.pem b/neversea/wallets/validators/wallet09.pem similarity index 100% rename from adder/wallets/validators/wallet09.pem rename to neversea/wallets/validators/wallet09.pem diff --git a/adder/wallets/validators/wallet10.json b/neversea/wallets/validators/wallet10.json similarity index 100% rename from adder/wallets/validators/wallet10.json rename to neversea/wallets/validators/wallet10.json diff --git a/adder/wallets/validators/wallet10.pem b/neversea/wallets/validators/wallet10.pem similarity index 100% rename from adder/wallets/validators/wallet10.pem rename to neversea/wallets/validators/wallet10.pem diff --git a/adder/wallets/validators/wallet11.json b/neversea/wallets/validators/wallet11.json similarity index 100% rename from adder/wallets/validators/wallet11.json rename to neversea/wallets/validators/wallet11.json diff --git a/adder/wallets/validators/wallet11.pem b/neversea/wallets/validators/wallet11.pem similarity index 100% rename from adder/wallets/validators/wallet11.pem rename to neversea/wallets/validators/wallet11.pem diff --git a/adder/wasm/Cargo.toml b/neversea/wasm/Cargo.toml similarity index 100% rename from adder/wasm/Cargo.toml rename to neversea/wasm/Cargo.toml diff --git a/adder/wasm/src/lib.rs b/neversea/wasm/src/lib.rs similarity index 100% rename from adder/wasm/src/lib.rs rename to neversea/wasm/src/lib.rs