Jump to content

Ludo

Members
  • Posts

    9
  • Joined

  • Last visited

  • Days Won

    1

Ludo last won the day on August 11

Ludo had the most liked content!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Ludo's Achievements

Rookie

Rookie (2/14)

  • Reacting Well Rare
  • Week One Done
  • One Month Later Rare
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

3

Reputation

  1. To complete, the first times we retrieve the transaction from the network, the resulting calls may not be complete and the token identifier not present (if we retrieve the transaction status just after the transaction `awaitExecuted` call). Here is some code to handle that const snooze = ms => new Promise(resolve => setTimeout(resolve, ms)); export async function getTokenIdentifier(issueTxHash: TransactionHash, network: ProxyProvider, nbRetry = 10): Promise<string> { const issueTxOnNework = await network.getTransaction(issueTxHash, undefined, true); const resultingCalls = issueTxOnNework.getSmartContractResults().getResultingCalls(); const transferContractResult = resultingCalls.find( c => c.data.startsWith('ESDTTransfer@') ); if (!transferContractResult) { if (nbRetry <= 0) { console.log('token identifier not found', resultingCalls); throw new Error('token identifier not found'); } console.log('getTokenIdentifier retry'); await snooze(1000); return getTokenIdentifier(issueTxHash, network, nbRetry-1); } return transferContractResult.data.split('@')[1]; }
  2. Thanks a lot ! For those who may want to do the same thing, the following code seems to work (not very robust through, adding some error handling won't hurt) : export async function getTokenIdentifier(issueTxHash: TransactionHash, network: ProxyProvider): Promise<string> { const issueTxOnNework = await network.getTransaction(issueTxHash, undefined, true); return issueTxOnNework.getSmartContractResults().getResultingCalls()[0].data.split('@')[1]; }
  3. My bad, now it has appeared. It just seems to have taken a long time to appear (and not the same for every wallet).
  4. Hi ! I don't know if there is a place to report bugs either than this forum and I haven't seen if this issue is already knew. I transferred some ESDT token to the Heidi wallet, the transaction went well https://devnet-explorer.elrond.com/transactions/0b402c8cbabfbb64334d3afe8442fe7ba319b30964bdfcd7c3653f40cb03e443, but the token are not visible on the explorer https://devnet-explorer.elrond.com/accounts/erd1dc3yzxxeq69wvf583gw0h67td226gu2ahpk3k50qdgzzym8npltq7ndgha/tokens or on the wallet website (Heidi walllet is commited in your github project if you want to check). It seems to be because there is no EGLD on those account, because the same thing with Alice wallet works well. Have a great day !
  5. The link to the transaction doesn't seem to work (it goes to the post it self). Here it is again : https://devnet-explorer.elrond.com/transactions/5c8a46bedf88048768da6de865b296e74604c4badc88ea5e1a8295e7c5e20849
  6. Hi here, I wonder how I can retrieve the ESDT token identifier automatically through the erdjs sdk. What I mean is that I am issuing some ESDT token using something like : let tx = new Transaction({ receiver: new Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"), gasLimit: new GasLimit(60000000), value: Balance.egld(0.05), data: new TransactionPayload( "issue" + "@4d534c546f6b656e73" + // "MSLTokens" hex encoded "@4d534c" + // "MSL" hex encoded "@0f41dc" + // 999900 hex encoded (9999*10^2) "@02" // 2 decimals ), }); tx.setNonce(account.getNonceThenIncrement()); await signer.sign(tx); const transactionHash = await tx.send(network); await tx.awaitExecuted(network); Once the transaction is done, I am trying extract the token identifier that matches that transaction. I have understand how to retrieve it manually (for example in that transaction, the token identifier is `MSL-b55cd2`, we can found it (encoded in hex) in the data of the linked smartcontract). But I have failed to retrieve it through the erdjs sdk. I have tried to retrieve the TransactionOnNetwork from the transaction hash, but I haven't found the token identifier inside it. If some one knows how to do it, it will be a big help ! By the way, if you have a good way to encode the TransactionPayload for the esdt token issue transaction, I am also interested ! Have a good day !
  7. Thank you for the information, I'm happy to see that it is in the works. I wish you a great day !
  8. It won't be a big help but for those interested into decompiling the wasm code encoded in hexa and visible on the elrond explorer page, you can use "wabt" that can be installed on fedora with sudo dnf install wabt Then you can convert the hex string into a wasm binary file : cat contract.hex | xxd -r -p > contract.wasm And the wasm file into wat or c : wasm2wat contract.wasm > contract.wat wasm2c contract.wasm > contract.c But you will only get some code almost impossible to understand for a human. Just to give an idea, a small extract of the generated c code I got : static void w2c_f36(u32 w2c_p0, u32 w2c_p1, u32 w2c_p2) { u32 w2c_l3 = 0, w2c_l4 = 0, w2c_l5 = 0, w2c_l6 = 0; FUNC_PROLOGUE; u32 w2c_i0, w2c_i1, w2c_i2; w2c_i0 = w2c_g0; w2c_i1 = 16u; w2c_i0 -= w2c_i1; w2c_l3 = w2c_i0; w2c_g0 = w2c_i0; w2c_i0 = w2c_l3; w2c_i1 = 8u; w2c_i0 += w2c_i1; w2c_i1 = w2c_p1; w2c_i2 = w2c_p2; w2c_i1 = (*Z_envZ_storageLoadLengthZ_iii)(w2c_i1, w2c_i2); w2c_l4 = w2c_i1; w2c_f33(w2c_i0, w2c_i1); w2c_i0 = w2c_l3; w2c_i0 = i32_load((&w2c_memory), (u64)(w2c_i0) + 12u); w2c_l5 = w2c_i0; w2c_i0 = w2c_l3; w2c_i0 = i32_load((&w2c_memory), (u64)(w2c_i0) + 8u); w2c_l6 = w2c_i0; w2c_i0 = w2c_l4; w2c_i0 = !(w2c_i0); if (w2c_i0) {goto w2c_B0;} w2c_i0 = w2c_p1; w2c_i1 = w2c_p2; w2c_i2 = w2c_l6; w2c_i0 = (*Z_envZ_storageLoadZ_iiii)(w2c_i0, w2c_i1, w2c_i2); w2c_B0:; w2c_i0 = w2c_p0; w2c_i1 = w2c_l6; i32_store((&w2c_memory), (u64)(w2c_i0), w2c_i1); w2c_i0 = w2c_p0; w2c_i1 = w2c_l5; i32_store((&w2c_memory), (u64)(w2c_i0) + 4, w2c_i1); w2c_i0 = w2c_l3; w2c_i1 = 16u; w2c_i0 += w2c_i1; w2c_g0 = w2c_i0; FUNC_EPILOGUE; }
  9. Hi here ! I wonder how we can ensure our user what is the source code of a given smart contract so they can check it does what we say it does. For example here there is some example of smart contract we have deployed : https://testnet-explorer.elrond.com/accounts/erd1qqqqqqqqqqqqqpgqsw4h5wp8nq9ucq698qn204a63j8mn82v70psmztwrn/code We can see what seems to be the compiled bytecode of the smartcontract, but it's not human readable of course, so users won't be able to understand what our smartcontract does just with that. I don't know how exactly it works, but with ethereum, on etherscan you can see the source code and there is some flag to indicate that it matches the deployed contract : https://etherscan.io/address/0xd654b3967f1cbc7f7089af774850192bc917c8e7#code Is-there some similar mechanism with elrond ? or is-it planned in the future ? If not, what is the recommended when to prove your deployed contract does what you say ? Will the (dev experienced) users obtain the same bytecode if they compiled the contract on their side ? (if so they can potentially compare it with what is deployed ? Is there some decompiler that will take the compiled bytecode of a deployed smart contract and transform it into some assembly like language ? Thanks for your help !
×
×
  • Create New...