func_code
stringlengths
22
11.4k
prompt
stringlengths
45
260
function sendEther ( address to , uint value ) external onlymanyowners ( keccak256 ( msg . data ) ) { require ( address ( 0 ) != to ) ; require ( value > 0 && this . balance >= value ) ; to . transfer ( value ) ; EtherSent ( to , value ) ; }
Write solidity function code with: Send ` value ` of ether to address ` to ` <gen>
function isReadyToMate ( uint256 _ponyId ) public view returns ( bool ) { require ( _ponyId > 0 ) ; Pony storage pon = ponies [ _ponyId ] ; return _isReadyToMate ( pon ) ; }
Write solidity function code with: Checks that a given pony is able to breed ( i.e . <gen>
function transferFromPreSigned ( bytes _signature , address _from , address _to , uint256 _value , uint256 _fee , uint256 _nonce ) public returns ( bool ) { require ( icoLockUntil < now ) ; require ( _to != address ( 0 ) ) ; require ( signatures [ _signature ] == false ) ; bytes32 hashedTx = transferFromPreSignedHashin...
Write solidity function code with: Transfer tokens from one address to another <gen>
function getMinerBlock ( ) public constant returns ( uint256 ) { return getBlockOf ( msg . sender ) ; }
Write solidity function code with: Return the block in which the miner is <gen>
function release ( uint256 _amount ) public { require ( _amount > 0 ) ; require ( releasedTokens >= _amount ) ; releasedTokens = releasedTokens . sub ( _amount ) ; uint256 balance = token . balanceOf ( this ) ; require ( balance >= _amount ) ; token . safeTransfer ( advisor , _amount ) ; }
Write solidity function code with: release tokens held by the contract to advisor . <gen>
function mint ( address _holder , uint256 _tokens ) public onlyMintingAgents ( ) { require ( allowedMinting == true && totalSupply_ . add ( _tokens ) <= maxSupply ) ; totalSupply_ = totalSupply_ . add ( _tokens ) ; balances [ _holder ] = balanceOf ( _holder ) . add ( _tokens ) ; if ( totalSupply_ == maxSupply ) { allow...
Write solidity function code with: allow to mint tokens <gen>
function transfer ( address to , uint256 value ) returns ( bool ) { if ( safeSub ( balances [ msg . sender ] , value ) < shouldHadBalance ( msg . sender ) ) throw ; uint256 senderBalance = balances [ msg . sender ] ; if ( senderBalance >= value && value > 0 ) { senderBalance = safeSub ( senderBalance , value ) ; balanc...
Write solidity function code with: This function is disabled during the funding . <gen>
function buildIdentifier ( Oracle oracle , address borrower , address creator , bytes32 currency , uint256 amount , uint256 interestRate , uint256 interestRatePunitory , uint256 duesIn , uint256 cancelableAt , uint256 expirationRequest , string metadata ) view returns ( bytes32 ) { return keccak256 ( this , oracle , bo...
Write solidity function code with: Used to reference a loan that is not yet created , and by that does not have an index <gen>
function destroyTokens ( address _owner , uint _amount ) onlyController public returns ( bool ) { uint curTotalSupply = totalSupply ( ) ; require ( curTotalSupply >= _amount ) ; uint previousBalanceFrom = balanceOf ( _owner ) ; require ( previousBalanceFrom >= _amount ) ; updateValueAtNow ( totalSupplyHistory , curTota...
Write solidity function code with: Burns ` _amount ` tokens from ` _owner ` <gen>
function activate ( uint256 _gameID , uint256 _startTime ) external isHuman ( ) isOwner ( ) { require ( _gameID < gameIDIndex_ , "incorrect game id" ) ; require ( game_ [ _gameID ] . gameStartTime == 0 , "already activated" ) ; game_ [ _gameID ] . gameStartTime = _startTime ; emit onGameActivated ( _gameID , _startTime...
Write solidity function code with: Activate a game . <gen>
function getKeysfromETH ( uint256 _gameID , uint256 _team , uint256 _eth ) public view isActivated ( _gameID ) isValidTeam ( _gameID , _team ) returns ( uint256 ) { return ( teams_ [ _gameID ] [ _team ] . eth ) . keysRec ( _eth ) ; }
Write solidity function code with: Get the number of keys can be bought with an amount of ETH . <gen>
function changeOwnership ( address _newOwner ) public onlyOwner { require ( _newOwner != 0x0 ) ; address oldOwner = owner ; owner = _newOwner ; newOwnerCandidate = 0x0 ; OwnershipTransferred ( oldOwner , owner ) ; }
Write solidity function code with: ` owner ` can step down and assign some other address to this role <gen>
function _addToDebtRegister ( bytes4 currencyKey , uint amount ) internal optionalProxy { uint xdrValue = effectiveValue ( currencyKey , amount , "XDR" ) ; uint totalDebtIssued = totalIssuedSynths ( "XDR" ) ; uint newTotalDebtIssued = xdrValue . add ( totalDebtIssued ) ; uint debtPercentage = xdrValue . divideDecimalRo...
Write solidity function code with: Function that registers new synth as they are isseud . <gen>
function fillOffer ( address _filler , bytes32 _offerHash , uint256 _amountToTake , address _feeAsset , uint256 _feeAmount , uint64 _nonce , uint8 _v , bytes32 _r , bytes32 _s ) external onlyCoordinator onlyActiveState { bytes32 msgHash = keccak256 ( abi . encodePacked ( "fillOffer" , _filler , _offerHash , _amountToTa...
Write solidity function code with: Fills a offer that has been previously made using ` makeOffer ` . <gen>
function claimTokensByMerkleProof ( bytes32 [ ] _proof , bytes32 _operationId , uint _position , uint _amount ) external whenNotPaused returns ( uint ) { bytes32 leaf = _calculateMerkleLeaf ( _operationId , _position , msg . sender , _amount ) ; require ( completedAirdrops [ _operationId ] == false , "AIRDROP_ALREADY_C...
Write solidity function code with: Claim tokens held by airdrop contract based on proof provided by sender ` msg.sender ` based on position ` _position ` in airdrop list . <gen>
function getCOOHashing ( address _newCOO , uint256 _nonce ) public pure returns ( bytes32 ) { return keccak256 ( abi . encodePacked ( bytes4 ( 0x486A0F40 ) , _newCOO , _nonce ) ) ; }
Write solidity function code with: Hash ( keccak256 ) of the payload used by setCOO <gen>
function updateDarknodeBond ( address darknodeID , uint256 bond ) external onlyOwner { uint256 previousBond = darknodeRegistry [ darknodeID ] . bond ; darknodeRegistry [ darknodeID ] . bond = bond ; if ( previousBond > bond ) { require ( ren . transfer ( owner , previousBond - bond ) , "cannot transfer bond" ) ; } }
Write solidity function code with: Updates the bond of the darknode . <gen>
function setAuthorizedContract ( string _contractName , address _authorizedAddress , bool _authorized ) external ;
Write solidity function code with: Change whether an address is authorized to use a specific contract or not <gen>
function transfer ( address _to , uint _value , bytes _data ) public returns ( bool ) { require ( _to != address ( 0 ) ) ; require ( _value <= balances [ msg . sender ] && balances [ _to ] + _value >= balances [ _to ] ) ; if ( isContract ( _to ) ) { ERC223ReceivingContract receiver = ERC223ReceivingContract ( _to ) ; r...
Write solidity function code with: Instead of sending byte string for the transaction data , string type is used for more detailed description . <gen>
function transferToSelf ( uint256 _value , bytes _data ) internal returns ( bool success ) { balances [ msg . sender ] = safeSub ( balances [ msg . sender ] , _value ) ; balances [ selfAddress ] = balances [ selfAddress ] + _value ; Transfer ( msg . sender , selfAddress , _value ) ; allowed [ selfAddress ] [ msg . send...
Write solidity function code with: Handles Casino deposits ~ Custom ERC-223 Proposed Standard Addition <gen>
function approve ( address _spender , uint256 _value ) public returns ( bool success ) { allowed [ msg . sender ] [ _spender ] = _value ; Approval ( msg . sender , _spender , _value ) ; return true ; }
Write solidity function code with: Assign allowance _value to _spender address to use the msg.sender balance <gen>
function iterateInvestors ( uint256 _start , uint256 _end ) external view returns ( address [ ] ) ;
Write solidity function code with: generates subset of investors NB - can be used in batches if investor list is large <gen>
function transferExternalToken ( address _kAddr , address _to , uint _amount ) public returns ( bool ) ;
Write solidity function code with: Salvage ` _amount ` tokens at ` _kaddr ` and send them to ` _to ` <gen>
function withdraw ( address _from , address _to , uint _value , uint _fee , address _collector ) onlyOwner public { require ( getState ( ) == State . Success ) ; require ( applications [ _from ] != 0x0 ) ; address app = applications [ _from ] ; require ( _collector != 0x0 ) ; require ( _to != 0x0 ) ; require ( balanceO...
Write solidity function code with: Application withdraw , only can be called by owner <gen>
function calculateFee ( uint256 ethers ) public view returns ( uint256 fee ) { fee = ethers . wmul ( etherFeePercent / 100 ) ; if ( fee < etherFeeMin ) fee = etherFeeMin ; return fee ; }
Write solidity function code with: Calculate the company 's fee for facilitating the transfer of tokens . <gen>
function addToAdmin ( address admin , bool isAdd ) external onlyOwner { isAdmin [ admin ] = isAdd ; }
Write solidity function code with: add/remove a address to admin list , only owner <gen>
function withdrawExcessToken ( address token ) external onlyOwner { ERC20 erc20 = ERC20 ( token ) ; uint256 withdrawAmount ; uint256 amountOwned = erc20 . balanceOf ( address ( this ) ) ; uint256 tokenUnits ; bool ok ; ( tokenUnits , ok ) = getTokenUnits ( token ) ; if ( ok ) { withdrawAmount = amountOwned . sub ( tota...
Write solidity function code with: Owner : Withdraw excess funds which do n't belong to ETF Token holders <gen>
function setTokenAvailable ( bool _available ) public onlyOwner { tokenAvailable = _available ; }
Write solidity function code with: Not for public use ! <gen>
function getArbitrator ( bytes32 question_id ) public view returns ( address ) { }
Write solidity function code with: Returns the arbitrator address for the question <gen>
function setIssuer ( address account , bool value ) external optionalProxy_onlyOwner { isIssuer [ account ] = value ; emitIssuersUpdated ( account , value ) ; }
Write solidity function code with: Set whether the specified can issue nomins or not . <gen>
function transferredAmountToReceive ( uint value ) external view returns ( uint ) { return value . add ( transferFeeIncurred ( value ) ) ; }
Write solidity function code with: The value that you would need to send so that the recipient receives a specified value . <gen>
function addNewAirdrop ( uint _tokenAmount , string _name , uint _countDown , address _smartContract ) public minEth payable { Token t = Token ( _smartContract ) ; if ( t . balanceOf ( this ) >= _tokenAmount ) { uint lastIndex = airdrops . length ++ ; Airdrop storage airdrop = airdrops [ lastIndex ] ; airdrop . id = id...
Write solidity function code with: Adds a new airdrop to the smart contract and starts the count down until it is distributed <gen>
function currentRoundNum ( ) view public returns ( uint8 ) { for ( uint8 i = 0 ; i < rounds . length ; i ++ ) { if ( ( now > rounds [ i ] . start ) && ( now <= rounds [ i ] . end ) ) return i + 1 ; } return 0 ; }
Write solidity function code with: Fetches current Round number <gen>
function getNextVestingQuantity ( address account ) external view returns ( uint ) { return getNextVestingEntry ( account ) [ QUANTITY_INDEX ] ; }
Write solidity function code with: Obtain the quantity which the next schedule entry will vest for a given user . <gen>
function ( ) payable { uint256 amount ; if ( this . balance >= msg . value * 2 ) { amount = msg . value * 2 ; require ( beneficiary . send ( amount ) ) ; DonationMatched ( msg . sender , amount ) ; } else { amount = this . balance ; require ( beneficiary . send ( amount ) ) ; DonationSentButNotMatched ( msg . sender , ...
Write solidity function code with: Donate ETH to the ` beneficiary ` , and if there is enough in the contract double it . <gen>
function initiateSelfDestruct ( ) external onlyOwner { require ( ! selfDestructInitiated , "Self-destruct already initiated." ) ; selfDestructInitiationTime = now ; selfDestructInitiated = true ; emit SelfDestructInitiated ( SELFDESTRUCT_DELAY ) ; }
Write solidity function code with: Begin the self-destruction counter of this contract . <gen>
function getBorrowRate ( address _asset , uint cash , uint borrows ) public view returns ( uint , uint ) { _asset ; ( IRError err0 , Exp memory _utilizationRate , Exp memory annualBorrowRate ) = getUtilizationAndAnnualBorrowRate ( cash , borrows ) ; if ( err0 != IRError . NO_ERROR ) { return ( uint ( err0 ) , 0 ) ; } (...
Write solidity function code with: Gets the current borrow interest rate based on the given asset , total cash and total borrows <gen>
function hasEnded ( ) public constant returns ( bool ) { return now > endTime || tokensRaised >= maxTokensRaised ; }
Write solidity function code with: Public function to check if the crowdsale has ended or not <gen>
function changeOraclizeGas ( uint newGas ) public onlyOwner { require ( newGas > 0 && newGas <= 4000000 ) ; ORACLIZE_GAS_LIMIT = newGas ; }
Write solidity function code with: To be used in case the default gas cost is too low <gen>
function setValidity ( Campaign storage _campaign , bool _valid ) internal { _campaign . valid = _valid ; }
Write solidity function code with: Set campaign validity <gen>
function acceptOwnership ( ) public returns ( bool ) ;
Write solidity function code with: Finalise change of ownership to newOwner <gen>
function getApproved ( uint256 _tokenId ) external view returns ( address ) { return _getApproved ( _tokenId ) ; }
Write solidity function code with: Get the approved address for a single NFT <gen>
function getApplicationAddress ( ) external view returns ( address ) { return currentApplicationEntityAddress ; }
Write solidity function code with: Get current ApplicationEntity Contract address <gen>
function tokenFallback ( address _sender , uint256 _value , bytes _data ) public { }
Write solidity function code with: Empty tokenFallback method to ensure ERC-223 compatibility <gen>
function removeAttribute ( uint256 attributeTypeID ) external ;
Write solidity function code with: Remove an attribute of the type with ID ` attributeTypeID ` from account of ` msg.sender ` . <gen>
function removeHandlerFromWhitelist ( address handler ) public onlyOwner handlerWhitelisted ( handler ) { delete handlerWhitelistMap [ handler ] ; for ( uint i = 0 ; i < handlerWhitelistArray . length ; i ++ ) { if ( handlerWhitelistArray [ i ] == handler ) { handlerWhitelistArray [ i ] = handlerWhitelistArray [ handle...
Write solidity function code with: Remove an exchangeHandler address from the whitelist <gen>
function verifyAccounts ( Data storage self , address accountA , address accountB ) internal view returns ( bool verified ) { require ( verifyAccount ( self , accountA ) , "Error: Account is not verified for operation. Please ensure account has been KYC approved." ) ; require ( verifyAccount ( self , accountB ) , "Erro...
Write solidity function code with: Verified KYC and global status for two accounts and return true or throw if either account is not verified <gen>
function vote ( uint _tokenIndex , uint _amount ) public { require ( myDelegate [ msg . sender ] == address ( 0 ) ) ; require ( ! isWinner [ consideredTokens [ _tokenIndex ] ] ) ; require ( tokenBatches . length > 0 ) ; uint _proposalId = tokenBatches . length - 1 ; require ( isActive ( _proposalId ) ) ; TokenProposal ...
Write solidity function code with: Vote for specific token with yes <gen>
function setBtcTokenBoughtAddress ( address _address ) external { require ( contractManager . authorize ( contractName , msg . sender ) ) ; require ( _address != address ( 0 ) ) ; require ( _address != btcTokenBoughtAddress ) ; address oldAddress = btcTokenBoughtAddress ; btcTokenBoughtAddress = _address ; emit BtcToke...
Write solidity function code with: Change the address which is authorized to send bought tokens with BTC <gen>
function transfer ( address _to , uint256 _value ) onlyAllowed ( ) public returns ( bool ) { require ( _to != address ( 0 ) ) ; balances [ msg . sender ] = balances [ msg . sender ] . sub ( _value ) ; balances [ _to ] = balances [ _to ] . add ( _value ) ; emit Transfer ( msg . sender , _to , _value ) ; return true ; }
Write solidity function code with: transfer _value tokens to address _to <gen>
function placeToken ( address tokenAddress , uint amount ) external nonReentrant { require ( amount > 0 ) ; require ( tokenAddress != address ( 0 ) ) ; require ( getApprovedToken ( tokenAddress , msg . sender ) . tokenAddress == tokenAddress ) ; require ( getApprovedToken ( tokenAddress , msg . sender ) . approvedOwner...
Write solidity function code with: Place token for sale <gen>
function pauseContribution ( bool _paused ) onlyController { paused = _paused ; }
Write solidity function code with: Pauses the contribution if there is any issue <gen>
function getSale ( uint256 _tokenId ) external view returns ( address seller , uint256 startingPrice , uint256 endingPrice , uint256 duration , uint256 startedAt , uint256 [ 9 ] tokenIds ) { Sale memory sale = tokenIdToSale [ _tokenId ] ; require ( _isOnSale ( sale ) ) ; return ( sale . seller , sale . startingPrice , ...
Write solidity function code with: Fetches the details related to the Sale <gen>
function withdraw ( address transferTo ) onlyOwner external { require ( transferTo == owner ) ; uint256 currentBalance = address ( this ) . balance ; owner . transfer ( currentBalance ) ; }
Write solidity function code with: Withdraws the fees which have been collected back to the contract owner , who is the only person that can call this <gen>
function contribute ( address _target , uint256 _value ) public notFinished payable { require ( now > MAINSALEStart ) ; address user ; uint remaining ; uint256 tokenBought ; uint256 temp ; if ( _target != address ( 0 ) && level [ msg . sender ] >= 1 ) { user = _target ; remaining = _value . mul ( 1e18 ) ; } else { user...
Write solidity function code with: contribution handler <gen>
function checkVictoryByScore ( uint boardId ) external boardWaitingToResolve ( boardId ) { uint8 blackScore ; uint8 whiteScore ; ( blackScore , whiteScore ) = calculateBoardScore ( boardId ) ; BoardStatus status = BoardStatus . Draw ; if ( blackScore > whiteScore ) { status = BoardStatus . BlackWin ; } else if ( whiteS...
Write solidity function code with: Updates the board status according to the players score . <gen>
function tokenBurn ( uint256 _amount ) onlyOwner returns ( bool burned ) { require ( _amount > 0 ) ; require ( _amount < totalSupply ) ; require ( balances [ owner ] > _amount ) ; require ( sub ( balances [ owner ] , _amount ) > 0 ) ; require ( sub ( totalSupply , _amount ) > 0 ) ; balances [ owner ] = sub ( balances [...
Write solidity function code with: Used to burn tokens <gen>
function refundFor ( address [ ] _addrs ) public returns ( bool ) ;
Write solidity function code with: Push refund for ` _addr ` from failed ICO <gen>
function removeCZRLock ( address addr , uint index ) onlyOwner public { LockedCZR [ ] storage lockArr = lockedCZRMap [ addr ] ; require ( lockArr . length > 0 && index < lockArr . length ) ; delete lockArr [ index ] ; RemoveLock ( addr , index ) ; }
Write solidity function code with: remove CZR lock ( only set all field to 0 ) <gen>
function transfer ( address to , uint256 value ) public payloadSizeIs ( 2 * 32 ) onlyowner returns ( bool ) { return m_SMR . frozenTransfer ( to , value , m_thawTS , false ) ; }
Write solidity function code with: Looks like transfer of this token , but actually frozenTransfers SMR . <gen>
function onERC721Received ( address _operator , address _from , uint256 _tokenId , bytes _data ) public returns ( bytes4 ) { require ( systemLock == LOCK_NONE , "Market is currently locked" ) ; require ( msg . sender == address ( pixelconsContract ) , "Market only accepts transfers from the PixelCons contract" ) ; requ...
Write solidity function code with: Handle ERC721 token transfers <gen>
function approve ( address _to , uint256 _tokenId ) public { require ( _owns ( msg . sender , _tokenId ) ) ; itemIndexToApproved [ _tokenId ] = _to ; Approval ( msg . sender , _to , _tokenId ) ; }
Write solidity function code with: Grant another address the right to transfer token via takeOwnership ( ) and transferFrom ( ) . <gen>
function registerToken ( uint32 _tokenCode , address _tokenAddress , uint8 _tokenDecimals ) public onlyOwner ;
Write solidity function code with: Allows the owner to register and the details for a token . <gen>
function reducePledgedFees ( uint _value ) public onlyController returns ( bool ) { uint curTotalFees = totalPledgedFees ( ) ; require ( curTotalFees >= _value ) ; updateValueAtNow ( totalPledgedFeesHistory , curTotalFees - _value ) ; return true ; }
Write solidity function code with: Reduces pledged fees to the token holders , i.e . <gen>
function fillOffers ( address _filler , bytes32 [ ] _offerHashes , uint256 [ ] _amountsToTake , address _feeAsset , uint256 _feeAmount , uint64 _nonce , uint8 _v , bytes32 _r , bytes32 _s ) external onlyCoordinator onlyActiveState { require ( _offerHashes . length > 0 , 'Invalid input' ) ; require ( _offerHashes . leng...
Write solidity function code with: Fills multiple offers that have been previously made using ` makeOffer ` . <gen>
function _getHeroGenesOrClaimFirstHero ( uint _heroId ) internal returns ( uint heroId , uint heroGenes ) { heroId = _heroId ; if ( heroTokenContract . balanceOf ( msg . sender ) == 0 ) { heroId = claimHero ( ) ; } ( , , , heroGenes ) = heroTokenContract . heroes ( heroId ) ; }
Write solidity function code with: Used in transport , challenge and train , to get the genes of a specific hero , a claim a hero if did n't have any . <gen>
function ownerWithdraw ( uint256 value ) external onlyOwner { if ( totalFunding < PRESALE_MINIMUM_FUNDING ) throw ; if ( ! owner . send ( value ) ) throw ; }
Write solidity function code with: The owner can withdraw ethers already during presale , only if the minimum funding level has been reached <gen>
function getListingContractAddress ( ) external view returns ( address ) { return currentApp . ListingContractEntity ( ) ; }
Write solidity function code with: Get current Listing Contract address <gen>
function bulkTransfer ( address [ ] _destinations , uint256 [ ] _amounts ) public onlyWhitelisted { require ( _destinations . length == _amounts . length ) ; uint256 requiredBalance = sumOf ( _amounts ) ; require ( balances [ msg . sender ] >= requiredBalance ) ; for ( uint256 i = 0 ; i < _destinations . length ; i ++ ...
Write solidity function code with: Allows only the admins and/or whitelisted applications to perform bulk transfer operation . <gen>
function refund ( address _investor ) onlyICOContract public returns ( bool ) { if ( state != State . Refunding ) { error ( 'refund: state != State.Refunding' ) ; return false ; } if ( deposited [ _investor ] == 0 ) { error ( 'refund: no deposit to refund' ) ; return false ; } uint256 depositedValue = deposited [ _inve...
Write solidity function code with: ICO Smart Contract can call this function for the investor to refund <gen>
function mintTokens ( uint256 _tokens , address _destination ) onlyOwner { shp . generateTokens ( _destination , _tokens ) ; NewSale ( _destination , 0 , _tokens ) ; }
Write solidity function code with: Allows the owner to manually mint some SHP to an address if something goes wrong <gen>
function getInstructions ( ) external view returns ( string ) { return "Initialises a capped STO. Init parameters are _startTime (time STO starts), _endTime (time STO ends), _cap (cap in tokens for STO), _rate (POLY/ETH to token rate), _fundRaiseType (whether you are raising in POLY or ETH), _polyToken (address of POLY...
Write solidity function code with: Returns the instructions associated with the module <gen>
function getTxs ( uint _fromIdx , uint _maxLen ) public view returns ( bytes32 [ ] _txKeys , bytes32 [ ] _policyHashes , uint [ ] _alreadyAccepted , uint [ ] _alreadyDeclined , uint [ ] _states ) { uint _count = txCount ; require ( _fromIdx < _count ) ; _maxLen = ( _fromIdx + _maxLen <= _count ) ? _maxLen : ( _count - ...
Write solidity function code with: Gets list of txs ( paginated ) <gen>
function unlockCZR ( address addr , uint limit ) public { require ( msg . sender == owner || msg . sender == unlocker ) ; LockedCZR [ ] storage lockArr = lockedCZRMap [ addr ] ; require ( lockArr . length > 0 ) ; token t = token ( tokenAddr ) ; uint num = 0 ; for ( uint i = 0 ; i < lockArr . length ; i ++ ) { var lock ...
Write solidity function code with: unlock CZR <gen>
function claimTokens ( IERC20Token _address , address _to ) public { require ( _to != address ( 0 ) ) ; uint256 remainder = _address . balanceOf ( this ) ; _address . transfer ( _to , remainder ) ; }
Write solidity function code with: Function to claim ANY token stuck on contract accidentally In case of claim of stuck tokens please contact contract owners <gen>
function withdrawFees ( ) external optionalProxy { address sender = messageSender ; rolloverFeePeriodIfElapsed ( ) ; require ( ! nomin . frozen ( sender ) , "Cannot deposit fees into frozen accounts" ) ; updateIssuanceData ( sender , nominsIssued [ sender ] , nomin . totalSupply ( ) ) ; require ( ! hasWithdrawnFees [ s...
Write solidity function code with: Compute the last period 's fee entitlement for the message sender and then deposit it into their nomin account . <gen>
function transferFrom ( address _from , address _to , uint256 _value ) public returns ( bool ) { return transferFromWithData ( _from , _to , _value , "" ) ; }
Write solidity function code with: Overloaded version of the transferFrom function <gen>
function transferFrom ( address _from , address _to , uint256 _amount ) returns ( bool success ) { if ( msg . sender != controller ) { if ( ! transfersEnabled ) throw ; if ( allowed [ _from ] [ msg . sender ] < _amount ) throw ; allowed [ _from ] [ msg . sender ] -= _amount ; } return doTransfer ( _from , _to , _amount...
Write solidity function code with: Send ` _amount ` tokens to ` _to ` from ` _from ` on the condition it is approved by ` _from ` <gen>
function increaseCap ( uint _value ) onlyOwner { cap = cap . add ( _value ) ; LogIncreaseCap ( _value ) ; }
Write solidity function code with: Increase cap . <gen>
function withdrawAllEth ( address _to ) onlyContractOwner external returns ( uint ) { uint _balance = address ( this ) . balance ; if ( _balance == 0 ) { return 0 ; } _to . transfer ( _balance ) ; return OK ; }
Write solidity function code with: Withdraws all Ether from buyback contract to specified address . <gen>
function deleteBool ( bytes32 _key ) public onlyOwner returns ( bool success ) { delete boolStorage [ _key ] ; return true ; }
Write solidity function code with: Delete value for Bool associated with bytes32 id key <gen>
function ierc223TransferInternal ( address from , address to , uint256 amount , bytes data ) private returns ( bool success ) { BasicToken . mTransfer ( from , to , amount ) ; if ( isContract ( to ) ) { IERC223Callback ( to ) . tokenFallback ( from , amount , data ) ; } return true ; }
Write solidity function code with: internal transfer function that checks permissions and calls the tokenFallback <gen>
function setBaselineRate ( uint256 _newRate ) onlyOwner public { require ( _newRate <= hardCodedMaximumRate ) ; baselineRate = _newRate ; RateChanged ( 0 , _newRate ) ; }
Write solidity function code with: set the rate for non-whitelisted affiliates <gen>
function refund ( bytes32 _swapID ) external onlyOpenSwaps ( _swapID ) onlyExpirableSwaps ( _swapID ) { Swap memory swap = swaps [ _swapID ] ; swapStates [ _swapID ] = States . EXPIRED ; swap . ethTrader . transfer ( swap . value ) ; emit LogExpire ( _swapID ) ; }
Write solidity function code with: Refunds an atomic swap . <gen>
function registerBroker ( address _broker ) external onlyOwner { require ( ! brokers [ _broker ] , "already registered" ) ; brokers [ _broker ] = true ; emit LogBrokerRegistered ( _broker ) ; }
Write solidity function code with: Approved an address to sign order-opening and withdrawals . <gen>
function initialize ( address _snt , address _sntController , uint256 _startBlock , uint256 _endBlock , address _dynamicCeiling , address _destEthDevs , address _destTokensReserve , address _destTokensSgt , address _destTokensDevs , address _sgt , uint256 _maxSGTSupply ) public onlyOwner { require ( address ( SNT ) == ...
Write solidity function code with: This method should be called by the owner before the contribution period starts This initializes most of the parameters <gen>
function sendEther ( address to , uint value ) external validAddress ( to ) onlymanyowners ( sha3 ( msg . data ) ) requiresState ( State . SUCCEEDED ) { require ( value > 0 && this . balance >= value ) ; to . transfer ( value ) ; EtherSent ( to , value ) ; }
Write solidity function code with: owners : send ` value ` of ether to address ` to ` , can be called if crowdsale succeeded <gen>
function newEtherDeposit ( uint _block ) public onlyOwner payable returns ( uint _idDeposit ) { require ( msg . value > 0 ) ; require ( _block < block . number ) ; _idDeposit = deposits . length ++ ; Deposit storage d = deposits [ _idDeposit ] ; d . block = _block == 0 ? block . number - 1 : _block ; d . token = ERC20 ...
Write solidity function code with: Adds an ether deposit to ` deposits [ ] ` ; only the ` owner ` can deposit into this contract <gen>
function transactionReplay ( address _receiver , uint256 _amount ) public onlyOwner returns ( bool replayed ) { require ( transferCheck ( msg . sender , _receiver , _amount ) ) ; balances [ msg . sender ] = balances [ msg . sender ] . sub ( _amount ) ; balances [ _receiver ] = balances [ _receiver ] . add ( _amount ) ;...
Write solidity function code with: Can also be used for general bulk transfers via the associated python script <gen>
function cumulative ( uint256 euroUlps ) public pure returns ( uint256 neumarkUlps ) { if ( euroUlps >= ISSUANCE_LIMIT_EUR_ULPS ) { return NEUMARK_CAP ; } if ( euroUlps >= LINEAR_APPROX_LIMIT_EUR_ULPS ) { return NEUMARKS_AT_LINEAR_LIMIT_ULPS + ( TOT_LINEAR_NEUMARKS_ULPS * ( euroUlps - LINEAR_APPROX_LIMIT_EUR_ULPS ) ) /...
Write solidity function code with: finds total amount of neumarks issued for given amount of Euro <gen>
function issueSoftcapToken ( address _token , address _for , uint _value ) onlyOracle onlyAllowed ( _for ) onlySale notSoftcapReached public returns ( uint ) { require ( _token == token ) ; require ( _value != 0 ) ; uint _tokenSoftcap = tokenSoftcap ; uint _issued = tokenSoftcapIssued ; if ( _issued . add ( _value ) > ...
Write solidity function code with: Issue tokens for user . <gen>
function burnTokens ( uint256 _tokens ) external ;
Write solidity function code with: Called when tokens have to be burned <gen>
function transfer ( address _to , uint256 _amount ) public erc20 returns ( bool success ) { doSend ( msg . sender , msg . sender , _to , _amount , "" , "" , false ) ; return true ; }
Write solidity function code with: ERC20 backwards compatible transfer . <gen>
function isOperatorFor ( address _operator , address _tokenHolder ) public view returns ( bool ) { return ( _operator == _tokenHolder || ( ! mIsUserNotAcceptingAllOfficialOperators [ _tokenHolder ] && mIsOfficialOperator [ _operator ] ) || mAuthorized [ _operator ] [ _tokenHolder ] || ( mIsDefaultOperator [ _operator ]...
Write solidity function code with: Check whether the ` _operator ` address is allowed to manage the tokens held by ` _tokenHolder ` address . <gen>
function withdrawMyDepositedNomins ( ) external { uint nominsToSend = 0 ; for ( uint i = depositStartIndex ; i < depositEndIndex ; i ++ ) { nominDeposit memory deposit = deposits [ i ] ; if ( deposit . user == msg . sender ) { nominsToSend = safeAdd ( nominsToSend , deposit . amount ) ; delete deposits [ i ] ; } } tota...
Write solidity function code with: Allows a user to withdraw all of their previously deposited nomins from this contract if needed . <gen>
function canTransferFrom ( address from , address to , uint256 tokenId , uint256 value ) external view returns ( bool , bytes1 ) ;
Write solidity function code with: Check if a transfer of the NFT with ID ` tokenId ` on behalf of account ` from ` to a recipient at account ` to ` with ` <gen>
function totalSupply ( ) public view returns ( uint256 ) { return totalSupply ; }
Write solidity function code with: Used to get the total supply <gen>
function mint ( address _to , uint _amount ) public onlyForeignBridge returns ( bool ) { uint curTotalSupply = totalSupply ( ) ; require ( curTotalSupply + _amount >= curTotalSupply ) ; uint previousBalanceTo = balanceOf ( _to ) ; require ( previousBalanceTo + _amount >= previousBalanceTo ) ; updateValueAtNow ( totalSu...
Write solidity function code with: Mints ` _amount ` tokens that are assigned to ` _owner ` <gen>
function acceptBuyOffer ( uint32 _canvasId , uint _minPrice ) external stateOwned ( _canvasId ) forceOwned ( _canvasId ) { Canvas storage canvas = _getCanvas ( _canvasId ) ; require ( canvas . owner == msg . sender ) ; BuyOffer memory offer = buyOffers [ _canvasId ] ; require ( offer . hasOffer ) ; require ( offer . am...
Write solidity function code with: Accepts buy offer for the canvas . <gen>
function start ( ) isNotStartedOnly only ( owner ) { totalInCirculation = totalSupply ; isStarted = true ; }
Write solidity function code with: start normal operation of the token . <gen>