New answers tagged

0

Zero knowledge proofs do take us closer to privacy on public chains. For example see the tornado cash project https://tornado.cash/ Gavin Andresen comments on it here: http://gavinandresen.ninja/private-thoughts It seems a pretty effective mixer if used carefully.


0

On ethereum blockchain it does not exist the possibility to transfer funds privately because all the blockchain is public by definition. Whatever mixing or obfuscation operation is easily reverse engineered by forensic analysis. Moreover it costs a lot in term of gas if you try to adopt algorithm like zsnark. For this reason no major application doing that ...


1

The statement escrow.originatorAddress.transfer(amount) can revert for either one of the following reasons: address(this).balance < amount escrow.originatorAddress is the address of a contract without a payable fallback function escrow.originatorAddress is the address of a contract with a payable fallback function which reverts when you execute the ...


0

Loom is EVM compatible so you can probably deploy the contract as is. Refer to this page for a quick overview on how to deploy to Extdev Testnet: https://loomx.io/developers/en/deploy-loom-testnet.html Transfer gateway is used to transfer tokens between chains, it's a different thing. This has details about transferring assets between Rinkeby and Extdev: ...


1

Since the resolution of ether is 18 decimals, but the resolution of an ERC20-token is not necessarily the same, you can use this: uint256 amount; uint8 decimals = ERC20Interface(token).decimals; if (decimals > 18) amount = _quantity * _tokenPrice / 10 ** (decimals - 18); else amount = _quantity * _tokenPrice * 10 ** (18 - decimals); Be sure to ...


0

You can only set the price of a token during its initial distribution phase (e.g. the crowdsale, ICO, etc.). Once the tokens have been initially sold, and they are out in the real world, then the price is set by supply and demand; you have no control. If you are currently writing your token distribution contract (this is separate to the ERC-20 contract ...


0

I think this is impossible, because the price is determined by traders on exchanges.


0

Use ERC1538: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1538.md That standard removes the max contract size limit.


0

You can use this function (tested with web3.js v1.2.1): const ABI = [{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]; async function send(web3, contractAddress, destAddress, ...


0

Change this: contract Cash To this: import './Cash.sol'; contract CashMockup is Cash And this var Cash = artifacts.require("./Cash.sol"); To this: var Cash = artifacts.require("CashMockup"); For future reference, keep in mind that while the Solidity's import statement imports one or more contracts by file-name, the Truffle's artifacts.require ...


2

There are several checks performed. Let me explain them one by one: if (frozen) return false; If all transfers are frozen now, just return false. if ((addressFlags [_from] | addressFlags [_to]) & BLACK_LIST_FLAG == BLACK_LIST_FLAG) return false; If either _from or _to is in black list, return false. _value <= allowances [_from][msg.sender] &...


2

The allowances variable (table) is the one controlling who can transfer from who and how much. This variable can be configured via function approve. For example, if you sign the transaction erc20Token.approve(myAccount, 100) with your private key and then send it to the blockchain, then the value of allowances[yourAccount][myAccount] in the erc20Token ...


0

It sounds like you've got some things mixed up. Let's start with a more abstract description of things. Consider the following two conceptual ways for you to hold money: You have N dollars in your wallet The bank has a record indicating that you own N dollars On the blockchain, whenever we say that user k has N tokens of type XXX, we mean that the ...


1

Slightly different to what you asked... (in that in the below we're querying an ERC-20 token contract to see if it contains a balance for a specific address). The following API will allow you to query an ERC-20 token contract (at a given address) for the balance associated with a particular account address. From https://etherscan.io/apis#tokens: https://...


0

Ok, I see @rob-hitchens-b9lab has answered the question beautifully while I was busy ;), so I'll give a short, cookbook answer of the steps I don't know what you're using but most people are familiar with Remix, so here are the steps in Remix: In the "Solidity Compiler" tab, create and compile an Erc20token.sol file : interface Erc20Token { function ...


1

A @Chan-Ho says, there is a transferFrom() in the buy function, and you said you didn't approve() first, so that is the first problem. This looks like the Token contract - AGI: erc20 = TOKEN(address(0x8eb24319393716668d768dcec29356ae9cffe285)); You have to call the approve() function there to "authorize" the snet contract to pull some tokens from your ...


0

The if statement below is failing in the transfer function of the LoanToken.sol contract if (_balances[msg.sender] >= amount && amount > 0) { This is failing because this function is being called from the problem2_bank.sol contract. For this reason msg.sender = the problem2_bank.sol contract's address rather than the address that was funded ...


0

Token transfers are not actually transfers of value at all. Only Ether transfers explicitly transfer (and contain) value. So a transaction transfers Ether if and only if its value field is non-zero. Detecting a token transfer is much more tricky. A token transfer is simply calling a function in a token contract. So first you need to know whether the ...


1

You could just deploy an ERC20 token with a name of Tether, then call the mint function to populate your wallet with tokens and pretend this is Tether for testing purposes. Here's an example: pragma solidity 0.5.7; pragma experimental ABIEncoderV2; import { ERC20 } from "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; contract MockTether is ERC20 {...


0

No, you will not consume less memory in the EVM. Per the ERC20 spec, decimals must be a uint8. Because of this, the actual decimals variable will always be the same cost. Additionally, you will not have any cost savings by storing variables of token values with a smaller decimals. In fact, it may even cost more to store a smaller value (such as uint128). ...


0

You can simply deploy them as separate contracts. On the "DEPLOY & RUN TRANSACTIONS" section of Remix, you can choose which contract you want to deploy, even if they are in the same file. When you have chosen your contract, simply hit "Deploy" on that same page. You can choose your network by specifying the "Environment" (on that same page) and ...


0

Not as a normal feature. You could make a contract for it. Users would have to be convinced to keep some of their money on deposit and you would implement the ERC20 interface. Alternatively, you could make a reserve-backed token and sale/buy-back contract offering a pegged 1:1 rate of exchange. Possibly neither of those solutions has any practical value. ...


0

It is not true that the limit is 1.46GB. A smart contract can theoretically store 2^256 words of 32 bytes. That is a ridiculously huge amount of data. The amount of data used by a smart contract that implements a token (ERC20) is really small. The amount of storage needed to register tokens of 200 Million users is 200 Million words of 32 bytes, which is ...


1

This is not erc721 standard this is erc20 standard function. For the etherscan to recognise your contract as erc72 your contract interface must implement the erc721 contract standard: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md. I don't see your safeTransfer function or ApprovalForAll event. The etherscan recognises your contract as erc20 ...


0

This design is inherently centralized and periodic distributions will not change that. Since the accounting is already in a mysql database it will not be a setback to continue that way. Present a function to request withdrawal on demand, and have the server send users their tokens when they ask for them. On the other hand, if a decentralized design is the ...


Top 50 recent answers are included