<commit_before>/*
    Contract Address: "0x2ba25711fa1f94998d875bf80acbc2cccdf9abbb"

    PokeCoinAddress:"0x037D274575fE52239BfeB4911A09Cc5cfCe0C9FD"
    PokemonsAdress:"0x13EccD104f4012F857a9cD32C1E4877275f78Cec"
    "0x037D274575fE52239BfeB4911A09Cc5cfCe0C9FD","0x13EccD104f4012F857a9cD32C1E4877275f78Cec"
    
    PokeSeller Address: "0xfFAe2A502A6142a00DBB54361E244ED55461C7Aa"
    PokeBuyer Address: "0xf09c7cbD8B7D27ac12e82b8bC6d8fe7EEfC9E7C8"
    Main Wallet: "0x6A5b342ec71DEF8aAc337b82969D9dDd811023C9"
    
*/


contract pokeCoin { mapping (address => uint256) public balanceOf; function transferFrom(address _from, address _to, uint256 _value){  } }
contract pokemon { mapping (uint256 => address) public pokemonToMaster; function transferPokemon(address _from, address _to, uint256 _pokemonID) {  } }

contract MarketPokemon {
    pokeCoin public pokeCoinDapp;
    pokemon public pokemonDapp;
    uint public totalPokemonSales;
    
    PokeSale[] public pokeSales;

    mapping (uint => bool) public pokeSelling;
    mapping (address => uint[]) public pokeMasterSelling;
    mapping (uint => uint) public pokeSaleIndex;
    
    struct PokeSale{
        address pokeSeller;
        address pokeBuyer;
        uint pokeID;
        uint pokePrice;
        bool pokeSold;
        bool pokeSellActive;
    }
    
    event NewSale(address pokeSellerAddress, uint pokemonID, uint pokemonSalePrice);
    event StopSale(address pokeSellerAddress, uint pokemonID);
    event PokeTrade(address pokeBuyerAddress, address pokeSellerAddress, uint pokemonID );
    event Log1(bool status);
    
    function MarketPokemon(pokeCoin pokeCoinAddress, pokemon pokeRepositoryAddress) {
        pokeCoinDapp = pokeCoin(pokeCoinAddress);
        pokemonDapp = pokemon(pokeRepositoryAddress);
        
    }
    
    function newSale(address pokeSellerAddress, uint pokemonID, uint pokemonSalePrice) returns (bool success){
        if (pokeSellerAddress != pokemonDapp.pokemonToMaster(pokemonID)) throw;
        if (pokeSelling[pokemonID]) throw;
        uint pokeSalesID = pokeSales.length++;
        PokeSale p = pokeSales[pokeSalesID];
        if (p.pokeSellActive) throw;
        p.pokeSeller = pokeSellerAddress;
        p.pokeID = pokemonID;
        p.pokePrice = pokemonSalePrice;
        p.pokeSold = false;
        p.pokeSellActive = true;
        
        pokeSelling[pokemonID] = true;
        pokeSaleIndex[pokemonID] = pokeSalesID;
        
        addPokemonToSellingList(pokeSellerAddress, pokemonID);
        
        totalPokemonSales+=1;
        
        NewSale(pokeSellerAddress, pokemonID, pokemonSalePrice);
        return (true);
    }
    
    function stopSale(address pokeSellerAddress, uint pokemonID){
        //if (pokeSellerAddress != pokemonDapp.pokemonToMaster(pokemonID)) throw;
        //if (!pokeSelling[pokemonID]) throw;
        
        uint pokeSalesID = pokeSaleIndex[pokemonID];
        PokeSale p = pokeSales[pokeSalesID];
        //if (!p.pokeSellActive) throw;
        p.pokeSellActive = false;
        pokeSelling[pokemonID] = false;
        
        delPokemonFromSellingList(pokeSellerAddress, pokemonID);

        totalPokemonSales-=1;
        
        StopSale(pokeSellerAddress, pokemonID);
    }
    
    function buyPokemon(address pokeBuyerAddress, uint pokemonID){
        //if (!pokeSelling[pokemonID]) throw;
        uint pokeSalesID = pokeSaleIndex[pokemonID];
        PokeSale p = pokeSales[pokeSalesID];
        //if (!p.pokeSellActive) throw;
        //if (pokeCoinDapp.balanceOf(pokeBuyerAddress) < p.pokePrice) throw;
        
        pokeCoinDapp.transferFrom(pokeBuyerAddress, p.pokeSeller, p.pokePrice);
        pokemonDapp.transferPokemon(p.pokeSeller, pokeBuyerAddress, pokemonID);
        p.pokeBuyer = pokeBuyerAddress;
        p.pokeSold = true;
        stopSale(p.pokeSeller,pokemonID);<commit_msg>Correcao de erro no stopselling<commit_after>/*
    Contract Address: "0x2ba25711fa1f94998d875bf80acbc2cccdf9abbb"

    PokeCoinAddress:"0x037D274575fE52239BfeB4911A09Cc5cfCe0C9FD"
    PokemonsAdress:"0x13EccD104f4012F857a9cD32C1E4877275f78Cec"
    "0x037D274575fE52239BfeB4911A09Cc5cfCe0C9FD","0x13EccD104f4012F857a9cD32C1E4877275f78Cec"
    
    PokeSeller Address: "0xfFAe2A502A6142a00DBB54361E244ED55461C7Aa"
    PokeBuyer Address: "0xf09c7cbD8B7D27ac12e82b8bC6d8fe7EEfC9E7C8"
    Main Wallet: "0x6A5b342ec71DEF8aAc337b82969D9dDd811023C9"
    
*/


contract pokeCoin { mapping (address => uint256) public balanceOf; function transferFrom(address _from, address _to, uint256 _value){  } }
contract pokemon { mapping (uint256 => address) public pokemonToMaster; function transferPokemon(address _from, address _to, uint256 _pokemonID) {  } }

contract MarketPokemon {
    pokeCoin public pokeCoinDapp;
    pokemon public pokemonDapp;
    uint public totalPokemonSales;
    
    PokeSale[] public pokeSales;

    mapping (uint => bool) public pokeSelling;
    mapping (address => uint[]) public pokeMasterSelling;
    mapping (uint => uint) public pokeSaleIndex;
    
    struct PokeSale{
        address pokeSeller;
        address pokeBuyer;
        uint pokeID;
        uint pokePrice;
        bool pokeSold;
        bool pokeSellActive;
    }
    
    event NewSale(address pokeSellerAddress, uint pokemonID, uint pokemonSalePrice);
    event StopSale(address pokeSellerAddress, uint pokemonID);
    event PokeTrade(address pokeBuyerAddress, address pokeSellerAddress, uint pokemonID );
    event Log1(bool status);
    
    function MarketPokemon(pokeCoin pokeCoinAddress, pokemon pokeRepositoryAddress) {
        pokeCoinDapp = pokeCoin(pokeCoinAddress);
        pokemonDapp = pokemon(pokeRepositoryAddress);
        
    }
    
    function newSale(address pokeSellerAddress, uint pokemonID, uint pokemonSalePrice) returns (bool success){
        if (pokeSellerAddress != pokemonDapp.pokemonToMaster(pokemonID)) throw;
        if (pokeSelling[pokemonID]) throw;
        uint pokeSalesID = pokeSales.length++;
        PokeSale p = pokeSales[pokeSalesID];
        if (p.pokeSellActive) throw;
        p.pokeSeller = pokeSellerAddress;
        p.pokeID = pokemonID;
        p.pokePrice = pokemonSalePrice;
        p.pokeSold = false;
        p.pokeSellActive = true;
        
        pokeSelling[pokemonID] = true;
        pokeSaleIndex[pokemonID] = pokeSalesID;
        
        addPokemonToSellingList(pokeSellerAddress, pokemonID);
        
        totalPokemonSales+=1;
        
        NewSale(pokeSellerAddress, pokemonID, pokemonSalePrice);
        return (true);
    }
    
    function stopSale(address pokeSellerAddress, uint pokemonID){
        if (pokeSellerAddress != pokemonDapp.pokemonToMaster(pokemonID)) throw;
        if (!pokeSelling[pokemonID]) throw;
        
        uint pokeSalesID = pokeSaleIndex[pokemonID];
        PokeSale p = pokeSales[pokeSalesID];
        if (!p.pokeSellActive) throw;
        p.pokeSellActive = false;
        pokeSelling[pokemonID] = false;
        
        delPokemonFromSellingList(pokeSellerAddress, pokemonID);

        totalPokemonSales-=1;
        
        StopSale(pokeSellerAddress, pokemonID);
    }
    
    function buyPokemon(address pokeBuyerAddress, uint pokemonID){
        if (!pokeSelling[pokemonID]) throw;
        uint pokeSalesID = pokeSaleIndex[pokemonID];
        PokeSale p = pokeSales[pokeSalesID];
        if (!p.pokeSellActive) throw;
        if (pokeCoinDapp.balanceOf(pokeBuyerAddress) < p.pokePrice) throw;
        
        pokeCoinDapp.transferFrom(pokeBuyerAddress, p.pokeSeller, p.pokePrice);
        pokemonDapp.transferPokemon(p.pokeSeller, pokeBuyerAddress, pokemonID);
        p.pokeBuyer = pokeBuyerAddress;
        p.pokeSold = true;
        
        stopSale(pokeBuyerAddress,pokemonID);
{'fraction_non_alphanumeric': 0.07813508975849154, 'fraction_numerical': 0.0526927547462224, 'mean_word_length': 3.2998334258745143, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4287335', 'n_tokens_mistral': 3056, 'n_tokens_neox': 2817, 'n_words': 459}