Questions tagged [smartpy]
Discussion about the SmartPy language
237
questions
0
votes
0
answers
8
views
Programatically create Tezos Wallet
Hi guys inside my ICO website I want to create on the fly a tezos compliant wallet with the custom tokens for people once they purhcase. Is there a way to programatically create a wallet thanks peeps?
0
votes
0
answers
9
views
How to access contract metadata from another contract?
I'm building a NFT Marketplace. I already set the mint function (with editions), list and buy function. Now i'm trying to build the auctions functions. On Smartpy, i created the Marketplace class, and ...
0
votes
0
answers
17
views
Two contract interactions same time?
So, i want to list my NFT, so, i update operators and then update my metadata.
The problem is i need to accept two times, one to update operators, other to update (list) in metadata. Is that a way to ...
0
votes
1
answer
22
views
Error: Uncaught (in promise) TezosOperationError: (temporary) proto.017-PtNairob.tez.subtraction_underflow
Error: Uncaught (in promise) TezosOperationError: (temporary) proto.017-PtNairob.tez.subtraction_underflow
I know this error is caused by a subtraction resulting in a negative number, but i'm just ...
0
votes
1
answer
26
views
How to set Total Supply on TzKT?
I'm trying to create multi-edition items. My idea was to make a list of each token and then each token edition with the owner. Ok, i create the item and shows like that on blockchain: https://api....
0
votes
1
answer
39
views
Error: Error in Scenario / Assertion failed
I am doing a contract to Mint Nfts on Tezos on Legacy SmartPY ide (because Tezos tutorial uses it). I already created Nfts but only in single edition, now i'm trying to do a Multi-edition, but the IDE ...
0
votes
1
answer
15
views
sp.contract can get only explicit string as an entrypoint
I'm trying to call another contract from mine.
It seems like I can't feed sp.contract with an entrypoint string that comes from an argument (it works perfectly fine with an explicit string like "...
0
votes
2
answers
26
views
Url error in smartpy
I trying to write a smart contract on the tezos network and using import FA2 library for this. But when I try to run the code I face the url error.
this is my code :
import smartpy as sp
FA2 = sp.io....
0
votes
1
answer
23
views
testing contract inside smartpy test initializing by contract address
While testing on smart contract file by adding scenario,
@sp.add_test("IntegrationTest")
def test():
sc = sp.test_scenario()
helper_contract = deploy_helper_contract()
...
0
votes
1
answer
19
views
Integrate a url in an NFT during the mint
I would like to add the possibility when I mint an NFT to integrate a "URL" in the parameters of the NFT.
For this I tried to modify my mint function in my smart contract like this:
@sp....
1
vote
1
answer
35
views
How to transfer an NFT
I'm trying to transfer an NFT, that I just minted to someone without them paying for it (just like an exchange).
Here is the function I created on smartpy:
@sp.entry_point
def transferTest(self, ...
0
votes
1
answer
47
views
NFT transfer functionality with Smart Contract
I created a smart contract thanks to the documentation on tezos: https://tezos.com/developers/tutorials/nft-markeplace
I wanted to be able to test the transfer functionality of nft between users or ...
0
votes
1
answer
30
views
How to handle oversized operation while originating contract?
I was trying to originate a smart contract from legacy smartpy CLI.
I got this error:
[INFO] - Using RPC https://ghostnet.ecadinfra.com...
{
"message": "Http error response: (500) [{...
0
votes
0
answers
22
views
getting issue on interscore contract burn of single asset
I have a function on my contract that calls the fa2 contract burn method of singleAsset provided by the fa2 library.
@sp.entry_point
def burn_test2(self,fa2_address, value):
...
0
votes
1
answer
10
views
Is there any other way than using lazify to update contract if i find any issue later?
How can we update a SmartPy contract. One way is through lazify but is there any other way to to so?
0
votes
1
answer
29
views
calling a FA2 smart contract transfer entrypoint from my contract in smartpy
Hello guys I am trying to call from my contract entry point from FA2 token contract that I have deployed. But I am unable to find anything on the internet.
The only thing I found from the ...
-2
votes
3
answers
94
views
Fraudulent Smartpy Charges on my credit card
For two months now I have been charged for Smartpy Smart Browser that I didn't ask for or sign up for. Can someone help me get to the bottom of this.
0
votes
0
answers
24
views
Updating baseURI not working in FA2
I have been working on a Worker contract which is the parent of an NFT contract. The NFT contract is used to create dynamic NFTs (by changing their baseURI) in the contract and accessing the tokens ...
0
votes
0
answers
25
views
RLP Encoding of integer in negative value
I want to encode an integer i.e -10, but I don't see any function to encode the negative integer in this library.
https://raw.githubusercontent.com/Acurast/acurast-hyperdrive/main/contracts/tezos/libs/...
1
vote
3
answers
55
views
checking if the number is negative or not
I have a requirement where I need to pass a byte into a function and that function should convert that byte to integer and returns true if it is negative else false.
the function will be this in the ...
1
vote
1
answer
30
views
rlp encoding of solidity
there are two functions on solidity
function encodeString(string memory self)
internal
pure
returns (bytes memory)
{
return encodeBytes(bytes(self));
}
/**
...
2
votes
1
answer
35
views
Pytezos balance_of entrypoint function for fa2 tokens
I was trying to implement a balance_of function. According to the documentation, it should be looking like this
$balance_of:
{
"requests": [ $requests_item, … ],
&...
0
votes
1
answer
19
views
got HTTPError while imporing
i am getting http error while importing fa2 library. i checked link and it says host error. did it moved to new address?
File "./contracts/src/something.py", line 3, in
FA2 = sp.io....
0
votes
1
answer
24
views
Trying to give a custom metadata but still it is using the default base metadata mentioned in class Common
Hello I am using the template Fa2NFT library. When we add the compilation target we need to give it a metadata parameter. I am trying to give it a custom metadata but still it is using the default ...
0
votes
1
answer
31
views
Do I always have to write the argument names in SmartPy tests?
I defined an entrypoint with 2 arguments:
@sp.entrypoint
def update(self, newx, newy):
self.data.x = newx
self.data.y = newy
then I wrote a test of this entrypoint:
scenario += contract....
1
vote
1
answer
26
views
rlp decoding not working as expected
I have a rlp encoded data and am trying to decode it with Accurast library
Utils = sp.io.import_script_from_url("https://raw.githubusercontent.com/Acurast/acurast-hyperdrive/main/contracts/tezos/...
0
votes
1
answer
48
views
Callback function getting issue
I have two contracts , contract A and Contract B.
This is my contract B where I have defined a callback function that will return sp.some("test") when called.
import smartpy as sp
...
0
votes
1
answer
35
views
trying to access a callback function
I am trying to read a balance_of function of fa2 contract and updating my storage with the balance. but I am getting an issue
Error: Type Error
sp.TList(sp.TPair(sp.TPair(sp.TAddress, sp.TNat), sp....
0
votes
1
answer
35
views
call another contract onchain view
first we deploy fa2 contract from a contract like this
deployed_fa2 = sp.create_contract_operation(contract=FA2_contract.SingleAssetToken(admin=sp.self_address, metadata=metadata,token_metadata=...
0
votes
1
answer
18
views
Error: Error in Scenario File "smartML/michelson_base/typing.ml", line 206, characters 27-33: Assertion failed
i was writing a HTLC contract and using a scenario when this error shows up: Error: Error in Scenario
File "smartML/michelson_base/typing.ml", line 206, characters 27-33: Assertion failed .
...
1
vote
1
answer
47
views
RLP decoding on tezos
I have a code where a string "TEST" is encoded using RLP,
https://smartpy.io/ide?cid=QmNVpo55Ss43aZiyrkdbEWcmmQEAsR2qHLKsPcLbqie7yu&k=8d516a673d972f3204f0
How do we decode the obtained ...
2
votes
1
answer
45
views
Smartpy 0.18.0 FA2 template
I am looking for the FA2 template with the new syntax in version 0.18.0 and above in smartpy.
Is there something already available as the token template in the smartpy template are using old version.
...
1
vote
1
answer
127
views
Problem when deploying smart contract
I've been trying to create a smart contract on the Tezos blockchain for several times.
I was never able to create a smart contract on this blockchain because of this error.
I use the code that is in ...
1
vote
1
answer
125
views
Error in Inter contract call from a contract to quipuswap dex2 contracts swap entrypoint
I have written smartpy code to call an entrypoint swap on quipuswap dex v2 smart contract.
Here is the code for that
@sp.entry_point
def swap_tokens(self, amount_in, min_amount_out, direction):...
1
vote
1
answer
29
views
Unable to fetch view `get_swap_min_res` from quipuswap v2 pool using smartpy
I was trying to use views in the v2 contract of quipuswap. This is my code.
But getting the error while executing.
Can someone spot where I am going wrong?
Code:
@sp.entry_point
def ...
0
votes
0
answers
57
views
Need help on translating code to convert packed address to string
There is a code on this link (https://tezos.stackexchange.com/a/5908/8795) that decodes a packed address using code that is taken from PyTezos .
I am trying to achieve the same using smartpy inside a ...
0
votes
1
answer
58
views
big endian order in smartpy
def tb(l):
return b''.join(map(lambda x: x.to_bytes(1, 'big'), l))
The above function takes a list of number and is being converted into bytes,
and the returned value is used this way,
base58....
1
vote
1
answer
35
views
Do we have allowance() method like solidity in smartpy?
I need to implement allowance() function of Solidity, how can we achieve it in SmartPy?
0
votes
1
answer
38
views
How to get XTZ balance of a address?
I want to read available tezos balance of a given address. How do we achieve this in smartpy?
Also do we have allowance() method like solidity in smartpy?
1
vote
2
answers
35
views
Data type mismatch
I have two codes,
Utils = sp.io.import_script_from_url("https://raw.githubusercontent.com/RomarQ/tezos-sc-utils/main/smartpy/utils.py")
sp.len(sp.bytes("0x0001"))
Utils.Int....
0
votes
2
answers
19
views
How to implement a simple hashlock contract with initial commit of a sha256 hash of a password string
Im trying to implement a simple hashlock contract where I initially commit a sha256 hash of a password string and an address of the target receiver.
The contract compiles and tests work (since for ...
0
votes
1
answer
63
views
Calculation complex mathematical expressions in smartpy like ln, log, etc
I want to calculate complex mathematical expressions such as ln(94) in smartpy.
How can this be done?
0
votes
2
answers
68
views
TezosOperationError: (permanent) proto.016-PtMumbai.michelson_v1.bad_stack
I am getting following issues:
compilation warning: [warning] Error in generated Michelson contract: previous error
deployment error: "TezosOperationError: (permanent) proto.016-PtMumbai....
0
votes
2
answers
68
views
Decoding sp.pack("address") outside of chain
I have a question ,
While packing the string, "KT1FRoFxDhnKXGPggejHPAnMs27j6rcVfwzV",
the output is 0501000000244b543146526f467844686e4b5847506767656a4850416e4d7332376a3672635666777a56
this ...
-1
votes
2
answers
24
views
sp.if: cannot unify branches
I am getting "sp.if: cannot unify branches" error from a onchain view method. Below is the code snippet.
Full error msg: [error] Type Error
sp.TRecord(
locked_balance = sp.TNat,
...
0
votes
3
answers
140
views
Conversion of address to bytes
I converted contract address to bytes using pack ,
and the result is this
050a00000016014b168ccb96310249aade4ce010e4e2ec8dd4602900
pasting this on online byte to string tool shows an error Invalid UTF-...
1
vote
1
answer
34
views
RLP related question
I am trying to translate solidity code in smartpy .
bytes memory rlpBytes;
rlpBytes = abi.encodePacked(rlpBytes, _link.encodeString());
rlpBytes = abi.encodePacked(
rlpBytes.length.addLength(false),
...
1
vote
1
answer
52
views
Writing SmartPy tests along with LIGO contracts
I have a set of smart contracts coded in SmartPy. They are heavily interdependent and some of them also interact with cTez contracts.
I need to write SmartPy tests to check if everything is working ...
1
vote
1
answer
77
views
Tracking gas consumption by an entrypoint in smartpy during tests
I want to check how much gas an entrypoint consumes when we perform a transaction when writing tests in smartpy.
How can this be done?
Smartpy documentation too doesn't have anything that can help.
0
votes
1
answer
76
views
Concat Address to String in smartpy
My use case is, I need to concat address with string this way,
"ab" + sp.self_address + "cd" .
How to achieve this in smartpy ?