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
13
// Note: messageHash is a string, that is 66-bytes long, to sign the binary value, we must convert it to the 32 byte Array that the string represents i.e.66-byte string "0x592fa743889fc7f92ac2a37bb1f5ba1daf2a5c84741ca0e0061d243a2e6707ba" ... vs ... 32 entry Uint8Array[ 89, 47, 167, 67, 136, 159, 199, 249, 42, 194, 163,...
let messageHashBytes = ethers.utils.arrayify(messageHash)
let messageHashBytes = ethers.utils.arrayify(messageHash)
32,140
173
// Validate pToken address see: https:github.com/element-fi/elf-contracts/blob/main/contracts/factories/TrancheFactory.solL58
address predictedAddress = address( uint160( uint256( keccak256( abi.encodePacked( bytes1(0xff), trancheFactory, keccak256(abi.encodePacked(wrappedPosition,...
address predictedAddress = address( uint160( uint256( keccak256( abi.encodePacked( bytes1(0xff), trancheFactory, keccak256(abi.encodePacked(wrappedPosition,...
33,482
19
// Pass the token ID and get the nft Information /
{ nft memory myNft = nfts[_tokenId]; return ( myNft.id, myNft.title, myNft.description, myNft.price, myNft.status, myNft.date, myNft.authorName, myNft.author, myNft.owner, myNft.im...
{ nft memory myNft = nfts[_tokenId]; return ( myNft.id, myNft.title, myNft.description, myNft.price, myNft.status, myNft.date, myNft.authorName, myNft.author, myNft.owner, myNft.im...
6,044
93
// Returns the fractional part of a fixed point number.In the case of a negative number the fractional is also negative.Test fractional(0) returns 0Test fractional(fixed1()) returns 0Test fractional(fixed1()-1) returns 10^24-1Test fractional(-fixed1()) returns 0Test fractional(-fixed1()+1) returns -10^24-1 /
function fractional(int256 x) public pure returns (int256) { return x - (x / fixed1()) * fixed1(); // Can't overflow }
function fractional(int256 x) public pure returns (int256) { return x - (x / fixed1()) * fixed1(); // Can't overflow }
755
30
// A dummy constructor, which deos not initialize any storage variablesA template will be deployed with no initialization and real pool will be clonedfrom this template (same as create_forwarder_to mechanism in Vyper),and use `initialize` to initialize all storage variables /
constructor () {} /** * @dev See {IPerpetualPool}.{initialize} */ function initialize( string memory symbol_, address[5] calldata addresses_, uint256[12] calldata parameters_ ) public override { require(bytes(_symbol).length == 0 && _controller == address(0), "...
constructor () {} /** * @dev See {IPerpetualPool}.{initialize} */ function initialize( string memory symbol_, address[5] calldata addresses_, uint256[12] calldata parameters_ ) public override { require(bytes(_symbol).length == 0 && _controller == address(0), "...
76,147
40
// Current number of votes for abstaining for this proposal
uint abstainVotes;
uint abstainVotes;
1,880
4
// Change the owner. Can only be called by the current owner. account New owner's address /
function changeOwner(address account) external onlyOwner { _changeOwner(account); }
function changeOwner(address account) external onlyOwner { _changeOwner(account); }
9,674
79
// Override to extend the way in which ether is converted to tokens. weiAmount Value in wei to be converted into tokensreturn Number of tokens that can be purchased with the specified _weiAmount /
function _getTokenAmount(uint256 weiAmount) internal view returns (uint256) { return weiAmount.mul(_rate); }
function _getTokenAmount(uint256 weiAmount) internal view returns (uint256) { return weiAmount.mul(_rate); }
35,888
6
// adopted from https:github.com/lexDAO/Kali/blob/main/contracts/libraries/SafeTransferLib.sol
error TransferFailed();
error TransferFailed();
13,906
45
// possibility to change burn rate by the owneronly after community vote
function changeBurnRate(uint8 newRate) external onlyOwner { basePercentage = newRate; }
function changeBurnRate(uint8 newRate) external onlyOwner { basePercentage = newRate; }
2,355
10
// Remove stake from balance
IStructs.StoredBalance memory balance = _loadCurrentBalance(balancePtr); balance.nextEpochBalance = uint256(balance.nextEpochBalance).safeAdd(amount).downcastToUint96(); balance.currentEpochBalance = uint256(balance.currentEpochBalance).safeAdd(amount).downcastToUint96();
IStructs.StoredBalance memory balance = _loadCurrentBalance(balancePtr); balance.nextEpochBalance = uint256(balance.nextEpochBalance).safeAdd(amount).downcastToUint96(); balance.currentEpochBalance = uint256(balance.currentEpochBalance).safeAdd(amount).downcastToUint96();
40,205
54
// transfer() doesn't have a return value
success = true;
success = true;
13,588
31
// SupportsInterfaceWithLookup Matt Condon (@shrugs) Implements ERC165 using a lookup table. /
contract SupportsInterfaceWithLookup is ERC165 { bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7; /** * 0x01ffc9a7 === * bytes4(keccak256('supportsInterface(bytes4)')) */ /** * @dev a mapping of interface id to whether or not it's supported */ mapping(bytes4 => bool) internal supported...
contract SupportsInterfaceWithLookup is ERC165 { bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7; /** * 0x01ffc9a7 === * bytes4(keccak256('supportsInterface(bytes4)')) */ /** * @dev a mapping of interface id to whether or not it's supported */ mapping(bytes4 => bool) internal supported...
18,947
23
// Set the migrator contract. Can only be called by the owner.
function setMigrator(IMigratorLady _migrator) public onlyOwner { migrator = _migrator; }
function setMigrator(IMigratorLady _migrator) public onlyOwner { migrator = _migrator; }
48,665
26
// add a role to an address addr address roleName the name of the role /
function adminAddRole(address addr, string roleName) onlyAdmin public
function adminAddRole(address addr, string roleName) onlyAdmin public
22,061
132
// Approve the spending of all assets by their corresponding cToken, if for some reason is it necessary. Only callable through Governance. /
function safeApproveAllTokens() external { uint256 assetCount = assetsMapped.length; for (uint256 i = 0; i < assetCount; i++) { address asset = assetsMapped[i]; address cToken = assetToPToken[asset]; // Safe approval IERC20(asset).safeApprove(cToken, 0...
function safeApproveAllTokens() external { uint256 assetCount = assetsMapped.length; for (uint256 i = 0; i < assetCount; i++) { address asset = assetsMapped[i]; address cToken = assetToPToken[asset]; // Safe approval IERC20(asset).safeApprove(cToken, 0...
26,093
94
// Encode length-delimited field./b Bytes/ return Marshaled bytes
function encode_length_delimited(bytes memory b) internal pure returns (bytes memory)
function encode_length_delimited(bytes memory b) internal pure returns (bytes memory)
28,354
0
// GeneralERC20 Set Protocol Interface for using ERC20 Tokens. This interface is needed to interact with tokens that are notfully ERC20 compliant and return something other than true on successful transfers. /
interface IERC20 { function balanceOf( address _owner ) external view returns (uint256); function allowance( address _owner, address _spender ) external view returns (uint256); function transfer( address _to, u...
interface IERC20 { function balanceOf( address _owner ) external view returns (uint256); function allowance( address _owner, address _spender ) external view returns (uint256); function transfer( address _to, u...
47,391
243
// Load poseidon smart contract _poseidon2Elements Poseidon contract address for 2 elements _poseidon3Elements Poseidon contract address for 3 elements _poseidon4Elements Poseidon contract address for 4 elements /
function _initializeHelpers( address _poseidon2Elements, address _poseidon3Elements, address _poseidon4Elements
function _initializeHelpers( address _poseidon2Elements, address _poseidon3Elements, address _poseidon4Elements
61,132
2
// Dex Factory contract interface
interface IdexFacotry { function createPair(address tokenA, address tokenB) external returns (address pair); }
interface IdexFacotry { function createPair(address tokenA, address tokenB) external returns (address pair); }
867
7
// returns AccountInfo
function getAccountInfo(DToken dToken, address payable account) public returns (AccountInfo memory) { AccountInfo memory accountInfo; address underlyingAssetAddress; address contractAddress = address(dToken); bool isETH = compareStrings(dToken.symbol(), mainDTokenSymbol); if (isETH) { und...
function getAccountInfo(DToken dToken, address payable account) public returns (AccountInfo memory) { AccountInfo memory accountInfo; address underlyingAssetAddress; address contractAddress = address(dToken); bool isETH = compareStrings(dToken.symbol(), mainDTokenSymbol); if (isETH) { und...
2,546
147
// get call options total collateral occupied value. /
function getCallTotalOccupiedCollateral() public view returns (uint256) { delegateToViewAndReturn(); }
function getCallTotalOccupiedCollateral() public view returns (uint256) { delegateToViewAndReturn(); }
78,045
32
// ShibaSwapWrappedLp /
contract WrappedShibaSwapLp is IWrappedAsset, Auth2, ERC20, ReentrancyGuard { import "../../interfaces/IVault.sol"; import "../../interfaces/IERC20WithOptional.sol"; import "../../interfaces/wrapped-assets/IWrappedAsset.sol"; import "../../interfaces/wrapped-assets/ITopDog.sol"; import "../../interfaces/wrapped-assets/...
contract WrappedShibaSwapLp is IWrappedAsset, Auth2, ERC20, ReentrancyGuard { import "../../interfaces/IVault.sol"; import "../../interfaces/IERC20WithOptional.sol"; import "../../interfaces/wrapped-assets/IWrappedAsset.sol"; import "../../interfaces/wrapped-assets/ITopDog.sol"; import "../../interfaces/wrapped-assets/...
79,097
5
// accumulated fees for workers and treasury
mapping(address worker => uint) public fees; event ExecutorFeePaid(address executor, uint fee); event TreasurySet(address treasury);
mapping(address worker => uint) public fees; event ExecutorFeePaid(address executor, uint fee); event TreasurySet(address treasury);
19,764
15
// Check if locked amount decreased
require( lockedAndClaimable(_tokenId) >= tokenIdLockedAmount[_tokenId], "Locked amount decreased" );
require( lockedAndClaimable(_tokenId) >= tokenIdLockedAmount[_tokenId], "Locked amount decreased" );
11,208
76
// Whether or not a domain specific by an id is available.
function isAvailable(uint256 id) external view returns (bool);
function isAvailable(uint256 id) external view returns (bool);
36,863
53
// Accept a contribution if KYC passed.
function acceptContribution(bytes32 transactionHash) public onlyOwner { Contribution storage c = contributions[transactionHash]; require(!c.resolved); c.resolved = true; c.success = true; balances[c.recipient] = balances[c.recipient].add(c.tokens); assert(multisig.sen...
function acceptContribution(bytes32 transactionHash) public onlyOwner { Contribution storage c = contributions[transactionHash]; require(!c.resolved); c.resolved = true; c.success = true; balances[c.recipient] = balances[c.recipient].add(c.tokens); assert(multisig.sen...
6,200
24
// Helper function to know if an address is a contract, extcodesize returns the size of the code of a smartcontract in a specific address
function isContract(address addr) internal returns (bool) { uint size; assembly { size := extcodesize(addr) } return size > 0; }
function isContract(address addr) internal returns (bool) { uint size; assembly { size := extcodesize(addr) } return size > 0; }
9,863
75
// Find no.of tokens to be purchased
uint256 purchaseTokens = inCents.mul(10 ** uint256(decimals)).div(lotsInfo[currLot].rateInCents);
uint256 purchaseTokens = inCents.mul(10 ** uint256(decimals)).div(lotsInfo[currLot].rateInCents);
50,022
39
// |/ Will reimburse tx.origin or fee recipient for the gas spent execution a transactionCan reimbuse in any ERC-20 or ERC-1155 token _fromAddress from which the payment will be made from _g GasReceipt object that contains gas reimbursement information /
function _transferGasFee(address _from, GasReceipt memory _g) internal
function _transferGasFee(address _from, GasReceipt memory _g) internal
20,204
77
// a struct used to keep track of each contributoors address and contribution amount
struct Contribution { address addr; uint256 amount; }
struct Contribution { address addr; uint256 amount; }
8,865
387
// "Private" profile. Access controlled by Permissions.sol. Nothing is really private on the blockchain, so data should be encrypted on symetric key.
struct PrivateProfile { // Private email. bytes email; // Mobile number. bytes mobile; }
struct PrivateProfile { // Private email. bytes email; // Mobile number. bytes mobile; }
13,555
115
// number of decimals of the token
uint8 private immutable _decimals;
uint8 private immutable _decimals;
32,166
20
// Internal function calculating receive amount for the caller.paybackIncentive is set to 5E16 => 5% incentive for paying back bad debt. /
function getReceivingToken( address _paybackToken, address _receivingToken, uint256 _paybackAmount ) public view returns (uint256 receivingAmount)
function getReceivingToken( address _paybackToken, address _receivingToken, uint256 _paybackAmount ) public view returns (uint256 receivingAmount)
1,335
39
// ERC-173 Contract Ownership Standard/See https:github.com/ethereum/EIPs/blob/master/EIPS/eip-173.md/Note: the ERC-165 identifier for this interface is 0x7f5828d0
contract IERC173 { /// @dev This emits when ownership of a contract changes. event OwnershipTransferred(address indexed _previousOwner, address indexed _newOwner); /// @notice Get the address of the owner /// @return The address of the owner. //// function owner() external view returns (address); ...
contract IERC173 { /// @dev This emits when ownership of a contract changes. event OwnershipTransferred(address indexed _previousOwner, address indexed _newOwner); /// @notice Get the address of the owner /// @return The address of the owner. //// function owner() external view returns (address); ...
5,557
6
// if royaltyFeeByID > 0 and0 < additionalPayeePercentage < 100
} else if (additionalPayeePercentage > 0 && additionalPayeePercentage < 100) {
} else if (additionalPayeePercentage > 0 && additionalPayeePercentage < 100) {
7,024
25
// Check that the token id has not already been redeemed.
if (redeemedTokenIds[tokenId]) { revert TokenGatedTokenAlreadyRedeemed(); }
if (redeemedTokenIds[tokenId]) { revert TokenGatedTokenAlreadyRedeemed(); }
30,976
4
// ! eft.sol | (c) 2018 Develop by BelovITLab LLC (smartcontract.ru), author @stupidlovejoy | License: MIT /
library SafeMath { function mul(uint256 a, uint256 b) internal pure returns(uint256) { if(a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns(uint256) { uint256 c = a / ...
library SafeMath { function mul(uint256 a, uint256 b) internal pure returns(uint256) { if(a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns(uint256) { uint256 c = a / ...
28,471
51
// Requre that the user had a balance >0 at time/blockNumber the disupte began
require(voteWeight != 0, "User balance is 0");
require(voteWeight != 0, "User balance is 0");
7,566
195
// map control token ID to its buy price
mapping(uint256 => uint256) public buyPrices;
mapping(uint256 => uint256) public buyPrices;
15,242
115
// When burning
_removeTokenFromOwnerEnumeration(from, tokenId);
_removeTokenFromOwnerEnumeration(from, tokenId);
11,434
32
// Subtract the vesting balance from total supply.
_vestingTotalSupply = _vestingTotalSupply.sub(vestingBalance);
_vestingTotalSupply = _vestingTotalSupply.sub(vestingBalance);
47,249
97
// GOVERNANCE FUNCTION: Add new oracle adapter._adapter Address of new adapter /
function addAdapter(address _adapter) external onlyOwner { require( !adapters.contains(_adapter), "PriceOracle.addAdapter: Adapter already exists." ); adapters.push(_adapter); emit AdapterAdded(_adapter); }
function addAdapter(address _adapter) external onlyOwner { require( !adapters.contains(_adapter), "PriceOracle.addAdapter: Adapter already exists." ); adapters.push(_adapter); emit AdapterAdded(_adapter); }
7,442
273
// Helper to swap many assets to a single target asset./ The intermediary asset will generally be WETH, and though we could make it per-outgoing asset, seems like overkill until there is a need.
function __uniswapV2SwapManyToOne( address _recipient, address[] memory _outgoingAssets, uint256[] memory _outgoingAssetAmounts, address _incomingAsset, address _intermediaryAsset
function __uniswapV2SwapManyToOne( address _recipient, address[] memory _outgoingAssets, uint256[] memory _outgoingAssetAmounts, address _incomingAsset, address _intermediaryAsset
25,405
164
// cost ether(wei)
require(msg.value == iCostNum); AddBonus(BONUS_PERCENT_PURCHASE);
require(msg.value == iCostNum); AddBonus(BONUS_PERCENT_PURCHASE);
41,944
8
// / create new contract send 0 Ether code starts at pointer stored in "clone" code size 0x37 (55 bytes)
result := create(0, clone, 0x37)
result := create(0, clone, 0x37)
22,473
145
// Initialize the auction house and base contracts,populate configuration values, and pause the contract. This function can only be called once. /
function initialize( IAxons _axons, IAxonsVoting _axonsVoting, address _axonsToken, uint256 _timeBuffer, uint256 _reservePrice, uint8 _minBidIncrementPercentage, uint256 _duration
function initialize( IAxons _axons, IAxonsVoting _axonsVoting, address _axonsToken, uint256 _timeBuffer, uint256 _reservePrice, uint8 _minBidIncrementPercentage, uint256 _duration
15,761
12
// This is the seed passed to VRFCoordinator. The oracle will mix this with the hash of the block containing this request to obtain the seed/input which is finally passed to the VRF cryptographic machinery.
uint256 vRFSeed = makeVRFInputSeed(_keyHash, USER_SEED_PLACEHOLDER, address(this), nonces[_keyHash]);
uint256 vRFSeed = makeVRFInputSeed(_keyHash, USER_SEED_PLACEHOLDER, address(this), nonces[_keyHash]);
21,074
47
// Withdraw ether from this contract (Callable by owner) /
function withdraw() public onlyOwner { uint256 balance = address(this).balance; msg.sender.transfer(balance); }
function withdraw() public onlyOwner { uint256 balance = address(this).balance; msg.sender.transfer(balance); }
5,399
2
// add a new participant to array
uint total_inv = benefactor.length; benefactor.length += 1; benefactor[total_inv].etherAddress = msg.sender; benefactor[total_inv].amount = msg.value; balance += msg.value; //keep track of amount available
uint total_inv = benefactor.length; benefactor.length += 1; benefactor[total_inv].etherAddress = msg.sender; benefactor[total_inv].amount = msg.value; balance += msg.value; //keep track of amount available
39,006
8
// Variant name not found.
string constant VAR_NAME_NOT_FOUND = "E8";
string constant VAR_NAME_NOT_FOUND = "E8";
22,971
30
// Revert with an error if supplied signed end time is greater than the maximum specified. /
error InvalidSignedEndTime(uint256 got, uint256 maximum);
error InvalidSignedEndTime(uint256 got, uint256 maximum);
27,026
39
// if_succeeds {:msg "Can only be called by account holder"} old(creditAccounts[msg.sender]) != address(0x0);/ if_succeeds {:msg "If this succeeded the pool gets paid at least borrowed + interest"}/ let minAmountOwedToPool := old(borrowedPlusInterest(creditAccounts[msg.sender])) in/ IERC20(underlyingToken).balanceOf(po...
function repayCreditAccount(address to) external override whenNotPaused // T:[CM-39] nonReentrant { _repayCreditAccountImpl(msg.sender, to); // T:[CM-17] }
function repayCreditAccount(address to) external override whenNotPaused // T:[CM-39] nonReentrant { _repayCreditAccountImpl(msg.sender, to); // T:[CM-17] }
6,935
113
// Transfers tokens from a user to the exchange. This function will/be called when a user deposits funds to the exchange./In a simple implementation the funds are simply stored inside the/deposit contract directly. More advanced implementations may store the funds/in some DeFi application to earn interest, so this func...
function deposit( address from, address token, uint96 amount, bytes calldata extraData ) external payable returns (uint96 amountReceived);
function deposit( address from, address token, uint96 amount, bytes calldata extraData ) external payable returns (uint96 amountReceived);
23,950
27
// Emits a {EmergencySet} event. /
function flipEmergencyPool(uint256 poolId) external onlyOwner { _emergency[poolId] = !_emergency[poolId]; emit EmergencySet(poolId, _emergency[poolId]); }
function flipEmergencyPool(uint256 poolId) external onlyOwner { _emergency[poolId] = !_emergency[poolId]; emit EmergencySet(poolId, _emergency[poolId]); }
30,340
7
// Bouncer will be a hot wallet in our backend without any critical access (e.g: access to funds) If the hot wallet gets compromised, the owner can just change the bouncer without any critical issues.
function setBouncer(address _bouncer) external onlyOwner { bouncer = _bouncer; }
function setBouncer(address _bouncer) external onlyOwner { bouncer = _bouncer; }
64,009
144
// Token supply - 50 Billion Tokens, with 18 decimal precision
uint256 constant BILLION = 1000000000; uint256 constant TOKEN_SUPPLY = 50 * BILLION * (10 ** uint256(TOKEN_DECIMALS));
uint256 constant BILLION = 1000000000; uint256 constant TOKEN_SUPPLY = 50 * BILLION * (10 ** uint256(TOKEN_DECIMALS));
22,125
34
// We don't care about overflow of the addition, because it would require a list larger than any feasible computer's memory.
int256 pivot = list[(lo + hi) / 2]; lo -= 1; // this can underflow. that's intentional. hi += 1; while (true) { do { lo += 1; } while (list[lo] < pivot);
int256 pivot = list[(lo + hi) / 2]; lo -= 1; // this can underflow. that's intentional. hi += 1; while (true) { do { lo += 1; } while (list[lo] < pivot);
65,832
6
// 80%
borrowCapFactorMantissa = 0.8e18;
borrowCapFactorMantissa = 0.8e18;
20,769
0
// numCoefficients = totalChunks(degree + 1)NOTE: degree + 1 is the number of coefficients
numCoefficients := mul(totalChunks, add(shr(BIT_SHIFT_degree, calldataload(add(header.offset, HEADER_OFFSET_degree))), 1))
numCoefficients := mul(totalChunks, add(shr(BIT_SHIFT_degree, calldataload(add(header.offset, HEADER_OFFSET_degree))), 1))
1,925
82
// Handle the receipt of multiple ERC1155 token types An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeBatchTransferFrom` after the balances have been updatedThis function MAY throw to revert and reject the transferReturn of other amount than the magic va...
function onERC1155BatchReceived( address _operator,
function onERC1155BatchReceived( address _operator,
77,417
4
// if the request contains project proposal.
int hasProjectProposal=0;
int hasProjectProposal=0;
12,278
49
// Dungeon run not started yet.
_heroHealth = _heroInitialHealth; _monsterLevel = 1; _monsterInitialHealth = monsterHealth; _monsterHealth = _monsterInitialHealth; _gameState = 0;
_heroHealth = _heroInitialHealth; _monsterLevel = 1; _monsterInitialHealth = monsterHealth; _monsterHealth = _monsterInitialHealth; _gameState = 0;
26,464
162
// Maximum number of tokens in the pool
uint public constant MAX_BOUND_TOKENS = 9;
uint public constant MAX_BOUND_TOKENS = 9;
10,308
209
// bytes4(keccak256('name()')) == 0x06fdde03bytes4(keccak256('symbol()')) == 0x95d89b41bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f /
bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;
bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;
1,099
237
// fire when seller want to update order price, selling method, fee
event OrderUpdate(address operator, uint128 indexed orderId);
event OrderUpdate(address operator, uint128 indexed orderId);
14,776
32
// Returns the symbol of the token, usually a shorter version of thename. /
function symbol() public view virtual override returns (string memory) { return _symbol; }
function symbol() public view virtual override returns (string memory) { return _symbol; }
139
22
// To facilitate the process of constructing salary system, we need an address that could execute `newPacakge`._helperAddress the address that is to be assigned as a helper/
function setHelper(address _helperAddress) external onlyAdmin { helperAddressTable[_helperAddress] = true; }
function setHelper(address _helperAddress) external onlyAdmin { helperAddressTable[_helperAddress] = true; }
18,889
12
// subscription queue size: should be power of 10 /
uint constant QMAX = 1000;
uint constant QMAX = 1000;
44,758
93
// Pause submitting loans for rating status Flag of the status /
function pauseSubmissions(bool status) public onlyOwner { submissionPauseStatus = status; emit SubmissionPauseStatusChanged(status); }
function pauseSubmissions(bool status) public onlyOwner { submissionPauseStatus = status; emit SubmissionPauseStatusChanged(status); }
17,544
168
// Approve the metapool LP tokens for the vault contract
metapool_token.approve(tc_address, metapool_lp_in);
metapool_token.approve(tc_address, metapool_lp_in);
57,713
93
// Order must have a maker. /
if (order.maker == address(0)) { return false; }
if (order.maker == address(0)) { return false; }
41,952
104
// See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for `accounts`'s tokens of at least`amount`. /
function burnFrom(address account, uint256 amount) public virtual { uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), decreasedAllowance); _burn(account, amount); }
function burnFrom(address account, uint256 amount) public virtual { uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), decreasedAllowance); _burn(account, amount); }
9,820
95
// Owner events
event SetOperator(address operator, bool enable); event SetMiningFactor(uint8 miningFactor); event SetTreasury(address treasury); event SetLonStaking(address lonStaking); event SetMiningTreasury(address miningTreasury); event SetFeeTokenRecipient(address feeTokenRecipient);
event SetOperator(address operator, bool enable); event SetMiningFactor(uint8 miningFactor); event SetTreasury(address treasury); event SetLonStaking(address lonStaking); event SetMiningTreasury(address miningTreasury); event SetFeeTokenRecipient(address feeTokenRecipient);
382
74
// Migrates initial list of transfer agents transferAgents List of addresses to grant TRANSFER_AGENT role to
* @dev - Emits {RoleGranted} events * * Can only be called: * - by ScalingFunds agents * - BEFORE token has launched */ function migrateTransferAgents(address[] calldata transferAgents) external onlyScalingFundsAgent onlyBeforeLaunch { for (uint256 i = 0; i < transferAgents.length;...
* @dev - Emits {RoleGranted} events * * Can only be called: * - by ScalingFunds agents * - BEFORE token has launched */ function migrateTransferAgents(address[] calldata transferAgents) external onlyScalingFundsAgent onlyBeforeLaunch { for (uint256 i = 0; i < transferAgents.length;...
14,501
41
// Aqua Sale Smart contract
contract AquaSale is Owned { using SafeMath for uint256; uint256 constant ONE_HUNDRED = 100; //Internal state mapping (address => uint) internal buyerBalances; //Public interface ///Team trust account address address public teamTrustAccount; ///Team share of total to...
contract AquaSale is Owned { using SafeMath for uint256; uint256 constant ONE_HUNDRED = 100; //Internal state mapping (address => uint) internal buyerBalances; //Public interface ///Team trust account address address public teamTrustAccount; ///Team share of total to...
51,199
31
// Determine asset supplied (use Etherizer for Ether) and ether value.
ERC20Interface assetToSupply; uint256 etherValue; if (args.assetToSupply == address(0)) { assetToSupply = _ETHERIZER; etherValue = executionArgs.amountToSupply; } else {
ERC20Interface assetToSupply; uint256 etherValue; if (args.assetToSupply == address(0)) { assetToSupply = _ETHERIZER; etherValue = executionArgs.amountToSupply; } else {
34,595
7
// A record of voting checkpoints for each account, by index.
mapping(address => mapping(uint256 => Checkpoint)) public checkpoints;
mapping(address => mapping(uint256 => Checkpoint)) public checkpoints;
79,595
27
// Reset values of pending (Transaction object) /
function abortTransaction() external onlyAdmin{ ResetTransferState(); }
function abortTransaction() external onlyAdmin{ ResetTransferState(); }
46,750
169
// Proposed flash mint fee percentage is too big./feePercentage Proposed flash mint fee percentage.
error FlashFeePercentageTooBig(uint256 feePercentage);
error FlashFeePercentageTooBig(uint256 feePercentage);
20,034
1
// These are all the places you can go search for loot
enum Places { TOWN, DUNGEON, CRYPT, CASTLE, DRAGONS_LAIR, THE_ETHER, TAINTED_KINGDOM, OOZING_DEN, ANCIENT_CHAMBER, ORC_GODS }
enum Places { TOWN, DUNGEON, CRYPT, CASTLE, DRAGONS_LAIR, THE_ETHER, TAINTED_KINGDOM, OOZING_DEN, ANCIENT_CHAMBER, ORC_GODS }
13,555
6
// MODIFIER requires the contract to be not paused
modifier isPaused() { require(!statusPause, "Contract has been paused"); _; }
modifier isPaused() { require(!statusPause, "Contract has been paused"); _; }
13,271
43
// Returns the admin role that controls `role`. See {grantRole} and{revokeRole}. To change a role's admin, use {_setRoleAdmin}. /
function getRoleAdmin(bytes32 role) public view returns (bytes32) { return _roles[role].adminRole; }
function getRoleAdmin(bytes32 role) public view returns (bytes32) { return _roles[role].adminRole; }
874
106
// First withdraw all rewards, than withdarw it all, then stake back the remaining. /
function withdraw(uint256 amount) external override virtual returns (bool) { address _staker = msg.sender; return _withdraw(_staker, amount); }
function withdraw(uint256 amount) external override virtual returns (bool) { address _staker = msg.sender; return _withdraw(_staker, amount); }
73,017
209
// Set the referrer.
burnupHolding.setReferrer(msg.sender, referrerAddress);
burnupHolding.setReferrer(msg.sender, referrerAddress);
14,165
212
// Withdraw tokens amount_ amount of internal token to burn /
function _withdraw ( uint256 amount_, uint256[N_TOKENS] memory outAmounts_ ) internal
function _withdraw ( uint256 amount_, uint256[N_TOKENS] memory outAmounts_ ) internal
31,369
123
// Emits a {UnlockLP} event. Parameters:- `isInvestor` whether caller is project party or investor Returns:- `availableTimes` is frequency times to unlock- `amount` is lp amount to unlock/
function getUnlockLPAmount(bool isInvestor, address user) public view returns (uint256 availableTimes, uint256 amount) { require(lpUnlockStartTimestamp > 0, "add liquidity not finished"); uint256 totalTimes = 0; if (block.timestamp > lpUnlockStartTimestamp.add(lpLockPeriod)){ t...
function getUnlockLPAmount(bool isInvestor, address user) public view returns (uint256 availableTimes, uint256 amount) { require(lpUnlockStartTimestamp > 0, "add liquidity not finished"); uint256 totalTimes = 0; if (block.timestamp > lpUnlockStartTimestamp.add(lpLockPeriod)){ t...
41,729
1
// no decimals, ensure we preserve all trailing zeros
params.sigfigs = number / tenPowDecimals; params.sigfigIndex = digits - decimals; params.bufferLength = params.sigfigIndex;
params.sigfigs = number / tenPowDecimals; params.sigfigIndex = digits - decimals; params.bufferLength = params.sigfigIndex;
8,030
32
// Resets the list of Tokens on the allowlist /
function unsetTokenAllowlist() external adminRequired { delete allowedTokens; }
function unsetTokenAllowlist() external adminRequired { delete allowedTokens; }
18,811
222
// remove dust
if (address(this).balance > 0) { etherPools[0].transfer(address(this).balance); }
if (address(this).balance > 0) { etherPools[0].transfer(address(this).balance); }
7,104
107
// Step 2
function setUpPoolPair( address addressOfProjectToken, string memory tokenName_, string memory tokenSymbol_, uint totalTokenSupply_, uint48 startTime_, uint48 endTime_
function setUpPoolPair( address addressOfProjectToken, string memory tokenName_, string memory tokenSymbol_, uint totalTokenSupply_, uint48 startTime_, uint48 endTime_
21,897
0
// Data for migration--------------------------------- main storage contract (for current version queue style) that stores checkpoints
StorageCheckpointRegistryV2 public v2storage;
StorageCheckpointRegistryV2 public v2storage;
15,429
25
// Make sure the coin exists
confirmTokenExists(_tokenId);
confirmTokenExists(_tokenId);
49,552
46
// allows withdrawal of ETH in case it was sent by accident _beneficiary address where to send the eth. /
function drainEth(address payable _beneficiary) external;
function drainEth(address payable _beneficiary) external;
18,160
51
// substr with length /
contract TestBytesSubstrWithLen is BytesTest { function testImpl() internal { bytes memory bts = hex"8899aabbccddeeff8899aabbccddeeff8899aabbccddeeff8899aabbccddeeff8899aabbccddeeff8899aabbccddeeff8899aabbccddeeff8899aabbccddeeff8899aabbccddeeffaabb"; var cpy = bts.substr(7, 12); var sdp = M...
contract TestBytesSubstrWithLen is BytesTest { function testImpl() internal { bytes memory bts = hex"8899aabbccddeeff8899aabbccddeeff8899aabbccddeeff8899aabbccddeeff8899aabbccddeeff8899aabbccddeeff8899aabbccddeeff8899aabbccddeeff8899aabbccddeeffaabb"; var cpy = bts.substr(7, 12); var sdp = M...
43,267
0
// Transfers a token and returns if it was a success/token Token that should be transferred/receiver Receiver to whom the token should be transferred/amount The amount of tokens that should be transferred
function transferToken( address token, address receiver, uint256 amount
function transferToken( address token, address receiver, uint256 amount
20,381
61
// Modifier to make a function callable only when the contract is paused./
modifier whenPaused() { require(_paused, "Pausable: not paused"); _; }
modifier whenPaused() { require(_paused, "Pausable: not paused"); _; }
31,070
2
// Triggers stopped state. /
function pause() external onlyRole(ADMIN_ROLE) { _pause(); }
function pause() external onlyRole(ADMIN_ROLE) { _pause(); }
22,920
56
// Calculate the amount of FPI needed to be sold in order to reach the target FPI price
fpi_to_use = getTwammToPegAmt(true);
fpi_to_use = getTwammToPegAmt(true);
41,620
170
// Array position not initialized, so use position
indices[index] = totalSize - 1;
indices[index] = totalSize - 1;
19,529