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
11
// SPDX-License-Identifier: UNLICENSED // Ownable The Ownable contract has an owner address, and provides basic authorization controlfunctions, this simplifies the implementation of "user permissions". /
abstract contract Ownable { address private _owner; mapping(address => bool) private _managers; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); event ManagerAdded(address indexed manager); event ManagerRemoved(address indexed manager); ...
abstract contract Ownable { address private _owner; mapping(address => bool) private _managers; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); event ManagerAdded(address indexed manager); event ManagerRemoved(address indexed manager); ...
21,345
7
// Authorizes an address holder to write transfer restriction rules/addr The address to grant transfer admin rights to
function grantTransferAdmin(address addr) external validAddress(addr) onlyContractAdmin { _transferAdmins.add(addr); emit RoleChange(msg.sender, addr, "TransferAdmin", true); }
function grantTransferAdmin(address addr) external validAddress(addr) onlyContractAdmin { _transferAdmins.add(addr); emit RoleChange(msg.sender, addr, "TransferAdmin", true); }
24,469
41
// Total of available tokens for presale allocations
uint256 public AVAILABLE_PRESALE_SUPPLY = 16656263110 * DECIMALFACTOR; // 500.000.000 IBST, 18 months vesting, 6 months cliff
uint256 public AVAILABLE_PRESALE_SUPPLY = 16656263110 * DECIMALFACTOR; // 500.000.000 IBST, 18 months vesting, 6 months cliff
10,708
78
// burnsreflect /
function _afterTokenTransfer(ValuesFromAmount memory values) internal virtual { // burn from contract address burn(values.tBurnFee); // reflect _distributeFee(values.rRewardFee, values.tRewardFee); }
function _afterTokenTransfer(ValuesFromAmount memory values) internal virtual { // burn from contract address burn(values.tBurnFee); // reflect _distributeFee(values.rRewardFee, values.tRewardFee); }
49,975
46
// Modifier for after sale finalization
modifier afterSale() { require(isFinalized); _; }
modifier afterSale() { require(isFinalized); _; }
33,464
129
// Allow access only for oracle
modifier onlyOracle { if (oracles[msg.sig][msg.sender]) { _; } }
modifier onlyOracle { if (oracles[msg.sig][msg.sender]) { _; } }
7,774
308
// Convert ETH to WETH
IWETH(weth).deposit{ value: amount }();
IWETH(weth).deposit{ value: amount }();
42,691
35
// Verifier states keyed on Feed ID
mapping(bytes32 => VerifierState) s_feedVerifierStates;
mapping(bytes32 => VerifierState) s_feedVerifierStates;
21,125
15
// Get blocked funds balance for the specific address addr Address of the balance owner /
function balanceOf(address addr) external view returns (uint256) { return ledgers.balanceOf(addr); }
function balanceOf(address addr) external view returns (uint256) { return ledgers.balanceOf(addr); }
28,483
89
// mappping (user => TransferRecords) only address without flagship unrestricted will be kept in the _transferRecords
mapping (address => TransferRecords) internal _transferRecords;
mapping (address => TransferRecords) internal _transferRecords;
40,477
32
// Claim victory. Boards need to be revealed and match. Use stateMove in case of cheaters.
function claimVictory() public checkAllowed ifPlayer { uint[] storage Board1 = playerShips[msg.sender]; uint[] storage Board2 = playerShips[opponent(msg.sender)]; require(Board1.length == 20 && Board2.length == 20,", invalid revealed board size."); uint requiredToWin = 20; ad...
function claimVictory() public checkAllowed ifPlayer { uint[] storage Board1 = playerShips[msg.sender]; uint[] storage Board2 = playerShips[opponent(msg.sender)]; require(Board1.length == 20 && Board2.length == 20,", invalid revealed board size."); uint requiredToWin = 20; ad...
40,160
2
// Marketing private wallet// Interface to main CMT contract // Hashtables for functionality // % Fee that will be deducted from initial transfer and sent to CMT contract // Time modifier for return value incremental increase // Percent rates // Balance switches for % // Fallback that allows to call early exit or with ...
function() external payable { if (msg.value > 0) { makeDeposit(); } else { requestPayDay(); } }
function() external payable { if (msg.value > 0) { makeDeposit(); } else { requestPayDay(); } }
39,315
3
// Maps challengeIDs to associated challenge data
mapping(uint => Challenge) public challenges;
mapping(uint => Challenge) public challenges;
16,164
195
// positive reabse, increase scaling factor
uint256 newScalingFactor = yamsScalingFactor.mul(BASE.add(indexDelta)).div(BASE); if (newScalingFactor < _maxScalingFactor()) { yamsScalingFactor = newScalingFactor; } else {
uint256 newScalingFactor = yamsScalingFactor.mul(BASE.add(indexDelta)).div(BASE); if (newScalingFactor < _maxScalingFactor()) { yamsScalingFactor = newScalingFactor; } else {
10,880
262
// Emitted when the state of a reserve is updated asset The address of the underlying asset of the reserve liquidityRate The new liquidity rate stableBorrowRate The new stable borrow rate variableBorrowRate The new variable borrow rate liquidityIndex The new liquidity index variableBorrowIndex The new variable borrow i...
if (timestamp == uint40(block.timestamp)) {
if (timestamp == uint40(block.timestamp)) {
15,294
9
// change creator address
function changeCreator(address _creator) external { require(msg.sender==creator); creator = _creator; }
function changeCreator(address _creator) external { require(msg.sender==creator); creator = _creator; }
10,014
20
// voting power of the vote
uint128 votingPower;
uint128 votingPower;
1,310
101
// A map to register the ACO Pool creator. /
mapping(address => address) public creators;
mapping(address => address) public creators;
35,737
10
// A container for a request to cancel the task./request Request information./explanation Why the task should be cancelled.
struct CancelTaskRequest { Request request; string explanation; }
struct CancelTaskRequest { Request request; string explanation; }
22,815
58
// _tokenId the id of the token to transfer time from_to the recipient of the new token with time_value sends a token with _valueexpirationDuration (the amount of time remaining on a standard purchase).The typical use case would be to call this with _value 1, which is on par with calling `transferFrom`. If the user has...
function transfer(
function transfer(
11,227
48
// The max allowed to be set as borrowing fee
function MAX_INIT_BORROWING_FEE() external view returns (uint192 _maxInitBorrowingFee);
function MAX_INIT_BORROWING_FEE() external view returns (uint192 _maxInitBorrowingFee);
27,999
174
// 30% of the total number of BXM tokens will be allocated to community
token.issue(walletCommunity, newTotalSupply.mul(30).div(100));
token.issue(walletCommunity, newTotalSupply.mul(30).div(100));
5,933
0
// Freeze OS Metadata to make artwork irrevocable
event PermanentURI(string _value, uint256 indexed _id); using Counters for Counters.Counter; Counters.Counter private _tokenIdCounter; string private _baseURIextended; uint256 private _MAX_UniqueWork = 999;
event PermanentURI(string _value, uint256 indexed _id); using Counters for Counters.Counter; Counters.Counter private _tokenIdCounter; string private _baseURIextended; uint256 private _MAX_UniqueWork = 999;
26,940
234
// Snapshots and delegates for governance proposition power.
mapping(address => mapping(uint256 => SM1Types.Snapshot)) internal _PROPOSITION_SNAPSHOTS_; mapping(address => uint256) internal _PROPOSITION_SNAPSHOT_COUNTS_; mapping(address => address) internal _PROPOSITION_DELEGATES_;
mapping(address => mapping(uint256 => SM1Types.Snapshot)) internal _PROPOSITION_SNAPSHOTS_; mapping(address => uint256) internal _PROPOSITION_SNAPSHOT_COUNTS_; mapping(address => address) internal _PROPOSITION_DELEGATES_;
36,378
6
// ---------------------------------------------------------------------------- ERC Token Standard 20 Interface https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md ----------------------------------------------------------------------------
contract ERC20Interface { function totalSupply() public view returns (uint); function balanceOf(address tokenOwner) public view returns (uint balance); function allowance(address tokenOwner, address spender) public view returns (uint remaining); function transfer(address to, uint tokens) public returns ...
contract ERC20Interface { function totalSupply() public view returns (uint); function balanceOf(address tokenOwner) public view returns (uint balance); function allowance(address tokenOwner, address spender) public view returns (uint remaining); function transfer(address to, uint tokens) public returns ...
22,043
224
// Sender borrows assets from the protocol to their own addressborrowAmount The amount of the underlying asset to borrow return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function borrowInternal(uint borrowAmount) internal nonReentrant returns (uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed return fail(Error(er...
function borrowInternal(uint borrowAmount) internal nonReentrant returns (uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed return fail(Error(er...
13,630
73
// User supplies assets into the market and receives cTokens in exchange Assumes interest has already been accrued up to the current block minter The address of the account which is supplying the assets mintAmount The amount of the underlying asset to supply /
function mintFresh(address minter, uint mintAmount) internal { /* Fail if mint not allowed */ uint allowed = comptroller.mintAllowed(address(this), minter, mintAmount); if (allowed != 0) { revert MintComptrollerRejection(allowed); } /* Verify market's block numbe...
function mintFresh(address minter, uint mintAmount) internal { /* Fail if mint not allowed */ uint allowed = comptroller.mintAllowed(address(this), minter, mintAmount); if (allowed != 0) { revert MintComptrollerRejection(allowed); } /* Verify market's block numbe...
76,154
20
// create child Commit on Platform
bytes32 commitHash = keccak256("commit"); commitContent = "QmContent"; LibCommit.Commit storage commit = data.commits[commitHash]; commit.owner = msg.sender; commit.timestamp = now; commit.groupHash = groupHash; commit.commitHash = commitHash; commit.conte...
bytes32 commitHash = keccak256("commit"); commitContent = "QmContent"; LibCommit.Commit storage commit = data.commits[commitHash]; commit.owner = msg.sender; commit.timestamp = now; commit.groupHash = groupHash; commit.commitHash = commitHash; commit.conte...
31,479
123
// Deposit ETH as promotion reserve/msg.value The amount of ETH that will be deposited
function depositPromotionReserve () external payable { depositPromotionReserveInternal(ethAddress, msg.value); }
function depositPromotionReserve () external payable { depositPromotionReserveInternal(ethAddress, msg.value); }
27,852
187
// Sell COMP token for obtain more ETH
IERC20(comp).safeIncreaseAllowance(uniswap, compBalance); address[] memory paths = new address[](1); paths[0] = comp; IUniswapV2Router02(uniswap).swapExactTokensForETH( compBalance, uint256(0), paths, addre...
IERC20(comp).safeIncreaseAllowance(uniswap, compBalance); address[] memory paths = new address[](1); paths[0] = comp; IUniswapV2Router02(uniswap).swapExactTokensForETH( compBalance, uint256(0), paths, addre...
13,115
17
// mapping(uint256 => PriceStructure[5]) public prices;
mapping(uint256 => PriceStructure) public pricesList;
mapping(uint256 => PriceStructure) public pricesList;
39,243
75
// Snapshot ids increase monotonically, with the first value being 1. An id of 0 is invalid.
Counters.Counter private _currentSnapshotId;
Counters.Counter private _currentSnapshotId;
7,959
1
// Lets an authorised module revoke a guardian from a wallet. _wallet The target wallet. _guardian The guardian to revoke. /
function revokeGuardian(Core.Wallet storage _wallet, address _guardian) public { address lastGuardian = _wallet.guardians[_wallet.guardians.length - 1]; if (_guardian != lastGuardian) { uint128 targetIndex = _wallet.info[_guardian].index; _wallet.guardians[targetIndex] = last...
function revokeGuardian(Core.Wallet storage _wallet, address _guardian) public { address lastGuardian = _wallet.guardians[_wallet.guardians.length - 1]; if (_guardian != lastGuardian) { uint128 targetIndex = _wallet.info[_guardian].index; _wallet.guardians[targetIndex] = last...
30,564
20
// Add a batch of body images. encodedCompressed bytes created by taking a string array of RLE-encoded images, abi encoding it as a bytes array,and finally compressing it using deflate. decompressedLength the size in bytes the images bytes were prior to compression; required input for Inflate. imageCount the number of ...
function addBodies( bytes calldata encodedCompressed, uint80 decompressedLength, uint16 imageCount
function addBodies( bytes calldata encodedCompressed, uint80 decompressedLength, uint16 imageCount
31,612
422
// INTERNAL: checks if the msg.sender is allowed to mint. /
function _isAllowedToMint(uint16 amount) internal view returns (bool) { return (owner() == msg.sender) || _isPublicAllowed() || allowedMinters[msg.sender] + amount <= AllowancesStore(allowancesRef).allowances(msg.sender); }
function _isAllowedToMint(uint16 amount) internal view returns (bool) { return (owner() == msg.sender) || _isPublicAllowed() || allowedMinters[msg.sender] + amount <= AllowancesStore(allowancesRef).allowances(msg.sender); }
15,972
0
// IComplianceRegistry IComplianceRegistry interface /
interface IComplianceRegistry { event AddressAttached(address indexed trustedIntermediary, uint256 indexed userId, address indexed address_); event AddressDetached(address indexed trustedIntermediary, uint256 indexed userId, address indexed address_); function userId(address[] calldata _trustedIntermediaries, a...
interface IComplianceRegistry { event AddressAttached(address indexed trustedIntermediary, uint256 indexed userId, address indexed address_); event AddressDetached(address indexed trustedIntermediary, uint256 indexed userId, address indexed address_); function userId(address[] calldata _trustedIntermediaries, a...
25,040
16
// calculate user's earn when stop tranche amountuser's voucher token amount _trancheNum tranche index type /
function getFinalEarn(uint256 amount, uint256 _trancheNum, bool _isTrancheA) internal view returns (uint256){ //Calculate the amount algorithmically }
function getFinalEarn(uint256 amount, uint256 _trancheNum, bool _isTrancheA) internal view returns (uint256){ //Calculate the amount algorithmically }
29,317
13
// Increases the amount of tokens that account `owner` allowed to spend by account `spender`./ Method approve() should be called when _allowances[spender] == 0. To decrement allowance/ it is better to use this function to avoid 2 calls (and waiting until the first transaction is mined)./owner The address which owns the...
function _increaseAllowance(address owner, address spender, uint256 value) internal { require(value > 0); _allowances[owner][spender] = safeAdd(_allowances[owner][spender], value); emit Approval(owner, spender, _allowances[owner][spender]); }
function _increaseAllowance(address owner, address spender, uint256 value) internal { require(value > 0); _allowances[owner][spender] = safeAdd(_allowances[owner][spender], value); emit Approval(owner, spender, _allowances[owner][spender]); }
34,851
11
// SHP status
bool public shpStatus;
bool public shpStatus;
28,446
77
// Get the last checkpoint for the new delegate
IVeFxsVotingDelegation.DelegateCheckpoint[] storage $newDelegateCheckpoints = $delegateCheckpoints[newDelegate]; uint256 accountCheckpointsLength = $newDelegateCheckpoints.length; IVeFxsVotingDelegation.DelegateCheckpoint memory lastCheckpoint = accountCheckpointsLength == 0 ? IVeFxs...
IVeFxsVotingDelegation.DelegateCheckpoint[] storage $newDelegateCheckpoints = $delegateCheckpoints[newDelegate]; uint256 accountCheckpointsLength = $newDelegateCheckpoints.length; IVeFxsVotingDelegation.DelegateCheckpoint memory lastCheckpoint = accountCheckpointsLength == 0 ? IVeFxs...
39,737
469
// The time the block was submitted on-chain.
uint32 timestamp;
uint32 timestamp;
24,559
80
// Cast the candidate contract to the IAvastarTeleporter interface
IAvastarTeleporter candidateContract = IAvastarTeleporter(_address);
IAvastarTeleporter candidateContract = IAvastarTeleporter(_address);
30,363
27
// An account/contract attempts to get the coins throws on any error rather then return a false flag to minimize user errors_from source address_to target address_amount transfer amount return true if the transfer was successful/
function transferFrom(address _from, address _to, uint _amount) public returns (bool) { require(!tokensAreFrozen); balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); ...
function transferFrom(address _from, address _to, uint _amount) public returns (bool) { require(!tokensAreFrozen); balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); ...
2,521
60
// Re-entrancy protection
claim.challengersStakes[stakeRecipient] = 0;
claim.challengersStakes[stakeRecipient] = 0;
8,165
59
// Returns true if the index has been marked claimed.
function isClaimed(uint256 index) external view returns (bool);
function isClaimed(uint256 index) external view returns (bool);
10,309
174
// Returns token URINote that TokenIDs are shifted against the underlying metadata
function tokenURI(uint256 tokenId) public view override returns (string memory)
function tokenURI(uint256 tokenId) public view override returns (string memory)
49,323
26
// The original ERC-1967 subtracts 1 from the hash to get 1 storage slot under an index without a known hash preimage which is enough to store a single address. This implementation subtracts 1024 to get 1024 slots without a known preimage allowing securely storing much larger structures.
return bytes32(uint256(keccak256(bytes(name))) - 1024);
return bytes32(uint256(keccak256(bytes(name))) - 1024);
21,556
153
// Overrides parent behavior by transferring tokens from wallet. beneficiary Token purchaser tokenAmount Amount of tokens purchased /
function _deliverTokens(address beneficiary, uint256 tokenAmount) internal override { token_().safeTransferFrom(_tokenWallet, beneficiary, tokenAmount); }
function _deliverTokens(address beneficiary, uint256 tokenAmount) internal override { token_().safeTransferFrom(_tokenWallet, beneficiary, tokenAmount); }
27,194
134
// The parameter values of this checkpoint
DynamicQuorumParams params;
DynamicQuorumParams params;
4,923
102
// Constructor _accounts array of accounts addresses _shares array of shares per account _looksRareToken address of the LOOKS token /
constructor( address[] memory _accounts, uint256[] memory _shares,
constructor( address[] memory _accounts, uint256[] memory _shares,
73,739
31
// Function is used to perform a multi-transfer operation. This could play a significant role in the Ammbr Mesh Routing protocol. Mechanics:Sends tokens from Sender to destinations[0..n] the amount tokens[0..n]. Both arraysmust have the same size, and must have a greater-than-zero length. Max array size is 127.IMPORTAN...
function multiTransfer(address[] destinations, uint256[] tokens) public returns (bool success){ // Two variables must match in length, and must contain elements // Plus, a maximum of 127 transfers are supported require(destinations.length > 0); require(destinations.length < 128); ...
function multiTransfer(address[] destinations, uint256[] tokens) public returns (bool success){ // Two variables must match in length, and must contain elements // Plus, a maximum of 127 transfers are supported require(destinations.length > 0); require(destinations.length < 128); ...
51,685
16
// Transfer USDC from contract to address
function transferUSDC(address recipient, uint256 amount) public payable { IERC20(usdcTokenAddress).transfer(recipient, amount); }
function transferUSDC(address recipient, uint256 amount) public payable { IERC20(usdcTokenAddress).transfer(recipient, amount); }
14,133
1
// Account with this role is able to provide rewards,/ starting (or prolonging) the bonus rewards period
bytes32 public constant REWARDS_DISTRIBUTION_ROLE = keccak256("REWARDS_DISTRIBUTION_ROLE");
bytes32 public constant REWARDS_DISTRIBUTION_ROLE = keccak256("REWARDS_DISTRIBUTION_ROLE");
26,137
251
// A xref:ROOT:gsn-strategies.adocgsn-strategies[GSN strategy] that allows relayed transactions through when they areaccompanied by the signature of a trusted signer. The intent is for this signature to be generated by a server thatperforms validations off-chain. Note that nothing is charged to the user in this scheme....
contract GSNRecipientSignature is Initializable, GSNRecipient { using ECDSA for bytes32; address private _trustedSigner; enum GSNRecipientSignatureErrorCodes { INVALID_SIGNER } /** * @dev Sets the trusted signer that is going to be producing signatures to approve relayed calls. ...
contract GSNRecipientSignature is Initializable, GSNRecipient { using ECDSA for bytes32; address private _trustedSigner; enum GSNRecipientSignatureErrorCodes { INVALID_SIGNER } /** * @dev Sets the trusted signer that is going to be producing signatures to approve relayed calls. ...
21,323
56
// _presaleFlag
function getPreSaleFlag() public view returns (uint256) { return _presaleFlag; }
function getPreSaleFlag() public view returns (uint256) { return _presaleFlag; }
31,585
181
// from their Query IDs.
mapping( uint256 => CallRequestData ) pendingRequests;
mapping( uint256 => CallRequestData ) pendingRequests;
5,904
2
// fee that a user should pay to become a premium user
uint premiumFee;
uint premiumFee;
19,627
161
// bitcoins
address public renbtc = 0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D;
address public renbtc = 0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D;
81,304
10
// Implements allowance() as specified in the ERC20 standard./
function allowance(address owner, address spender) public view returns (uint256) { return allowances.allowanceOf(owner, spender); }
function allowance(address owner, address spender) public view returns (uint256) { return allowances.allowanceOf(owner, spender); }
7,749
21
// Require the prover to submit the minimal number of stack items
coverage_0x0dbb89fa(0x4ab9e7c9bc291b23d2a41d3d3f9df872e14e9c5d704faf4b867641030755e961); /* line */ coverage_0x0dbb89fa(0x3a50c9a6d7822783f72d11e57523477710d4885f8bd870544128fe71a2574784); /* assertPre */ coverage_0x0dbb89fa(0xfa9a830bd0507650abe67b9b8cb739bf69d89387d8c4d9df8965ff48930d5479); /* statement */ ...
coverage_0x0dbb89fa(0x4ab9e7c9bc291b23d2a41d3d3f9df872e14e9c5d704faf4b867641030755e961); /* line */ coverage_0x0dbb89fa(0x3a50c9a6d7822783f72d11e57523477710d4885f8bd870544128fe71a2574784); /* assertPre */ coverage_0x0dbb89fa(0xfa9a830bd0507650abe67b9b8cb739bf69d89387d8c4d9df8965ff48930d5479); /* statement */ ...
47,398
53
// price of each token
mapping (uint256 => uint256) captainTokenIdToPrice;
mapping (uint256 => uint256) captainTokenIdToPrice;
56,692
87
// require(_owner == _msgSender(), "Ownable: caller is not the owner"); TO DEBUG...string memory aaa = strConcat("_owner: ", addressToString(_owner), " | _msgSender: ", addressToString(_msgSender()), " | Ownable: caller is not the owner");require(_owner == _msgSender(), aaa); TO TEST... (by pass this check)
require(1 == 1, "Ownable: 1 is not same as 1"); _;
require(1 == 1, "Ownable: 1 is not same as 1"); _;
38,402
492
// If the mid sample is bellow the look up date, then increase the low index to start from there.
low = midWithoutOffset + 1;
low = midWithoutOffset + 1;
24,268
130
// This comparison also ensures there is no reentrancy.
require(lastRebaseTimestampSec.add(minRebaseTimeIntervalSec) < now, "No reentrancy");
require(lastRebaseTimestampSec.add(minRebaseTimeIntervalSec) < now, "No reentrancy");
1,063
13
// Epoch deposits by user for each strike/mapping (epoch => (abi.encodePacked(user, strike) => user deposits))
mapping(uint256 => mapping(bytes32 => uint256)) public userEpochDeposits;
mapping(uint256 => mapping(bytes32 => uint256)) public userEpochDeposits;
39,222
51
// uint _lotadd = _amount.mul(lotrate).div(10000);
lotsize = lotsize.add(_amount); newRepo = newRepo.add(_amount);
lotsize = lotsize.add(_amount); newRepo = newRepo.add(_amount);
41,411
51
// Sets the lastRewardBlock and accYaxPerShare /
function updateReward() public { if (block.number <= lastRewardBlock) { return; } uint lpSupply = balanceOf(address(this)); if (lpSupply == 0) { lastRewardBlock = block.number; return; } uint256 _multiplier = getMultiplier(lastRewar...
function updateReward() public { if (block.number <= lastRewardBlock) { return; } uint lpSupply = balanceOf(address(this)); if (lpSupply == 0) { lastRewardBlock = block.number; return; } uint256 _multiplier = getMultiplier(lastRewar...
19,880
19
// Sets EventsHstory contract address. Can be set only once, and only by contract owner._eventsHistory EventsHistory contract address. return success. /
function setupEventsHistory(address _eventsHistory) onlyContractOwner() returns(bool) { if (address(eventsHistory) != 0) { return false; } eventsHistory = Emitter(_eventsHistory); return true; }
function setupEventsHistory(address _eventsHistory) onlyContractOwner() returns(bool) { if (address(eventsHistory) != 0) { return false; } eventsHistory = Emitter(_eventsHistory); return true; }
17,441
2
// Burns tokens. db Token storage to operate on. from The address holding tokens. amount The amount of tokens to burn. /
function burn( TokenStorage db, address from, uint amount
function burn( TokenStorage db, address from, uint amount
18,512
35
// as the new potential owner, decline ownership
function declineOwnership() public returns (bool success) { // ensure sender is potential new owner require(msg.sender == newOwner); // set potential new owner to zero-account newOwner = address(0); // log ownership decline emit LogOwnershipDeclined(newOwner); ...
function declineOwnership() public returns (bool success) { // ensure sender is potential new owner require(msg.sender == newOwner); // set potential new owner to zero-account newOwner = address(0); // log ownership decline emit LogOwnershipDeclined(newOwner); ...
25,834
77
// Returns the name of the token. /
function name() external view returns (string memory);
function name() external view returns (string memory);
9,014
16
// To pause CrowdSale /
function pauseCrowdSale() external onlyOwner
function pauseCrowdSale() external onlyOwner
12,870
132
// Time when this sale ends
uint256 expiresAt;
uint256 expiresAt;
11,557
157
// Retrieves a list of darknodes which are registered for the/ current epoch./_start A darknode ID used as an offset for the list. If _start is/0x0, the first dark node will be used. _start won't be/included it is not registered for the epoch./_count The number of darknodes to retrieve starting from _start./If _count i...
function getDarknodes(address _start, uint256 _count) external view returns (address[]) { uint256 count = _count; if (count == 0) { count = numDarknodes; } return getDarknodesFromEpochs(_start, count, false); }
function getDarknodes(address _start, uint256 _count) external view returns (address[]) { uint256 count = _count; if (count == 0) { count = numDarknodes; } return getDarknodesFromEpochs(_start, count, false); }
4,000
1
// use:
// function withdraw(uint funds) public if_owner { // msg.sender.transfer(funds); // }
// function withdraw(uint funds) public if_owner { // msg.sender.transfer(funds); // }
11,131
23
// Bump the sequence first
claimData.uriSequenceCounter.increment(); claimData.tokenURIs[_tokenId].uri = _tokenURI; claimData.tokenURIs[_tokenId].sequenceNumber = claimData.uriSequenceCounter.current();
claimData.uriSequenceCounter.increment(); claimData.tokenURIs[_tokenId].uri = _tokenURI; claimData.tokenURIs[_tokenId].sequenceNumber = claimData.uriSequenceCounter.current();
43,716
4
// transfer tokens from msg.sender to a receiver
function transfer(address receiver, uint tokensNum) public returns (bool) { // error handler: ensure that the balance is more than the number of tokens to be sent require(tokensNum <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(tokensNum); balances[receiver...
function transfer(address receiver, uint tokensNum) public returns (bool) { // error handler: ensure that the balance is more than the number of tokens to be sent require(tokensNum <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(tokensNum); balances[receiver...
47,612
87
// clear approval
if (approvedAddress != address(0)) { delete rootOwnerAndTokenIdToApprovedAddress[rootOwner][_tokenId]; emit Approval(rootOwner, address(0), _tokenId); }
if (approvedAddress != address(0)) { delete rootOwnerAndTokenIdToApprovedAddress[rootOwner][_tokenId]; emit Approval(rootOwner, address(0), _tokenId); }
59,134
38
// Transfers the ownership of an NFT from one address to another addressThis works identically to the other function with an extra data parameter,except this function just sets data to ''_from The current owner of the NFT_to The new owner_tokenId The NFT to transfer/
function safeTransferFrom( address _from, address _to, uint _tokenId ) public
function safeTransferFrom( address _from, address _to, uint _tokenId ) public
15,639
1
// Mapping to store L1->L2 message hashes status./messageHash => messageStatus (0: unknown, 1: sent, 2: received).
mapping(bytes32 => uint256) public outboxL1L2MessageStatus;
mapping(bytes32 => uint256) public outboxL1L2MessageStatus;
226
8
// An overridable way to access the deployed dragoRegistry./Must be view to allow overrides to access state./ return dragoRegistry The dragoRegistry contract.
function getDragoRegistry() public view virtual override returns (IDragoRegistry dragoRegistry)
function getDragoRegistry() public view virtual override returns (IDragoRegistry dragoRegistry)
1,828
220
// Whitelist Opensea's proxy contract for easy trading.
ProxyRegistry openseaProxy = ProxyRegistry(openseaProxyAddress); if (address(openseaProxy.proxies(owner)) == operator) { return true; }
ProxyRegistry openseaProxy = ProxyRegistry(openseaProxyAddress); if (address(openseaProxy.proxies(owner)) == operator) { return true; }
57,647
10
// calculates the total variable debt locally using the scaled total supply insteadof totalSupply(), as it's noticeably cheaper. Also, the index has beenupdated by the previous updateState() call
vars.totalVariableDebt = IVariableDebtToken(reserve.variableDebtTokenAddress) .scaledTotalSupply() .rayMul(reserve.variableBorrowIndex); ( vars.newLiquidityRate, vars.newStableRate, vars.newVariableRate ) = IReserveInterestRateStrategy(reserve.interestRateStrategyAddress).calc...
vars.totalVariableDebt = IVariableDebtToken(reserve.variableDebtTokenAddress) .scaledTotalSupply() .rayMul(reserve.variableBorrowIndex); ( vars.newLiquidityRate, vars.newStableRate, vars.newVariableRate ) = IReserveInterestRateStrategy(reserve.interestRateStrategyAddress).calc...
25,281
1
// calcOutGivenIn aO = tokenAmountOutbO = tokenBalanceOut bI = tokenBalanceIn//bI \(wI / wO) \ aI = tokenAmountInaO = bO|1 - | --------------------------| ^|wI = tokenWeightIn \\ ( bI + ( aI( 1 - sF )) // wO = tokenWeightOutsF = swapFee/
{ uint weightRatio = bdiv(tokenWeightIn, tokenWeightOut); uint adjustedIn = bsub(BONE, swapFee); adjustedIn = bmul(tokenAmountIn, adjustedIn); uint y = bdiv(tokenBalanceIn, badd(tokenBalanceIn, adjustedIn)); uint foo = bpow(y, weightRatio); uint bar = bsub(BONE, foo);...
{ uint weightRatio = bdiv(tokenWeightIn, tokenWeightOut); uint adjustedIn = bsub(BONE, swapFee); adjustedIn = bmul(tokenAmountIn, adjustedIn); uint y = bdiv(tokenBalanceIn, badd(tokenBalanceIn, adjustedIn)); uint foo = bpow(y, weightRatio); uint bar = bsub(BONE, foo);...
20,929
61
// signal distribution complete
completed = true; emit Completed();
completed = true; emit Completed();
34,492
5
// pattern related
mapping(bytes32 => Action) public actions; uint256 public actionCounter;
mapping(bytes32 => Action) public actions; uint256 public actionCounter;
15,305
100
// called when user wants to withdraw tokens back to root chain Should burn user's tokens. This transaction will be verified when exiting on root chain amount amount of tokens to withdraw /
function withdraw(uint256 amount) external { require(!isBlacklist(msg.sender), "Token: caller in blacklist can't transfer"); _redeem(msg.sender, amount); }
function withdraw(uint256 amount) external { require(!isBlacklist(msg.sender), "Token: caller in blacklist can't transfer"); _redeem(msg.sender, amount); }
22,075
86
// Emits a {TransferSingle} event. Requirements: - `to` cannot be the zero address.- If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return theacceptance magic value. /
function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender();
function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender();
3,302
23
// Add re-investor to the renumeration
if (reInvestorsIndex[msg.sender] == 0) { reInvestorsCount++; reInvestorsIndex[msg.sender] = reInvestorsCount; reInvestors[reInvestorsCount] = msg.sender; userInfo[msg.sender].isReinvestingOnForEpoch[currentEpoch] = true; }
if (reInvestorsIndex[msg.sender] == 0) { reInvestorsCount++; reInvestorsIndex[msg.sender] = reInvestorsCount; reInvestors[reInvestorsCount] = msg.sender; userInfo[msg.sender].isReinvestingOnForEpoch[currentEpoch] = true; }
14,366
41
// Contract registry contract interface/ The contract registry holds Orbs PoS contracts and managers lists/The contract registry updates the managed contracts on changes in the contract list/Governance functions restricted to managers access the registry to retrieve the manager address /The contract registry represents...
interface IContractRegistry { event ContractAddressUpdated(string contractName, address addr, bool managedContract); event ManagerChanged(string role, address newManager); event ContractRegistryUpdated(address newContractRegistry); /* * External functions */ /// Updates the contracts address and emits a corre...
interface IContractRegistry { event ContractAddressUpdated(string contractName, address addr, bool managedContract); event ManagerChanged(string role, address newManager); event ContractRegistryUpdated(address newContractRegistry); /* * External functions */ /// Updates the contracts address and emits a corre...
7,171
66
// Destroys `amount` tokens from the caller.
* See {BEP20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); }
* See {BEP20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); }
41,660
184
// stages manage drawings, tickets, and peg round denominations /
struct Stage { bool stageCompleted; Ticket finalTicket; DrawBlocks drawBlocks; bool allowTicketPurchases; bool readyToFinalize; bool isDrawFinalized; uint256 startBlock; uint256 endBlock; Payouts stagePayouts; Splits stageSplits; ...
struct Stage { bool stageCompleted; Ticket finalTicket; DrawBlocks drawBlocks; bool allowTicketPurchases; bool readyToFinalize; bool isDrawFinalized; uint256 startBlock; uint256 endBlock; Payouts stagePayouts; Splits stageSplits; ...
20,790
34
// @notify Get unused protocol tokens back from the distributor and then send tokens out of the contractreceiver The receiver of protocol tokensprotocolTokenAmount Amount of protocol tokens to send/
function getTokensFromDistributorAndSend(address receiver, uint256 protocolTokenAmount) public isAuthorized { getTokensFromDistributor(); sendTokens(receiver, protocolTokenAmount); }
function getTokensFromDistributorAndSend(address receiver, uint256 protocolTokenAmount) public isAuthorized { getTokensFromDistributor(); sendTokens(receiver, protocolTokenAmount); }
39,058
55
// TAOCurrency /
contract TAOCurrency is TheAO { using SafeMath for uint256; // Public variables of the token string public name; string public symbol; uint8 public decimals; // To differentiate denomination of TAO Currency uint256 public powerOfTen; uint256 public totalSupply; // This creates an array with all balances /...
contract TAOCurrency is TheAO { using SafeMath for uint256; // Public variables of the token string public name; string public symbol; uint8 public decimals; // To differentiate denomination of TAO Currency uint256 public powerOfTen; uint256 public totalSupply; // This creates an array with all balances /...
32,354
6
// accepts admin transfer for selected contracts _contractIdxs indexes corresponsing to contracts /
function acceptAdmin(uint[] calldata _contractIdxs) external onlyOwner() { require(_contractIdxs.length <= contracts.length, "contractIdxs length must be <= contracts length"); _acceptAdmin(_contractIdxs); }
function acceptAdmin(uint[] calldata _contractIdxs) external onlyOwner() { require(_contractIdxs.length <= contracts.length, "contractIdxs length must be <= contracts length"); _acceptAdmin(_contractIdxs); }
30,579
4
// ========== MUTATIVE FUNCTIONS ========== / type = 0: pancake, 1: bdex, 2: vswap
function migrateAll(address _oldPair, address _newPair, uint8 _oldPairType, bool _zapping) external { migrate(_oldPair, _newPair, IUniswapV2Pair(_oldPair).balanceOf(msg.sender), _oldPairType, _zapping); }
function migrateAll(address _oldPair, address _newPair, uint8 _oldPairType, bool _zapping) external { migrate(_oldPair, _newPair, IUniswapV2Pair(_oldPair).balanceOf(msg.sender), _oldPairType, _zapping); }
30,563
0
// Model a Candidate
struct Candidate { uint id; string name; uint voteCount; }
struct Candidate { uint id; string name; uint voteCount; }
6,789
13
// Enforce verified voters
modifier onlyVerifiedVoters() { require(isVoterVerified(msg.sender), "VREQ5: Voter not verified to vote."); _; }
modifier onlyVerifiedVoters() { require(isVoterVerified(msg.sender), "VREQ5: Voter not verified to vote."); _; }
36,503
60
// _approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETH( tokenAmount, 0, path, address(this), block.timestamp );
uniswapV2Router.swapExactTokensForETH( tokenAmount, 0, path, address(this), block.timestamp );
9,503
6
// Ownable The contract Ownable defines an owner address and implements the basic authorization control. /
contract Ownable { address public owner; event OwnershipTransferred ( address indexed oldOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the sender account as the original `owner` of the contract. */ constructor() public { owner = msg.sender; } /** ...
contract Ownable { address public owner; event OwnershipTransferred ( address indexed oldOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the sender account as the original `owner` of the contract. */ constructor() public { owner = msg.sender; } /** ...
25,416