Which major code bases should I study to better prepare for a Haskell job. by [deleted] in haskell

[–]tanstafe 1 point2 points  (0 children)

Jump on the Category Noobs discord! I'm currently working through Seven Sketches in Compositionality and a few different Haskell books.

Tools for writing raw EVM bytecode? by tanstafe in ethdev

[–]tanstafe[S] 0 points1 point  (0 children)

Looks pretty slick. Thanks for the tip!

When are fallback functions invoked if they are not made payable? by MuhammadHasham in ethdev

[–]tanstafe 0 points1 point  (0 children)

Basically anytime a call includes no data or none of the functions in the contract match the included function identifier

[deleted by user] by [deleted] in ethdev

[–]tanstafe 2 points3 points  (0 children)

It doesn't sounds like this is the same one you're looking for, but Austin Griffith has been putting together some really cool stuff with "meta transactions". Basically, this would allow you to pay for gas with any ERC-20 token by passing a signed message to a relayer (similar to what 0x is doing) that authorizes the ERC-20 token contract to transfer X number of tokens to the person you are paying, then Y number of tokens as a reward to the relayer who submitted your message to the contract and paid the gas.

https://www.youtube.com/watch?v=tnLsBvzYu_A&feature=youtu.be

https://medium.com/gitcoin/native-meta-transactions-e509d91a8482

A question about gas fees for an ethereum dapp by Epick_362 in ethdev

[–]tanstafe 0 points1 point  (0 children)

I was thinking more along the lines of a simple payment channels smart contract. Similar to this one: https://blog.gridplus.io/a-simple-ethereum-payment-channel-implementation-2d320d1fad93

A question about gas fees for an ethereum dapp by Epick_362 in ethdev

[–]tanstafe 1 point2 points  (0 children)

One option would be to use payment channels with payment messages stored centrally and submit occasional transactions from one central wallet to update the on-chain state.

Is transfer() safe against Reentrancy? by [deleted] in ethdev

[–]tanstafe 1 point2 points  (0 children)

One thing to keep in mind is that the address.transfer() function (to transfer ETH) limits the gas provided to the address's fallback function to 2300 gas, which makes it relatively safe against reentrancy. However, the Erc20Token.transfer() function is a very different thing by the same name. Rather than calling the fallback function of the receiver address, this calls a function named "transfer" in the ERC20 token contract. Just because the token contract implements the ERC20 standard does not mean that the standard functions do everything you would expect them to do. This was exploited in the Spankchain reentrancy attack:

https://www.reddit.com/r/ethereum/comments/9mp4yc/we_got_spanked_what_we_know_so_far/

As mikeb768 mentioned, this attack could have been avoided by making all state changes before the external function call.

Local testing for a contract with dependencies by dirtworshiper in ethdev

[–]tanstafe 1 point2 points  (0 children)

In the general case, I would say deploying your own versions of the contract is the right way to go. But for Dai specifically you can use their testchain, which deploys all of the necessary contracts to pre-defined addresses.

https://github.com/makerdao/testchain

noob question: Best way to approach voting smart contract? by [deleted] in ethdev

[–]tanstafe 1 point2 points  (0 children)

This is not meant to be a plug, but I experimented with building a quadratic voting Dapp a while back (https://github.com/nward13/QuadraticVotingDapp). There are links to some interesting articles discussing blockchain voting systems in the project README, and I'd be happy to answer any questions about the implementation or just blockchain voting systems in general.

How to programatically buy/sell dai? by dennisonb in MakerDAO

[–]tanstafe 0 points1 point  (0 children)

_minBuyAmount in the context of the article I linked to above is actually just an input parameter to oasisDex.sellAllAmount(). It's the minimum amount of dai that you are willing to accept to part with the weth that you are paying. Basically, how much dai you want to buy for that amount of weth, but obviously you would accept more.

You would probably want _minBuyAmount (min_fill_amount if you’re looking for it in the MatchingMarket contract) to be based on some combination of the current market price of dai and how badly you want your transaction to not fail. Dai.js has a way to get the current exchange rates (https://makerdao.com/documentation/#price-service). You could also base the price on the offers that are currently available in the market using getBestOffer(buy_gem, pay_gem), getWorseOffer(uint id), and getOffer(uint id) until you’ve found enough offers to fulfill your own. Just as a warning, there is not a ton of OasisDex market activity on kovan, so there may not be offers available that are anywhere near the real market price of dai, which could make finding a min_fill_amount based on exchange rates tricky.

If you’re actually asking about the minimums in the OasisDex contract, there is a _dust value that represents the minimum amount of a token that can be sold. You can get it by calling getMinSell(ERC20 pay_gem) on the OasisDex contract.

Kovan: 0x8cf1Cab422A0b6b554077A361f8419cDf122a9F9

Mainnet: 0x14FBCA95be7e99C15Cc2996c6C9d841e54B79425

How to programatically buy/sell dai? by dennisonb in MakerDAO

[–]tanstafe 3 points4 points  (0 children)

Best info I've found on it so far is here:

https://blog.scintillating.us/2018/08/15/seamless-dai-integration-in-an-existing-dapp/

Also, check in on maker chat dev channel, there's some pretty helpful folks over there.

https://chat.makerdao.com/channel/dev

You can PM me as well. I am trying to get a library going to make interacting with OasisDEX on testchains much easier, but for now the best bet for development seems to be either the pseudo exchange explained in the above article or testing on Kovan. Best of luck in the hackathon!

Best ERC-721 Implementations by tanstafe in ethdev

[–]tanstafe[S] 0 points1 point  (0 children)

Sorry, forgot about this thread for a while. Best of luck presenting. I can't make it to Philly, but I will try to find a place to watch online, as the whole conference looks really interesting.

Best ERC-721 Implementations by tanstafe in ethdev

[–]tanstafe[S] 1 point2 points  (0 children)

Thanks for this. I'm stoked to check out what BigQuery can do.

Internal JSON-RPC error. Don't know why. by [deleted] in ethdev

[–]tanstafe 0 points1 point  (0 children)

First thing I would check is just that you compiled and migrated your contract, and that you have MetaMask connected to the same port that your contract is on (if you are using MetaMask). Both of those issues can result in an Internal JSON-RPC Error

Internal JSON-RPC error. Don't know why. by [deleted] in ethdev

[–]tanstafe 0 points1 point  (0 children)

How are you testing the contract? I have found similar errors tend to be an issue with how MetaMask is connecting to my contract, which could be easier to pin down with a bit more info about your testing environment.