Questions tagged [move-lang]

Move is a programming language for writing safe smart contracts. It was created to write contracts for the Diem blockchain. Use this tag for questions about writing or working with code in Move.

Move is a programming language for writing safe smart contracts originally developed at Facebook to power the Diem blockchain. Move is designed to be a platform-agnostic language to enable common libraries, tooling, and developer communities across diverse blockchains with vastly different data and execution models. Move's ambition is to become the "JavaScript of web3" in terms of ubiquity--when developers want to quickly write safe code involving assets, it should be written in Move.

37 questions
1
vote
1 answer

Transfer coins in move package

I wrote a mov package in which anyone can mint token (very new to move) module fungible_tokens::rcoin { use sui::coin::{Self, Coin, TreasuryCap}; use sui::transfer; use sui::tx_context::{Self, TxContext}; struct RCOIN has drop {} …
Alwaysblue
  • 9,948
  • 38
  • 121
  • 210
1
vote
1 answer

Getting error MODULE_ADDRESS_DOES_NOT_MATCH_SENDER when publishing Move (language) module

I have published a module. It has a function which publishes another module. When I try to call this function the transaction commits with error MODULE_ADDRESS_DOES_NOT_MATCH_SENDER. My code uses account::create_resource_account to create the future…
1
vote
3 answers

Failed to build Move modules: "Unable to resolve packages for package 'my_first_package'"

New to move and sui. I am trying to follow the documentation on Sui and attempted to use the command sui move build to build my move package. I encountered this error: Failed to build Move modules: "Unable to resolve packages for package…
Jim
  • 450
  • 2
  • 10
1
vote
3 answers

Failure in verification of Move Module for SUI

So I was following the documentation for beginners on SUI, I faced an issue with my Move.toml as I was building my file with sui move build. And I got the following error Failed to verify the Move module, reason: "Sui framework version mismatch…
chia yongkang
  • 786
  • 10
  • 20
1
vote
1 answer

How can I use other published module functions in my move module?

I need to call some other module functions (Those already published modules in aptos blockchain) in my move module. How can I import those module functions in my module? How to add that module as a dependency in my Move.toml file?
Anto
  • 153
  • 1
  • 7
1
vote
1 answer

How do you really track a Move transaction on Diem?

I have been thinking about Diem/Move, and have been reading on how to really track a transaction (not in forensics way, but in e-commerce way). Let me explain a bit here. Let's say Bob is a guy who sells products, and Alice is a customer of Bob. Bob…
mtisz
  • 1,000
  • 10
  • 11
0
votes
0 answers

How to handle ASCII error in move language

I have a simple move file containing this simple code address 0x2 { module Coin { struct Coin { value:u64, } } } But when I try to publish it, it gives me this strange error error[E01001]: invalid character …
0
votes
1 answer

Could not infer this type. Try adding an annotation

This is the code fragment from here. public fun publish_balance(account: &signer) { let empty_coin = Coin { value: 0 }; assert!(!exists>(signer::address_of(account)), EALREADY_HAS_BALANCE); …
MikhilMC
  • 949
  • 3
  • 8
  • 14
0
votes
1 answer

is there constructor function in move programming language?

Is there any kind of a constructor like function, which will run at the time of deployment in move programming language?
MikhilMC
  • 949
  • 3
  • 8
  • 14
0
votes
0 answers

Aptos move compilation error: Duplicate definition for module

I set up an Aptos local testnet and try to publish a module using Aptos move CLI, but it always fail on compilation with an error: duplicate declaration, item, or annotation. Duplicate definition for module. However, the move source code only…
0
votes
0 answers

Given a key, how do I read the value from a iterable table via the API?

I have a struct like this: struct MarketData { markets: IterableTable\ , whitelist: IterableTable\, isOpenForAll: u64 } Given a key, how do I read the value from an iterable table via the API? I tried but got this…
0
votes
1 answer

Aptos Move conflicting dependencies of imported dependencies

I have two dependencies that I need, they both created a module called U256 with different addresses. is there a way to fix this dependency conflict? Unable to resolve package dependency 'U256': Conflicting dependencies found: package 'U256'…
Bob Sfog
  • 105
  • 8
0
votes
1 answer

How do I get all the keys in a table?

Assume I have a table deployed on chain. I know if I have a key, I can lookup the value like this: Given a key, how do I read the value from a table via the API? But what if I don't know the key? How do I lookup all the keys in a table via the API?
Daniel Porteous
  • 5,536
  • 3
  • 25
  • 44
0
votes
1 answer

How do I use a dependency just for tests?

Move is generally pretty Rust-like, the syntax for using dependencies looks very similar: use aptos_framework::aptos_account; As such, I'd expect that if I want to use something only in tests, I'd do this: #[cfg(test)] use…
Daniel Porteous
  • 5,536
  • 3
  • 25
  • 44
0
votes
1 answer

Given a key, how do I read the value from a table via the API?

Imagine I have a move module that looks like this. Move.toml [package] name = 'friends' version = '1.0.0' [dependencies.AptosFramework] git = 'https://github.com/aptos-labs/aptos-core.git' rev = 'testnet' subdir =…
Daniel Porteous
  • 5,536
  • 3
  • 25
  • 44