Unnamed: 0 int64 0 7.36k | comments stringlengths 3 35.2k | code_string stringlengths 1 527k | code stringlengths 1 527k | __index_level_0__ int64 0 88.6k |
|---|---|---|---|---|
0 | // keccak256("Permit(address spender,uint256 tokenId,uint256 nonce,uint256 deadline)"); | bytes32 public constant PERMIT_TYPEHASH = 0x49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad;
| bytes32 public constant PERMIT_TYPEHASH = 0x49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad;
| 34,145 |
73 | // Returns the account approved for `tokenId` token. Requirements: - `tokenId` must exist. / | function getApproved(uint256 tokenId) external view returns (address operator);
| function getApproved(uint256 tokenId) external view returns (address operator);
| 179 |
91 | // Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which isforwarded in {IERC721Receiver-onERC721Received} to contract recipients. / | function _safeMint(
| function _safeMint(
| 6,681 |
0 | // keccak256("ForeignGivethBridge") | bytes32 constant public FOREIGN_BRIDGE_ID = 0x304d2fc3aa031b861c3906c5d3f8d5c80d2e6adb979d9cc223a6a3f445cb7e1d;
address public recipient;
event RecipientChanged(address indexed liquidPledging, uint64 indexed idProject, address recipient);
event PaymentCollected(address indexed liquidPledging, uint64 indexed idProject);
| bytes32 constant public FOREIGN_BRIDGE_ID = 0x304d2fc3aa031b861c3906c5d3f8d5c80d2e6adb979d9cc223a6a3f445cb7e1d;
address public recipient;
event RecipientChanged(address indexed liquidPledging, uint64 indexed idProject, address recipient);
event PaymentCollected(address indexed liquidPledging, uint64 indexed idProject);
| 45,118 |
7 | // Set a required fee for a given attribute type ID `ID` and an amount of `fee`, to be paid to the owner of the jurisdiction upon assignment of attributes of the given type.ID uint256 The attribute type ID to set the required fee for.fee uint256 The required fee amount to be paid upon assignment.To remove a fee requirement from an attribute type, the fee amount should be set to 0./ | function setAttributeTypeJurisdictionFee(uint256 ID, uint256 fee) external;
| function setAttributeTypeJurisdictionFee(uint256 ID, uint256 fee) external;
| 41,201 |
2 | // PUBLIC CONSTANTS |
uint256 public constant SECONDS_IN_DAY = 3_600 * 24;
uint256 public constant DAYS_IN_YEAR = 365;
uint256 public constant GENESIS_RANK = 1;
uint256 public constant MIN_TERM = 1 * SECONDS_IN_DAY - 1;
uint256 public constant MAX_TERM_START = 100 * SECONDS_IN_DAY;
uint256 public constant MAX_TERM_END = 1_000 * SECONDS_IN_DAY;
uint256 public constant TERM_AMPLIFIER = 15;
|
uint256 public constant SECONDS_IN_DAY = 3_600 * 24;
uint256 public constant DAYS_IN_YEAR = 365;
uint256 public constant GENESIS_RANK = 1;
uint256 public constant MIN_TERM = 1 * SECONDS_IN_DAY - 1;
uint256 public constant MAX_TERM_START = 100 * SECONDS_IN_DAY;
uint256 public constant MAX_TERM_END = 1_000 * SECONDS_IN_DAY;
uint256 public constant TERM_AMPLIFIER = 15;
| 31,125 |
1 | // Throws if called by smart contract/ | modifier onlyEOA() {
require(tx.origin == msg.sender, "onlyEOA");
_;
}
| modifier onlyEOA() {
require(tx.origin == msg.sender, "onlyEOA");
_;
}
| 40,564 |
2 | // Maximum integer (used for managing allowance) | uint256 public constant MAX_INT = 2**256 - 1;
| uint256 public constant MAX_INT = 2**256 - 1;
| 28,330 |
23 | // Allows Admin to add schain type / | function addSchainType(uint8 partOfNode, uint numberOfNodes) external onlyAdmin {
require(_keysOfSchainTypes.add(numberOfSchainTypes + 1), "Schain type is already added");
schainTypes[numberOfSchainTypes + 1].partOfNode = partOfNode;
schainTypes[numberOfSchainTypes + 1].numberOfNodes = numberOfNodes;
numberOfSchainTypes++;
}
| function addSchainType(uint8 partOfNode, uint numberOfNodes) external onlyAdmin {
require(_keysOfSchainTypes.add(numberOfSchainTypes + 1), "Schain type is already added");
schainTypes[numberOfSchainTypes + 1].partOfNode = partOfNode;
schainTypes[numberOfSchainTypes + 1].numberOfNodes = numberOfNodes;
numberOfSchainTypes++;
}
| 52,683 |
92 | // real deposit/withdraw | if (adjustCollateral > 0) {
deposit(liquidityPool, perpetualIndex, trader, adjustCollateral);
} else if (adjustCollateral < 0) {
| if (adjustCollateral > 0) {
deposit(liquidityPool, perpetualIndex, trader, adjustCollateral);
} else if (adjustCollateral < 0) {
| 34,340 |
30 | // set lvl3 admins | AuthLike(POOL_ADMIN).rely(LEVEL3_ADMIN1);
| AuthLike(POOL_ADMIN).rely(LEVEL3_ADMIN1);
| 81,395 |
145 | // Collateral balance related | uint256 public missing_decimals;
| uint256 public missing_decimals;
| 9,574 |
252 | // Perform purchase restriciton checks. Override if more logic is needed / | function _validatePurchaseRestrictions() internal virtual {
require(active, "Inactive");
require(block.timestamp >= startTime, "Purchasing not active");
}
| function _validatePurchaseRestrictions() internal virtual {
require(active, "Inactive");
require(block.timestamp >= startTime, "Purchasing not active");
}
| 62,858 |
70 | // Moves tokens `amount` from `sender` to `recipient`. | * This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
| * This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
| 13,921 |
31 | // invoked by RewardsDistribution on L1 (takes SNX) | function notifyRewardAmount(uint256 amount) external requireActive {
require(msg.sender == address(rewardsDistribution()), "Caller is not RewardsDistribution contract");
// to be here means I've been given an amount of SNX to distribute onto L2
_rewardDeposit(amount);
}
| function notifyRewardAmount(uint256 amount) external requireActive {
require(msg.sender == address(rewardsDistribution()), "Caller is not RewardsDistribution contract");
// to be here means I've been given an amount of SNX to distribute onto L2
_rewardDeposit(amount);
}
| 11,761 |
103 | // Internal function that increases tokens to an account./ Update magnifiedDividendCorrections to keep dividends unchanged./account The account that will receive the created tokens./value The amount that will be created. | function _increase(address account, uint256 value) internal {
for (uint256 i; i < rewardTokens.length; i++){
magnifiedDividendCorrections[rewardTokens[i]][account] = magnifiedDividendCorrections[rewardTokens[i]][account]
.sub((magnifiedDividendPerShare[rewardTokens[i]].mul(value)).toInt256Safe());
}
}
| function _increase(address account, uint256 value) internal {
for (uint256 i; i < rewardTokens.length; i++){
magnifiedDividendCorrections[rewardTokens[i]][account] = magnifiedDividendCorrections[rewardTokens[i]][account]
.sub((magnifiedDividendPerShare[rewardTokens[i]].mul(value)).toInt256Safe());
}
}
| 15,412 |
43 | // Create the disputes The deposit is zero for conflicting attestations | bytes32 dID1 = _createQueryDisputeWithAttestation(
fisherman,
0,
attestation1,
_attestationData1
);
bytes32 dID2 = _createQueryDisputeWithAttestation(
fisherman,
0,
attestation2,
| bytes32 dID1 = _createQueryDisputeWithAttestation(
fisherman,
0,
attestation1,
_attestationData1
);
bytes32 dID2 = _createQueryDisputeWithAttestation(
fisherman,
0,
attestation2,
| 38,567 |
4 | // The delay before voting on a proposal may take place, once proposed | function votingDelay() public pure returns (uint256) {
return 1;
} // 1 block
| function votingDelay() public pure returns (uint256) {
return 1;
} // 1 block
| 1,123 |
23 | // Stores and tracks frozen IPT Global token balances. | mapping(address => uint256) public frozenBalance;
| mapping(address => uint256) public frozenBalance;
| 331 |
167 | // Currently returns the internal storage amountwho The address to query. return The underlying balance of the specified address./ | function balanceOfUnderlying(address who)
external
view
returns (uint256)
| function balanceOfUnderlying(address who)
external
view
returns (uint256)
| 34,738 |
192 | // Emitted when the owner of the factory is changed/oldOwner The owner before the owner was changed/newOwner The owner after the owner was changed | event OwnerChanged(address indexed oldOwner, address indexed newOwner);
| event OwnerChanged(address indexed oldOwner, address indexed newOwner);
| 23,391 |
22 | // 添加新发布的漏洞ipfs哈希 | userMap[username].vulnerabilities.push(vulnerabilityIpfsHash);
userMap[username].vCount++;
return true;
| userMap[username].vulnerabilities.push(vulnerabilityIpfsHash);
userMap[username].vCount++;
return true;
| 14,433 |
138 | // If the validator set has only one validator, don't remove it. | uint256 length = _currentValidators.length;
if (length == 1) {
return false;
}
| uint256 length = _currentValidators.length;
if (length == 1) {
return false;
}
| 47,521 |
88 | // Calculates the amount of Trams the xTrams is worth | uint256 what = _share.mul(trams.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
trams.transfer(msg.sender, what);
| uint256 what = _share.mul(trams.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
trams.transfer(msg.sender, what);
| 19,196 |
2 | // Maximum number of rounds to lock | uint256 public constant MAX_LOCK_ROUNDS = 26;
| uint256 public constant MAX_LOCK_ROUNDS = 26;
| 17,566 |
0 | // reward rate 40.00% per year | uint256 internal constant rewardRate = 4000;
uint256 internal constant rewardInterval = 365 days;
| uint256 internal constant rewardRate = 4000;
uint256 internal constant rewardInterval = 365 days;
| 15,243 |
141 | // A record of the highest Etheria bid version => (tileIndex => Bid) | mapping (string => mapping (uint => Bid)) public bids;
mapping (string => mapping (uint => GlobalBid)) public globalbids;
mapping (address => uint) public pendingWithdrawals;
event EtheriaTransfer(string indexed version, uint indexed index, address from, address to);
event EtheriaBidCreated(string indexed version, uint indexed index, uint amount, address bidder);
event EtheriaGlobalBidCreated(string indexed version, uint indexed globalbidid, uint amount, address bidder);
event EtheriaBidWithdrawn(string indexed version, uint indexed index, uint amount, address bidder);
event EtheriaGlobalBidWithdrawn(string indexed version, uint indexed globalbidid, uint amount, address bidder);
event EtheriaBought(string indexed version, uint indexed index, uint amount, address seller, address bidder);
| mapping (string => mapping (uint => Bid)) public bids;
mapping (string => mapping (uint => GlobalBid)) public globalbids;
mapping (address => uint) public pendingWithdrawals;
event EtheriaTransfer(string indexed version, uint indexed index, address from, address to);
event EtheriaBidCreated(string indexed version, uint indexed index, uint amount, address bidder);
event EtheriaGlobalBidCreated(string indexed version, uint indexed globalbidid, uint amount, address bidder);
event EtheriaBidWithdrawn(string indexed version, uint indexed index, uint amount, address bidder);
event EtheriaGlobalBidWithdrawn(string indexed version, uint indexed globalbidid, uint amount, address bidder);
event EtheriaBought(string indexed version, uint indexed index, uint amount, address seller, address bidder);
| 38,127 |
14 | // root token owner address => (tokenId => approved address) | mapping(address => mapping(uint256 => address)) internal rootOwnerAndTokenIdToApprovedAddress;
| mapping(address => mapping(uint256 => address)) internal rootOwnerAndTokenIdToApprovedAddress;
| 24,222 |
192 | // Mints a token to an address with a tokenURI. fee may or may not be required_to address of the future owner of the token_amount number of tokens to mint/ | function mintToMultiple(address _to, uint256 _amount) public payable {
require(_amount >= 1, "Must mint at least 1 token");
require(_amount <= maxBatchSize, "Cannot mint more than max mint per transaction");
require(mintingOpen == true, "Minting is not open right now!");
require(currentTokenId() + _amount <= collectionSize, "Cannot mint over supply cap of 6969");
require(msg.value == getPrice(_amount), "Value below required mint fee for amount");
_safeMint(_to, _amount);
}
| function mintToMultiple(address _to, uint256 _amount) public payable {
require(_amount >= 1, "Must mint at least 1 token");
require(_amount <= maxBatchSize, "Cannot mint more than max mint per transaction");
require(mintingOpen == true, "Minting is not open right now!");
require(currentTokenId() + _amount <= collectionSize, "Cannot mint over supply cap of 6969");
require(msg.value == getPrice(_amount), "Value below required mint fee for amount");
_safeMint(_to, _amount);
}
| 611 |
118 | // Method to check if an asset identified by the given id exists under this DAR.return uint256 the assetId / | function exists(uint256 assetId) public view returns (bool) {
return _holderOf[assetId] != 0;
}
| function exists(uint256 assetId) public view returns (bool) {
return _holderOf[assetId] != 0;
}
| 8,131 |
109 | // Sets a yield token as either enabled or disabled.//`msg.sender` must be either the admin or a sentinel or this call will revert with an {Unauthorized} error./`yieldToken` must be registered or this call will revert with a {UnsupportedToken} error.//Emits a {YieldTokenEnabled} event.//yieldToken The address of the yield token to enable or disable./enabledIf the underlying token should be enabled or disabled. | function setYieldTokenEnabled(address yieldToken, bool enabled) external;
| function setYieldTokenEnabled(address yieldToken, bool enabled) external;
| 5,050 |
136 | // This will suffice for checking _exists(nextTokenId), as a burned slot cannot contain the zero address. | if (nextTokenId != _currentIndex) {
nextSlot.addr = from;
nextSlot.startTimestamp = prevOwnership.startTimestamp;
}
| if (nextTokenId != _currentIndex) {
nextSlot.addr = from;
nextSlot.startTimestamp = prevOwnership.startTimestamp;
}
| 11,654 |
206 | // Push payment amount to the end of the buffer - | mstore(add(0x20, add(ptr, mload(ptr))), _amount)
| mstore(add(0x20, add(ptr, mload(ptr))), _amount)
| 28,219 |
273 | // Allows `msg.sender` to recharge their wallet for further gas reimbursement.Requirements:- 'msg.sender` should recharge their gas wallet for amount that enough to reimburse any transaction from schain to mainnet. / | function rechargeUserWallet(string calldata schainName, address user) external payable {
bytes32 schainHash = keccak256(abi.encodePacked(schainName));
require(
msg.value + _userWallets[user][schainHash] >= minTransactionGas * tx.gasprice,
"Not enough ETH for transaction"
);
_userWallets[user][schainHash] = _userWallets[user][schainHash] + msg.value;
if (!activeUsers[user][schainHash]) {
activeUsers[user][schainHash] = true;
messageProxy.postOutgoingMessage(
schainHash,
schainLinks[schainHash],
Messages.encodeActivateUserMessage(user)
);
}
}
| function rechargeUserWallet(string calldata schainName, address user) external payable {
bytes32 schainHash = keccak256(abi.encodePacked(schainName));
require(
msg.value + _userWallets[user][schainHash] >= minTransactionGas * tx.gasprice,
"Not enough ETH for transaction"
);
_userWallets[user][schainHash] = _userWallets[user][schainHash] + msg.value;
if (!activeUsers[user][schainHash]) {
activeUsers[user][schainHash] = true;
messageProxy.postOutgoingMessage(
schainHash,
schainLinks[schainHash],
Messages.encodeActivateUserMessage(user)
);
}
}
| 48,419 |
18 | // 轉移 ETH 至股東的 address | msg.sender.transfer(avaliableWithdrew);
LogWithdrew(msg.sender, avaliableWithdrew);
| msg.sender.transfer(avaliableWithdrew);
LogWithdrew(msg.sender, avaliableWithdrew);
| 12,941 |
14 | // We allocate memory for the return data by setting the free memory location to current free memory location + data size + 32 bytes for data size value | mstore(0x40, add(ptr, add(returndatasize(), 0x20)))
| mstore(0x40, add(ptr, add(returndatasize(), 0x20)))
| 9,827 |
5 | // reads all of them using a single SLOAD | (claimCount, hasOpenClaim, hasAcceptedClaim) = (info.claimCount, info.hasOpenClaim, info.hasAcceptedClaim);
| (claimCount, hasOpenClaim, hasAcceptedClaim) = (info.claimCount, info.hasOpenClaim, info.hasAcceptedClaim);
| 81,967 |
3 | // Map of snapshot index to dividend total amount | mapping(uint256 => uint256) private mapERCPayment;
| mapping(uint256 => uint256) private mapERCPayment;
| 8,595 |
167 | // baseTokenURI = baseURI; | vipPresaleStartTimestamp = _vipPresaleStartTimestamp;
vipPresaleEndTimestamp = _vipPresaleEndTimestamp;
wlPresaleStartTimestamp = _wlPresaleStartTimestamp;
wlPresaleEndTimestamp = _wlPresaleEndTimestamp;
publicSaleStartTimestamp = _publicSaleStartTimestamp;
| vipPresaleStartTimestamp = _vipPresaleStartTimestamp;
vipPresaleEndTimestamp = _vipPresaleEndTimestamp;
wlPresaleStartTimestamp = _wlPresaleStartTimestamp;
wlPresaleEndTimestamp = _wlPresaleEndTimestamp;
publicSaleStartTimestamp = _publicSaleStartTimestamp;
| 32,610 |
26 | // ZRX Config | address ZRX_EXCHANGE_ADDRESS = 0x61935CbDd02287B511119DDb11Aeb42F1593b7Ef;
address ZRX_ERC20_PROXY_ADDRESS = 0x95E6F48254609A6ee006F7D493c8e5fB97094ceF;
address ZRX_STAKING_PROXY = 0xa26e80e7Dea86279c6d778D702Cc413E6CFfA777; // Fee collector
| address ZRX_EXCHANGE_ADDRESS = 0x61935CbDd02287B511119DDb11Aeb42F1593b7Ef;
address ZRX_ERC20_PROXY_ADDRESS = 0x95E6F48254609A6ee006F7D493c8e5fB97094ceF;
address ZRX_STAKING_PROXY = 0xa26e80e7Dea86279c6d778D702Cc413E6CFfA777; // Fee collector
| 19,406 |
4 | // ERC1400 functions to control with certificate / | {
_transferByDefaultPartitions(msg.sender, msg.sender, to, value, data);
}
| {
_transferByDefaultPartitions(msg.sender, msg.sender, to, value, data);
}
| 7,806 |
2 | // fee recipient | address private feeTo;
| address private feeTo;
| 31,254 |
198 | // IGenericLender/Yearn with slight modifications from Angle Core Team/Interface for the `GenericLender` contract, the base interface for contracts interacting/ with lending and yield farming platforms | interface IGenericLender is IAccessControl {
function lenderName() external view returns (string memory);
function nav() external view returns (uint256);
function strategy() external view returns (address);
function apr() external view returns (uint256);
function weightedApr() external view returns (uint256);
function withdraw(uint256 amount) external returns (uint256);
function emergencyWithdraw(uint256 amount) external;
function deposit() external;
function withdrawAll() external returns (bool);
function hasAssets() external view returns (bool);
function aprAfterDeposit(uint256 amount) external view returns (uint256);
function sweep(address _token, address to) external;
}
| interface IGenericLender is IAccessControl {
function lenderName() external view returns (string memory);
function nav() external view returns (uint256);
function strategy() external view returns (address);
function apr() external view returns (uint256);
function weightedApr() external view returns (uint256);
function withdraw(uint256 amount) external returns (uint256);
function emergencyWithdraw(uint256 amount) external;
function deposit() external;
function withdrawAll() external returns (bool);
function hasAssets() external view returns (bool);
function aprAfterDeposit(uint256 amount) external view returns (uint256);
function sweep(address _token, address to) external;
}
| 45,168 |
13 | // Removes existing account proof hash proof hash / | function removeAccountProof(
bytes32 hash
)
external
| function removeAccountProof(
bytes32 hash
)
external
| 6,648 |
10 | // Get the hash of the order order The order objectreturn bytes32 The hash of the order / | function getOrderHash(Order memory order) internal pure returns (bytes32) {
bytes32 result = keccak256(abi.encode(EIP712_ORDER_TYPE, order));
return keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, result));
}
| function getOrderHash(Order memory order) internal pure returns (bytes32) {
bytes32 result = keccak256(abi.encode(EIP712_ORDER_TYPE, order));
return keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, result));
}
| 40,794 |
63 | // length of proofOutput | let proofOutputLength := sub(s, startOfProofOutput)
mstore(startOfProofOutput, sub(proofOutputLength, 0x20))
mstore(0x180, sub(s, 0x1a0)) // store length of proofOutputs at 0x100
mstore(0x160, 0x20)
return(0x160, sub(s, 0x160)) // return the final byte array
| let proofOutputLength := sub(s, startOfProofOutput)
mstore(startOfProofOutput, sub(proofOutputLength, 0x20))
mstore(0x180, sub(s, 0x1a0)) // store length of proofOutputs at 0x100
mstore(0x160, 0x20)
return(0x160, sub(s, 0x160)) // return the final byte array
| 43,064 |
196 | // Function that is called either externally or by default payable methodbeneficiary who should receive tokens / | function buy(address beneficiary) public payable {
require(beneficiary != address(0));
// amount of ethers sent
uint256 value = msg.value;
// throw error if not enough ethers sent
require(value >= minEthPerTransaction);
// refund the extra ethers if sent more than allowed
if(value > maxEthPerTransaction) {
// more ethers are sent so refund extra
msg.sender.transfer(value.sub(maxEthPerTransaction));
value = maxEthPerTransaction;
}
// calculate tokens
uint256 tokens = calculate(value);
// validate the purchase
require(validate(value , tokens));
// update current state
update(value , tokens);
// transfer tokens from contract balance to beneficiary account. calling ERC223 method
bytes memory empty;
token.transfer(beneficiary, tokens, empty);
// log event for token purchase
TokenPurchase(msg.sender, beneficiary, value, tokens, now);
}
| function buy(address beneficiary) public payable {
require(beneficiary != address(0));
// amount of ethers sent
uint256 value = msg.value;
// throw error if not enough ethers sent
require(value >= minEthPerTransaction);
// refund the extra ethers if sent more than allowed
if(value > maxEthPerTransaction) {
// more ethers are sent so refund extra
msg.sender.transfer(value.sub(maxEthPerTransaction));
value = maxEthPerTransaction;
}
// calculate tokens
uint256 tokens = calculate(value);
// validate the purchase
require(validate(value , tokens));
// update current state
update(value , tokens);
// transfer tokens from contract balance to beneficiary account. calling ERC223 method
bytes memory empty;
token.transfer(beneficiary, tokens, empty);
// log event for token purchase
TokenPurchase(msg.sender, beneficiary, value, tokens, now);
}
| 37,444 |
36 | // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. | return string(abi.encodePacked(_baseURI, tokenId.toString()));
| return string(abi.encodePacked(_baseURI, tokenId.toString()));
| 28 |
136 | // take sell fee | if (takeFee && from != owner() && from != address(this)) {
| if (takeFee && from != owner() && from != address(this)) {
| 4,519 |
40 | // Withdraw followed by deposit of same amount to prevent MSB1 | addUserBattleValue(_msgSender, attackAmountAfterFee); // Don't include boost here!
subUserBattleValue(_msgSender, attackAmountAfterFee, false);
| addUserBattleValue(_msgSender, attackAmountAfterFee); // Don't include boost here!
subUserBattleValue(_msgSender, attackAmountAfterFee, false);
| 18,356 |
13 | // Ownable The Ownable contract has an owner address, and provides basic authorization controlfunctions, this simplifies the implementation of "user permissions". This adds two-phaseownership control to OpenZeppelin's Ownable class. In this model, the original owner designates a new owner but does not actually transfer ownership. The new owner then accepts ownership and completes the transfer. / | contract Ownable {
address public owner;
address public pendingOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
pendingOwner = address(0);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner, "Account is not owner");
_;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyPendingOwner() {
require(msg.sender == pendingOwner, "Account is not pending owner");
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
require(_newOwner != address(0), "Empty address");
pendingOwner = _newOwner;
}
/**
* @dev Allows the pendingOwner address to finalize the transfer.
*/
function claimOwnership() onlyPendingOwner public {
emit OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
}
| contract Ownable {
address public owner;
address public pendingOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
pendingOwner = address(0);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner, "Account is not owner");
_;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyPendingOwner() {
require(msg.sender == pendingOwner, "Account is not pending owner");
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
require(_newOwner != address(0), "Empty address");
pendingOwner = _newOwner;
}
/**
* @dev Allows the pendingOwner address to finalize the transfer.
*/
function claimOwnership() onlyPendingOwner public {
emit OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
}
| 26,071 |
150 | // Current index and length of nfts | uint256 public currentNFTIndex = 0;
| uint256 public currentNFTIndex = 0;
| 72,677 |
185 | // background color can't be burned | if (trait == RerollTrait.Outfit) {
donor.outfit = Outfit.NONE;
}
| if (trait == RerollTrait.Outfit) {
donor.outfit = Outfit.NONE;
}
| 11,282 |
33 | // This is needed because the createTopic also uses this logic as well as createPost and if we just called it directly it would use the contract address with msg.sender.// | function createPostInternal(address _user, uint256 _board, uint256 _topic, string _message, address[] _attachedFiles) internal returns (uint256 error) {
if (_board > boards.length ||
_topic > boards[_board].topics.length)
return 2;
Topic topic = boards[_board].topics[_topic];
// Check to make sure that the thread is not auto_locked due to too much time without any replies.
if (topic.updated + AUTO_TOPIC_LOCK < now)
return 3;
topic.updated = now;
uint256 postId = topic.posts.length++;
Post post = topic.posts[postId];
post.poster = _user;
post.message = _message;
post.created = now;
post.attachedFiles = _attachedFiles;
return 1;
}
| function createPostInternal(address _user, uint256 _board, uint256 _topic, string _message, address[] _attachedFiles) internal returns (uint256 error) {
if (_board > boards.length ||
_topic > boards[_board].topics.length)
return 2;
Topic topic = boards[_board].topics[_topic];
// Check to make sure that the thread is not auto_locked due to too much time without any replies.
if (topic.updated + AUTO_TOPIC_LOCK < now)
return 3;
topic.updated = now;
uint256 postId = topic.posts.length++;
Post post = topic.posts[postId];
post.poster = _user;
post.message = _message;
post.created = now;
post.attachedFiles = _attachedFiles;
return 1;
}
| 15,405 |
114 | // This function divides two decimals represented as (decimal10DECIMALS)return uint256 Result of division represented as (decimal10DECIMALS) / | function div(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = SafeMath.add(SafeMath.mul(x, (10 ** 18)), y / 2) / y;
}
| function div(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = SafeMath.add(SafeMath.mul(x, (10 ** 18)), y / 2) / y;
}
| 5,214 |
529 | // PRIVILEGED GOVERNANCE FUNCTION. Override the Increase of allowances of ERC20 with special conditions for vestingAtomically increases the allowance granted to `spender` by the caller.This is an override with respect to the fulfillment of vesting conditions along the wayHowever an user can increase allowance many times, it will never be able to transfer locked tokens during vesting periodreturn Whether or not the increaseAllowance succeeded / | function increaseAllowance(address spender, uint256 addedValue) public override nonReentrant returns (bool) {
require(
unlockedBalance(msg.sender) >= allowance(msg.sender, spender).add(addedValue) ||
spender == address(timeLockRegistry),
'TimeLockedToken::increaseAllowance:Not enough unlocked tokens'
);
require(spender != address(0), 'TimeLockedToken::increaseAllowance:Spender cannot be zero address');
require(spender != msg.sender, 'TimeLockedToken::increaseAllowance:Spender cannot be the msg.sender');
_approve(msg.sender, spender, allowance(msg.sender, spender).add(addedValue));
return true;
}
| function increaseAllowance(address spender, uint256 addedValue) public override nonReentrant returns (bool) {
require(
unlockedBalance(msg.sender) >= allowance(msg.sender, spender).add(addedValue) ||
spender == address(timeLockRegistry),
'TimeLockedToken::increaseAllowance:Not enough unlocked tokens'
);
require(spender != address(0), 'TimeLockedToken::increaseAllowance:Spender cannot be zero address');
require(spender != msg.sender, 'TimeLockedToken::increaseAllowance:Spender cannot be the msg.sender');
_approve(msg.sender, spender, allowance(msg.sender, spender).add(addedValue));
return true;
}
| 76,458 |
58 | // Let an user deposit GLMB inside the SC linked to his mirror wallet _glmbAmount: amount of GLMB to deposit // | function depositFunds (uint256 _glmbAmount) public payable {
require(_glmbAmount > 0, "Amount must be greater than zero");
require(glmbAddress.balanceOf(msg.sender) >= _glmbAmount, "Not enough GLMB");
glmbAddress.transferFrom(msg.sender, address(this), _glmbAmount);
players[msg.sender].glmbAvailable += _glmbAmount;
}
| function depositFunds (uint256 _glmbAmount) public payable {
require(_glmbAmount > 0, "Amount must be greater than zero");
require(glmbAddress.balanceOf(msg.sender) >= _glmbAmount, "Not enough GLMB");
glmbAddress.transferFrom(msg.sender, address(this), _glmbAmount);
players[msg.sender].glmbAvailable += _glmbAmount;
}
| 32,410 |
126 | // depositor info is stored | Bond memory info = bondInfo[ _depositor ];
bondInfo[ _depositor ] = Bond({
valueRemaining: info.valueRemaining.add( value ), // add on to previous
payoutRemaining: info.payoutRemaining.add( payout ), // amounts if they exist
vestingPeriod: terms.vestingTerm,
lastBlock: block.number,
pricePaid: priceInUSD
});
| Bond memory info = bondInfo[ _depositor ];
bondInfo[ _depositor ] = Bond({
valueRemaining: info.valueRemaining.add( value ), // add on to previous
payoutRemaining: info.payoutRemaining.add( payout ), // amounts if they exist
vestingPeriod: terms.vestingTerm,
lastBlock: block.number,
pricePaid: priceInUSD
});
| 10,304 |
215 | // Internal function to add the given debt value to the given position. | function _addDebt(uint256 id, uint256 debtVal) internal {
Position storage pos = positions[id];
uint256 debtShare = debtValToShare(debtVal);
pos.debtShare = pos.debtShare.add(debtShare);
vaultDebtShare = vaultDebtShare.add(debtShare);
vaultDebtVal = vaultDebtVal.add(debtVal);
emit AddDebt(id, debtShare);
}
| function _addDebt(uint256 id, uint256 debtVal) internal {
Position storage pos = positions[id];
uint256 debtShare = debtValToShare(debtVal);
pos.debtShare = pos.debtShare.add(debtShare);
vaultDebtShare = vaultDebtShare.add(debtShare);
vaultDebtVal = vaultDebtVal.add(debtVal);
emit AddDebt(id, debtShare);
}
| 12,971 |
511 | // solhint-disable-next-line max-line-length | require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
| require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
| 2,666 |
224 | // Withdraws `_amountNeeded` to `vault`.This may only be called by the Vault. _amountNeeded How much `want` to withdraw. / | function withdraw(uint256 _amountNeeded) external {
require(msg.sender == address(vault), "!vault");
// Liquidate as much as possible to `want`, up to `_amount`
uint256 amountFreed = liquidatePosition(_amountNeeded);
// Send it directly back (NOTE: Using `msg.sender` saves some gas here)
want.transfer(msg.sender, amountFreed);
}
| function withdraw(uint256 _amountNeeded) external {
require(msg.sender == address(vault), "!vault");
// Liquidate as much as possible to `want`, up to `_amount`
uint256 amountFreed = liquidatePosition(_amountNeeded);
// Send it directly back (NOTE: Using `msg.sender` saves some gas here)
want.transfer(msg.sender, amountFreed);
}
| 48,952 |
9 | // standardizedCall | callData = abi.decode(data[4:], (bytes));
| callData = abi.decode(data[4:], (bytes));
| 9,181 |
75 | // Event with syntheticId metadata JSON string (for DIB.ONE derivative explorer) | event MetadataSet(string metadata);
| event MetadataSet(string metadata);
| 29,308 |
43 | // If the contract is initializing we ignore whether _initialized is set in order to support multiple inheritance patterns, but we only do this in the context of a constructor, because in other contexts the contract may have been reentered. | require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");
bool isTopLevelCall = !_initializing;
if (isTopLevelCall) {
_initializing = true;
_initialized = true;
}
| require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");
bool isTopLevelCall = !_initializing;
if (isTopLevelCall) {
_initializing = true;
_initialized = true;
}
| 12,586 |
0 | // bool isSet; | uint256 tokenAmount;
uint8 numberOfCard;
| uint256 tokenAmount;
uint8 numberOfCard;
| 4,399 |
485 | // require tokens transferred in; | IERC20Burnable(WaToken).safeTransferFrom(sender, address(this), amount);
totalSupplyWaTokens = totalSupplyWaTokens.add(amount);
depositedWaTokens[sender] = depositedWaTokens[sender].add(amount);
| IERC20Burnable(WaToken).safeTransferFrom(sender, address(this), amount);
totalSupplyWaTokens = totalSupplyWaTokens.add(amount);
depositedWaTokens[sender] = depositedWaTokens[sender].add(amount);
| 15,856 |
62 | // Token name | string internal name_;
| string internal name_;
| 29,484 |
181 | // This claims the rewards, liquidates all the reward token to underlying and reinvests. This is same as hardwork, but can be called externally (without fund) / | function claimLiquidateAndReinvestRewards()
external
onlyFundManagerOrRelayer
| function claimLiquidateAndReinvestRewards()
external
onlyFundManagerOrRelayer
| 29,857 |
126 | // Returns a boolean for whether the given address is in either the current generation or the next queued generation./self The pool to operate on./resourceAddress The address to check membership of | function isInPool(Pool storage self, address resourceAddress) constant returns (bool) {
// TODO: tests
return (isInCurrentGeneration(self, resourceAddress) || isInNextGeneration(self, resourceAddress));
}
| function isInPool(Pool storage self, address resourceAddress) constant returns (bool) {
// TODO: tests
return (isInCurrentGeneration(self, resourceAddress) || isInNextGeneration(self, resourceAddress));
}
| 50,597 |
175 | // replace position of given tokenId with last position | reverseBinding[_targetId][_index] = reverseBinding[_targetId][_lastIndex];
| reverseBinding[_targetId][_index] = reverseBinding[_targetId][_lastIndex];
| 3,088 |
109 | // Function to simply retrieve block number This exists mainly for inheriting test contracts to stub this result. / | function getBlockNumber() internal view returns (uint) {
return block.number;
}
| function getBlockNumber() internal view returns (uint) {
return block.number;
}
| 9,232 |
20 | // MODIFIERSCan only be called by contribution contract. | modifier only_minter {
if (msg.sender != minter) throw;
_;
}
| modifier only_minter {
if (msg.sender != minter) throw;
_;
}
| 23,957 |
3 | // Insert a new group/_groupthe group be added | function insert(address _group)
external
onlyGroupManagement
returns (bool)
| function insert(address _group)
external
onlyGroupManagement
returns (bool)
| 47,192 |
173 | // Returns zero if the result would be negative. See the docs for the formulae this implements. | function bidOrRefundForPrice(
Side bidSide,
Side priceSide,
uint price,
bool refund
| function bidOrRefundForPrice(
Side bidSide,
Side priceSide,
uint price,
bool refund
| 2,758 |
15 | // USDT Token | i = 2;
| i = 2;
| 44,662 |
1 | // Multiplies two numbers, reverts on overflow./ | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "multiplication constraint voilated");
return c;
}
| function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "multiplication constraint voilated");
return c;
}
| 345 |
61 | // Withdrawals include a fee, specified as a percentage. | uint16 public feePercent;
| uint16 public feePercent;
| 40,525 |
31 | // When total deposits is 0, G is not updated. In this case, the Prisma issued can not be obtained by laterdepositors - it is missed out on, and remains in the balanceof the Treasury contract./ | if (totalDebt == 0 || _prismaIssuance == 0) {
return;
}
| if (totalDebt == 0 || _prismaIssuance == 0) {
return;
}
| 41,529 |
6 | // This error is thrown when the verifier at an address does/ not conform to the verifier interface | error VerifierInvalid();
| error VerifierInvalid();
| 11,574 |
2 | // Emit event TransferedOwnership / | function emitTransferedOwnership(
address oldOwner,
address newOwner,
bytes memory symbol,
bytes memory issuerName
)
public;
| function emitTransferedOwnership(
address oldOwner,
address newOwner,
bytes memory symbol,
bytes memory issuerName
)
public;
| 11,815 |
107 | // got stored intercoin address / | function getIntercoinAddress() public override view returns (address) {
return intercoinAddr;
}
| function getIntercoinAddress() public override view returns (address) {
return intercoinAddr;
}
| 16,306 |
29 | // The contract holds the token until refunding | rspToken.buyTokens.value (msg.value) (referral);
uint256 nTokens = msg.value.mul (8000);
_markCredit (msg.sender, nTokens);
| rspToken.buyTokens.value (msg.value) (referral);
uint256 nTokens = msg.value.mul (8000);
_markCredit (msg.sender, nTokens);
| 20,732 |
28 | // If supplied tokens more that the rest of the tokens, will refund the excess ether | if (_tokens > restTokens) {
uint256 bonusTokens = restTokens - restTokens / (100 + bonus) * 100;
| if (_tokens > restTokens) {
uint256 bonusTokens = restTokens - restTokens / (100 + bonus) * 100;
| 3,311 |
91 | // emitting it here since to avoid duplication made the if block common for incentive and reward tokens | emit AdminWithdrawal(owner(), totalGameInterest, totalIncentiveAmount, adminFeeAmount);
| emit AdminWithdrawal(owner(), totalGameInterest, totalIncentiveAmount, adminFeeAmount);
| 7,023 |
30 | // The default period (in seconds) to time-lock requests. All requests will be subject to this default time lock, and the duration is fixed at contract creation./ | uint256 public defaultTimeLock;
| uint256 public defaultTimeLock;
| 38,195 |
2 | // Issue: Change to internal pure/ | function minus(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
| function minus(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
| 18,754 |
1 | // Set some variables here to prevent stack too deep error. | maxSupply = 126;
priceInWei = uint256(694200000000000000); /* 0.6942 eth */
maxMintPerTx = 1;
launchTime = 0;
publicMintingEnabled = false;
| maxSupply = 126;
priceInWei = uint256(694200000000000000); /* 0.6942 eth */
maxMintPerTx = 1;
launchTime = 0;
publicMintingEnabled = false;
| 20,161 |
152 | // Removes a token from tokensTraded_token The address of the token to be removed_tokenIndexThe index of the token to be removed/ | function removeToken(address _token, uint256 _tokenIndex) public onlyOwner {
require(_token != address(ETH_TOKEN_ADDRESS));
require(tokensTraded[_token]);
require(IERC20(_token).balanceOf(address(this)) == 0);
require(tokenAddresses[_tokenIndex] == _token);
tokensTraded[_token] = false;
// remove token from array
uint256 arrayLength = tokenAddresses.length - 1;
tokenAddresses[_tokenIndex] = tokenAddresses[arrayLength];
delete tokenAddresses[arrayLength];
tokenAddresses.pop();
}
| function removeToken(address _token, uint256 _tokenIndex) public onlyOwner {
require(_token != address(ETH_TOKEN_ADDRESS));
require(tokensTraded[_token]);
require(IERC20(_token).balanceOf(address(this)) == 0);
require(tokenAddresses[_tokenIndex] == _token);
tokensTraded[_token] = false;
// remove token from array
uint256 arrayLength = tokenAddresses.length - 1;
tokenAddresses[_tokenIndex] = tokenAddresses[arrayLength];
delete tokenAddresses[arrayLength];
tokenAddresses.pop();
}
| 9,111 |
181 | // ================================ information of a block, paiting price, buying price, owner and color. ID is from 0 to 999999 | mapping (uint256 => uint256) public blockSetPrice_; // price of paiting on a block
mapping (uint256 => uint256) public blockBuyPrice_; // price of buying a block
mapping (uint256 => address) public blockAddress_; // owner of block
mapping (uint256 => uint8) public blockColor_; // color of block
uint256[] public changedBlockID_; // ID of blocks that have been painted.
| mapping (uint256 => uint256) public blockSetPrice_; // price of paiting on a block
mapping (uint256 => uint256) public blockBuyPrice_; // price of buying a block
mapping (uint256 => address) public blockAddress_; // owner of block
mapping (uint256 => uint8) public blockColor_; // color of block
uint256[] public changedBlockID_; // ID of blocks that have been painted.
| 20,223 |
34 | // swap maker and taker&39;s tokens according to their signed order info. PARAMS: addresses: [0]:maker tokenBuy [1]:taker tokenBuy [2]:maker tokenSell [3]:taker tokenSell [4]:maker user [5]:taker user [6]:maker baseTokenAddr .default:0 ,then baseToken is ETH [7]:taker baseTokenAddr .default:0 ,then baseToken is ETH [8]:maker feeToken . [9]:taker feeToken . [10]:feeAccount values: [0]:maker amountBuy [1]:taker amountBuy [2]:maker amountSell [3]:taker amountSell [4]:maker fee [5]:taker fee [6]:maker expires [7]:taker expires [8]:maker nonce [9]:taker nonce [10]:tradeAmount of token v,r,s:maker and taker&39;s signature/ | {
Order memory makerOrder = Order({
tokenBuy : addresses[0],
tokenSell : addresses[2],
user : addresses[4],
amountBuy : values[0],
amountSell : values[2],
fee : values[4],
expires : values[6],
nonce : values[8],
orderHash : 0,
baseToken : addresses[6],
feeToken : addresses[8]
});
Order memory takerOrder = Order({
tokenBuy : addresses[1],
tokenSell : addresses[3],
user : addresses[5],
amountBuy : values[1],
amountSell : values[3],
fee : values[5],
expires : values[7],
nonce : values[9],
orderHash : 0,
baseToken : addresses[7],
feeToken : addresses[9]
});
uint256 tradeAmount = values[10];
//check expires
require(makerOrder.expires >= block.number && takerOrder.expires >= block.number);
//make sure both is the same trade pair
require(makerOrder.baseToken == takerOrder.baseToken && makerOrder.tokenBuy == takerOrder.tokenSell && makerOrder.tokenSell == takerOrder.tokenBuy);
require(takerOrder.baseToken == takerOrder.tokenBuy || takerOrder.baseToken == takerOrder.tokenSell);
makerOrder.orderHash = getOrderHash(makerOrder.tokenBuy, makerOrder.amountBuy, makerOrder.tokenSell, makerOrder.amountSell, makerOrder.baseToken, makerOrder.expires, makerOrder.nonce, makerOrder.feeToken);
takerOrder.orderHash = getOrderHash(takerOrder.tokenBuy, takerOrder.amountBuy, takerOrder.tokenSell, takerOrder.amountSell, takerOrder.baseToken, takerOrder.expires, takerOrder.nonce, takerOrder.feeToken);
require(ecrecover(keccak256("\x19Ethereum Signed Message:\n32", makerOrder.orderHash), v[0], r[0], s[0]) == makerOrder.user);
require(ecrecover(keccak256("\x19Ethereum Signed Message:\n32", takerOrder.orderHash), v[1], r[1], s[1]) == takerOrder.user);
balance(makerOrder, takerOrder, addresses[10], tradeAmount);
}
| {
Order memory makerOrder = Order({
tokenBuy : addresses[0],
tokenSell : addresses[2],
user : addresses[4],
amountBuy : values[0],
amountSell : values[2],
fee : values[4],
expires : values[6],
nonce : values[8],
orderHash : 0,
baseToken : addresses[6],
feeToken : addresses[8]
});
Order memory takerOrder = Order({
tokenBuy : addresses[1],
tokenSell : addresses[3],
user : addresses[5],
amountBuy : values[1],
amountSell : values[3],
fee : values[5],
expires : values[7],
nonce : values[9],
orderHash : 0,
baseToken : addresses[7],
feeToken : addresses[9]
});
uint256 tradeAmount = values[10];
//check expires
require(makerOrder.expires >= block.number && takerOrder.expires >= block.number);
//make sure both is the same trade pair
require(makerOrder.baseToken == takerOrder.baseToken && makerOrder.tokenBuy == takerOrder.tokenSell && makerOrder.tokenSell == takerOrder.tokenBuy);
require(takerOrder.baseToken == takerOrder.tokenBuy || takerOrder.baseToken == takerOrder.tokenSell);
makerOrder.orderHash = getOrderHash(makerOrder.tokenBuy, makerOrder.amountBuy, makerOrder.tokenSell, makerOrder.amountSell, makerOrder.baseToken, makerOrder.expires, makerOrder.nonce, makerOrder.feeToken);
takerOrder.orderHash = getOrderHash(takerOrder.tokenBuy, takerOrder.amountBuy, takerOrder.tokenSell, takerOrder.amountSell, takerOrder.baseToken, takerOrder.expires, takerOrder.nonce, takerOrder.feeToken);
require(ecrecover(keccak256("\x19Ethereum Signed Message:\n32", makerOrder.orderHash), v[0], r[0], s[0]) == makerOrder.user);
require(ecrecover(keccak256("\x19Ethereum Signed Message:\n32", takerOrder.orderHash), v[1], r[1], s[1]) == takerOrder.user);
balance(makerOrder, takerOrder, addresses[10], tradeAmount);
}
| 53,812 |
337 | // Get the synthetic token symbol associated to this poolreturn symbol The ERC20 synthetic token symbol / | function syntheticTokenSymbol()
external
view
override
returns (string memory symbol)
| function syntheticTokenSymbol()
external
view
override
returns (string memory symbol)
| 64,354 |
17 | // Sets the implementation address of the proxy.newImplementation Address of the new implementation./ | function _setImplementation(address newImplementation) internal {
require(
isContract(newImplementation),
"Cannot set a proxy implementation to a non-contract address"
);
bytes32 slot = IMPLEMENTATION_SLOT;
/* solium-disable-next-line */
assembly {
sstore(slot, newImplementation)
}
}
| function _setImplementation(address newImplementation) internal {
require(
isContract(newImplementation),
"Cannot set a proxy implementation to a non-contract address"
);
bytes32 slot = IMPLEMENTATION_SLOT;
/* solium-disable-next-line */
assembly {
sstore(slot, newImplementation)
}
}
| 31,086 |
1 | // enables DAO to burn tokens amount the amount of tokens to burn/ | function burn(uint256 amount) public {
require(balanceOf(msg.sender) >= amount, "insufficent balance");
_burn(msg.sender, amount);
}
| function burn(uint256 amount) public {
require(balanceOf(msg.sender) >= amount, "insufficent balance");
_burn(msg.sender, amount);
}
| 938 |
1 | // Changes the state of saleIsActive from true to false and false to true / | function flipSaleState() external onlyOwner {
saleIsActive = !saleIsActive;
}
| function flipSaleState() external onlyOwner {
saleIsActive = !saleIsActive;
}
| 25,995 |
10 | // Initial proposal id set at become | uint256 public initialProposalId;
| uint256 public initialProposalId;
| 29,074 |
229 | // DIP4GenesisBlock | function setStorageDIP4GenesisBlock(uint256 _block) internal {
eternalStorage().setUint(getStorageDIP4GenesisBlockKey(), _block);
}
| function setStorageDIP4GenesisBlock(uint256 _block) internal {
eternalStorage().setUint(getStorageDIP4GenesisBlockKey(), _block);
}
| 40,758 |
193 | // Execution of SET_FREE_PROPOSAL_DAYS proposal./proposal_ proposal. | function _executeSetFreeProposalDays(Proposal storage proposal_) private {
_freeProposalDays = proposal_.amount;
}
| function _executeSetFreeProposalDays(Proposal storage proposal_) private {
_freeProposalDays = proposal_.amount;
}
| 1,948 |
144 | // split the liquify amount into halves | uint256 half = liquifyAmount.div(2);
uint256 otherHalf = liquifyAmount.sub(half);
| uint256 half = liquifyAmount.div(2);
uint256 otherHalf = liquifyAmount.sub(half);
| 23,970 |
37 | // require minCap not reached | require ((amountRaisedInWei < fundingMinCapInWei)
&& (isPresaleClosed)
&& (block.number > fundingEndBlock)
&& (fundValue[msg.sender] > 0));
| require ((amountRaisedInWei < fundingMinCapInWei)
&& (isPresaleClosed)
&& (block.number > fundingEndBlock)
&& (fundValue[msg.sender] > 0));
| 41,999 |
1 | // Borrowing issuance properties | BorrowingIssuanceProperty.Data private _bip;
| BorrowingIssuanceProperty.Data private _bip;
| 39,147 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.