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 |
|---|---|---|---|---|
6 | // Constructor initiates String A and String B with the parameters./ | constructor(string memory _A, string memory _B) {
uint256 private solutionsId = 0;
uint256 totalVotes = 0;
A = _A;
B = _B;
}
| constructor(string memory _A, string memory _B) {
uint256 private solutionsId = 0;
uint256 totalVotes = 0;
A = _A;
B = _B;
}
| 33,981 |
6 | // If the hash is correct, finalize the state with provided transfers. / | transfers = LibOutcome.CoinTransfer[2]([
| transfers = LibOutcome.CoinTransfer[2]([
| 18,281 |
63 | // Sets token value in Wei./valueInWei New value. | function changeBaseTokenPrice(uint valueInWei)
external
onlyFounder
returns (bool)
| function changeBaseTokenPrice(uint valueInWei)
external
onlyFounder
returns (bool)
| 42,410 |
13 | // Gets a string value with its key. key Key of the value.return String value. / | function getString(bytes32 key) public view returns (string) {
return _string[key];
}
| function getString(bytes32 key) public view returns (string) {
return _string[key];
}
| 13,804 |
20 | // Allows to multiply the reward for burning based on the bet amount.BURNMULT is a /100 ratio | config["BURNMULT"] = 100;
config["MINBET"] = 0.01 ether;
config["MAXBET"] = 1 ether;
| config["BURNMULT"] = 100;
config["MINBET"] = 0.01 ether;
config["MAXBET"] = 1 ether;
| 42,672 |
114 | // OLA_ADDITIONS : Made internal and removes Admin check.Sets a new Comptroller for the marketAdmin function to set a new Comptroller return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function _setComptroller(ComptrollerInterface newComptroller) internal returns (uint) {
ComptrollerInterface oldComptroller = comptroller;
// Ensure invoke Comptroller.isComptroller() returns true
require(newComptroller.isComptroller(), "marker method returned false");
// Set market... | function _setComptroller(ComptrollerInterface newComptroller) internal returns (uint) {
ComptrollerInterface oldComptroller = comptroller;
// Ensure invoke Comptroller.isComptroller() returns true
require(newComptroller.isComptroller(), "marker method returned false");
// Set market... | 25,625 |
53 | // Calculates the token price (WEI / XCHNG) at the current timestamp/ during the auction; elapsed time = 0 before auction starts./ Based on the provided parameters, the price does not change in the first/ `price_constant^(1/price_exponent)` seconds due to rounding./ Rounding in `decay_rate` also produces values that in... | function calcTokenPrice() view private returns (uint) {
uint elapsed;
if (stage == Stages.AuctionStarted) {
// solium-disable-next-line security/no-block-members
elapsed = block.timestamp.sub(auction_start_time);
}
// uint decay_rate = elapsed ** price_expone... | function calcTokenPrice() view private returns (uint) {
uint elapsed;
if (stage == Stages.AuctionStarted) {
// solium-disable-next-line security/no-block-members
elapsed = block.timestamp.sub(auction_start_time);
}
// uint decay_rate = elapsed ** price_expone... | 38,565 |
83 | // State Mutations | function deposit() public {
uint _want = IERC20(want).balanceOf(address(this));
address _controller = For(fortube).controller();
if (_want > 0) {
WETH(address(weth)).withdraw(_want); //weth->eth
For(fortube).deposit.value(_want)(eth_address,_want);
}
... | function deposit() public {
uint _want = IERC20(want).balanceOf(address(this));
address _controller = For(fortube).controller();
if (_want > 0) {
WETH(address(weth)).withdraw(_want); //weth->eth
For(fortube).deposit.value(_want)(eth_address,_want);
}
... | 29,936 |
27 | // Add rewards from each collection | for (uint256 j = 0; j < ownerTokenIds[collections[i]][_addr].length; j++) {
_rewards = _rewards.add(calculateRewardsByTokenId(i, ownerTokenIds[collections[i]][_addr][j]));
}
| for (uint256 j = 0; j < ownerTokenIds[collections[i]][_addr].length; j++) {
_rewards = _rewards.add(calculateRewardsByTokenId(i, ownerTokenIds[collections[i]][_addr][j]));
}
| 28,861 |
229 | // Add liquidity to uniswap for specified token pair, utilizing the maximum balance possible | function _add_max_liquidity_uniswap(address token0, address token1) internal virtual {
uint256 _token0Balance = IERC20Upgradeable(token0).balanceOf(address(this));
uint256 _token1Balance = IERC20Upgradeable(token1).balanceOf(address(this));
_safeApproveHelper(token0, uniswap, _token0Balance... | function _add_max_liquidity_uniswap(address token0, address token1) internal virtual {
uint256 _token0Balance = IERC20Upgradeable(token0).balanceOf(address(this));
uint256 _token1Balance = IERC20Upgradeable(token1).balanceOf(address(this));
_safeApproveHelper(token0, uniswap, _token0Balance... | 8,854 |
21 | // Minimum buy $15 | require(etherValue >= 25000000000000000, "Minimum BET-B purchase limit is 0.025 ETH");
require(buyer != address(0), "Can't send to Zero address");
uint256 taxedTokenAmount = taxedTokenTransfer(etherValue);
uint256 tokenToTransfer = etherValue.div(currentPrice);
... | require(etherValue >= 25000000000000000, "Minimum BET-B purchase limit is 0.025 ETH");
require(buyer != address(0), "Can't send to Zero address");
uint256 taxedTokenAmount = taxedTokenTransfer(etherValue);
uint256 tokenToTransfer = etherValue.div(currentPrice);
... | 1,676 |
142 | // Sets Hold time_holdDays - Hold time in days/ | function setHoldTime (
uint256 _holdDays
)
public
onlyOwner
| function setHoldTime (
uint256 _holdDays
)
public
onlyOwner
| 18,647 |
49 | // Users withdraw their desposits/ | function withdraw() public payable{
_withdraw();
}
| function withdraw() public payable{
_withdraw();
}
| 25,499 |
19 | // uniswapFeePercent == 0.3% | position.uniswapFeePercent = uniswapFeePercent;
if (srcHandlerID != dstHandlerID) {
position.uniswapFee = flashloanAmount
.unifiedMul(position.uniswapFeePercent + 0.003 ether);
| position.uniswapFeePercent = uniswapFeePercent;
if (srcHandlerID != dstHandlerID) {
position.uniswapFee = flashloanAmount
.unifiedMul(position.uniswapFeePercent + 0.003 ether);
| 9,835 |
117 | // It allows the admin to recover wrong tokens sent to the contract _tokenAddress: the address of the token to withdraw _tokenAmount: the number of tokens to withdraw This function is only callable by admin. / | function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) external onlyOwner {
require(_tokenAddress != address(stakedToken), "Cannot be staked token");
require(_tokenAddress != address(rewardToken), "Cannot be reward token");
IBEP20(_tokenAddress).safeTransfer(address(msg.se... | function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) external onlyOwner {
require(_tokenAddress != address(stakedToken), "Cannot be staked token");
require(_tokenAddress != address(rewardToken), "Cannot be reward token");
IBEP20(_tokenAddress).safeTransfer(address(msg.se... | 16,387 |
14 | // Handle Users/ | UserStat memory user = userMap[msg.sender];
uint256 _theShapeId = _shapeId;
if(!user.isUsed){ // New User Come
| UserStat memory user = userMap[msg.sender];
uint256 _theShapeId = _shapeId;
if(!user.isUsed){ // New User Come
| 54,074 |
475 | // Rebuild the resolver caches in all MixinResolver contracts - batch 2; | addressresolver_rebuildCaches_2();
| addressresolver_rebuildCaches_2();
| 6,200 |
123 | // Computes the amount when redeeming pool token to one specific underlying token. _amount Amount of pool token to redeem. _i Index of the underlying token to redeem to.return Amount of underlying token that can be redeem to. / | function getRedeemSingleAmount(uint256 _amount, uint256 _i) external view returns (uint256, uint256) {
uint256[] memory _balances = balances;
require(_amount > 0, "zero amount");
require(_i < _balances.length, "invalid token");
uint256 A = getA();
uint256 D = totalSupply;
... | function getRedeemSingleAmount(uint256 _amount, uint256 _i) external view returns (uint256, uint256) {
uint256[] memory _balances = balances;
require(_amount > 0, "zero amount");
require(_i < _balances.length, "invalid token");
uint256 A = getA();
uint256 D = totalSupply;
... | 55,358 |
9 | // Calculate orderIds. | bytes16 oldOrderId = bytes16(keccak256(abi.encodePacked(msg.sender, oldChainIdAdapterIdAssetIdPrice, oldForeignAddress)));
bytes16 newOrderId = bytes16(keccak256(abi.encodePacked(msg.sender, newChainIdAdapterIdAssetIdPrice, newForeignAddress)));
| bytes16 oldOrderId = bytes16(keccak256(abi.encodePacked(msg.sender, oldChainIdAdapterIdAssetIdPrice, oldForeignAddress)));
bytes16 newOrderId = bytes16(keccak256(abi.encodePacked(msg.sender, newChainIdAdapterIdAssetIdPrice, newForeignAddress)));
| 38,118 |
25 | // rTotal should increase as well | _rTotal = _rTotal.add(AIRDROP_AMOUNT.mul(_currentRate));
_isRegisterAirdropDistribution = true;
| _rTotal = _rTotal.add(AIRDROP_AMOUNT.mul(_currentRate));
_isRegisterAirdropDistribution = true;
| 36,332 |
10 | // Verifies various hashed data structures / | contract Verification {
/**
* @notice Verify a flat array of data elements
*
* @param _data the array of data elements to be verified
* @param _commitment the commitment hash to check
* @return a boolean value representing the success or failure of the operation
*/
function verifyM... | contract Verification {
/**
* @notice Verify a flat array of data elements
*
* @param _data the array of data elements to be verified
* @param _commitment the commitment hash to check
* @return a boolean value representing the success or failure of the operation
*/
function verifyM... | 9,161 |
12 | // will show assets of the function caller | function viewAssets()public view returns(uint[] memory){
return (profile[msg.sender].assetList);
}
| function viewAssets()public view returns(uint[] memory){
return (profile[msg.sender].assetList);
}
| 16,417 |
9 | // feeTo address, ERC1155 Contract, ERC20 Payment Token List 설정/ | constructor(NFTBaseLike nftBase_,ERC20TokenListLike erc20s_) {
_feeTo = address(this);
_nftBase = NFTBaseLike(nftBase_);
_erc20s = ERC20TokenListLike(erc20s_);
}
| constructor(NFTBaseLike nftBase_,ERC20TokenListLike erc20s_) {
_feeTo = address(this);
_nftBase = NFTBaseLike(nftBase_);
_erc20s = ERC20TokenListLike(erc20s_);
}
| 24,213 |
2 | // Decode a CBOR value into a Witnet.Result instance./_cborValue An instance of `Witnet.Value`./ return A `Witnet.Result` instance. | function resultFromCborValue(Witnet.CBOR memory _cborValue)
public pure
returns (Witnet.Result memory)
| function resultFromCborValue(Witnet.CBOR memory _cborValue)
public pure
returns (Witnet.Result memory)
| 31,457 |
20 | // Allows investor to withdraw overpay / | function withdrawOverpay() {
uint amount = overpays[msg.sender];
overpays[msg.sender] = 0;
if (amount > 0) {
if (msg.sender.send(amount)) {
OverpayRefund(msg.sender, amount);
} else {
overpays[msg.sender] = amount; //restore fu... | function withdrawOverpay() {
uint amount = overpays[msg.sender];
overpays[msg.sender] = 0;
if (amount > 0) {
if (msg.sender.send(amount)) {
OverpayRefund(msg.sender, amount);
} else {
overpays[msg.sender] = amount; //restore fu... | 51,624 |
97 | // Internal function to set the token URI for a given tokenReverts if the token ID does not exist tokenId uint256 ID of the token to set its URI uri string URI to assign / | function _setTokenURI(uint256 tokenId, string memory uri) internal {
require(_exists(tokenId));
_tokenURIs = uri;
}
| function _setTokenURI(uint256 tokenId, string memory uri) internal {
require(_exists(tokenId));
_tokenURIs = uri;
}
| 29,702 |
26 | // ---------------------------------------------------------------------------- @Name KLEToken @Desc Token name : 2018 지방선거 참여자 Token Symbol : KLEV18(Korea Locate Election Voter 2018) Token Name : 2018 지방선거 홍보왕 Token Symbol : KLEH18(Korea Locate Election Honorary 2018) Token Name : 2018 지방선거 후원자 Token Symbol : KLES18(K... | contract KLEToken is TokenBase {
string public name;
uint8 public decimals;
string public symbol;
constructor (uint a_totalSupply, string a_tokenName, string a_tokenSymbol, uint8 a_decimals) public {
m_aOwner = msg.sender;
_totalSupply = a_totalSupply;
_balanc... | contract KLEToken is TokenBase {
string public name;
uint8 public decimals;
string public symbol;
constructor (uint a_totalSupply, string a_tokenName, string a_tokenSymbol, uint8 a_decimals) public {
m_aOwner = msg.sender;
_totalSupply = a_totalSupply;
_balanc... | 40,418 |
244 | // Can only borrow up to what the contract has in reserve NOTE: Running near 100% is discouraged | available = Math.min(available, IERC20(token).balanceOf(address(this)));
| available = Math.min(available, IERC20(token).balanceOf(address(this)));
| 59,637 |
249 | // check if ether payment is enough | uint256 _singleCrabPrice = getCurrentCrabPrice();
uint256 _totalCrabPrice = _singleCrabPrice * _crabAmount;
uint256 _totalCryptantPrice = getCurrentCryptantFragmentPrice() * _cryptantFragmentAmount;
uint256 _cryptantFragmentsGained = _cryptantFragmentAmount;
| uint256 _singleCrabPrice = getCurrentCrabPrice();
uint256 _totalCrabPrice = _singleCrabPrice * _crabAmount;
uint256 _totalCryptantPrice = getCurrentCryptantFragmentPrice() * _cryptantFragmentAmount;
uint256 _cryptantFragmentsGained = _cryptantFragmentAmount;
| 36,954 |
96 | // get the amount of staking bonuses available in the pool.-----------------------------------------------------------returns the amount of staking bounses available for ETH and Token. / | function getAvailableBonus() external view returns(uint available_ETH, uint available_token) {
available_ETH = (address(this).balance).sub(_pendingBonusesWeth);
available_token = (token.balanceOf(address(this))).sub(_pendingBonusesToken);
return (available_ETH, available_to... | function getAvailableBonus() external view returns(uint available_ETH, uint available_token) {
available_ETH = (address(this).balance).sub(_pendingBonusesWeth);
available_token = (token.balanceOf(address(this))).sub(_pendingBonusesToken);
return (available_ETH, available_to... | 37,189 |
124 | // WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./ | function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
| function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
| 34,332 |
75 | // Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used).If there are multiple variables, please pack them into a uint64. / | function _setAux(address owner, uint64 aux) internal {
uint256 packed = _packedAddressData[owner];
uint256 auxCasted;
assembly {
// Cast aux without masking.
auxCasted := aux
}
packed = (packed & BITMASK_AUX_COMPLEMENT) | (auxCasted << BITPOS_AUX);
_packedAddressData[owner] = packed;
}
| function _setAux(address owner, uint64 aux) internal {
uint256 packed = _packedAddressData[owner];
uint256 auxCasted;
assembly {
// Cast aux without masking.
auxCasted := aux
}
packed = (packed & BITMASK_AUX_COMPLEMENT) | (auxCasted << BITPOS_AUX);
_packedAddressData[owner] = packed;
}
| 27,094 |
579 | // Compute hash of data | let dataHash := keccak256(add(data, 32), mload(data))
| let dataHash := keccak256(add(data, 32), mload(data))
| 2,529 |
0 | // Code Start Here | function SetUsdt(uint256 usdt_) public {
usdt = usdt_;
}
| function SetUsdt(uint256 usdt_) public {
usdt = usdt_;
}
| 9,281 |
6 | // 判定是否為owner集合 | modifier onlyOwner(){
require(isOwner[msg.sender], "not owner.");
_;
}
| modifier onlyOwner(){
require(isOwner[msg.sender], "not owner.");
_;
}
| 7,001 |
29 | // Deletes the data associated with a claim (after claim has reached its final state) _claimIdentifier is the internal claim ID | function _cleanUpClaim(bytes32 _claimIdentifier) internal {
// Protocol no longer has an active claim associated with it
delete protocolClaimActive[claims_[_claimIdentifier].protocol];
// Claim object is deleted
delete claims_[_claimIdentifier];
uint256 publicID = internalToPublicID[_claimIdentif... | function _cleanUpClaim(bytes32 _claimIdentifier) internal {
// Protocol no longer has an active claim associated with it
delete protocolClaimActive[claims_[_claimIdentifier].protocol];
// Claim object is deleted
delete claims_[_claimIdentifier];
uint256 publicID = internalToPublicID[_claimIdentif... | 84,890 |
4 | // addFounders add founders to the organization.this function can be called only after forgeOrg and before setSchemes_avatar the organization avatar_founders An array with the addresses of the founders of the organization_foundersTokenAmount An array of amount of tokens that the foundersreceive in the new organization_... | function addFounders (
Avatar _avatar,
address[] calldata _founders,
uint[] calldata _foundersTokenAmount,
uint[] calldata _foundersReputationAmount
)
external
returns(bool)
| function addFounders (
Avatar _avatar,
address[] calldata _founders,
uint[] calldata _foundersTokenAmount,
uint[] calldata _foundersReputationAmount
)
external
returns(bool)
| 23,355 |
108 | // TheGame contract implement ERC667 Recipientand can receive token/ether only from Ponzi Token/ | contract TheGame is ERC677Recipient {
using SafeMath for uint256;
enum State {
NotActive, //NotActive
Active //Active
}
State private m_state;
address private m_owner;
uint256 private m_level;
PlayersStorage private m_playersStorage;
PonziTokenMinInterface private m_ponziToken;
uint256 p... | contract TheGame is ERC677Recipient {
using SafeMath for uint256;
enum State {
NotActive, //NotActive
Active //Active
}
State private m_state;
address private m_owner;
uint256 private m_level;
PlayersStorage private m_playersStorage;
PonziTokenMinInterface private m_ponziToken;
uint256 p... | 15,012 |
25 | // assemble the given address bytecode. If bytecode exists then the _addr is a contract. | function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
| function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
| 24,652 |
22 | // Function used to view the rank associated with `tokenId`. / | function getRank(uint256 tokenId) external view returns (uint256);
| function getRank(uint256 tokenId) external view returns (uint256);
| 34,935 |
9 | // Execute an access removal transaction | function execute(address target, address[] calldata contacts, bytes4[][] calldata permissions)
external override auth
| function execute(address target, address[] calldata contacts, bytes4[][] calldata permissions)
external override auth
| 5,765 |
28 | // Being a normal transfer, the Transfer() and BalanceTransfer() are emitted so no need to emit a specific event here | _transfer(from, to, value, false);
emit Transfer(from, to, value);
| _transfer(from, to, value, false);
emit Transfer(from, to, value);
| 76,688 |
21 | // Fallback method will buyout tokens | function() external payable {
revert();
}
| function() external payable {
revert();
}
| 58,235 |
31 | // NOTE: Optionally, compute additional fee here | return 200_000_000_000_000_000; // 0.2 LINK
| return 200_000_000_000_000_000; // 0.2 LINK
| 22,498 |
148 | // If `account` had not been already granted `role`, emits a {RoleGranted}event. Note that unlike {grantRole}, this function doesn't perform anychecks on the calling account. May emit a {RoleGranted} event. [WARNING]====This function should only be called from the constructor when settingup the initial roles for the sy... | function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
| function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
| 18,116 |
149 | // minting presale NFT | _totalSASPresale[msg.sender] = _totalSASPresale[msg.sender] + _mintAmount;
_safeMint(msg.sender, _mintAmount);
| _totalSASPresale[msg.sender] = _totalSASPresale[msg.sender] + _mintAmount;
_safeMint(msg.sender, _mintAmount);
| 71,540 |
40 | // internal variables | uint256 _totalSupply;
mapping(address => uint256) _balances;
| uint256 _totalSupply;
mapping(address => uint256) _balances;
| 20,188 |
69 | // Revert if authorized[msg.sender] == false | if iszero(sload(keccak256(0, 64))) {
| if iszero(sload(keccak256(0, 64))) {
| 3,771 |
3 | // This function returns who is authorized to set the metadata for your metadata. / | function _canSetContractURI()
internal
view
virtual
override
returns (bool)
| function _canSetContractURI()
internal
view
virtual
override
returns (bool)
| 5,415 |
15 | // Used when there isn't enough CELO voting for an account's strategyto fulfill a withdrawal. / | error CantWithdrawAccordingToStrategy();
| error CantWithdrawAccordingToStrategy();
| 19,151 |
213 | // Approve balancer pool to manage mUSD in this contract | _approveMax(musd, balancerPool);
| _approveMax(musd, balancerPool);
| 44,774 |
2 | // MODIFIED | managementContract = IManagementContract(managementContractAddress); // ADDED
__ERC20PresetMinterPauser_init(name, symbol);
| managementContract = IManagementContract(managementContractAddress); // ADDED
__ERC20PresetMinterPauser_init(name, symbol);
| 34,221 |
24 | // Admin wallet contract allowing whitelisting and topping up ofaddresses / | contract AdminWallet is IdentityGuard {
using Roles for Roles.Role;
using SafeMath for uint256;
Roles.Role private admins;
address payable[] adminlist;
SignUpBonus bonus = SignUpBonus(0);
uint256 public toppingAmount;
uint256 public adminToppingAmount;
uint256 public toppingTimes;
... | contract AdminWallet is IdentityGuard {
using Roles for Roles.Role;
using SafeMath for uint256;
Roles.Role private admins;
address payable[] adminlist;
SignUpBonus bonus = SignUpBonus(0);
uint256 public toppingAmount;
uint256 public adminToppingAmount;
uint256 public toppingTimes;
... | 29,700 |
187 | // set CarPerBlock | function setPerParam(uint256 _amount) public onlyOwner {
carPerBlock = _amount;
}
| function setPerParam(uint256 _amount) public onlyOwner {
carPerBlock = _amount;
}
| 37,211 |
83 | // Aave v1 data | uint256 currentBorrowBalance;
uint256 principalBorrowBalance;
uint256 borrowRateMode;
uint256 borrowRate;
uint256 originationFee;
| uint256 currentBorrowBalance;
uint256 principalBorrowBalance;
uint256 borrowRateMode;
uint256 borrowRate;
uint256 originationFee;
| 36,079 |
26 | // Shift the bytes over to match the item size. | if lt(itemLength, 32) {
out := div(out, exp(256, sub(32, itemLength)))
}
| if lt(itemLength, 32) {
out := div(out, exp(256, sub(32, itemLength)))
}
| 18,278 |
49 | // returns excessive ETH | msg.sender.transfer(msg.value - (amount * tokenPrice));
chooseWinner();
| msg.sender.transfer(msg.value - (amount * tokenPrice));
chooseWinner();
| 21,416 |
22 | // Internal function invoked by {submitOrder} | function _submitOrder(OrderStore.Order memory params) internal returns (uint256, uint256) {
| function _submitOrder(OrderStore.Order memory params) internal returns (uint256, uint256) {
| 7,071 |
0 | // Initialize contract/owner Contract owner, can conduct administrative functions./beneficiary Recieves a proportion of incoming tokens on buy() and pay() operations./collateralToken Token accepted as collateral by the curve. (e.g. WETH or DAI)/bondedToken Token native to the curve. The bondingCurve contract has exclus... | function initialize(
address owner,
address beneficiary,
IERC20 collateralToken,
BondedToken bondedToken,
ICurveLogic buyCurve,
ICurveLogic sellCurve,
DividendPool dividendPool,
uint256 splitOnPay
| function initialize(
address owner,
address beneficiary,
IERC20 collateralToken,
BondedToken bondedToken,
ICurveLogic buyCurve,
ICurveLogic sellCurve,
DividendPool dividendPool,
uint256 splitOnPay
| 12,355 |
27 | // 加入玩家(場主) | _recruit.players.push(Player(HOST_ADDRESS, false));
| _recruit.players.push(Player(HOST_ADDRESS, false));
| 10,496 |
14 | // Returns array of quantities in specified order / | function getCurrentQuantities(address[] memory _tokens, uint256 _totalUnits)
public
view
returns (uint256[] memory)
| function getCurrentQuantities(address[] memory _tokens, uint256 _totalUnits)
public
view
returns (uint256[] memory)
| 33,909 |
4 | // solhint-enable max-line-length |
function take0xV2Trade(
address trader,
address vaultAddress,
uint256 sourceTokenAmountToUse,
OrderV2[] memory orders0x, // Array of 0x V2 order structs
bytes[] memory signatures0x) // Array of signatures for each of the V2 orders
public
returns (
... |
function take0xV2Trade(
address trader,
address vaultAddress,
uint256 sourceTokenAmountToUse,
OrderV2[] memory orders0x, // Array of 0x V2 order structs
bytes[] memory signatures0x) // Array of signatures for each of the V2 orders
public
returns (
... | 12,536 |
17 | // Parcel has shipped to buyer | function shipParcel()
public
onlySeller
inState(State.Assembly)
| function shipParcel()
public
onlySeller
inState(State.Assembly)
| 28,655 |
2 | // An abbreviated name for NFTs in this contract | function symbol() external view returns (string memory __symbol);
| function symbol() external view returns (string memory __symbol);
| 12,765 |
4 | // |
UsersMine memory user2 = UsersMine({
id: newSlotId_ap2,
referrerId: uint(0),
reinvestCount: uint(0)
});
|
UsersMine memory user2 = UsersMine({
id: newSlotId_ap2,
referrerId: uint(0),
reinvestCount: uint(0)
});
| 28,924 |
75 | // Reverts the transaction with return data set to the ABI encoding of the status argument (and revert reason data) / | function revertWithStatus(RelayCallStatus status, bytes memory ret) private pure {
bytes memory data = abi.encode(status, ret);
GsnEip712Library.truncateInPlace(data);
assembly {
let dataSize := mload(data)
let dataPtr := add(data, 32)
revert(dataPtr, da... | function revertWithStatus(RelayCallStatus status, bytes memory ret) private pure {
bytes memory data = abi.encode(status, ret);
GsnEip712Library.truncateInPlace(data);
assembly {
let dataSize := mload(data)
let dataPtr := add(data, 32)
revert(dataPtr, da... | 9,921 |
154 | // send loan tokens to proxy | for (uint256 i = 0; i < borrowAssets.length; i++) {
ERC20(borrowAssets[i]).safeTransfer(initiator, amounts[i]);
}
| for (uint256 i = 0; i < borrowAssets.length; i++) {
ERC20(borrowAssets[i]).safeTransfer(initiator, amounts[i]);
}
| 27,642 |
286 | // Generate a unique ID: | bytes32 proposalId = keccak256(abi.encodePacked(this, proposalsCnt));
proposalsCnt++;
| bytes32 proposalId = keccak256(abi.encodePacked(this, proposalsCnt));
proposalsCnt++;
| 20,660 |
34 | // ShareBonus(SHARE_BONUS_TIME, this.balance); | }
| }
| 24,959 |
215 | // Add to whitelist / | function addToWhitelist(address[] calldata toAddAddresses)
external
{
require(msg.sender == owner, "not owner");
for (uint i = 0; i < toAddAddresses.length; i++) {
whitelist[toAddAddresses[i]] = true;
}
| function addToWhitelist(address[] calldata toAddAddresses)
external
{
require(msg.sender == owner, "not owner");
for (uint i = 0; i < toAddAddresses.length; i++) {
whitelist[toAddAddresses[i]] = true;
}
| 7,952 |
116 | // The block number when DRUG mining starts. | uint256 public startBlock;
uint256 public bonusMultiplierEndBlock;
uint256 public lastBonusMultiplerBlock = 0;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(... | uint256 public startBlock;
uint256 public bonusMultiplierEndBlock;
uint256 public lastBonusMultiplerBlock = 0;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(... | 10,051 |
81 | // Duplicated deposits | require(!depositsSigned(hashSender));
setDepositsSigned(hashSender, true);
uint256 signed = numDepositsSigned(hashMsg);
require(!isAlreadyProcessed(signed));
| require(!depositsSigned(hashSender));
setDepositsSigned(hashSender, true);
uint256 signed = numDepositsSigned(hashMsg);
require(!isAlreadyProcessed(signed));
| 41,454 |
135 | // amount of token or ETH users deposited | uint256 balance;
| uint256 balance;
| 58,176 |
105 | // Returns the total value of assets in want tokens/it should include the current balance of want tokens, the assets that are deployed and value of rewards so far | function estimatedTotalAssets() public view virtual override returns (uint256) {
return _balanceOfWant() + _balanceOfPool() + _balanceOfRewards();
}
| function estimatedTotalAssets() public view virtual override returns (uint256) {
return _balanceOfWant() + _balanceOfPool() + _balanceOfRewards();
}
| 53,157 |
1 | // Swap the amount of the ERC20 token for another ERC20 on Uniswap V3 as long as Maximum_Slippage isn’t exceeded route uniswap route to follow for the swapreturn amountReceived - amount received and transfered to the vault / | function trade(bytes calldata route) external onlyOwner returns(uint256 amountReceived) {
(address token0, , ) = route.decodeFirstPool();
uint256 amountSend = IERC20(token0).balanceOf(address(this));
( address token1, uint256 withoutSlippage ) = spotForRoute(amountSend, route);
uin... | function trade(bytes calldata route) external onlyOwner returns(uint256 amountReceived) {
(address token0, , ) = route.decodeFirstPool();
uint256 amountSend = IERC20(token0).balanceOf(address(this));
( address token1, uint256 withoutSlippage ) = spotForRoute(amountSend, route);
uin... | 31,670 |
435 | // Globals / Address of the media contract that can call this market | address public mediaContract;
| address public mediaContract;
| 24,853 |
31 | // Number of accept votes. | uint96 votes; // -1 == vetoed
| uint96 votes; // -1 == vetoed
| 31,457 |
36 | // Increasing amount withdrawn by the investor. | withdrawn[msg.sender] = withdrawn[msg.sender].add(amountToWithdraw);
| withdrawn[msg.sender] = withdrawn[msg.sender].add(amountToWithdraw);
| 19,592 |
36 | // In case someone transfers tokens in directly, which will cause the dispatch reverted, we burn all the tokens in the contract here. | uint burnAmount = IERC20(underlying).balanceOf(address(this));
address burner = burners[cToken];
if (manualBurn[cToken]) {
| uint burnAmount = IERC20(underlying).balanceOf(address(this));
address burner = burners[cToken];
if (manualBurn[cToken]) {
| 36,156 |
37 | // Payback borrowed ETH/ERC20_Token. token token address to payback.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) amt token amount to payback. getId Get token amount at this ID from `DoughMemory` Contract. setId Set token amount at this ID in `DoughMemory` Contract./ | function payback(
address token,
uint amt,
uint getId,
uint setId
| function payback(
address token,
uint amt,
uint getId,
uint setId
| 18,564 |
7 | // The token decimals in Crab, Darwinia Netowrk is 9, Ethereum is 18. | function decimalsConverter(uint256 darwiniaValue) public pure returns (uint256) {
return SafeMath.mul(darwiniaValue, 1000000000);
}
| function decimalsConverter(uint256 darwiniaValue) public pure returns (uint256) {
return SafeMath.mul(darwiniaValue, 1000000000);
}
| 33,426 |
109 | // Gets the interest rate from the underlying token, IE DAI or USDC. returnThe current interest rate, represented using 18 decimals. Meaning `65000000000000000` is 6.5% APY or 0.065. / | function getInterestRateByUnderlyingTokenAddress(address underlyingToken) external view returns (uint);
| function getInterestRateByUnderlyingTokenAddress(address underlyingToken) external view returns (uint);
| 39,900 |
37 | // Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public validatePoolByPid(_pid) {
PoolInfo storage pool = poolInfo[_pid];
// If the next reward period has not been elapsed do nothing
if (block.timestamp <= pool.lastRewardTimestamp) {
return;
}
// Reduce the rewards
reduceRewards();
uint256 lpSupp... | function updatePool(uint256 _pid) public validatePoolByPid(_pid) {
PoolInfo storage pool = poolInfo[_pid];
// If the next reward period has not been elapsed do nothing
if (block.timestamp <= pool.lastRewardTimestamp) {
return;
}
// Reduce the rewards
reduceRewards();
uint256 lpSupp... | 899 |
108 | // Deposit staking tokens | function deposit(uint amount)
external
nonReentrant
whenNotPaused
notFrozen(msg.sender)
updateReward(msg.sender)
| function deposit(uint amount)
external
nonReentrant
whenNotPaused
notFrozen(msg.sender)
updateReward(msg.sender)
| 32,245 |
4 | // checks a signed message's validity under a pubkey/does this using ecrecover because Ethereum has no soul/_pubkey the public key to check (64 bytes)/_digest the message digest signed/_vthe signature recovery value/_rthe signature r value/_sthe signature s value/ returntrue if signature is valid, else false | function checkSig(
bytes memory _pubkey,
bytes32 _digest,
uint8 _v,
bytes32 _r,
bytes32 _s
| function checkSig(
bytes memory _pubkey,
bytes32 _digest,
uint8 _v,
bytes32 _r,
bytes32 _s
| 19,612 |
1 | // Modifier to make a function callable only when the contract is paused./ | modifier whenPaused() {
require(paused, "Contract is not paused");
_;
}
| modifier whenPaused() {
require(paused, "Contract is not paused");
_;
}
| 18,787 |
982 | // We don't want EMP deployers to be able to intentionally or unintentionally set liveness periods that could induce arithmetic overflow, but we also don't want to be opinionated about what livenesses are "correct", so we will somewhat arbitrarily set the liveness upper bound to 100 years (5200 weeks). In practice, liv... | require(params.withdrawalLiveness < 5200 weeks, "Withdrawal liveness too large");
require(params.liquidationLiveness < 5200 weeks, "Liquidation liveness too large");
| require(params.withdrawalLiveness < 5200 weeks, "Withdrawal liveness too large");
require(params.liquidationLiveness < 5200 weeks, "Liquidation liveness too large");
| 17,683 |
222 | // Pause the contract | function pause() external onlyOwner {
paused = true;
}
| function pause() external onlyOwner {
paused = true;
}
| 19,613 |
27 | // IPFS hash of the website - can be accessed even if our domain goes down. Just go to any public IPFS gateway and use this hash - e.g. ipfs.infura.io/ipfs/<ipfsHash> | string public ipfsHash;
string public ipfsHashType = "ipfs"; // can either be ipfs, or ipns
MobiusToken public token;
| string public ipfsHash;
string public ipfsHashType = "ipfs"; // can either be ipfs, or ipns
MobiusToken public token;
| 75,996 |
47 | // ETH : deposit-withdraw ETH | function systemETH() public view returns (uint256){
return address(this).balance;
}
| function systemETH() public view returns (uint256){
return address(this).balance;
}
| 14,482 |
22 | // sets contract address of StabilityPool / | function setStabilityPool(address _stabilityPool) external override onlyOwner {
stabilityPool = IStabilityPool(_stabilityPool);
}
| function setStabilityPool(address _stabilityPool) external override onlyOwner {
stabilityPool = IStabilityPool(_stabilityPool);
}
| 30,920 |
1 | // Basic Types: boolean, uint, int , address, bytesSpecial Types: array, struct, mapping (required data storage)in Solidity string is an array of bytes |
uint256 myFavouriteNumber; //Default is 0
|
uint256 myFavouriteNumber; //Default is 0
| 16,277 |
319 | // Function to withdraw contract funds. _address address to transfer funds to. _amount amount to be transferred in wei. / | function withdrawFunds(address _address, uint256 _amount)
external
onlyOwner
| function withdrawFunds(address _address, uint256 _amount)
external
onlyOwner
| 3,241 |
90 | // Gov Functions //Begins transfer of gov rights. The newPendingGov must call `_acceptGov` to finalize the transfer.Gov function to begin change of gov. The newPendingGov must call `_acceptGov` to finalize the transfer.newPendingGov New pending gov./ | function _setPendingGov(address newPendingGov)
external
| function _setPendingGov(address newPendingGov)
external
| 24,174 |
57 | // if minting an option then no need to transfer (means that we need to mint onExercise instead) | if (mintingOption == 2) {
return;
}
| if (mintingOption == 2) {
return;
}
| 20,855 |
22 | // Get the boost IDs for the staked team. | uint16[] memory _boostIds = inStakedteam[_staketeam].boostIds;
uint8 _boostRate = 0;
| uint16[] memory _boostIds = inStakedteam[_staketeam].boostIds;
uint8 _boostRate = 0;
| 11,688 |
525 | // Check if msg.sender is the current advocate of a Name/TAO ID / | modifier onlyAdvocate(address _id) {
require (senderIsAdvocate(msg.sender, _id));
_;
}
| modifier onlyAdvocate(address _id) {
require (senderIsAdvocate(msg.sender, _id));
_;
}
| 32,661 |
352 | // Get the source of the operator contract's authority./ If the contract uses delegated authority,/ returns the original source of the delegated authority./ If the contract doesn't use delegated authority,/ returns the contract itself./ Authorize `getAuthoritySource(operatorContract)`/ to grant `operatorContract` the a... | function getAuthoritySource(
address operatorContract
| function getAuthoritySource(
address operatorContract
| 6,973 |
209 | // store request in the core | requestId= requestCore.createRequest(msg.sender, _payees, _expectedAmounts, _payer, _data);
| requestId= requestCore.createRequest(msg.sender, _payees, _expectedAmounts, _payer, _data);
| 47,276 |
238 | // not first bet in current cycle, add amount | bets_[player].amount = bets_[player].amount.add(value);
| bets_[player].amount = bets_[player].amount.add(value);
| 48,371 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.