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:
- After creating contract and wallets, transfer 1 token from owner to contract
- Set buy and sell price to 1000000000000000000 wei (1 ETH)
- Buy the 1 token back from the contract, which now receives 1 ETH
- Set minimum balance to 5 finney (0.005 ETH)
- 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)
- Tried some transactions between them, Autorefill never got triggered, even when the conditions are met
transfer
method code.