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 |
|---|---|---|---|---|
29 | // Write the abi-encoded calldata into memory, beginning with the function selector. | mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
mstore(add(freeMemoryPointer, 4), from) // Append the "from" argument.
mstore(add(freeMemoryPointer, 36), to) // Append the "to" argument.
mstore(add(freeMemoryPointer, 68), amou... | mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
mstore(add(freeMemoryPointer, 4), from) // Append the "from" argument.
mstore(add(freeMemoryPointer, 36), to) // Append the "to" argument.
mstore(add(freeMemoryPointer, 68), amou... | 2,848 |
100 | // Fees 30% in total - 0% devFundFee for development fund - 0% comFundFee for community fund - 30% used to burn/repurchase btfs which will be sent to profit pool | uint256 public devFundFee = 0;
uint256 public constant devFundMax = 10000;
uint256 public comFundFee = 0;
uint256 public constant comFundMax = 10000;
uint256 public burnFee = 3000;
uint256 public constant burnMax = 10000;
| uint256 public devFundFee = 0;
uint256 public constant devFundMax = 10000;
uint256 public comFundFee = 0;
uint256 public constant comFundMax = 10000;
uint256 public burnFee = 3000;
uint256 public constant burnMax = 10000;
| 25,818 |
3 | // GraphCurationToken contract This is the implementation of the Curation ERC20 token (GCS). GCS are created for each subgraph deployment curated in the Curation contract.The Curation contract is the owner of GCS tokens and the only one allowed to mint orburn them. GCS tokens are transferrable and their holders can do ... | contract GraphCurationToken is ERC20Upgradeable, Governed {
/**
* @dev Graph Curation Token Contract initializer.
* @param _owner Address of the contract issuing this token
*/
function initialize(address _owner) external initializer {
Governed._initialize(_owner);
ERC20Upgradeable... | contract GraphCurationToken is ERC20Upgradeable, Governed {
/**
* @dev Graph Curation Token Contract initializer.
* @param _owner Address of the contract issuing this token
*/
function initialize(address _owner) external initializer {
Governed._initialize(_owner);
ERC20Upgradeable... | 1,608 |
149 | // Random DS Proof Step 1: The prefix has to match 'LP\x01' (Ledger Proof version 1) | if ((_proof[0] != "L") || (_proof[1] != "P") || (uint8(_proof[2]) != uint8(1))) {
return 1;
}
| if ((_proof[0] != "L") || (_proof[1] != "P") || (uint8(_proof[2]) != uint8(1))) {
return 1;
}
| 1,557 |
14 | // Fallback function for receiving payments | function() public payable {
// Don't need to do anything
}
| function() public payable {
// Don't need to do anything
}
| 9,014 |
40 | // Trade start check | if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
| if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
| 38,720 |
61 | // 获得token直接给V2 | mstore(ptr,0x022c0d9f)
mstore(add(ptr,0x20),div(calldataload(0xc4),0x100000000000000000000000000000000))
mstore(add(ptr,0x40),and(calldataload(0xc4),0xffffffffffffffffffffffffffffffff))
mstore(add(ptr,0x60),nextAddr)
mstore(add(ptr,0x80),0x... | mstore(ptr,0x022c0d9f)
mstore(add(ptr,0x20),div(calldataload(0xc4),0x100000000000000000000000000000000))
mstore(add(ptr,0x40),and(calldataload(0xc4),0xffffffffffffffffffffffffffffffff))
mstore(add(ptr,0x60),nextAddr)
mstore(add(ptr,0x80),0x... | 19,613 |
7 | // maps dna to bool if claimed to avoid duplicates | mapping (uint256 => bool) public DnaToClaimedMap;
| mapping (uint256 => bool) public DnaToClaimedMap;
| 17,322 |
2 | // Returns staked amount by wallet address / | function balanceOf(
address _walletAddress
)
external
view
returns (uint256)
| function balanceOf(
address _walletAddress
)
external
view
returns (uint256)
| 29,567 |
73 | // The maximum value of a uint256 contains 78 digits (1 byte per digit), but we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. We will need 1 word for the trailing zeros padding, 1 word for the length, and 3 words for a maximum of 78 digits. | str := add(mload(0x40), 0x80)
| str := add(mload(0x40), 0x80)
| 14,433 |
59 | // true if (cEth APR - cDai APR) >= (aEth APR - aDai APR), otherwise, false | function findBestRate() public view returns (bool) {
return AaveDaiAPR().mul(targetRatio).div(1e18).add(CompoundEthAPR()) > CompoundDaiAPR().mul(targetRatio).div(1e18).add(AaveEthAPR());
}
| function findBestRate() public view returns (bool) {
return AaveDaiAPR().mul(targetRatio).div(1e18).add(CompoundEthAPR()) > CompoundDaiAPR().mul(targetRatio).div(1e18).add(AaveEthAPR());
}
| 3,725 |
20 | // approve a contract to be used during harvesting | function allowHarvester(address target, bool allowed) public onlyOwner {
if (allowed) {
_allHarvesters.push(target);
}
allowedHarvesters[target] = allowed;
emit UpdateAllowedHarvester(target, allowed);
}
| function allowHarvester(address target, bool allowed) public onlyOwner {
if (allowed) {
_allHarvesters.push(target);
}
allowedHarvesters[target] = allowed;
emit UpdateAllowedHarvester(target, allowed);
}
| 19,874 |
44 | // Modifier to allow function calls only from the Manager. / | modifier onlyManager() {
require(msg.sender == _manager(), "Only manager can execute");
_;
}
| modifier onlyManager() {
require(msg.sender == _manager(), "Only manager can execute");
_;
}
| 15,444 |
15 | // See {ITrustedIssuersRegistry-hasClaimTopic}. / | function hasClaimTopic(address _issuer, uint256 _claimTopic) external view override returns (bool) {
uint256 length = _trustedIssuerClaimTopics[_issuer].length;
uint256[] memory claimTopics = _trustedIssuerClaimTopics[_issuer];
for (uint256 i = 0; i < length; i++) {
if (claimTopi... | function hasClaimTopic(address _issuer, uint256 _claimTopic) external view override returns (bool) {
uint256 length = _trustedIssuerClaimTopics[_issuer].length;
uint256[] memory claimTopics = _trustedIssuerClaimTopics[_issuer];
for (uint256 i = 0; i < length; i++) {
if (claimTopi... | 4,144 |
40 | // view balanceOfStaged (amount that is staged) | function getBalanceOfStaged() external view returns (uint256) {
return esds.balanceOfStaged(address(this));
}
| function getBalanceOfStaged() external view returns (uint256) {
return esds.balanceOfStaged(address(this));
}
| 10,741 |
21 | // Delegates the current call to nftImplementation. This function does not return to its internall call site, it will return directly to the external caller. / | function _fallback() internal virtual {
address impl = address(nftImplementation);
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad a... | function _fallback() internal virtual {
address impl = address(nftImplementation);
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad a... | 29,461 |
7 | // length | function ln_() external view isOwnerOrManager returns (uint) {
return mediators.length;
}
| function ln_() external view isOwnerOrManager returns (uint) {
return mediators.length;
}
| 35,257 |
6 | // 28 first epochs (1 week) with 4.5% expansion regardless of PegToken price | uint256 public bootstrapEpochs;
uint256 public bootstrapSupplyExpansionPercent;
| uint256 public bootstrapEpochs;
uint256 public bootstrapSupplyExpansionPercent;
| 8,812 |
50 | // Exclude the owner and this contract from fees | _isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
| _isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
| 5,219 |
46 | // Transfers the StakeAmount from the reporded miner to the reporting party | TellorTransfer.doTransfer(self, disp.reportedMiner, disp.reportingParty, self.uintVars[keccak256("stakeAmount")]);
| TellorTransfer.doTransfer(self, disp.reportedMiner, disp.reportingParty, self.uintVars[keccak256("stakeAmount")]);
| 15,316 |
3 | // Maximum integer (used for managing allowance) | uint256 public constant MAX_INT = 2 ** 256 - 1;
| uint256 public constant MAX_INT = 2 ** 256 - 1;
| 10,458 |
0 | // Structs / | struct MintData
| struct MintData
| 8,478 |
48 | // call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)it is assumed that when does this that the cal... | ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, this, _extraData);
return true;
| ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, this, _extraData);
return true;
| 22,544 |
1 | // --- Events --- |
event OrumTokenAddressSet(address _orumTokenAddress);
event StabilityPoolAddressSet(address _stabilityPoolAddress);
event TotalOrumIssuedUpdated(uint _totalOrumIssued);
|
event OrumTokenAddressSet(address _orumTokenAddress);
event StabilityPoolAddressSet(address _stabilityPoolAddress);
event TotalOrumIssuedUpdated(uint _totalOrumIssued);
| 2,054 |
28 | // Validating mint passes | for (uint256 index = 0; index < guids.length; index++) {
| for (uint256 index = 0; index < guids.length; index++) {
| 36,796 |
4 | // It checks if token is stable coin | mapping(address => bool) public isStableToken;
address[] public allStableTokens;
| mapping(address => bool) public isStableToken;
address[] public allStableTokens;
| 36,339 |
54 | // ERC20 token address | address public immutable token;
| address public immutable token;
| 19,147 |
35 | // De-list token on transfer. | function _beforeTokenTransfer(
| function _beforeTokenTransfer(
| 1,171 |
0 | // Le mot clé "public" rend ces variables/ Structure Utilisateur / | struct User {
/* Adresse (hash) de l'utilisateur (deprecated) */
bytes32 userAddress;
/* Montant de QC que possède l'utilisateur */
uint coins;
/* Adresses des transactions de l'utilisateur */
mapping (uint => uint) transactions;
/* Nombre de transactions */
uint userNumberOfTransactionsInLedger;
}
| struct User {
/* Adresse (hash) de l'utilisateur (deprecated) */
bytes32 userAddress;
/* Montant de QC que possède l'utilisateur */
uint coins;
/* Adresses des transactions de l'utilisateur */
mapping (uint => uint) transactions;
/* Nombre de transactions */
uint userNumberOfTransactionsInLedger;
}
| 34,899 |
27 | // should be safe because a team can't be killed if there are 0 teams to kill. | Battleboards[battleboardId].numTeams1 -= 1;
| Battleboards[battleboardId].numTeams1 -= 1;
| 10,871 |
236 | // Returns the amount of votes that `account` had at the end of a past block (`blockNumber`). Requirements: - `blockNumber` must have been already mined / | function getPastVotes(address account, uint256 blockNumber)
public
view
virtual
override
returns (uint256)
| function getPastVotes(address account, uint256 blockNumber)
public
view
virtual
override
returns (uint256)
| 20,018 |
9 | // Map a token to enable its movement via the PoS Portal, callable only by mappers rootToken address of token on root chain / | function mapToken(address rootToken) public {
// check if token is already mapped
require(rootToChildTokens[rootToken] == address(0x0), "FxERC721RootTunnel: ALREADY_MAPPED");
// name, symbol
ERC721 rootTokenContract = ERC721(rootToken);
string memory name = rootTokenContract... | function mapToken(address rootToken) public {
// check if token is already mapped
require(rootToChildTokens[rootToken] == address(0x0), "FxERC721RootTunnel: ALREADY_MAPPED");
// name, symbol
ERC721 rootTokenContract = ERC721(rootToken);
string memory name = rootTokenContract... | 55,822 |
46 | // called by the owner of the contract to rescue the token from the contract/ amount amount of token to withdraw | function withdrawToken(uint256 amount) external onlyOwner{
IERC20(token).transfer(msg.sender, amount);
}
| function withdrawToken(uint256 amount) external onlyOwner{
IERC20(token).transfer(msg.sender, amount);
}
| 3,965 |
471 | // allows the owner to set the oracle address to use for value conversionssetting the _oracleAddress to address(0) removes support for the token This will also call update to ensure at least one datapoint has been recorded. / | function setOracle(
address _tokenAddress,
address _oracleAddress
) external;
| function setOracle(
address _tokenAddress,
address _oracleAddress
) external;
| 27,038 |
268 | // res += valcoefficients[40]. | res := addmod(res,
mulmod(val, /*coefficients[40]*/ mload(0xa40), PRIME),
PRIME)
| res := addmod(res,
mulmod(val, /*coefficients[40]*/ mload(0xa40), PRIME),
PRIME)
| 33,815 |
76 | // Gets the current votes balance for `account` account The address to get votes balancereturn The number of current votes for `account` / | function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
| function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
| 4,587 |
181 | // ===== Permissioned Actions: Governance ===== | function setFarmPerformanceFeeGovernance(uint256 _fee) external {
_onlyGovernance();
farmPerformanceFeeGovernance = _fee;
}
| function setFarmPerformanceFeeGovernance(uint256 _fee) external {
_onlyGovernance();
farmPerformanceFeeGovernance = _fee;
}
| 25,103 |
94 | // raised when an address is zero | error NonZeroAddress(address addr);
| error NonZeroAddress(address addr);
| 32,149 |
26 | // send tokens | function transfer(address _to, uint256 _value) public returns (bool success) {
require(_balanceOf[msg.sender] >= _value);
_transfer(msg.sender, _to, _value);
return true;
}
| function transfer(address _to, uint256 _value) public returns (bool success) {
require(_balanceOf[msg.sender] >= _value);
_transfer(msg.sender, _to, _value);
return true;
}
| 32,298 |
15 | // dezasociaza contul curent de compania ei veche (daca era asociat inainte cu o alta companie) | if (bytes(companies[msg.sender]).length != 0) {
companyAddresses[companies[msg.sender]] = address(0);
companies[msg.sender] = "";
}
| if (bytes(companies[msg.sender]).length != 0) {
companyAddresses[companies[msg.sender]] = address(0);
companies[msg.sender] = "";
}
| 18,957 |
11 | // Owner of this contract | address public owner;
uint public perTokenPrice = 0;
uint256 public owner_balance = 12000000 * 10 **10;
uint256 public one_ether_usd_price = 0;
uint256 public bonus_percentage = 0;
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _... | address public owner;
uint public perTokenPrice = 0;
uint256 public owner_balance = 12000000 * 10 **10;
uint256 public one_ether_usd_price = 0;
uint256 public bonus_percentage = 0;
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _... | 41,441 |
185 | // calculate amount of FHM available for claim by depositor_depositor addressindex uint return pendingPayout_ uint / | function pendingPayoutFor( address _depositor, uint index ) external view returns ( uint pendingPayout_ ) {
uint percentVested = percentVestedFor( _depositor, index );
uint percentVestedBlocks = percentVestedBlocksFor( _depositor, index );
uint payout = depositors.get(_depositor, index).payo... | function pendingPayoutFor( address _depositor, uint index ) external view returns ( uint pendingPayout_ ) {
uint percentVested = percentVestedFor( _depositor, index );
uint percentVestedBlocks = percentVestedBlocksFor( _depositor, index );
uint payout = depositors.get(_depositor, index).payo... | 19,093 |
48 | // See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is notrequired by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address.- `sender` must have a balance of at least `amount`.- the caller must have allowance for... | function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
_transfer(sender, recipient, amount);
return true;
... | function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
_transfer(sender, recipient, amount);
return true;
... | 1,036 |
4 | // The last active operator | address lastActiveOperator;
| address lastActiveOperator;
| 8,775 |
791 | // Add a new LP to the pool. Can only be called by the owner./ DO NOT add the same LP token more than once. Rewards will be messed up if you do./allocPoint AP of the new pool./_lpToken Address of the LP ERC-20 token./_rewarder Address of the rewarder delegate. | function add(
uint256 allocPoint,
IERC20 _lpToken,
IRewarder _rewarder
| function add(
uint256 allocPoint,
IERC20 _lpToken,
IRewarder _rewarder
| 38,565 |
76 | // Deposits funds into the vault.//_amountthe amount of funds to deposit. | function deposit(uint256 _amount) external;
| function deposit(uint256 _amount) external;
| 3,677 |
0 | // token vars | uint256 public tokenIds;
| uint256 public tokenIds;
| 18,176 |
22 | // returns token value in terms of ETH if the pool contains ETH. if the pool does not contain ETH, the value is returned in terms of the 0 index coin. | function getTokenValue(uint8 _index)public view returns(uint){
if(hasEth == 0){
Coin _coin = Coin(payable(address(uint160(tokenData[0]))));
uint256 primaryBalance = _coin.balanceOf(address(this));
return bmul(primaryBalance, bdiv(uint256(tokenData[_index]>>160),uint256(to... | function getTokenValue(uint8 _index)public view returns(uint){
if(hasEth == 0){
Coin _coin = Coin(payable(address(uint160(tokenData[0]))));
uint256 primaryBalance = _coin.balanceOf(address(this));
return bmul(primaryBalance, bdiv(uint256(tokenData[_index]>>160),uint256(to... | 26,823 |
53 | // Check the specified wallet whether it is in the whitelist._wallet The address of wallet to check./ | function isWhitelisted(address _wallet) constant public returns (bool) {
return whitelist[_wallet];
}
| function isWhitelisted(address _wallet) constant public returns (bool) {
return whitelist[_wallet];
}
| 49,535 |
23 | // Trait ids start from 1 and are defined in a sequential order. Zero trait id is possible - it means that generating NFT won't have such attribute. But it's possible only for those attributes, which were added after deployment, i.e. whose ids >= `minAttributesAmount` | if ((i < minAttributesAmount && seed[i] == 0) || seed[i] > maxTraitIdInAttribute) {
return false;
}
| if ((i < minAttributesAmount && seed[i] == 0) || seed[i] > maxTraitIdInAttribute) {
return false;
}
| 6,105 |
1 | // Using up all of the gas you send causes transaction to fail. State changes are undone GFas spent are not refunded | function forever() public {
// Loop until all gas is spent and transaction fails
while (true) {
i += 1;
}
}
| function forever() public {
// Loop until all gas is spent and transaction fails
while (true) {
i += 1;
}
}
| 13,074 |
14 | // register an organization address with the hub and join the trust graph/signup is permanent for organizations too, there's no way to unsignup | function organizationSignup() public {
// can't register as an organization if you have a token
require(address(userToToken[msg.sender]) == address(0), "Normal users cannot signup as organizations");
// can't register as an organization twice
require(organizations[msg.sender] == fals... | function organizationSignup() public {
// can't register as an organization if you have a token
require(address(userToToken[msg.sender]) == address(0), "Normal users cannot signup as organizations");
// can't register as an organization twice
require(organizations[msg.sender] == fals... | 21,462 |
17 | // Lender depends | address navFeed = borrowerDeployer.feed();
DependLike_3(reserve_).depend("shelf", shelf_);
DependLike_3(lenderDeployer.assessor()).depend("navFeed", navFeed);
| address navFeed = borrowerDeployer.feed();
DependLike_3(reserve_).depend("shelf", shelf_);
DependLike_3(lenderDeployer.assessor()).depend("navFeed", navFeed);
| 7,220 |
51 | // See {IERC721-setApprovalForAll}. / | function setApprovalForAll(address operator, bool approved) public override {
require(operator != _msgSender(), "ERC721A: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
| function setApprovalForAll(address operator, bool approved) public override {
require(operator != _msgSender(), "ERC721A: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
| 2,128 |
42 | // Vote for proj. using id: _id | function vote(uint _id) public onlyVoter returns(bool success){
updateAccount(msg.sender);
require(frozen == false);
for (uint p = 0; p < projects.length; p++){
if(projects[p].id == _id && projects[p].active == true){
projects[p].votesWeight += sqrt(accounts[msg... | function vote(uint _id) public onlyVoter returns(bool success){
updateAccount(msg.sender);
require(frozen == false);
for (uint p = 0; p < projects.length; p++){
if(projects[p].id == _id && projects[p].active == true){
projects[p].votesWeight += sqrt(accounts[msg... | 40,053 |
140 | // power-up old campaign | if (payRate > 0) {
require(payRate > brand.payRate, "!expired: increasing pay rate only");
require(payRate < 1<<192, "payRate overflow");
brand.payRate = uint192(payRate);
}
| if (payRate > 0) {
require(payRate > brand.payRate, "!expired: increasing pay rate only");
require(payRate < 1<<192, "payRate overflow");
brand.payRate = uint192(payRate);
}
| 22,792 |
102 | // last cumulative price; | uint256 internal price_cumulative_last;
| uint256 internal price_cumulative_last;
| 68,846 |
295 | // https:docs.synthetix.io/contracts/source/contracts/proxyable | contract Proxyable is Owned {
// This contract should be treated like an abstract contract
/* The proxy this contract exists behind. */
Proxy public proxy;
/* The caller of the proxy, passed through to this contract.
* Note that every function using this member must apply the onlyProxy or
* ... | contract Proxyable is Owned {
// This contract should be treated like an abstract contract
/* The proxy this contract exists behind. */
Proxy public proxy;
/* The caller of the proxy, passed through to this contract.
* Note that every function using this member must apply the onlyProxy or
* ... | 3,657 |
13 | // Claim accumulated rewards for a set of tokens at a given cycle number | function claim(
address[] calldata tokens,
uint256[] calldata cumulativeAmounts,
uint256 index,
uint256 cycle,
bytes32[] calldata merkleProof
| function claim(
address[] calldata tokens,
uint256[] calldata cumulativeAmounts,
uint256 index,
uint256 cycle,
bytes32[] calldata merkleProof
| 1,307 |
22 | // maybe add a delay between them, 12 hrs? | function applyAddToken() external;
function updateWeightsGradually(
uint[] calldata newWeights,
uint startBlock,
uint endBlock
) external;
| function applyAddToken() external;
function updateWeightsGradually(
uint[] calldata newWeights,
uint startBlock,
uint endBlock
) external;
| 35,410 |
158 | // 计算用户有多少奖金可以领取 | function pendingWithdrawWithBetRound(address user,uint256 _betRound) public view returns (uint256 withdrawAmount,uint256 winAmount){
require(oracle.isBetRoundWinOpen(_betRound),'bet round win not open');
PlayerInfo storage player = players[msg.sender];
require(players[msg.sender].registerTim... | function pendingWithdrawWithBetRound(address user,uint256 _betRound) public view returns (uint256 withdrawAmount,uint256 winAmount){
require(oracle.isBetRoundWinOpen(_betRound),'bet round win not open');
PlayerInfo storage player = players[msg.sender];
require(players[msg.sender].registerTim... | 80,316 |
75 | // Admin Functions // Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer. Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer. newPendingAdmin New pending admin.return uint 0=success, otherwise a failure (see ... | function _setPendingAdmin(address payable newPendingAdmin) external returns (uint256) {
// Check caller = admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);
}
// Save current value, if any, for inclusion in log
... | function _setPendingAdmin(address payable newPendingAdmin) external returns (uint256) {
// Check caller = admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);
}
// Save current value, if any, for inclusion in log
... | 50,942 |
38 | // do nothing | } catch (bytes memory reason) {
| } catch (bytes memory reason) {
| 33,781 |
69 | // Argument validations | _validateLockParameters(beneficiary, amount, releaseTime);
require(!_isLockExists(id), "Token lock already exists");
| _validateLockParameters(beneficiary, amount, releaseTime);
require(!_isLockExists(id), "Token lock already exists");
| 19,475 |
22 | // If true, no changes can be made | function unchangeable() public view returns (bool){
return _unchangeable;
}
| function unchangeable() public view returns (bool){
return _unchangeable;
}
| 8,244 |
14 | // Interface for the optional metadata functions from the ERC20 standard. _Available since v4.1._ / | interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals ... | interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals ... | 447 |
35 | // multipliying tonnes with decimals | uint256 cap = totalVintageQuantity * 10**decimals();
| uint256 cap = totalVintageQuantity * 10**decimals();
| 25,191 |
2 | // Address of ICHI contract. | IERC20 private immutable ICHI;
| IERC20 private immutable ICHI;
| 40,092 |
96 | // See {IERC721Enumerable-tokenOfOwnerByIndex}.This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first.It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case. / | function tokenOfOwnerByIndex(address owner, uint256 index)
public
view
override
returns (uint256)
{
require(index < balanceOf(owner), "ERC721A: owner index out of bounds");
uint256 numMintedSoFar = totalSupply();
uint256 tokenIdsIdx = 0;
address currOwnershipAddr ... | function tokenOfOwnerByIndex(address owner, uint256 index)
public
view
override
returns (uint256)
{
require(index < balanceOf(owner), "ERC721A: owner index out of bounds");
uint256 numMintedSoFar = totalSupply();
uint256 tokenIdsIdx = 0;
address currOwnershipAddr ... | 71,710 |
58 | // Convert current token to COT via ETH help | else {
| else {
| 21,970 |
59 | // function to get total token stake in contract | function getTotalTokenStakesInContract() public view returns(uint256){
return totalTokenStakesInContract;
}
| function getTotalTokenStakesInContract() public view returns(uint256){
return totalTokenStakesInContract;
}
| 75,240 |
63 | // And the specified start time has not yet come If initialization return an error, check the start date! | require(now <= startTime);
initialization();
emit Initialized();
renewal = 0;
isInitialized = true;
| require(now <= startTime);
initialization();
emit Initialized();
renewal = 0;
isInitialized = true;
| 9,173 |
3 | // users[users.length-1].userAddress = horce_image; users[users.length-1].salary = _salary; | return users.length;
| return users.length;
| 2,662 |
2 | // Creation code | bytes memory creationCode = _PROXY_CHILD_BYTECODE;
| bytes memory creationCode = _PROXY_CHILD_BYTECODE;
| 30,037 |
36 | // Fallback function to receive Ether | receive() external payable {}
// Function to set an address Exempt From TxFee
function setExemptFromTxFee(address _address, bool _exempt) public onlyOwner {
isExemptFromTxFee[_address] = _exempt;
emit ExemptionStatusChanged(_address, _exempt);
}
| receive() external payable {}
// Function to set an address Exempt From TxFee
function setExemptFromTxFee(address _address, bool _exempt) public onlyOwner {
isExemptFromTxFee[_address] = _exempt;
emit ExemptionStatusChanged(_address, _exempt);
}
| 5,707 |
82 | // Withdraw LP tokens from Amplify. | function withdrawLP(uint256 _pid, uint256 _amount) public whenNotPaused {
massUpdatePools();
_withdrawInternal(_pid, _amount, true);
}
| function withdrawLP(uint256 _pid, uint256 _amount) public whenNotPaused {
massUpdatePools();
_withdrawInternal(_pid, _amount, true);
}
| 40,569 |
216 | // Convert a real to an integer. Preserves sign. / | function fromReal(int256 realValue) internal pure returns (int216) {
return int216(realValue / REAL_ONE);
}
| function fromReal(int256 realValue) internal pure returns (int216) {
return int216(realValue / REAL_ONE);
}
| 37,085 |
13 | // Ensure there are enough tokens to be burned | uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "Burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
| uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "Burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
| 14,541 |
583 | // res += val(coefficients[256] + coefficients[257]adjustments[19]). | res := addmod(res,
mulmod(val,
add(/*coefficients[256]*/ mload(0x2440),
mulmod(/*coefficients[257]*/ mload(0x2460),
| res := addmod(res,
mulmod(val,
add(/*coefficients[256]*/ mload(0x2440),
mulmod(/*coefficients[257]*/ mload(0x2460),
| 20,873 |
2 | // owner The address from which the balance will be retrieved/ return The balance | function balanceOf(address owner) public view returns (uint256 balance);
| function balanceOf(address owner) public view returns (uint256 balance);
| 6,118 |
305 | // Call initialize on the transaction request clone. | TransactionRequestCore(transactionRequest).initialize.value(msg.value)(
[
msg.sender, // Created by
_addressArgs[0], // meta.owner
_addressArgs[1], // paymentData.feeRecipient
_addressArgs[2] // txnData.toAddress
]... | TransactionRequestCore(transactionRequest).initialize.value(msg.value)(
[
msg.sender, // Created by
_addressArgs[0], // meta.owner
_addressArgs[1], // paymentData.feeRecipient
_addressArgs[2] // txnData.toAddress
]... | 16,080 |
241 | // Construct the contractaddressRegistry Registry containing our system addresses Note: Pause operation in this context. Only calls from Proxy allowed. / | constructor(
IAddressRegistry addressRegistry,
OpenSeaProxyRegistry openSeaProxyRegistry
| constructor(
IAddressRegistry addressRegistry,
OpenSeaProxyRegistry openSeaProxyRegistry
| 38,803 |
24 | // 新增這個活動票券的 Host。 | function setHost(address host) external onlyHost {
hosts[host] = true;
}
| function setHost(address host) external onlyHost {
hosts[host] = true;
}
| 30,244 |
171 | // assign top bidder and bid time | highestBid.bidder = _msgSender();
highestBid.bid = bidAmount;
highestBid.lastBidTime = _getNow();
emit BidPlaced(_garmentTokenId, _msgSender(), bidAmount);
| highestBid.bidder = _msgSender();
highestBid.bid = bidAmount;
highestBid.lastBidTime = _getNow();
emit BidPlaced(_garmentTokenId, _msgSender(), bidAmount);
| 34,006 |
448 | // When LQTYToken deployed, it should have transferred CommunityIssuance's LQTY entitlement | uint LQTYBalance = lqtyToken.balanceOf(address(this));
assert(LQTYBalance >= LQTYSupplyCap);
emit LQTYTokenAddressSet(_lqtyTokenAddress);
emit StabilityPoolAddressSet(_stabilityPoolAddress);
_renounceOwnership();
| uint LQTYBalance = lqtyToken.balanceOf(address(this));
assert(LQTYBalance >= LQTYSupplyCap);
emit LQTYTokenAddressSet(_lqtyTokenAddress);
emit StabilityPoolAddressSet(_stabilityPoolAddress);
_renounceOwnership();
| 21,356 |
4 | // Proxy Basic proxy that delegates all calls to a fixed implementing contract.The implementing contract cannot be upgraded. / | contract Proxy is Ownable {
address public implementation;
event Received(uint256 indexed value, address indexed sender, bytes data);
event ChangedImplementationContract(address implementation);
constructor(address _implementation) public {
implementation = _implementation;
}
function... | contract Proxy is Ownable {
address public implementation;
event Received(uint256 indexed value, address indexed sender, bytes data);
event ChangedImplementationContract(address implementation);
constructor(address _implementation) public {
implementation = _implementation;
}
function... | 47,215 |
255 | // Decodes MultiAsset assetData and recursively transfers assets to sender./assetData Byte array encoded for the respective asset proxy./from Address to transfer asset from./to Address to transfer asset to./amount Amount of asset to transfer to sender. | function transferMultiAsset(
bytes memory assetData,
address from,
address to,
uint256 amount
)
internal
| function transferMultiAsset(
bytes memory assetData,
address from,
address to,
uint256 amount
)
internal
| 49,095 |
2 | // Set file info and associate it with the sender address_fileName Name of the file_ipfsHash Hash of file on IPFS_tags String with tags/ | function insertFile(string _fileName, string _ipfsHash, string _tags)
public
whenNotPaused
inputIsValid(_fileName,_ipfsHash,_tags)
| function insertFile(string _fileName, string _ipfsHash, string _tags)
public
whenNotPaused
inputIsValid(_fileName,_ipfsHash,_tags)
| 11,807 |
9 | // Save this for an assertion in the future | uint previousBalances = balanceOf[_from] + balanceOf[_to];
| uint previousBalances = balanceOf[_from] + balanceOf[_to];
| 1,055 |
3 | // Initializes the debt token. pool The address of the lending pool where this oToken will be used underlyingAsset The address of the underlying asset of this oToken (E.g. WETH for aWETH) incentivesController The smart contract managing potential incentives distribution debtTokenDecimals The decimals of the debtToken, ... | function initialize(
ILendingPool pool,
address underlyingAsset,
IOmniDexIncentivesController incentivesController,
uint8 debtTokenDecimals,
string memory debtTokenName,
string memory debtTokenSymbol,
bytes calldata params
| function initialize(
ILendingPool pool,
address underlyingAsset,
IOmniDexIncentivesController incentivesController,
uint8 debtTokenDecimals,
string memory debtTokenName,
string memory debtTokenSymbol,
bytes calldata params
| 26,087 |
43 | // they approve the slammertime contract to take the token away from them | require(approve(slammerTime,_id));
require(approve(slammerTime,_id2));
require(approve(slammerTime,_id3));
require(approve(slammerTime,_id4));
require(approve(slammerTime,_id5));
bytes32 stack = keccak256(nonce++,msg.sender);
uint256[5] memory ids = [_id,_id2,_id3,_id4,_id5];
... | require(approve(slammerTime,_id));
require(approve(slammerTime,_id2));
require(approve(slammerTime,_id3));
require(approve(slammerTime,_id4));
require(approve(slammerTime,_id5));
bytes32 stack = keccak256(nonce++,msg.sender);
uint256[5] memory ids = [_id,_id2,_id3,_id4,_id5];
... | 65,290 |
123 | // Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite | * {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the accoun... | * {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the accoun... | 966 |
42 | // Failsafe to restart auction with params in case of failure / | function restartAuction(
uint256 _seconds,
uint256 _startingPrice,
uint256 _priceDeduction
| function restartAuction(
uint256 _seconds,
uint256 _startingPrice,
uint256 _priceDeduction
| 43,719 |
46 | // Erc智能合约 | contract ERC20 is ERC20Interface, BobbyERC20Base {
using BobbySafeMath for uint256;
uint private _Thousand = 1000;
uint private _Billion = _Thousand * _Thousand * _Thousand;
//代币基本信息
string private _name = "BOBBY"; //代币名称
string private _symbol = "BOBBY"; //代币标识
uint8 private _decima... | contract ERC20 is ERC20Interface, BobbyERC20Base {
using BobbySafeMath for uint256;
uint private _Thousand = 1000;
uint private _Billion = _Thousand * _Thousand * _Thousand;
//代币基本信息
string private _name = "BOBBY"; //代币名称
string private _symbol = "BOBBY"; //代币标识
uint8 private _decima... | 31,025 |
256 | // We call doTransferIn for the payer and the repayAmount Note: The cToken must handle variations between ERC-20 and ETH underlying. On success, the cToken holds an additional repayAmount of cash. doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.it returns the amount actually... | vars.actualRepayAmount = doTransferIn(payer, vars.repayAmount, isNative);
| vars.actualRepayAmount = doTransferIn(payer, vars.repayAmount, isNative);
| 33,205 |
36 | // Wraps ETH into WETH and make a collateral deposit in the BalanceSheet contract./This is a payable function so it can receive ETH transfers./weth The address of the WETH contract./balanceSheet The address of the BalanceSheet contract. | function wrapEthAndDepositCollateral(WethInterface weth, IBalanceSheetV2 balanceSheet) external payable;
| function wrapEthAndDepositCollateral(WethInterface weth, IBalanceSheetV2 balanceSheet) external payable;
| 41,060 |
120 | // sell -> the quote is the wanted token by the maker | return mustSkipFee[makerOrder.offerToken_][makerOrder.wantToken_]
? 0
: toMakerAmount.mul(feeEdoPerQuote[makerOrder.wantToken_]).div(10**feeEdoPerQuoteDecimals[makerOrder.wantToken_]);
| return mustSkipFee[makerOrder.offerToken_][makerOrder.wantToken_]
? 0
: toMakerAmount.mul(feeEdoPerQuote[makerOrder.wantToken_]).div(10**feeEdoPerQuoteDecimals[makerOrder.wantToken_]);
| 22,702 |
74 | // Internal function that burns an amount of the token of a given account.account The account whose tokens will be burnt.amount The amount that will be burnt./ | function _burn(address account, uint256 amount) internal {
require(amount <= _balances[account]);
_totalSupply = _totalSupply.sub(amount);
_balances[account] = _balances[account].sub(amount);
emit Transfer(account, address(0), amount);
}
| function _burn(address account, uint256 amount) internal {
require(amount <= _balances[account]);
_totalSupply = _totalSupply.sub(amount);
_balances[account] = _balances[account].sub(amount);
emit Transfer(account, address(0), amount);
}
| 22,803 |
185 | // mint MaskMan | function mintMaskMan(address _to, uint256 _count) external payable {
require(
totalSupply() + _count <= MAX_MM,
"Exceeds maximum supply of Mask Man"
);
if (msg.sender != owner()) {
require(saleOpen, "Sale is not open yet");
require(
... | function mintMaskMan(address _to, uint256 _count) external payable {
require(
totalSupply() + _count <= MAX_MM,
"Exceeds maximum supply of Mask Man"
);
if (msg.sender != owner()) {
require(saleOpen, "Sale is not open yet");
require(
... | 64,965 |
34 | // ERC20 精度,推荐是 8 / | function decimals() public view returns (uint8){
return tokenStore.decimals();
}
| function decimals() public view returns (uint8){
return tokenStore.decimals();
}
| 33,996 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.