Voy a iniciar una preventa de tokens y quiero poder enviar los tokens al comprador pero evitar que el comprador envíe tokens a otra billetera.
Intenté lo siguiente en mi contrato inteligente ERC20, pero en realidad me impidió a mí mismo, el creador del contrato, transferir tokens. Necesito poder enviar tokens a los compradores y evitar que los compradores transfieran tokens hasta cierto momento en el futuro.
aquí está el contrato de contrato inteligente de prueba: https://etherscan.io/address/0x5783f4e4a1bec72f41f246c50ba3d06265d984a6#code
función de transferencia (dirección _a, uint _valor) public { require( now > 1514764800 ); /* Resto de la función */ }
Puedes hacerlo.
modifier notPaused {
require(now > 1514764800 || msg.sender == owner);
_;
}
function transfer(address to, uint256 amount) public notPaused returns(bool) {
//rest of function
}
//this is where you declare the identifier owner
address owner;
//whith this modifier, only you can call the transfer function
//when now <= 1514764800.
modifier notPaused{
require(now > 1514764800 || msg.sender == owner);
_;
}
//the identifier owner is initialized once the contract is deployed and
//set to the address of the message sender. Note that this should be in
//the constructor of the contract, which is always the function with the
//same name as the contract.
function ERC20Token() {
owner = msg.sender;
//rest of constructor
}
//by adding notPaused here, the function will only successfully execute when
//A: you the owner call the function before or after the block 1514764800 or
//B: when anyone else calls the the function after the block 1514764800
function transfer(address to, uint256 amount) public notPaused returns (bool) {
//rest of function
}
mikko ohtamaa