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
24
// Calculates the amount of liquidity in the pair. For a SNWM pool, the liquidity in thepair is two times the amount of SNWM multiplied by the price of AVAX per SNWM. Onlyworks for SNWM pairs. Args:pair: SNWM pair to get liquidity inconversionFactor: the price of AVAX to SNWM Returns: the amount of liquidity in the poo...
function getPngLiquidity(address pair, uint conversionFactor) public view returns (uint) { (uint reserve0, uint reserve1, ) = IPangolinPair(pair).getReserves(); uint liquidity = 0; // add the snwm straight up if (IPangolinPair(pair).token0() == snwm) { liquidity = liqui...
function getPngLiquidity(address pair, uint conversionFactor) public view returns (uint) { (uint reserve0, uint reserve1, ) = IPangolinPair(pair).getReserves(); uint liquidity = 0; // add the snwm straight up if (IPangolinPair(pair).token0() == snwm) { liquidity = liqui...
6,417
14
// Ensure the destination token is allowed to be transferred by Set TransferProxy
ERC20.ensureAllowance( trade.destinationToken, address(this), setTransferProxy, destinationTokenQuantity ); return ( trade.destinationToken, destinationTokenQuantity
ERC20.ensureAllowance( trade.destinationToken, address(this), setTransferProxy, destinationTokenQuantity ); return ( trade.destinationToken, destinationTokenQuantity
9,616
57
// function provide the current bonus rate
function getCurrentBonusRate() internal returns (uint8) { if (getState() == State.Acquiantances) { return 40; } if (getState() == State.PreSale) { return 20; } if (getState() == State.CrowdFund) { return 0; } else { ...
function getCurrentBonusRate() internal returns (uint8) { if (getState() == State.Acquiantances) { return 40; } if (getState() == State.PreSale) { return 20; } if (getState() == State.CrowdFund) { return 0; } else { ...
1,171
162
// clear all data associated with a motionID for hygiene purposes. /
function _closeMotion(uint motionID) internal
function _closeMotion(uint motionID) internal
73,639
99
// 1. Sanity check the input position, or add a new position of ID is 0.
if (id == 0) { id = nextPositionID++; positions[id].goblin = goblin; positions[id].owner = msg.sender; } else {
if (id == 0) { id = nextPositionID++; positions[id].goblin = goblin; positions[id].owner = msg.sender; } else {
47,541
6
// @desc provides the name of the token/
function name() external view returns (string) { return NAME; }
function name() external view returns (string) { return NAME; }
79,495
2
// libraries / because they are saved in storage and storage will be cleaned up on proxy clones (right?)
{ clowderMain = ClowderMain(_clowderMain); reservoirOracleAddress = _reservoirOracleAddress; }
{ clowderMain = ClowderMain(_clowderMain); reservoirOracleAddress = _reservoirOracleAddress; }
18,711
113
// update rewardCycleBlock
nextAvailableClaimDate[msg.sender] = block.timestamp + getRewardCycleBlock(); emit ClaimEthSuccessfully( msg.sender, reward, nextAvailableClaimDate[msg.sender] );
nextAvailableClaimDate[msg.sender] = block.timestamp + getRewardCycleBlock(); emit ClaimEthSuccessfully( msg.sender, reward, nextAvailableClaimDate[msg.sender] );
16,438
1
// mapping(address => Land) public landsByAddress;
uint256 public landsCounter; mapping(address => uint256) public CounterByAddress; mapping (address => mapping (uint => Land)) public landsByAddress;
uint256 public landsCounter; mapping(address => uint256) public CounterByAddress; mapping (address => mapping (uint => Land)) public landsByAddress;
48,450
18
// Returns the rate of interest collected to be distributed to the protocol reserve.
function reserveRate() external view returns (uint);
function reserveRate() external view returns (uint);
34,845
323
// Resolves a price request that has expired or been disputed and a price is available from the DVM. This will revert if the unique request ID does not match the hashed request parameters. This also marks the request as settled, therefore this method can only be triggered once per eligible request.
function _settle( address requester, bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, Request memory request
function _settle( address requester, bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, Request memory request
15,159
7
// If the verifier already verified this hash, throw.
if(hashes[_thehash].verifications[msg.sender] == true) { Error('msg sender already verified this.'); return 'msg sender already verified this.'; }
if(hashes[_thehash].verifications[msg.sender] == true) { Error('msg sender already verified this.'); return 'msg sender already verified this.'; }
26,923
61
// ERC165 interface ID of ERC721Metadata
bytes4 internal constant ERC721_METADATA_INTERFACE_ID = 0x5b5e139f; bool internal _unlocked;
bytes4 internal constant ERC721_METADATA_INTERFACE_ID = 0x5b5e139f; bool internal _unlocked;
30,886
37
// timeout capped at TIMEOUT1
if (timeout > TIMEOUT1) timeout = TIMEOUT1; _slideEndTime = (block.timestamp).add(timeout);
if (timeout > TIMEOUT1) timeout = TIMEOUT1; _slideEndTime = (block.timestamp).add(timeout);
45,055
14
// Retract an item's latest revision. Revision 0 cannot be retracted. itemId itemId of the item. /
function retractLatestRevision(bytes32 itemId) external;
function retractLatestRevision(bytes32 itemId) external;
13,226
257
// See {ERC20-transferFrom} from The address to transfer tokens from to The address to transfer tokens to value The amount of tokens to transferreturn success A boolean indicating whether the operation was successful /
function transferFrom(address from, address to, uint256 value) override public notRestrictedTransferFrom(msg.sender, from, to, value) returns (bool success) { success = ERC20.transferFrom(from, to, value); }
function transferFrom(address from, address to, uint256 value) override public notRestrictedTransferFrom(msg.sender, from, to, value) returns (bool success) { success = ERC20.transferFrom(from, to, value); }
29,847
2
// Simple hash signatures checker. _hash Signed hash.return Verification status. /
function isSigned(bytes32 _hash) public view returns (bool)
function isSigned(bytes32 _hash) public view returns (bool)
30,937
20
// External Supporter struct to allow tracking reserved amounts by supporter/
struct ExternalSupporter { uint256 reservedAmount; }
struct ExternalSupporter { uint256 reservedAmount; }
36,311
15
// Mock of the vault (from yearn.finance) to test deposit/withdraw/yield harvest locally, NOTE: this vault mock keeps 15% in reserve (otherwise 0.5% fee is applied)
contract InvestmentVaultYUSDCv2Mock is ERC20("yUSDCMOCK", "yUSDC"), IYearnVaultUSDCv2 { using SafeMath for uint256; using SafeERC20 for IERC20; address private constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; address public override token; address public tokenStash; uint256 pu...
contract InvestmentVaultYUSDCv2Mock is ERC20("yUSDCMOCK", "yUSDC"), IYearnVaultUSDCv2 { using SafeMath for uint256; using SafeERC20 for IERC20; address private constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; address public override token; address public tokenStash; uint256 pu...
13,659
0
// Construct a new money market underlying_ The address of the underlying asset comptroller_ The address of the Comptroller interestRateModel_ The address of the interest rate model initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18 name_ ERC-20 name of this token symbol_ ERC-20 symbol of this token...
constructor(address underlying_, ComptrollerInterface comptroller_, InterestRateModel interestRateModel_, uint initialExchangeRateMantissa_, string memory name_, string memory symbol_, uint8 decimals_, ad...
constructor(address underlying_, ComptrollerInterface comptroller_, InterestRateModel interestRateModel_, uint initialExchangeRateMantissa_, string memory name_, string memory symbol_, uint8 decimals_, ad...
4,246
24
// for withdraw admin to user1st step function// function for approval of multi token to send from admin wallet to all user wallet
function multiApprovalbyAdmin( address[] memory tokenContracts, uint256 _values
function multiApprovalbyAdmin( address[] memory tokenContracts, uint256 _values
14,451
12
// Transfer in offer asset - erc20 to this contract
ERC20(erc20Address).safeTransferFrom(address(msg.sender), address(this), erc20Amount); _abonus.switchToEthForNTokenOffer.value(ethMining)(nTokenAddress);
ERC20(erc20Address).safeTransferFrom(address(msg.sender), address(this), erc20Amount); _abonus.switchToEthForNTokenOffer.value(ethMining)(nTokenAddress);
53,350
186
// Address of the contract responsible for post rebase syncs with AMMs
address private _deprecated_rebaseHooksAddr = address(0);
address private _deprecated_rebaseHooksAddr = address(0);
67,808
8
// Create additional privacy (only for receiver hashed transfers)
uint256 private privacyFund;
uint256 private privacyFund;
50,799
67
// _mints The set of {to: address, amount: uint256} pairs /
function batchMint(MintArgs[] calldata _mints) external { require(msg.sender == minter); for (uint256 i = 0; i < _mints.length; i++) { _mint(_mints[i].to, _mints[i].amount); }
function batchMint(MintArgs[] calldata _mints) external { require(msg.sender == minter); for (uint256 i = 0; i < _mints.length; i++) { _mint(_mints[i].to, _mints[i].amount); }
59,216
7
// Sets the base URI for the token's metadata./baseURI The new base URI.
function setURI(string memory baseURI) external onlyOwner { _setURI(baseURI); }
function setURI(string memory baseURI) external onlyOwner { _setURI(baseURI); }
24,513
236
// withdraw unlock lp
function withdrawUnlock(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(pool.lockedSeconds > 0 , "invalid pool"); updatePool(_pid); uint256 unlockAmount = 0; uint256 checkTime = block.timest...
function withdrawUnlock(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(pool.lockedSeconds > 0 , "invalid pool"); updatePool(_pid); uint256 unlockAmount = 0; uint256 checkTime = block.timest...
35,302
28
// The updated body of smart contract.%6 fund will be transferred to ParcelX advisors automatically./
contract RoutineGPX is MultiOwnable, Pausable { using SafeMath for uint256; function RoutineGPX(address[] _multiOwners, uint _multiRequires) MultiOwnable(_multiOwners, _multiRequires) public { } event Deposit(address indexed who, uint256 value); event Withdraw(address indexed who, ui...
contract RoutineGPX is MultiOwnable, Pausable { using SafeMath for uint256; function RoutineGPX(address[] _multiOwners, uint _multiRequires) MultiOwnable(_multiOwners, _multiRequires) public { } event Deposit(address indexed who, uint256 value); event Withdraw(address indexed who, ui...
32,103
14
// withdraw directly to curve LP token, this is what we primarily use
function withdrawAndUnwrap(uint256 _amount, bool _claim) external returns (bool);
function withdrawAndUnwrap(uint256 _amount, bool _claim) external returns (bool);
18,817
11
// Multiply the price by the decimal adjuster to get the normalized result.
return uint256(_price) * feedDecimalAdjuster[_currency];
return uint256(_price) * feedDecimalAdjuster[_currency];
13,839
14
// string memory _quantity
{
{
32,101
83
// internal helper function to calculate fee per token multiplier used inswap fee calculations swapFee swap fee for the tokens /
function _feePerToken(uint256 swapFee) internal pure returns (uint256) { return swapFee / NUM_TOKENS; }
function _feePerToken(uint256 swapFee) internal pure returns (uint256) { return swapFee / NUM_TOKENS; }
12,717
93
// @inheritdoc IReserve
function getToken() external view override returns (IERC20) { return token; }
function getToken() external view override returns (IERC20) { return token; }
32,702
51
// Hook that is called after any transfer of tokens. This includesminting and burning. Calling conditions: - when `from` and `to` are both non-zero, `amount` of ``from``'s tokenshas been transferred to `to`.- when `from` is zero, `amount` tokens have been minted for `to`.- when `to` is zero, `amount` of ``from``'s toke...
function _afterTokenTransfer( address from, address to, uint256 amount
function _afterTokenTransfer( address from, address to, uint256 amount
27,031
11
// Admin errors/Royalty percentage too high
error Setup_RoyaltyPercentageTooHigh(uint16 maxRoyaltyBPS);
error Setup_RoyaltyPercentageTooHigh(uint16 maxRoyaltyBPS);
17,332
32
// The `to` address cannot be the null address.
if (to == address(0)) { return (false, bytes1(hex"57")); // invalid receiver }
if (to == address(0)) { return (false, bytes1(hex"57")); // invalid receiver }
23,387
3
// this swap function is used to trade from one token to anotherthe inputs are self explainatorytoken in = the token address you want to trade out oftoken out = the token address you want as the output of this tradeamount in = the amount of tokens you are sending inamount out Min = the minimum amount of tokens you want...
function swap( address _tokenIn, address _tokenOut, uint256 _amountIn, uint256 _amountOutMin, address _to
function swap( address _tokenIn, address _tokenOut, uint256 _amountIn, uint256 _amountOutMin, address _to
17,907
0
// Constants related to the betting rules.
uint256 constant BET_AMT = 0.2 ether; uint8 constant NUM_BETS = 3;
uint256 constant BET_AMT = 0.2 ether; uint8 constant NUM_BETS = 3;
15,390
96
// return {uint256} totalToken /
function getTotalToken() public view returns (uint256) { return _token.balanceOf(getContractAddress()); }
function getTotalToken() public view returns (uint256) { return _token.balanceOf(getContractAddress()); }
36,101
19
// If there are SHER rewards still available (we didn't surpass zeroRewardsStartTVL)...
if (slopeRewardsAvailable != 0) {
if (slopeRewardsAvailable != 0) {
62,262
33
// check sum
require(0 != sum);
require(0 != sum);
34,058
5
// closingPrice The price the oracle recorded after the elapse runTime of the bet/ betID The ID of the bet to settle
function settleBet(uint256 betID, uint256 closingPrice) external override onlyOracle { BetDetails memory closeBetDetails = betDetails[betID]; require(closeBetDetails.endTime <= block.timestamp, "PepeBet: UnelapsedBet"); require(closeBetDetails.active, "PepeBet: InactiveBet"); requir...
function settleBet(uint256 betID, uint256 closingPrice) external override onlyOracle { BetDetails memory closeBetDetails = betDetails[betID]; require(closeBetDetails.endTime <= block.timestamp, "PepeBet: UnelapsedBet"); require(closeBetDetails.active, "PepeBet: InactiveBet"); requir...
17,744
18
// Only owner (EVTMaster Contract)
function mint(address _to, uint256 amount) public onlyOwner returns (bool) { require(totalSupply.add(amount, 'EVT::mint: mint amount overflows') <= maxSupply, 'EVT::mint: max supply exceeded'); _mint(_to, amount); return true; }
function mint(address _to, uint256 amount) public onlyOwner returns (bool) { require(totalSupply.add(amount, 'EVT::mint: mint amount overflows') <= maxSupply, 'EVT::mint: max supply exceeded'); _mint(_to, amount); return true; }
37,939
5
// comptroller_ The address of the comptroller, which will be consulted for market listing status v1PriceOracle_ The address of the v1 price oracle, which will continue to operate and hold prices for collateral assets /
constructor(address comptroller_, address v1PriceOracle_
constructor(address comptroller_, address v1PriceOracle_
48,740
326
// Function to initialize the contract stakingAddress must be initialized separately after Staking contract is deployed delegateManagerAddress must be initialized separately after DelegateManager contract is deployed serviceTypeManagerAddress must be initialized separately after ServiceTypeManager contract is deployed ...
function initialize (
function initialize (
41,272
544
// A bitmap currency can only ever hold debt in this currency
require(localCurrencyId == accountContext.bitmapCurrencyId);
require(localCurrencyId == accountContext.bitmapCurrencyId);
63,198
15
// Accrue token to the market by updating the borrow index To avoid revert: no over/underflow token The token whose borrow index to update mToken The market whose borrow index to update marketBorrowIndex The market borrow index /
function updateTokenBorrowIndexInternal(address token, address mToken, uint marketBorrowIndex) internal { // Non-token market's speed will always be 0, 0 speed token market will also update nothing if (isLendingPool == true && farmStates[token].speeds[mToken] > 0 && marketBorrowIndex > 0) { ...
function updateTokenBorrowIndexInternal(address token, address mToken, uint marketBorrowIndex) internal { // Non-token market's speed will always be 0, 0 speed token market will also update nothing if (isLendingPool == true && farmStates[token].speeds[mToken] > 0 && marketBorrowIndex > 0) { ...
25,330
10
// Withdraws funds from this contract, debiting the user's wallet. /
function withdraw( bytes32[] walletIDs, address[] recipients, uint256[] values, uint64[] nonces, uint8[] v, bytes32[] r, bytes32[] s
function withdraw( bytes32[] walletIDs, address[] recipients, uint256[] values, uint64[] nonces, uint8[] v, bytes32[] r, bytes32[] s
20,879
35
// Farm distributes the ERC20 rewards based on staked LP to each user.
contract Farm { using SafeMath for uint256; using SafeERC20 for IERC20; // Info of each user. struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. uint256 lastClaimTime; uint256 ...
contract Farm { using SafeMath for uint256; using SafeERC20 for IERC20; // Info of each user. struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. uint256 lastClaimTime; uint256 ...
61,763
1,003
// Freezes a reserve. A frozen reserve doesn't allow any new deposit, borrow or rate swap but allows repayments, liquidations, rate rebalances and withdrawals asset The address of the underlying asset of the reserve /
function freezeReserve(address asset) external onlyPoolAdmin { DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset); currentConfig.setFrozen(true); pool.setConfiguration(asset, currentConfig.data); emit ReserveFrozen(asset); }
function freezeReserve(address asset) external onlyPoolAdmin { DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset); currentConfig.setFrozen(true); pool.setConfiguration(asset, currentConfig.data); emit ReserveFrozen(asset); }
39,515
9
// The hash of the name parameter for the EIP712 domain. NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costsare a concern. /
function _EIP712NameHash() internal virtual view returns (bytes32) { return _HASHED_NAME; }
function _EIP712NameHash() internal virtual view returns (bytes32) { return _HASHED_NAME; }
8,280
503
// Sets {decimals} to a value other than the default one of 18. WARNING: This function should only be called from the constructor. Mostapplications that interact with token contracts will not expect{decimals} to ever change, and may work incorrectly if it does. /
function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; }
function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; }
8,793
112
// Get the rounds an account has unclaimed rewards
function getRewards(address accountAddress) public view returns(uint256[] memory)
function getRewards(address accountAddress) public view returns(uint256[] memory)
67,646
51
// Then unpause will sync all pairs
tokenUniswapPairCORE = coreGlobals.COREWETHUniPair(); _editNoFeeList(coreGlobals.COREVaultAddress(), true); // corevault proxy needs to have no sender fee _addPairToTrack(coreGlobals.COREWETHUniPair());
tokenUniswapPairCORE = coreGlobals.COREWETHUniPair(); _editNoFeeList(coreGlobals.COREVaultAddress(), true); // corevault proxy needs to have no sender fee _addPairToTrack(coreGlobals.COREWETHUniPair());
40,329
9
// loop through players to see who selected winning team
for(uint256 i = 0; i < winners.length; i++){ playerAddress = winners[i];
for(uint256 i = 0; i < winners.length; i++){ playerAddress = winners[i];
42,815
6
// Team allocation vested over {VESTING_DURATION} years
uint256 internal constant _TEAM_ALLOCATION = 250_000_000 * 1 ether;
uint256 internal constant _TEAM_ALLOCATION = 250_000_000 * 1 ether;
13,815
13
// call the initializer, passing any remaining amount and get initial state (S_0)
bytes32 initial_state = logic_contract.initialize_state{ value: remainder }(user);
bytes32 initial_state = logic_contract.initialize_state{ value: remainder }(user);
45,547
80
// Set caller as contract owner /
function initialize() public initializer { _setInitialOwner(msg.sender); }
function initialize() public initializer { _setInitialOwner(msg.sender); }
41,104
44
// Function to accept stamping of an item by the intended recipient self is the mappings of completed stamping associated with the recipient user _stampingOrderMapping is the mapping of the completed stamping order using SortOrder Struct (IceSort Library) of the recipient _stampingCountMapping is the mapping of complet...
function acceptStamping( mapping (uint => IceGlobal.GlobalRecord) storage self, mapping (uint => IceSort.SortOrder) storage _stampingOrderMapping, mapping (uint => uint) storage _stampingCountMapping, mapping (uint => IceGlobal.GlobalRecord) storage _stampingsReq, m...
function acceptStamping( mapping (uint => IceGlobal.GlobalRecord) storage self, mapping (uint => IceSort.SortOrder) storage _stampingOrderMapping, mapping (uint => uint) storage _stampingCountMapping, mapping (uint => IceGlobal.GlobalRecord) storage _stampingsReq, m...
34,372
7
// A contract that can be stopped/restarted by its owner. /
contract Stoppable is Ownable { bool public isActive = true; event IsActiveChanged(bool _isActive); modifier onlyActive() { require(isActive, "contract is stopped"); _; } function setIsActive(bool _isActive) external onlyOwner { if (_isActive == isActive) return; ...
contract Stoppable is Ownable { bool public isActive = true; event IsActiveChanged(bool _isActive); modifier onlyActive() { require(isActive, "contract is stopped"); _; } function setIsActive(bool _isActive) external onlyOwner { if (_isActive == isActive) return; ...
31,857
17
// `pendingOwner` can claim `owner` account.
function claimOwner() external { require(msg.sender == pendingOwner, "NOT_PENDING_OWNER"); emit TransferOwner(owner, msg.sender); owner = msg.sender; pendingOwner = address(0); }
function claimOwner() external { require(msg.sender == pendingOwner, "NOT_PENDING_OWNER"); emit TransferOwner(owner, msg.sender); owner = msg.sender; pendingOwner = address(0); }
19,719
25
// Assert that main UTXO for passed wallet exists in storage.
bytes32 mainUtxoHash = self .registeredWallets[walletPubKeyHash] .mainUtxoHash; require(mainUtxoHash != bytes32(0), "No main UTXO for given wallet");
bytes32 mainUtxoHash = self .registeredWallets[walletPubKeyHash] .mainUtxoHash; require(mainUtxoHash != bytes32(0), "No main UTXO for given wallet");
10,781
81
// Gets the amount of Crane locked in the contract
uint256 totalCrane = crane.balanceOf(address(this));
uint256 totalCrane = crane.balanceOf(address(this));
26,321
20
// check if any of the winnerPicks is this contributor's bin
for (uint8 j = 0; j < numberOfPicks; j++) { if (acc > winnerPicks[j] && winnerPicks[j] >= prevLimit) { winnerIdxs.push(contributorIdx); }
for (uint8 j = 0; j < numberOfPicks; j++) { if (acc > winnerPicks[j] && winnerPicks[j] >= prevLimit) { winnerIdxs.push(contributorIdx); }
8,906
49
// 總共有空令牌或沒有銷售代幣
if (tokens == 0 || total_supply == 0) { return 0; }
if (tokens == 0 || total_supply == 0) { return 0; }
12,579
72
// uint delta = LiquidityGauge(reward_contract).claimable_tokens(address(this));Error: Mutable call in static context
uint delta = LiquidityGauge(reward_contract).integrate_fraction(address(this)).sub(Minter(LiquidityGauge(reward_contract).minter()).minted(address(this), reward_contract)); return _claimable_tokens(addr, delta, reward_integral_[rewarded_token], reward_integral_for_[addr][rewarded_token]);
uint delta = LiquidityGauge(reward_contract).integrate_fraction(address(this)).sub(Minter(LiquidityGauge(reward_contract).minter()).minted(address(this), reward_contract)); return _claimable_tokens(addr, delta, reward_integral_[rewarded_token], reward_integral_for_[addr][rewarded_token]);
28,540
9
// Emitted if Relay Server is inactive for an `abandonmentDelay` and contract owner initiates its removal.
event RelayServerAbandoned( address indexed relayManager, uint256 abandonedTime );
event RelayServerAbandoned( address indexed relayManager, uint256 abandonedTime );
11,145
34
// Multisignature wallet factory
contract MultiSigWalletCreator is Ownable() { // wallets mapping(address => bool) public isMultiSigWallet; mapping(address => address[]) public wallets; mapping(address => uint) public numberOfWallets; // information about system string public currentSystemInfo; event walletCreated(addr...
contract MultiSigWalletCreator is Ownable() { // wallets mapping(address => bool) public isMultiSigWallet; mapping(address => address[]) public wallets; mapping(address => uint) public numberOfWallets; // information about system string public currentSystemInfo; event walletCreated(addr...
33,275
186
// check if the sender is an authorized operator _sender msg.sender _accountOwner owner of a vault /
function _isAuthorized(address _sender, address _accountOwner) internal view { require( (_sender == _accountOwner) || (operators[_accountOwner][_sender]), "Controller: msg.sender is not authorized to run action" ); }
function _isAuthorized(address _sender, address _accountOwner) internal view { require( (_sender == _accountOwner) || (operators[_accountOwner][_sender]), "Controller: msg.sender is not authorized to run action" ); }
9,490
0
// 定义工厂合约接口
contract FactoryInterface { // uniswap中现有的代币地址数组 address[] public tokenList; // 设置a代币地址和a代币流动性池子地址的映射 mapping(address => address) tokenToExchange; // 设置a代币流动性池子地址和a代币地址的映射 mapping(address => address) exchangeToToken; // 启动一个新的流动性池子(new一个新的子合约) function launchExchange(address _token) pub...
contract FactoryInterface { // uniswap中现有的代币地址数组 address[] public tokenList; // 设置a代币地址和a代币流动性池子地址的映射 mapping(address => address) tokenToExchange; // 设置a代币流动性池子地址和a代币地址的映射 mapping(address => address) exchangeToToken; // 启动一个新的流动性池子(new一个新的子合约) function launchExchange(address _token) pub...
34,219
101
// for dev fee send to the dev address
sendEthToDevAddress(devEthBalance); emit SwapAndLiquify(contractTokenBalance, liquidityEthBalance, devEthBalance);
sendEthToDevAddress(devEthBalance); emit SwapAndLiquify(contractTokenBalance, liquidityEthBalance, devEthBalance);
29,032
106
// generates a base64 encoded metadata response without referencing off-chain content tokenId the ID of the token to generate the metadata forreturn a base64 encoded JSON dictionary of the token's metadata and SVG /
function tokenURI(uint256 tokenId) public view override returns (string memory) { IKONGS.KaijuKong memory s = kongs.getTokenTraits(tokenId); string memory metadata = string(abi.encodePacked( '{"name": "', s.isKaiju ? 'Kaiju #' : 'Kong #', tokenId.toString(), '", "description": "Thousa...
function tokenURI(uint256 tokenId) public view override returns (string memory) { IKONGS.KaijuKong memory s = kongs.getTokenTraits(tokenId); string memory metadata = string(abi.encodePacked( '{"name": "', s.isKaiju ? 'Kaiju #' : 'Kong #', tokenId.toString(), '", "description": "Thousa...
21,962
119
// sets the referenced backup oracle/newBackupOracle the new backup oracle to reference
function setBackupOracle(address newBackupOracle) external override onlyGovernorOrAdmin { _setBackupOracle(newBackupOracle); }
function setBackupOracle(address newBackupOracle) external override onlyGovernorOrAdmin { _setBackupOracle(newBackupOracle); }
31,851
2
// Remove a trusted claim topic (For example: KYC=1, AML=2) claimTopicclaim topic identification /
function removeClaimTopic( uint256 claimTopic
function removeClaimTopic( uint256 claimTopic
19,414
4
// Returns whether the interface is supported.interfaceId The interface id to check against. /
function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC1155Receiver, ONFT1155Core) returns (bool)
function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC1155Receiver, ONFT1155Core) returns (bool)
11,661
117
// check LP balance
uint256 _lpBalance = IERC20(uniswapV2Pair).balanceOf(address(this)); if (_lpBalance != 0) {
uint256 _lpBalance = IERC20(uniswapV2Pair).balanceOf(address(this)); if (_lpBalance != 0) {
30,139
2
// Total Claimable GTX which is the Amount of GTX sold during presale
uint256 public totalClaimableGTX;
uint256 public totalClaimableGTX;
47,668
99
// a checkpoint of the valid balance of a user for an epoch
struct Checkpoint { uint128 epochId; uint128 multiplier; uint256 startBalance; uint256 newDeposits; }
struct Checkpoint { uint128 epochId; uint128 multiplier; uint256 startBalance; uint256 newDeposits; }
42,361
20
// Token Buy/
function buyTokensWithEth() external payable { require (msg.value > 0, "You need to send some Ether"); require (msg.value <= maxAmountinEth, "Cannot buy more than max limit"); uint256 amount = msg.value * exchangeRateInEth; require(token.balanceOf(address(this)) >= amount, "Not eno...
function buyTokensWithEth() external payable { require (msg.value > 0, "You need to send some Ether"); require (msg.value <= maxAmountinEth, "Cannot buy more than max limit"); uint256 amount = msg.value * exchangeRateInEth; require(token.balanceOf(address(this)) >= amount, "Not eno...
32,848
285
// part two
bpool.swapExactAmountIn( weth,wethB,address(want), 0,uint256(-1));
bpool.swapExactAmountIn( weth,wethB,address(want), 0,uint256(-1));
9,885
0
// Withdrawal addresses
address public constant ADD = 0xa64b407D4363E203F682f7D95eB13241B039E580; bool public preSale; bool public publicSale; bool public revealed; uint256 public reservedMintedAmount; mapping(address => bool) public presalerList; mapping(address => uint256) public presalerListPurchases;
address public constant ADD = 0xa64b407D4363E203F682f7D95eB13241B039E580; bool public preSale; bool public publicSale; bool public revealed; uint256 public reservedMintedAmount; mapping(address => bool) public presalerList; mapping(address => uint256) public presalerListPurchases;
2,285
28
// Fetch bet parameters into local variables (to save gas).
Game storage game = games[commit]; uint bet1Amount = game.bet1Amount; uint bet2Amount = game.bet2Amount; uint bet3Amount = game.bet3Amount; uint bet4Amount = game.bet4Amount; uint bet5Amount = game.bet5Amount; uint placeBlockNumber = game.placeBlockNumber; address gambler = game.gambler;...
Game storage game = games[commit]; uint bet1Amount = game.bet1Amount; uint bet2Amount = game.bet2Amount; uint bet3Amount = game.bet3Amount; uint bet4Amount = game.bet4Amount; uint bet5Amount = game.bet5Amount; uint placeBlockNumber = game.placeBlockNumber; address gambler = game.gambler;...
47,553
65
// IMMUTABLES & CONSTANTS / Fees are 6-decimal places. For example: 20106 = 20%
uint256 internal constant FEE_MULTIPLIER = 10**6;
uint256 internal constant FEE_MULTIPLIER = 10**6;
64,908
15
// accessible only by owner, prevents further loans to be created after being called/called by bot when sudden price drop is detected on OpenSea API of listed collections/resumes the contract to normal operations when called again/supplies, repays, sells & withdraws stay unaffected
function stopOrRestartBorrows() public { require(msg.sender == owner); stopBorrows = !stopBorrows; }
function stopOrRestartBorrows() public { require(msg.sender == owner); stopBorrows = !stopBorrows; }
29,984
80
// copy candidates to confirms
copyCandidatesToConfirms(candidates);
copyCandidatesToConfirms(candidates);
9,092
60
// It is expected that this value is sometimes NULL.
address prev = self.list[target].previous; self.list[newNode].next = target; self.list[newNode].previous = prev; self.list[target].previous = newNode; self.list[prev].next = newNode; self.list[newNode].inList = true;
address prev = self.list[target].previous; self.list[newNode].next = target; self.list[newNode].previous = prev; self.list[target].previous = newNode; self.list[prev].next = newNode; self.list[newNode].inList = true;
12,341
11
// returns the resistant balance and FEI in the deposit
function resistantBalanceAndFei() public view override returns (uint256, uint256) { uint256 resistantBalance = balance(); uint256 reistantFei = isProtocolFeiDeposit ? resistantBalance : 0; return (resistantBalance, reistantFei); }
function resistantBalanceAndFei() public view override returns (uint256, uint256) { uint256 resistantBalance = balance(); uint256 reistantFei = isProtocolFeiDeposit ? resistantBalance : 0; return (resistantBalance, reistantFei); }
51,890
543
// Existing Voting contract needs to be informed of the address of the new Voting contract.
Voting public existingVoting;
Voting public existingVoting;
21,441
67
// 150 000 tokens soft cap
uint public constant ICO_TOKEN_SOFT_CAP = 150000 * (1 ether / 1 wei);
uint public constant ICO_TOKEN_SOFT_CAP = 150000 * (1 ether / 1 wei);
46,279
6
// totalShares are not 0, so we can uncheck
unchecked { result /= totalShares; }
unchecked { result /= totalShares; }
8,585
179
// Return the borrow balance of account based on stored data account The address whose balance should be calculatedreturn The calculated balance /
function borrowBalanceStored(address account) public view returns (uint) { (MathError err, uint result) = borrowBalanceStoredInternal(account); require(err == MathError.NO_ERROR, "borrowBalanceStored: borrowBalanceStoredInternal failed"); return result; }
function borrowBalanceStored(address account) public view returns (uint) { (MathError err, uint result) = borrowBalanceStoredInternal(account); require(err == MathError.NO_ERROR, "borrowBalanceStored: borrowBalanceStoredInternal failed"); return result; }
1,502
3
// The token being loaned.
address loanToken;
address loanToken;
9,212
18
// 销毁收藏品/碎片
Burn,
Burn,
44,794
19
// Mint a ParagonsDAO Player ID NFT for PDT (Public). nameOn-chain username for the minter. /
function publicMint(bytes32 name) external nonReentrant { _handleMint(msg.sender, name, false); }
function publicMint(bytes32 name) external nonReentrant { _handleMint(msg.sender, name, false); }
19,439
23
// How much of the generated interest is donated, meaning no GD is expected in compensation, 1 in mil precision. 100% for phase0 POC
uint32 public avgInterestDonatedRatio = 1e6;
uint32 public avgInterestDonatedRatio = 1e6;
51,389
21
// Setea el CUIT de la SAS/proyecto /
function setCuit(uint cuit) onlyowner public { m_cuit = cuit; emit cuitSet(m_cuit); }
function setCuit(uint cuit) onlyowner public { m_cuit = cuit; emit cuitSet(m_cuit); }
27,386
6
// @custom:security-contact john@newellserv.com
contract GoldCoin is ERC20, ERC20Burnable, AccessControl, ERC20Permit, ERC20Votes { bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); constructor() ERC20("Gold Coin", "gCOIN") ERC20Permit("Gold Coin") { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(MINTER_ROLE, msg.sender...
contract GoldCoin is ERC20, ERC20Burnable, AccessControl, ERC20Permit, ERC20Votes { bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); constructor() ERC20("Gold Coin", "gCOIN") ERC20Permit("Gold Coin") { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(MINTER_ROLE, msg.sender...
43,022
121
// Constructs the Bomb ERC-20 contract. /
constructor() ERC20("Bomb", "bomb") { // Mints 5000 Bomb to contract creator for initial pool setup _mint(msg.sender, 5000 ether); }
constructor() ERC20("Bomb", "bomb") { // Mints 5000 Bomb to contract creator for initial pool setup _mint(msg.sender, 5000 ether); }
13,386
173
// Configured contract implementing token rule(s).If set, transfer will consult this contract should transferbe allowed after successful authorization signature check.And call doTransfer() in order for rules to decide where fundshould end up. /
ITransferRules public _rules; event RulesUpdated(address rules);
ITransferRules public _rules; event RulesUpdated(address rules);
29,776
10
// Asset for which we create a covered call for
address public asset;
address public asset;
9,764