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
// Green certificate /
struct Certificate { address token; uint256 value; }
struct Certificate { address token; uint256 value; }
22,714
38
// System-level secure distributed random number generator.
function updateRandomness(uint[2] memory sig) public { if (!validateAndVerify( TrafficSystemRandom, lastRandomness, toBytes(lastRandomness), BN256.G1Point(sig[0], sig[1]), lastHandledGroup)) { return; ...
function updateRandomness(uint[2] memory sig) public { if (!validateAndVerify( TrafficSystemRandom, lastRandomness, toBytes(lastRandomness), BN256.G1Point(sig[0], sig[1]), lastHandledGroup)) { return; ...
15,027
15
// Supply limited to 2^128 rather than 2^256 to prevent potentialmultiplication overflow
require(_supply < 2**128); totSupply = _supply; sym = _symbol; balance[msg.sender] = totSupply;
require(_supply < 2**128); totSupply = _supply; sym = _symbol; balance[msg.sender] = totSupply;
45,248
8
// move unlocked funds between poolscan be moved only by the owner and only from zero pool - the reserve cannot use locked funds (vesting)cannot be called before vesting is funded /
function moveFunds(uint256 toPoolId, uint256 amount) external onlyOwner { require(vestingEndDate > 0, "PoolsBase: pools not ready"); uint256 _lockedPercent = lockedPercent(); if (_lockedPercent > 0) { require( poolBalance[0] >= amount + vestingBase[0] * _lockedPer...
function moveFunds(uint256 toPoolId, uint256 amount) external onlyOwner { require(vestingEndDate > 0, "PoolsBase: pools not ready"); uint256 _lockedPercent = lockedPercent(); if (_lockedPercent > 0) { require( poolBalance[0] >= amount + vestingBase[0] * _lockedPer...
29,141
8
// EVM BLOCKHASH opcode can query no further than 256 blocks into the past. Given that settleBet uses block hash of placeBet as one of complementary entropy sources, we cannot process bets older than this threshold. On rare occasions myethergames.fun croupier may fail to invoke settleBet in this timespan due to technic...
uint constant BET_EXPIRATION_BLOCKS = 250;
uint constant BET_EXPIRATION_BLOCKS = 250;
5,734
58
// Returns the token collection name. /
function name() external view returns (string memory);
function name() external view returns (string memory);
5,783
47
// Issue tokens. See MonetarySupervisor but as a rule of thumb issueTo is only allowed:- on new loan (by trusted Lender contracts)- when converting old tokens using MonetarySupervisor- strictly to reserve by Stability Board (via MonetarySupervisor)
function issueTo(address to, uint amount) external restrict("MonetarySupervisor") { balances[to] = balances[to].add(amount); totalSupply = totalSupply.add(amount); emit Transfer(0x0, to, amount); emit AugmintTransfer(0x0, to, amount, "", 0); }
function issueTo(address to, uint amount) external restrict("MonetarySupervisor") { balances[to] = balances[to].add(amount); totalSupply = totalSupply.add(amount); emit Transfer(0x0, to, amount); emit AugmintTransfer(0x0, to, amount, "", 0); }
32,048
132
// e.g. 8e1717268172638 = 138145381104e17
uint256 scaled = x.mul(y);
uint256 scaled = x.mul(y);
11,563
17
// the first note is the current interest note
_loanVariables.settlementToken.confidentialTransferFrom(JOIN_SPLIT_PROOF, _proof2Outputs.get(0));
_loanVariables.settlementToken.confidentialTransferFrom(JOIN_SPLIT_PROOF, _proof2Outputs.get(0));
26,825
3
// Operators
function authorizeOperator(address _operator) external; function revokeOperator(address _operator) external; function isOperator(address _operator, address _tokenHolder) external view returns (bool); function authorizeOperatorByPartition(bytes32 _partition, address _operator) external; function revo...
function authorizeOperator(address _operator) external; function revokeOperator(address _operator) external; function isOperator(address _operator, address _tokenHolder) external view returns (bool); function authorizeOperatorByPartition(bytes32 _partition, address _operator) external; function revo...
26,723
21
// fees for all the completed epochs
for (uint256 liqIndex = claimedTillEpochIndex + 1; liqIndex <= epochsLength; liqIndex++) {
for (uint256 liqIndex = claimedTillEpochIndex + 1; liqIndex <= epochsLength; liqIndex++) {
10,323
71
// Get bank who has lately updated the customer details
* @param {bytes32} customerName The user name of the customer for whom the request is made * modifier isBankValid Checks whether bank has been validated and added by admin * @returns {address} Returns the bank address */ function lastUpdatedBy(bytes32 customerName) public view ...
* @param {bytes32} customerName The user name of the customer for whom the request is made * modifier isBankValid Checks whether bank has been validated and added by admin * @returns {address} Returns the bank address */ function lastUpdatedBy(bytes32 customerName) public view ...
40,551
20
// 定义一个调用CommandList的合约
contract MockCommandList { using CommandList for CommandList.commandMap; CommandList.commandMap commands; function insert( uint256 _fromChain, uint256 _toChain, uint256 _verbs, bytes32 _payloadHash ) public returns (uint256) { return commands.insert(msg.sender, _fromChain, _toChain, ...
contract MockCommandList { using CommandList for CommandList.commandMap; CommandList.commandMap commands; function insert( uint256 _fromChain, uint256 _toChain, uint256 _verbs, bytes32 _payloadHash ) public returns (uint256) { return commands.insert(msg.sender, _fromChain, _toChain, ...
35,934
85
// This isn't ever read from - it's only used to respond to the defaultOperators query.
address[] private _defaultOperatorsArray;
address[] private _defaultOperatorsArray;
7,176
79
// stop destroy
if(_tFeeTotal >= _maxDestroyAmount) return; _balances[deadAddress] = _balances[deadAddress].add(tAmount); _tFeeTotal = _tFeeTotal.add(tAmount); emit Transfer(sender, deadAddress, tAmount);
if(_tFeeTotal >= _maxDestroyAmount) return; _balances[deadAddress] = _balances[deadAddress].add(tAmount); _tFeeTotal = _tFeeTotal.add(tAmount); emit Transfer(sender, deadAddress, tAmount);
3,492
6
// ------------------------------ STRUCTS ------------------------------ //Represent a shareholder/account Shareholders address that can receive income/weight Determines share allocation
struct Shareholder { address account; uint96 weight; }
struct Shareholder { address account; uint96 weight; }
56,266
54
// e.g. assume scale = fullScale z = 10e189e17 = 9e36
uint256 z = x.mul(y);
uint256 z = x.mul(y);
18,723
3
// Overrides the Vault abstract contract's _withdrawToVault functionby utilizing the external contract's interface. /
function _withdrawFromVault(uint256 _amount, address _user) public override { bool depositSuccess = IERC20(vault).transfer(address(vault), _amount); require(depositSuccess, "VaultPipe: Deposit transfer failed."); vault.withdrawTokens(_amount, _user); }
function _withdrawFromVault(uint256 _amount, address _user) public override { bool depositSuccess = IERC20(vault).transfer(address(vault), _amount); require(depositSuccess, "VaultPipe: Deposit transfer failed."); vault.withdrawTokens(_amount, _user); }
21,830
7
// Allows to create new proxy contact using CREATE2 but it doesn't run the initializer./This method is only meant as an utility to be called from other methods/initializer Payload for message call sent to new proxy contract./saltNonce Nonce that will be used to generate the salt to calculate the address of the new prox...
function deployProxyWithNonce( bytes memory initializer, uint256 saltNonce
function deployProxyWithNonce( bytes memory initializer, uint256 saltNonce
16,060
193
// WETH-specific functions.
function deposit() external payable; function withdraw(uint amount) external;
function deposit() external payable; function withdraw(uint amount) external;
32,568
1
// Create an event for successful deposits
event Deposit( address indexed sender, uint256 indexed amount, uint256 indexed balance );
event Deposit( address indexed sender, uint256 indexed amount, uint256 indexed balance );
8,008
0
// Interface of the Token Deal standardImplementers can declare support of contract interfaces, which can then bequeried by others. /
interface ITokenDeal { function whitelistMint(address to) external; }
interface ITokenDeal { function whitelistMint(address to) external; }
34,109
3
// Function to calculate the interest accumulated using a linear interest rate formula rate The interest rate lastUpdateTimestamp The timestamp of the last update of the interestreturn The interest rate linearly accumulated during the timeDelta /
) internal view returns (uint256) { //solium-disable-next-line uint256 timeDifference = block.timestamp.sub( uint256(lastUpdateTimestamp) ); return rate.mul(timeDifference).div(SECONDS_PER_YEAR).add( Precision.FACTOR1E18 ); }
) internal view returns (uint256) { //solium-disable-next-line uint256 timeDifference = block.timestamp.sub( uint256(lastUpdateTimestamp) ); return rate.mul(timeDifference).div(SECONDS_PER_YEAR).add( Precision.FACTOR1E18 ); }
13,067
4
// check if the msg.sender is the validator factory.
modifier isValidatorFactory() { require( msg.sender == validatorFactory, "Caller is not the validator factory" ); _; }
modifier isValidatorFactory() { require( msg.sender == validatorFactory, "Caller is not the validator factory" ); _; }
28,628
54
// DEBUG ONLYrequire((InterfaceSignature_ERC165 == 0x01ffc9a7) && (InterfaceSignature_ERC721 == 0x9f40b779));
return ((_interfaceID == InterfaceSignature_ERC165) || (_interfaceID == InterfaceSignature_ERC721));
return ((_interfaceID == InterfaceSignature_ERC165) || (_interfaceID == InterfaceSignature_ERC721));
15,397
34
// The mapping to track administrator accounts - true is reserved for admin addresses.
mapping (address => bool) public administrators;
mapping (address => bool) public administrators;
42,416
11
// subtracnt the amount from sender
balanceOf[msg.sender] -= _amount;
balanceOf[msg.sender] -= _amount;
9,747
178
// whitelist count
function whitelistCount(address _address) public view returns(uint8) { return whitelist[_address]; }
function whitelistCount(address _address) public view returns(uint8) { return whitelist[_address]; }
31,227
174
// If the contract WAS NOT deployed by the TokenRegistry, and the contract exists, then it IS of local origin Return true if code exists at _addr
uint256 _codeSize;
uint256 _codeSize;
22,345
50
// An event emitted when a vote has been cast on a proposal
event VoteCast( address voter, uint256 proposalId, bool support, uint256 votes );
event VoteCast( address voter, uint256 proposalId, bool support, uint256 votes );
11,420
29
// special case for selling the entire supply
if (_sellAmount == _supply) { return _reserveBalance; }
if (_sellAmount == _supply) { return _reserveBalance; }
32,545
22
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes memory _data) private returns (bool) { moveTokens(msg.sender, _to, _value); ERC223ReceivingContract receiver = ERC223ReceivingContract(_to); receiver.tokenFallback(msg.sender, _value, _data); emit Transfer(msg.sender, _to, _value, _data); emit Trans...
function transferToContract(address _to, uint _value, bytes memory _data) private returns (bool) { moveTokens(msg.sender, _to, _value); ERC223ReceivingContract receiver = ERC223ReceivingContract(_to); receiver.tokenFallback(msg.sender, _value, _data); emit Transfer(msg.sender, _to, _value, _data); emit Trans...
10,648
90
// /Import cuties from previous version of Core contract./_oldAddress Old core contract address/_fromIndex (inclusive)/_toIndex (inclusive)
function migrate(address _oldAddress, uint40 _fromIndex, uint40 _toIndex) public onlyOwner whenPaused
function migrate(address _oldAddress, uint40 _fromIndex, uint40 _toIndex) public onlyOwner whenPaused
80,288
93
// Get reward token (stkAAVE) unclaimed rewards balance of bank node/ return rewardsBalance
function getRewardsBalance() external view override returns (uint256) { return unusedFundsIncentivesController.getRewardsBalance(_dividendAssets(), address(this)); }
function getRewardsBalance() external view override returns (uint256) { return unusedFundsIncentivesController.getRewardsBalance(_dividendAssets(), address(this)); }
7,151
61
// tt1 = (uint16 )workingStorage;
for (u = 0; u < m; u++) { uint8[2] memory buf; uint32 w; uint32 wr; OQS_SHA3_shake256_inc_squeeze(/*buf,*/ 2 /*sizeof(buf)*/); w = (uint32(buf[0]) << 8) | uint32(buf[1]); wr = w - (uint32(24578) & (((w - 24578) >> 31) - 1)); ...
for (u = 0; u < m; u++) { uint8[2] memory buf; uint32 w; uint32 wr; OQS_SHA3_shake256_inc_squeeze(/*buf,*/ 2 /*sizeof(buf)*/); w = (uint32(buf[0]) << 8) | uint32(buf[1]); wr = w - (uint32(24578) & (((w - 24578) >> 31) - 1)); ...
14,268
5
// Maps a user address to number of schedules created for the account
mapping(address => uint256) public numberOfSchedules;
mapping(address => uint256) public numberOfSchedules;
39,520
140
// The executor has not provided sufficient gas
reason = "NOT_ENOUGH_GAS";
reason = "NOT_ENOUGH_GAS";
17,609
10
// remove authority from the FlipperMom
FlipperMomAbstract(FLIPPER_MOM).setAuthority(address(0));
FlipperMomAbstract(FLIPPER_MOM).setAuthority(address(0));
17,464
36
// Check if the current round is active
if (rwNFT.numWithdrawals() != RWNFT_ROUND) {
if (rwNFT.numWithdrawals() != RWNFT_ROUND) {
11,147
3
// EIP1271 Interface/Standardized interface for an implementation of smart contract/ signatures as described in EIP-1271. The code that follows is identical to/ the code in the standard with the exception of formatting and syntax/ changes to adapt the code to our Solidity version.
interface EIP1271Verifier { /// @dev Should return whether the signature provided is valid for the /// provided data /// @param _hash Hash of the data to be signed /// @param _signature Signature byte array associated with _data /// /// MUST return the bytes4 magic value 0x1626ba7e when fun...
interface EIP1271Verifier { /// @dev Should return whether the signature provided is valid for the /// provided data /// @param _hash Hash of the data to be signed /// @param _signature Signature byte array associated with _data /// /// MUST return the bytes4 magic value 0x1626ba7e when fun...
30,112
29
// Contruct the sell params
address[] memory sellPath = new address[](2); sellPath[0] = _outputTokenAddress; sellPath[1] = _inputTokenAddress;
address[] memory sellPath = new address[](2); sellPath[0] = _outputTokenAddress; sellPath[1] = _inputTokenAddress;
36,397
42
// update token name, symbol/update token name, symbol/_name token new name/_symbol token new symbol
function update(string _name, string _symbol) external onlyOwner
function update(string _name, string _symbol) external onlyOwner
5,841
65
// uint contractBalance = Token(tokenAddress).balanceOf(address(this));
if (contractBalance < amount) { amount = contractBalance; }
if (contractBalance < amount) { amount = contractBalance; }
43,285
29
// protect partner quota in stage one
uint256 value = msg.value; uint256 fund = _stageFund[stage][receipient]; fund = fund.add(value); if (fund > _stageCondition[stage].limitFund ) { uint256 refund = fund.sub(_stageCondition[stage].limitFund); value = value.sub(refund); msg.sender.transfer...
uint256 value = msg.value; uint256 fund = _stageFund[stage][receipient]; fund = fund.add(value); if (fund > _stageCondition[stage].limitFund ) { uint256 refund = fund.sub(_stageCondition[stage].limitFund); value = value.sub(refund); msg.sender.transfer...
8,099
318
// Mint legacy pool reward for migration
mintToAccount(Constants.getLegacyPoolAddress(), Constants.getLegacyPoolReward()); _;
mintToAccount(Constants.getLegacyPoolAddress(), Constants.getLegacyPoolReward()); _;
19,549
1
// Revert with an error if the drop stage is not active. /
error NotActive( uint256 currentTimestamp, uint256 startTimestamp, uint256 endTimestamp );
error NotActive( uint256 currentTimestamp, uint256 startTimestamp, uint256 endTimestamp );
12,687
3
// Emits an {OperatorChanged} event. /
function setOperator(uint256 tokenId, address operator) external;
function setOperator(uint256 tokenId, address operator) external;
17,137
106
// lets check last sell was more than 90 mins ago
require(block.timestamp >= timestamp[sender], "Everyone is vested! You cannot sell more than 25% of your stack once per 120 mins");
require(block.timestamp >= timestamp[sender], "Everyone is vested! You cannot sell more than 25% of your stack once per 120 mins");
39,631
42
// We have read (32 + 32 + 4) = 68 additional bytes of calldata in the above assembly block. Update pointer accordingly.
unchecked { pointer += BYTE_LENGTH_NON_SIGNER_INFO; }
unchecked { pointer += BYTE_LENGTH_NON_SIGNER_INFO; }
38,583
45
// make it easier
miningTarget = miningTarget.add(miningTarget.div(2000).mul(shortage_block_pct_extra)); //by up to 50 %
miningTarget = miningTarget.add(miningTarget.div(2000).mul(shortage_block_pct_extra)); //by up to 50 %
15,029
267
// Save the request info
requests[id] = Request({ open: false, approved: true, cosigner: _cosigner, amount: uint128(uint256(read(_requestData, O_AMOUNT, L_AMOUNT))), model: address(uint256(read(_requestData, O_MODEL, L_MODEL))), creator: address(uint256(read(_reque...
requests[id] = Request({ open: false, approved: true, cosigner: _cosigner, amount: uint128(uint256(read(_requestData, O_AMOUNT, L_AMOUNT))), model: address(uint256(read(_requestData, O_MODEL, L_MODEL))), creator: address(uint256(read(_reque...
25,642
44
// Transfer `_value` tokens from `_from` to `_to` if `msg.sender` is allowed./Allows for an approved third party to transfer tokens from one/ address to another. Returns success./_from Address from where tokens are withdrawn./_to Address to where tokens are sent./_value Number of tokens to transfer./ return Returns suc...
function transferFrom(address _from, address _to, uint256 _value) public onlyIfLockTimePassed returns (bool)
function transferFrom(address _from, address _to, uint256 _value) public onlyIfLockTimePassed returns (bool)
19,386
466
// we'll pass the zero address on the first deploy due to missing previous MCR contract
if (masterAddress == address(0)) { return; }
if (masterAddress == address(0)) { return; }
2,028
9
// PRIVATE
function contractFallback( address _to, uint256 _value, bytes memory _data
function contractFallback( address _to, uint256 _value, bytes memory _data
10,261
17
// output
if(version == SYSCOIN_TX_VERSION_BURN){ output_value = getBytesLE(txBytes, pos, 64); }
if(version == SYSCOIN_TX_VERSION_BURN){ output_value = getBytesLE(txBytes, pos, 64); }
47,119
21
// Returns the integer division of two unsigned integers. Reverts with custom message ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming...
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
5,441
80
// Add or remove game contract, which can accept tokens /
function setCanAcceptTokens(address _address, bool _value) onlyAdministrator() public
function setCanAcceptTokens(address _address, bool _value) onlyAdministrator() public
33,179
22
// collateral token address
function collateralToken() external view returns (address);
function collateralToken() external view returns (address);
36,548
108
// Withdraw corresponding amount of ETH to _addr and burn _value tokens _addr withdrawal address _amount amount of tokens to sell /
function withdrawToken(address _addr, uint256 _amount) onlyOwner public { token.burn(_addr, _amount); uint256 etherValue = _amount * token.mrate() / token.rate(); _addr.transfer(etherValue); }
function withdrawToken(address _addr, uint256 _amount) onlyOwner public { token.burn(_addr, _amount); uint256 etherValue = _amount * token.mrate() / token.rate(); _addr.transfer(etherValue); }
76,106
72
// Deposit LP tokens to MasterChef for SUSHI allocation.
function deposit(uint256 _pid, uint256 _amount) public {} // Withdraw LP tokens from MasterChef. function withdraw(uint256 _pid, uint256 _amount) public {} }
function deposit(uint256 _pid, uint256 _amount) public {} // Withdraw LP tokens from MasterChef. function withdraw(uint256 _pid, uint256 _amount) public {} }
12,312
26
// LXL can be registered as `provider` request for `client` deposit (by calling `confirmLocker()`). client Account to provide `sum` deposit and call `release()` of registered `amount`s. clientOracle Account that can help call `release()` and `withdraw()` (default to `client` if unsure). provider Account to receive regi...
function registerLocker( // PROVIDER-TRACK address client, address clientOracle, address provider, address resolver, address token, uint256[] calldata amount, uint256 termination, string memory details, bool swiftResolver
function registerLocker( // PROVIDER-TRACK address client, address clientOracle, address provider, address resolver, address token, uint256[] calldata amount, uint256 termination, string memory details, bool swiftResolver
9,950
35
// A. If number of users for this _bracket number is superior to 0
if ( (_numberTicketsPerLotteryId[_lotteryId][transformedWinningNumber] - numberAddressesInPreviousBracket) != 0 ) {
if ( (_numberTicketsPerLotteryId[_lotteryId][transformedWinningNumber] - numberAddressesInPreviousBracket) != 0 ) {
36,839
129
// Update the user's lastPaidTaxes
lastPaidTaxes[user] = now;
lastPaidTaxes[user] = now;
11,506
15
// group bid amounts by line
mapping(int32 => uint)[2] line_amounts; int32[] memory away_lines = new int32[](away_lines_length); int32[] memory home_lines = new int32[](home_lines_length); uint k = 0; for (uint i=0; i < book.homeBids.length; i++) { Bid bid = book.homeBids[i]; if (bi...
mapping(int32 => uint)[2] line_amounts; int32[] memory away_lines = new int32[](away_lines_length); int32[] memory home_lines = new int32[](home_lines_length); uint k = 0; for (uint i=0; i < book.homeBids.length; i++) { Bid bid = book.homeBids[i]; if (bi...
25,274
183
// Issue burn
function SetIssueAssetRole(address[] calldata issuer, bool[] calldata setTo) public { _setRoles(ISSUE_ASSET_ROLE, issuer, setTo); }
function SetIssueAssetRole(address[] calldata issuer, bool[] calldata setTo) public { _setRoles(ISSUE_ASSET_ROLE, issuer, setTo); }
47,695
43
// if_succeeds res == x + getX();
function inc(uint x) public returns (uint res) { return x + getX(); }
function inc(uint x) public returns (uint res) { return x + getX(); }
22,254
19
// Withdraw appeal crowdfunding balance for given ruling option for all rounds./Allows to withdraw any rewards or reimbursable fees after the dispute gets resolved for all rounds at once./_disputeID The dispute ID as in arbitrator./_contributor Beneficiary of withdraw operation./_ruling Ruling option that caller wants ...
function withdrawFeesAndRewardsForAllRounds( uint256 _disputeID, address payable _contributor, RulingOptions _ruling ) external virtual;
function withdrawFeesAndRewardsForAllRounds( uint256 _disputeID, address payable _contributor, RulingOptions _ruling ) external virtual;
25,891
3
// this delegatecall uses Proxy's state context to execute, meaning it changes the state vars here every variable setting will get saved here also it will try to read variable data from Proxy's storage, instead of Dogs for onlyOwner it will check against owner in Proxy, which is not set by default
let result := delegatecall(gas, implementation, add(data, 0x20), mload(data), 0, 0) let size := returndatasize let ptr := mload(0x40) returndatacopy(ptr, 0, size)
let result := delegatecall(gas, implementation, add(data, 0x20), mload(data), 0, 0) let size := returndatasize let ptr := mload(0x40) returndatacopy(ptr, 0, size)
50,823
18
// Used in place of the constructor to allow the contract to be upgradable via proxy. registryAddress The address of the registry contract. _approver The address that needs to approve proposals to move to the referendum stage. _concurrentProposals The number of proposals to dequeue at once. _minDeposit The minimum CELO...
function initialize( address registryAddress, address _approver, uint256 _concurrentProposals, uint256 _minDeposit, uint256 _queueExpiry, uint256 _dequeueFrequency, uint256 approvalStageDuration, uint256 referendumStageDuration, uint256 executionStageDuration,
function initialize( address registryAddress, address _approver, uint256 _concurrentProposals, uint256 _minDeposit, uint256 _queueExpiry, uint256 _dequeueFrequency, uint256 approvalStageDuration, uint256 referendumStageDuration, uint256 executionStageDuration,
10,622
15
// See {IERC721-safeTransferFrom}./from current holder of NFT/to new holder of NFT/tokenId id for NFT account/_data (not used)
function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public override { preTransferCleanup(to, tokenId); super.safeTransferFrom(from, to, tokenId, _data); }
function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public override { preTransferCleanup(to, tokenId); super.safeTransferFrom(from, to, tokenId, _data); }
30,090
13
// Withdraw funds previously deposited to an instruction, {msg.sender} must be the payer. s_instruction Instruction to withdraw funds from. /
function withdraw(Instruction storage s_instruction) internal {
function withdraw(Instruction storage s_instruction) internal {
21,150
8
// Emitted when a relay is unstaked for, including the returned stake.
event Unstaked(address indexed relay, uint256 stake);
event Unstaked(address indexed relay, uint256 stake);
37,473
13
// Update account balances:
(uint256 lusdToStake, uint256 lusdStaked, uint32 accountEpoch, bool shouldUnstake) = _unpackAccountStakeData(newBalances.lusdStakeData); newBalances.lusdStakeData = _packAccountStakeData(lusdToStake + _lusdAmount, lusdStaked, accountEpoch, shouldUnstake); _updateAccountBalances(msg.sender, oldBa...
(uint256 lusdToStake, uint256 lusdStaked, uint32 accountEpoch, bool shouldUnstake) = _unpackAccountStakeData(newBalances.lusdStakeData); newBalances.lusdStakeData = _packAccountStakeData(lusdToStake + _lusdAmount, lusdStaked, accountEpoch, shouldUnstake); _updateAccountBalances(msg.sender, oldBa...
20,131
203
// Allow a user to deposit underlying tokens and mint the corresponding number of wrapped tokens. /
function depositFor(address account, uint256 amount) public virtual returns (bool) { SafeERC20.safeTransferFrom(underlying, _msgSender(), address(this), amount); _mint(account, amount); return true; }
function depositFor(address account, uint256 amount) public virtual returns (bool) { SafeERC20.safeTransferFrom(underlying, _msgSender(), address(this), amount); _mint(account, amount); return true; }
25,225
16
// Reads environment variables as arrays, (name, delim) => (value[])
function envBool(string calldata, string calldata) external returns (bool[] memory); function envUint(string calldata, string calldata) external returns (uint256[] memory); function envInt(string calldata, string calldata) external returns (int256[] memory); function envAddress(string calldata, string c...
function envBool(string calldata, string calldata) external returns (bool[] memory); function envUint(string calldata, string calldata) external returns (uint256[] memory); function envInt(string calldata, string calldata) external returns (int256[] memory); function envAddress(string calldata, string c...
28,701
22
// require(user.stakesCount != 0, "Stakes not found!");
uint256 _tokensCount = rewardManager.totalTokens(); address[] memory tokens = new address[](_tokensCount); uint256[] memory balances = new uint256[](_tokensCount); (uint256 stakedAmount, , ) = calculateTotalStakedInfo(_user);
uint256 _tokensCount = rewardManager.totalTokens(); address[] memory tokens = new address[](_tokensCount); uint256[] memory balances = new uint256[](_tokensCount); (uint256 stakedAmount, , ) = calculateTotalStakedInfo(_user);
22,961
7
// Emits an event to communicate with system that a new distributor has been added.
emit DistributorAdded(account);
emit DistributorAdded(account);
30,434
38
// Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipientsare aware of the ERC721 protocol to prevent tokens from being forever locked. `data` is additional data, it has no specified format and it is sent in call to `to`.
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenI...
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenI...
5,622
15
// 2^2
assembly ("memory-safe") { let factor := shl(1, gt(x, 0x3)) x := shr(factor, x) result := or(result, factor) }
assembly ("memory-safe") { let factor := shl(1, gt(x, 0x3)) x := shr(factor, x) result := or(result, factor) }
27,616
78
// Determine what the account liquidity would be if the given amounts were redeemed/borrowed pTokenModify The market to hypothetically redeem/borrow in account The account to determine liquidity for redeemTokens The number of tokens to hypothetically redeem borrowAmount The amount of underlying to hypothetically borrow...
function getHypotheticalAccountLiquidity( address account, address pTokenModify, uint redeemTokens, uint borrowAmount
function getHypotheticalAccountLiquidity( address account, address pTokenModify, uint redeemTokens, uint borrowAmount
76,760
7
// an event emitted when somebody contributed to the Aavegotchi funding
event ContributedAavegotchi( address indexed contributor, address collateralAddress, uint256 amount, uint256 totalFromContributor );
event ContributedAavegotchi( address indexed contributor, address collateralAddress, uint256 amount, uint256 totalFromContributor );
18,457
20
// Gets the token symbol return string representing the token symbol/
function symbol()
function symbol()
41,519
351
// Allows the owner of the contract to update the address of the/ RenExBalances contract.//_balancesContract The address of the new balances contract
function updateBalancesContract(address _balancesContract) external onlyOwner { emit LogBalancesContractUpdated(balancesContract, _balancesContract); balancesContract = _balancesContract; }
function updateBalancesContract(address _balancesContract) external onlyOwner { emit LogBalancesContractUpdated(balancesContract, _balancesContract); balancesContract = _balancesContract; }
32,903
396
// A lender optimisation strategy for any erc20 assetv0.2.0 /
contract Strategy is BaseStrategy, DydxFlashloanBase, ICallee, FlashLoanReceiverBase { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; // @notice emitted when trying to do ...
contract Strategy is BaseStrategy, DydxFlashloanBase, ICallee, FlashLoanReceiverBase { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; // @notice emitted when trying to do ...
42,693
20
// Mints stablecoins to this contract
function addReserves(uint256 amount, address stablecoin) external onlyOwner onlyValidTokens(stablecoin) { _addReserves(amount, stablecoin); }
function addReserves(uint256 amount, address stablecoin) external onlyOwner onlyValidTokens(stablecoin) { _addReserves(amount, stablecoin); }
28,937
5
// Return if deposit cannot be made.
msg.sender.send(msg.value); return false;
msg.sender.send(msg.value); return false;
50,780
241
// Batch confiscate to a maximum of 256 addresses._confiscatees array addresses who's funds are being confiscated_receivers array addresses who's receiving the funds_values array of values of funds being confiscated/
function batchConfiscate(address[] memory _confiscatees, address[] memory _receivers, uint256[] memory _values) public returns (bool) { require(_confiscatees.length == _values.length && _receivers.length == _values.length, "SygnumToken: confiscatees, recipients and values are not equal."); require(...
function batchConfiscate(address[] memory _confiscatees, address[] memory _receivers, uint256[] memory _values) public returns (bool) { require(_confiscatees.length == _values.length && _receivers.length == _values.length, "SygnumToken: confiscatees, recipients and values are not equal."); require(...
4,903
112
// decrement Hat supply counter
--hatSupply[uint256(id)]; emit TransferSingle(msg.sender, from, address(0), id, amount);
--hatSupply[uint256(id)]; emit TransferSingle(msg.sender, from, address(0), id, amount);
36,594
3
// Function to unlock timelocked tokensIf block.timestap passed tokens are sent to owner and lock is removed from database /
function unlock() external
function unlock() external
5,387
20
// remove staker from array
if (_stakedAmount[_msgSender()] == 0) { for (uint256 i=0; i < _stakers.length; i++) { if (_stakers[i] == _msgSender()) { _stakers[i] = _stakers[_stakers.length.sub(1)]; _stakers.pop();
if (_stakedAmount[_msgSender()] == 0) { for (uint256 i=0; i < _stakers.length; i++) { if (_stakers[i] == _msgSender()) { _stakers[i] = _stakers[_stakers.length.sub(1)]; _stakers.pop();
2,744
8
// Uniswap V3
function exactInputSingle(IBNPLSwapMarket.ExactInputSingleParams calldata params) external payable override returns (uint256 amountOut)
function exactInputSingle(IBNPLSwapMarket.ExactInputSingleParams calldata params) external payable override returns (uint256 amountOut)
40,416
215
// After a pack is bought with ETH, we call this to attribute the sale to the buyer's referrer./_buyer The user who bought the pack./_amount The price of the pack bought, in wei.
function _attributeSale(address _buyer, uint256 _amount) internal { address referrer = referrers[_buyer]; // Can only attribute a sale to a valid referrer. // Referral commissions only accrue if the referrer has bought a pack. if (referrer == address(0) || packsBought[referrer] == 0) { return; ...
function _attributeSale(address _buyer, uint256 _amount) internal { address referrer = referrers[_buyer]; // Can only attribute a sale to a valid referrer. // Referral commissions only accrue if the referrer has bought a pack. if (referrer == address(0) || packsBought[referrer] == 0) { return; ...
29,415
282
// ERC1155AzukiERC-721 Marketplace with tokens and royalties support /
contract ERC1155Marketplace is ERC1155YuzuInternal, ReentrancyGuard { using Address for address; // admin address, the owner of the marketplace address public admin; // commission rate is a value from 0 to 100 uint256 public commissionRate; // royalties commission rate is a value from 0 to 1...
contract ERC1155Marketplace is ERC1155YuzuInternal, ReentrancyGuard { using Address for address; // admin address, the owner of the marketplace address public admin; // commission rate is a value from 0 to 100 uint256 public commissionRate; // royalties commission rate is a value from 0 to 1...
6,018
22
// Withdrawal mode data.
uint32[] public withdrawalMode;
uint32[] public withdrawalMode;
16,184
2
// Struct for books/
struct Book { string title; string author; string img; uint bookid; uint rental; State state; address payable lender; address payable borrower; }
struct Book { string title; string author; string img; uint bookid; uint rental; State state; address payable lender; address payable borrower; }
19,781
115
// All financial functions are stripped from struct for visibility
mapping(uint256 => address) public projectIdToArtistAddress; mapping(uint256 => string) public projectIdToCurrencySymbol; mapping(uint256 => address) public projectIdToCurrencyAddress; mapping(uint256 => uint256) public projectIdToPricePerTokenInWei; mapping(uint256 => address) public projectIdToAdd...
mapping(uint256 => address) public projectIdToArtistAddress; mapping(uint256 => string) public projectIdToCurrencySymbol; mapping(uint256 => address) public projectIdToCurrencyAddress; mapping(uint256 => uint256) public projectIdToPricePerTokenInWei; mapping(uint256 => address) public projectIdToAdd...
34,073
71
// Check that SignedMintValidationParams have been initialized; if not, this is an invalid signer.
if (signedMintValidationParams.maxMaxTotalMintableByWallet == 0) { revert InvalidSignature(signer); }
if (signedMintValidationParams.maxMaxTotalMintableByWallet == 0) { revert InvalidSignature(signer); }
30,208
84
// subsidy controller checks payouts since last subsidy and resets counter return payoutSinceLastSubsidy_ uint /
function paySubsidy() external returns ( uint payoutSinceLastSubsidy_ ) { require( msg.sender == subsidyRouter, "Only subsidy controller" ); payoutSinceLastSubsidy_ = payoutSinceLastSubsidy; payoutSinceLastSubsidy = 0; }
function paySubsidy() external returns ( uint payoutSinceLastSubsidy_ ) { require( msg.sender == subsidyRouter, "Only subsidy controller" ); payoutSinceLastSubsidy_ = payoutSinceLastSubsidy; payoutSinceLastSubsidy = 0; }
31,168
232
// Borrows are repaid by another user (possibly the borrower). payer the account paying off the borrow borrower the account with the debt being payed off repayAmount the amount of undelrying tokens being returnedreturn (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual re...
function repayBorrowFresh(address payer, address borrower, uint repayAmount) internal returns (uint, uint) { /* Fail if repayBorrow not allowed */ uint allowed = bController.repayBorrowAllowed(address(this), payer, borrower, repayAmount); if (allowed != 0) { return (failOpaque(Er...
function repayBorrowFresh(address payer, address borrower, uint repayAmount) internal returns (uint, uint) { /* Fail if repayBorrow not allowed */ uint allowed = bController.repayBorrowAllowed(address(this), payer, borrower, repayAmount); if (allowed != 0) { return (failOpaque(Er...
12,298
75
// Update the given pool's Ramp allocation point. Can only be called by the owner.
function set(uint256 _poolId, uint256 _rampPerBlock, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } poolInfo[_poolId].rampPerBlock = _rampPerBlock; }
function set(uint256 _poolId, uint256 _rampPerBlock, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } poolInfo[_poolId].rampPerBlock = _rampPerBlock; }
18,318