4

I've been trying to write a token contract with the autorefill function, but perhaps the code for the token example on the ethereum website is somewhat outdated, because it isn't working.

Did anybody get Autorefill working? Could someone with Solidity experience simply copy and paste the "Improved Coin" code and include the Autorefill?

There's 2 types of Autorefill, the first one I've managed to include and compile successfully, but it doesn't seems to work on transactions, and the second one, which the fee is paid forward to the receiver, I couldn't get to compile at all.

I'm testing on a exact copy of "Improved Coin" on Rinkeby testnet. And i'm aware that the function is triggered when the sender's balance gets below a threshold defined by "minBalanceAccount", which I set as 5 finney, and that it takes away Ether from the contract's balance. Still, it never gets triggered.

Here are the steps i've tried:

  1. After creating contract and wallets, transfer 1 token from owner to contract
  2. Set buy and sell price to 1000000000000000000 wei (1 ETH)
  3. Buy the 1 token back from the contract, which now receives 1 ETH
  4. Set minimum balance to 5 finney (0.005 ETH)
  5. Transfered a few tokens to several test wallets, which some have more ether than the set minimum (e.g: 0.1 ether), some with the exact minimum, some with below minimum (e.g: 0.004 ether)
  6. Tried some transactions between them, Autorefill never got triggered, even when the conditions are met
  • Autorefill is not even present in "Improved Coin's" transfer method code. – Maciek Łoziński Dec 18 '18 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.