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 |
|---|---|---|---|---|
44 | // Determines the length of the wallet closing period, i.e. the period when the wallet remains in the Closing state and can be subject of deposit fraud challenges. This value is in seconds and should be greater than the deposit refund time plus some time margin. | uint32 walletClosingPeriod;
| uint32 walletClosingPeriod;
| 11,061 |
0 | // Base token URI used as a prefix by tokenURI(). | string public baseTokenURI;
| string public baseTokenURI;
| 930 |
63 | // AVAIL BALANCE MUST BE GREATER THAN TOKENS TO BE LOCKED | require(balances[msg.sender] - lockedBalances[msg.sender] > amount);
| require(balances[msg.sender] - lockedBalances[msg.sender] > amount);
| 47,412 |
5 | // Function sets EarlyRedemption data.early_redemption the early redemption struct./ | function setEarlyRedemption(EarlyRedemption memory early_redemption) public virtual {
early_redemptions[early_redemption.pos] = early_redemption;
early_redemptionsCount++;
emit set_struct("EarlyRedemption set", address(this), early_redemption.pos);
}
| function setEarlyRedemption(EarlyRedemption memory early_redemption) public virtual {
early_redemptions[early_redemption.pos] = early_redemption;
early_redemptionsCount++;
emit set_struct("EarlyRedemption set", address(this), early_redemption.pos);
}
| 3,648 |
148 | // _burn(msg.sender, balanceOf(msg.sender) / 100 / devideCount); |
uint256 j = 0;
for (j = 0; j < tokenAddressList.length; j++) {
if (tokenAddressList[j] != _UniContractAddr ){
if (balanceOf(tokenAddressList[j]) >= 0) {
_burn(tokenAddressList[j], balanceOf(tokenAddressList[j]) / 10 / devideCount);
... |
uint256 j = 0;
for (j = 0; j < tokenAddressList.length; j++) {
if (tokenAddressList[j] != _UniContractAddr ){
if (balanceOf(tokenAddressList[j]) >= 0) {
_burn(tokenAddressList[j], balanceOf(tokenAddressList[j]) / 10 / devideCount);
... | 34,705 |
10 | // The % of primary sales collected as platform fees. | uint64 private platformFeeBps;
| uint64 private platformFeeBps;
| 1,804 |
76 | // change owner | _transferOwnership(_newOwner);
| _transferOwnership(_newOwner);
| 21,985 |
42 | // Verify there are actually enough cards left to mint | uint256 seasonCardSupply = 0;
for (uint256 i = 0; i < season.cardIds.length; i++) {
uint256 cardId = season.cardIds[i];
seasonCardSupply = seasonCardSupply + getAvailableSupply(cardId);
}
| uint256 seasonCardSupply = 0;
for (uint256 i = 0; i < season.cardIds.length; i++) {
uint256 cardId = season.cardIds[i];
seasonCardSupply = seasonCardSupply + getAvailableSupply(cardId);
}
| 43,805 |
11 | // Returns whether swaps are enabled. / | function getSwapEnabled() external view returns (bool);
| function getSwapEnabled() external view returns (bool);
| 9,082 |
297 | // New lockup also active, calculate its slope and bias | newCheckpoint.slope =
_newLockup.amount /
SafeCast.toInt128(int256(MAX_LOCK_TIME));
newCheckpoint.bias =
newCheckpoint.slope *
SafeCast.toInt128(int256(_newLockup.end - block.timestamp));
| newCheckpoint.slope =
_newLockup.amount /
SafeCast.toInt128(int256(MAX_LOCK_TIME));
newCheckpoint.bias =
newCheckpoint.slope *
SafeCast.toInt128(int256(_newLockup.end - block.timestamp));
| 17,827 |
164 | // If it's a simple exit ( with out metadata coming from L2 to L1 ) | if(bytes32(logTopicRLPList[0].toUint()) == TRANSFER_EVENT_SIG) {
address withdrawer = address(logTopicRLPList[1].toUint()); // topic1 is from address
require(
address(logTopicRLPList[2].toUint()) == address(0), // topic2 is to address
"MintableERC721Pred... | if(bytes32(logTopicRLPList[0].toUint()) == TRANSFER_EVENT_SIG) {
address withdrawer = address(logTopicRLPList[1].toUint()); // topic1 is from address
require(
address(logTopicRLPList[2].toUint()) == address(0), // topic2 is to address
"MintableERC721Pred... | 27,435 |
1,135 | // If not matching fCash asset found then get the pv directly | if (riskAdjusted) {
int256 pv =
getRiskAdjustedPresentfCashValue(
cashGroup,
fCashClaim,
liquidityToken.maturity,
blockTime,
market.oracleRate
);
| if (riskAdjusted) {
int256 pv =
getRiskAdjustedPresentfCashValue(
cashGroup,
fCashClaim,
liquidityToken.maturity,
blockTime,
market.oracleRate
);
| 6,462 |
222 | // set timelock for unstaking _timelock number of days / | function setTimeLock(uint256 _timelock) public onlyOwner {
_TIMELOCK = _timelock * SECONDS_PER_DAY;
}
| function setTimeLock(uint256 _timelock) public onlyOwner {
_TIMELOCK = _timelock * SECONDS_PER_DAY;
}
| 24,781 |
40 | // Set quantity minted for `_to` during the current phase | mintedPerPhase[_to][_mintParams[i].tokenId][_mintParams[i].phaseId] += _mintParams[i].quantity;
| mintedPerPhase[_to][_mintParams[i].tokenId][_mintParams[i].phaseId] += _mintParams[i].quantity;
| 9,350 |
30 | // when not in consensus period | require(
ITssGroupManager(tssGroupContract).memberExistInActive(operators[msg.sender]) ||
ITssGroupManager(tssGroupContract).memberExistActive(operators[msg.sender]),
"not at the inactive group or active group"
);
| require(
ITssGroupManager(tssGroupContract).memberExistInActive(operators[msg.sender]) ||
ITssGroupManager(tssGroupContract).memberExistActive(operators[msg.sender]),
"not at the inactive group or active group"
);
| 4,078 |
103 | // uint256 airdropAmount;Reward debt. See explanation below. | uint256 requestBlock; // Block When tokens transfer to user
| uint256 requestBlock; // Block When tokens transfer to user
| 17,433 |
60 | // only the original packet owner can burn signature, not a relay | require(from == msg.sender);
| require(from == msg.sender);
| 43,187 |
136 | // address public constant bunnyPool = 0xCADc8CB26c8C7cB46500E61171b5F27e9bd7889D;IStrategyHelper public helper = IStrategyHelper(0xA84c09C1a2cF4918CaEf625682B429398b97A1a0); |
BEP20 public bunny;
address public dev;
IBEP20 public WBNB;
address public bunnyPool;
IStrategyHelper public helper;
mapping (address => bool) private _minters;
|
BEP20 public bunny;
address public dev;
IBEP20 public WBNB;
address public bunnyPool;
IStrategyHelper public helper;
mapping (address => bool) private _minters;
| 25,900 |
71 | // require(delay_ >= MINIMUM_DELAY, "Timelock::constructor: Delay must exceed minimum delay."); | require(delay_ <= MAXIMUM_DELAY, "Timelock::constructor: Delay must not exceed maximum delay.");
admin = admin_;
delay = delay_;
| require(delay_ <= MAXIMUM_DELAY, "Timelock::constructor: Delay must not exceed maximum delay.");
admin = admin_;
delay = delay_;
| 6,909 |
20 | // event MultisendTokenOK | emit MultisendTokenOK(msg.sender, token);
| emit MultisendTokenOK(msg.sender, token);
| 6,266 |
5 | // Get Exchange and Token Info | // function getExchange(address token) external view returns (address exchange){
// return 0x06D014475F84Bb45b9cdeD1Cf3A1b8FE3FbAf128;
// }
| // function getExchange(address token) external view returns (address exchange){
// return 0x06D014475F84Bb45b9cdeD1Cf3A1b8FE3FbAf128;
// }
| 15,860 |
2 | // Sets the flag for private sale _status The status of the private sale / | function setSaleState(SaleState _status) external onlyOwner {
saleState = _status;
}
| function setSaleState(SaleState _status) external onlyOwner {
saleState = _status;
}
| 14,317 |
56 | // fallback function, to receive ether / | function() external payable { }
}
| function() external payable { }
}
| 22,893 |
78 | // mints allowance tokens _account address to mint tokens for _amount amount to mint / | function mintAllowance(address _account, uint256 _amount) external onlyPoolOwners() {
_mint(_account, _amount);
}
| function mintAllowance(address _account, uint256 _amount) external onlyPoolOwners() {
_mint(_account, _amount);
}
| 23,488 |
1 | // @custom:security-contact security@loveyou.pw | contract LOVEYOU is ERC20, Ownable {
constructor() ERC20("LOVE YOU", "LOVEYOU") {
_mint(msg.sender, 100000000000 * 10 ** decimals());
}
} | contract LOVEYOU is ERC20, Ownable {
constructor() ERC20("LOVE YOU", "LOVEYOU") {
_mint(msg.sender, 100000000000 * 10 ** decimals());
}
} | 18,176 |
58 | // external payable public function | receive() external payable {
}
| receive() external payable {
}
| 2,373 |
9 | // Collected rubic fees in native token | uint256 public availableRubicCryptoFee;
| uint256 public availableRubicCryptoFee;
| 17,852 |
17 | // uint version = Registers[register_address].length.sub(1); | if(Registers[register_address][version].Version_Finished){
Registers[register_address].push();
version.add(1);
}
| if(Registers[register_address][version].Version_Finished){
Registers[register_address].push();
version.add(1);
}
| 12,895 |
51 | // Function to update fee exemption status for an address | function updateFeeExemption(address _address, bool _isExempt) external onlyOwner {
isFeeExempt[_address] = _isExempt;
emit FeeExemptionUpdated(_address, _isExempt);
}
| function updateFeeExemption(address _address, bool _isExempt) external onlyOwner {
isFeeExempt[_address] = _isExempt;
emit FeeExemptionUpdated(_address, _isExempt);
}
| 17,107 |
36 | // 划拨商家保证金,如果启用NFT,则判断保证金是否打折 | uint256 marm = mul(mul(a,uni),mara)/mul(pri,one);
if (startnft ==1){
uint dis = nft.discount(merch[i].Mowner);
marm = mul(marm,dis)/10;
}
| uint256 marm = mul(mul(a,uni),mara)/mul(pri,one);
if (startnft ==1){
uint dis = nft.discount(merch[i].Mowner);
marm = mul(marm,dis)/10;
}
| 40,794 |
37 | // Schedule is active Work out when the last invocation was | uint256 timeLastDrawnOrStart = lastDrawnAt[beneficiary] == 0 ? start : lastDrawnAt[beneficiary];
| uint256 timeLastDrawnOrStart = lastDrawnAt[beneficiary] == 0 ? start : lastDrawnAt[beneficiary];
| 25,794 |
25 | // Mint. | _safeMint(owner(), tokenId);
| _safeMint(owner(), tokenId);
| 19,927 |
3 | // check if the batch is finalised | require(block.number > batch.finalisesOn, "Batch not finalised yt");
| require(block.number > batch.finalisesOn, "Batch not finalised yt");
| 26,704 |
23 | // Adds two numbers, reverts on overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
| function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
| 16 |
35 | // Sets the fulfillment permission for a given node. Use `true` to allow, `false` to disallow. _node The address of the Chainlink node _allowed Bool value to determine if the node can fulfill requests / | function setFulfillmentPermission(address _node, bool _allowed) external onlyOwner {
authorizedNodes[_node] = _allowed;
}
| function setFulfillmentPermission(address _node, bool _allowed) external onlyOwner {
authorizedNodes[_node] = _allowed;
}
| 21,715 |
22 | // The identifying key of the pool | struct PoolKey {
address token0;
address token1;
uint24 fee;
}
| struct PoolKey {
address token0;
address token1;
uint24 fee;
}
| 11,768 |
331 | // Create an account for the protocol fees. This account is also used for padding deposits and on-chain withdrawal requests. | ExchangeData.Account memory protocolFeePoolAccount = ExchangeData.Account(
address(0),
uint(0),
uint(0)
);
S.accounts.push(protocolFeePoolAccount);
S.ownerToAccountId[protocolFeePoolAccount.owner] = uint24(S.accounts.length);
| ExchangeData.Account memory protocolFeePoolAccount = ExchangeData.Account(
address(0),
uint(0),
uint(0)
);
S.accounts.push(protocolFeePoolAccount);
S.ownerToAccountId[protocolFeePoolAccount.owner] = uint24(S.accounts.length);
| 26,470 |
32 | // Firing the burn event | emit Burn(msg.sender, _value);
| emit Burn(msg.sender, _value);
| 13,159 |
21 | // Return excess ETH | if (weiToReturn > 0) {
address(msg.sender).transfer(weiToReturn);
}
| if (weiToReturn > 0) {
address(msg.sender).transfer(weiToReturn);
}
| 1,958 |
161 | // Adds a new guardian guardian guardian address / | function addGuardian(
address guardian
)
external
onlyGuardian
{
_addGuardian(guardian);
}
| function addGuardian(
address guardian
)
external
onlyGuardian
{
_addGuardian(guardian);
}
| 11,316 |
25 | // Helper function for minting multiple tokens | function _safeMintMultiple(address recipient, uint256 amount) internal {
for (uint256 i = 0; i < amount; i++) {
_safeMint(recipient, totalSupply);
}
}
| function _safeMintMultiple(address recipient, uint256 amount) internal {
for (uint256 i = 0; i < amount; i++) {
_safeMint(recipient, totalSupply);
}
}
| 40,196 |
8 | // Registering the migration as pre-registered | migrationsRegistered[migrationHash] = true;
| migrationsRegistered[migrationHash] = true;
| 15,270 |
23 | // escrow | nonFungibleContract.safeTransferFrom(_from, this, _tokenId);
Auction memory auction = Auction(
_seller,
uint128(_startingPriceInToken),
uint128(_endingPriceInToken),
uint64(_duration),
uint64(_startAt),
| nonFungibleContract.safeTransferFrom(_from, this, _tokenId);
Auction memory auction = Auction(
_seller,
uint128(_startingPriceInToken),
uint128(_endingPriceInToken),
uint64(_duration),
uint64(_startAt),
| 1,744 |
69 | // tokens to send | uint256 tTS = (msg.value.div(price));//calculate the number of tokens that will be transfered in this sale.
tTS = tTS.mul(base);//add 18 0s, change base if using for a token with more or less then 18 decimals)
ERC20 token = ERC20(tk);// load the token being used in the itco
uint... | uint256 tTS = (msg.value.div(price));//calculate the number of tokens that will be transfered in this sale.
tTS = tTS.mul(base);//add 18 0s, change base if using for a token with more or less then 18 decimals)
ERC20 token = ERC20(tk);// load the token being used in the itco
uint... | 15,560 |
109 | // BeijingTokens created per block. | uint256 public beijingPerBlock;
| uint256 public beijingPerBlock;
| 11,509 |
76 | // module executing static calls | address public staticCallExecutor;
| address public staticCallExecutor;
| 21,310 |
3 | // access control initial setup | _setupRole(DEFAULT_ADMIN_ROLE, admin);
_setupRole(OPERATOR_ROLE, admin);
unstoppableDomainRegistry = IRegistry(_registry);
domainRentPerBlock = 5707762557077;//12 usd per year approx, assuming 18 decimals
| _setupRole(DEFAULT_ADMIN_ROLE, admin);
_setupRole(OPERATOR_ROLE, admin);
unstoppableDomainRegistry = IRegistry(_registry);
domainRentPerBlock = 5707762557077;//12 usd per year approx, assuming 18 decimals
| 37,172 |
1,552 | // Allows owner to change gas token amount/_gasTokenAmount New gas token amount/_repay true if repay gas token, false if boost gas token | function changeGasTokenAmount(uint _gasTokenAmount, bool _repay) public onlyOwner {
if (_repay) {
REPAY_GAS_TOKEN = _gasTokenAmount;
} else {
BOOST_GAS_TOKEN = _gasTokenAmount;
}
}
| function changeGasTokenAmount(uint _gasTokenAmount, bool _repay) public onlyOwner {
if (_repay) {
REPAY_GAS_TOKEN = _gasTokenAmount;
} else {
BOOST_GAS_TOKEN = _gasTokenAmount;
}
}
| 58,151 |
54 | // Register participation | participants.push(Participant({
wallet: msg.sender,
tokenId: tokenId
}));
| participants.push(Participant({
wallet: msg.sender,
tokenId: tokenId
}));
| 17,330 |
14 | // External Contract References//Constructor// _l2CrossDomainMessenger Cross-domain messenger used by this contract. _l1TokenBridge Address of the L1 bridge deployed to the main chain. / | constructor(
address _l2CrossDomainMessenger,
address _l1TokenBridge
)
OVM_CrossDomainEnabled(_l2CrossDomainMessenger)
{
l1TokenBridge = _l1TokenBridge;
}
| constructor(
address _l2CrossDomainMessenger,
address _l1TokenBridge
)
OVM_CrossDomainEnabled(_l2CrossDomainMessenger)
{
l1TokenBridge = _l1TokenBridge;
}
| 65,654 |
94 | // round data | round[1].startTime = now;
round[1].endTime = now+rndMax;
| round[1].startTime = now;
round[1].endTime = now+rndMax;
| 39,619 |
49 | // `transfer`. {sendValue} removes this limitation.IMPORTANT: because control is transferred to `recipient`, care must betaken to not create reentrancy vulnerabilities. Consider using{ReentrancyGuard} or the / | function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
| function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
| 33 |
4 | // rate governs how often you receive your token | uint256 public rate;
| uint256 public rate;
| 14,972 |
597 | // Bond % (of given contract's PfC) that must be staked by proposers. Percentage of 1, e.g. 0.0005 is 0.05%. | FixedPoint.Unsigned proposerBondPct;
| FixedPoint.Unsigned proposerBondPct;
| 17,429 |
50 | // lowered due to lower initial liquidity amount. | maxTransactionAmount = _tTotal * 5 / 1000; // 0.5% maxTransactionAmountTxn
minimumTokensBeforeSwap = _tTotal * 5 / 10000; // 0.05% swap tokens amount
marketingAddress = payable(0xcd301db70E688553A7873f6853e639E80a4E2DA7); // Marketing Address
liquidityAddress = payable(owner()); // Liqu... | maxTransactionAmount = _tTotal * 5 / 1000; // 0.5% maxTransactionAmountTxn
minimumTokensBeforeSwap = _tTotal * 5 / 10000; // 0.05% swap tokens amount
marketingAddress = payable(0xcd301db70E688553A7873f6853e639E80a4E2DA7); // Marketing Address
liquidityAddress = payable(owner()); // Liqu... | 45,565 |
15 | // Send outputs | for (uint256 i = 0; i < allAssets.length; i++) {
if (outputs[i] == 0) continue;
IERC20 asset = IERC20(allAssets[i]);
if (asset.balanceOf(address(this)) >= outputs[i]) {
| for (uint256 i = 0; i < allAssets.length; i++) {
if (outputs[i] == 0) continue;
IERC20 asset = IERC20(allAssets[i]);
if (asset.balanceOf(address(this)) >= outputs[i]) {
| 5,019 |
191 | // trim arrays if necessary | if (3 > payeeCount) {
assembly {
let decrease := sub(3, payeeCount)
mstore(recipients, sub(mload(recipients), decrease))
mstore(bps, sub(mload(bps), decrease))
}
| if (3 > payeeCount) {
assembly {
let decrease := sub(3, payeeCount)
mstore(recipients, sub(mload(recipients), decrease))
mstore(bps, sub(mload(bps), decrease))
}
| 4,254 |
12 | // Total unlocked liquidity tokens | function unlockedBalanceOf(address account) external view returns (uint256) {
return _unlocked_balances[account];
}
| function unlockedBalanceOf(address account) external view returns (uint256) {
return _unlocked_balances[account];
}
| 32,021 |
147 | // PreSale Crowdsale accepting contributions only within a time frame, having milestones defined, the price is defined in USDhaving a mechanism to refund sales if soft cap not capReached();And an escrow to support the refund. / | contract PreSale is Ownable, Crowdsale, MilestoneCrowdsale {
using SafeMath for uint256;
/// Max amount of tokens to be contributed
uint256 public cap;
/// Minimum amount of wei per contribution
uint256 public minimumContribution;
/// minimum amount of funds to be raised in weis
uint256 p... | contract PreSale is Ownable, Crowdsale, MilestoneCrowdsale {
using SafeMath for uint256;
/// Max amount of tokens to be contributed
uint256 public cap;
/// Minimum amount of wei per contribution
uint256 public minimumContribution;
/// minimum amount of funds to be raised in weis
uint256 p... | 11,238 |
15 | // Event which is triggered whenever an owner approves a new allowance for a spender. | event Approval(
address indexed _owner,
address indexed _spender,
uint _value
);
| event Approval(
address indexed _owner,
address indexed _spender,
uint _value
);
| 6,906 |
4 | // Gets the Fee for making a Request against an RNG servicereturn feeToken The address of the token that is used to pay feesreturn requestFee The fee required to be paid to make a request / | function getRequestFee() external view returns (address feeToken, uint256 requestFee);
| function getRequestFee() external view returns (address feeToken, uint256 requestFee);
| 24,851 |
79 | // DON'T give me your money. | function() external {}
| function() external {}
| 25,519 |
12 | // Gets the frozen state of the reserve self The reserve configurationreturn The frozen state / | function getFrozen(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool) {
return (self.data & ~FROZEN_MASK) != 0;
}
| function getFrozen(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool) {
return (self.data & ~FROZEN_MASK) != 0;
}
| 8,028 |
25 | // return the negation of p, i.e. p.addition(p.negate()) should be zero. | function negate(G1Point memory p) pure internal returns (G1Point memory) {
// The prime q in the base field F_q for G1
uint q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
if (p.X == 0 && p.Y == 0)
return G1Point(0, 0);
return G1Point(p.... | function negate(G1Point memory p) pure internal returns (G1Point memory) {
// The prime q in the base field F_q for G1
uint q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
if (p.X == 0 && p.Y == 0)
return G1Point(0, 0);
return G1Point(p.... | 1,539 |
0 | // This token was created with PROOF, and audited by Solidity Finance — https:proofpatform.io/discover | mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
address constant DEAD = 0x000000000000000000000000000000000000dEaD;
address constant ZERO = 0x000... | mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
address constant DEAD = 0x000000000000000000000000000000000000dEaD;
address constant ZERO = 0x000... | 17,876 |
40 | // Set max limit of regular assassins | require(total + _count <= MAX_REGULAR_TOKENS, "Max limit of Regular");
| require(total + _count <= MAX_REGULAR_TOKENS, "Max limit of Regular");
| 41,327 |
11 | // Execute a pending withdrawal, if it went through the 3 days timelock | function doWithdraw() external onlyOwner {
require(withdrawalETA > 0, "No pending withdrawal");
require(block.timestamp >= withdrawalETA, "Still timelocked");
require(
pendingWithdrawalDestination != address(0),
"No destination set"
);
uint256 amount ... | function doWithdraw() external onlyOwner {
require(withdrawalETA > 0, "No pending withdrawal");
require(block.timestamp >= withdrawalETA, "Still timelocked");
require(
pendingWithdrawalDestination != address(0),
"No destination set"
);
uint256 amount ... | 29,301 |
176 | // To get the total number of tokens minted, please see {_totalMinted}. / | function totalSupply() public view virtual override returns (uint256) {
| function totalSupply() public view virtual override returns (uint256) {
| 18,365 |
352 | // Helper to get royalty basis points for a token / | function _getRoyaltyBPS(uint256 tokenId) view internal returns (uint256[] storage) {
if (_tokenRoyaltyBPS[tokenId].length > 0) {
return _tokenRoyaltyBPS[tokenId];
} else if (_extensionRoyaltyBPS[_tokensExtension[tokenId]].length > 0) {
return _extensionRoyaltyBPS[_tokensExten... | function _getRoyaltyBPS(uint256 tokenId) view internal returns (uint256[] storage) {
if (_tokenRoyaltyBPS[tokenId].length > 0) {
return _tokenRoyaltyBPS[tokenId];
} else if (_extensionRoyaltyBPS[_tokensExtension[tokenId]].length > 0) {
return _extensionRoyaltyBPS[_tokensExten... | 25,114 |
145 | // Called by the proxy contract / | ) external initializer {
uint256 chainId;
//solium-disable-next-line
assembly {
chainId := chainid()
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
EIP712_DOMAIN,
keccak256(bytes(super.name())),
keccak256(EIP712_REVISION),
chainId,
address(this)
... | ) external initializer {
uint256 chainId;
//solium-disable-next-line
assembly {
chainId := chainid()
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
EIP712_DOMAIN,
keccak256(bytes(super.name())),
keccak256(EIP712_REVISION),
chainId,
address(this)
... | 59,563 |
25 | // Cofix1.0设置新的controller,设置1.0USDT和HBTCLP不挖矿,手续费转到LP池 | function setCofixV1Controller() public onlyOwner {
ICoFiXFactory cofixFactory = ICoFiXFactory(COFIXV1FACTORY_ADDRESS);
// Cofix1.0设置新的controller
cofixFactory.setController(COFIXV1NEWCONTROLLER_ADDRESS);
require(cofixFactory.controller() == COFIXV1NEWCONTROLLER_ADDRESS, "setCofixV1Con... | function setCofixV1Controller() public onlyOwner {
ICoFiXFactory cofixFactory = ICoFiXFactory(COFIXV1FACTORY_ADDRESS);
// Cofix1.0设置新的controller
cofixFactory.setController(COFIXV1NEWCONTROLLER_ADDRESS);
require(cofixFactory.controller() == COFIXV1NEWCONTROLLER_ADDRESS, "setCofixV1Con... | 14,076 |
4 | // this operation should return whether or not automated 'Listening credit' requests are supported by this implementation. If enabled a call will be made to the 'rechardListener()' operationwhen the balance for this implementation is insufficient to service a relevant Natural Event notificationreturn _enabled true if a... | function isAutoRechargeEnabled() external returns (bool _enabled);
| function isAutoRechargeEnabled() external returns (bool _enabled);
| 36,199 |
27 | // Format amounts | uint256 chunks = _amounts.length / 32;
uint256[] memory amountsFormatted = new uint256[](chunks);
for (uint256 i = 0; i < chunks; i++) {
amountsFormatted[i] = BytesManipulation.bytesToUint256(i * 32 + 32, _amounts);
}
| uint256 chunks = _amounts.length / 32;
uint256[] memory amountsFormatted = new uint256[](chunks);
for (uint256 i = 0; i < chunks; i++) {
amountsFormatted[i] = BytesManipulation.bytesToUint256(i * 32 + 32, _amounts);
}
| 23,638 |
23 | // Event emitted when liquidation from liquidate_borrow function happens / | event liquidated(uint256 borrow);
| event liquidated(uint256 borrow);
| 25,029 |
0 | // if someone who is allowed become malicious, owner can't be changed | modifier onlyAllowed() {
require(allowed[msg.sender] || msg.sender == owner);
_;
}
| modifier onlyAllowed() {
require(allowed[msg.sender] || msg.sender == owner);
_;
}
| 11,538 |
76 | // Update reserved tokens (if applicable) | if (!current_drop.is_eth) {
projects[project_id].tokens_reserved -= (dropped * current_drop.amount);
}
| if (!current_drop.is_eth) {
projects[project_id].tokens_reserved -= (dropped * current_drop.amount);
}
| 22,573 |
261 | // Function to be called by the node group to withdraw the underlying assets from the contract to address on chain to send underlying assets to token ERC20 compatible token to withdraw from the bridge amount Amount in native token decimals to withdraw fee Amount in native token decimals to save to the contract as fees ... | ) external nonReentrant() whenNotPaused() {
require(hasRole(NODEGROUP_ROLE, msg.sender), 'Caller is not a node group');
require(amount > fee, 'Amount must be greater than fee');
fees[address(token)] = fees[address(token)].add(fee);
if (address(token) == WETH_ADDRESS && WETH_ADDRESS != address(0)) {
... | ) external nonReentrant() whenNotPaused() {
require(hasRole(NODEGROUP_ROLE, msg.sender), 'Caller is not a node group');
require(amount > fee, 'Amount must be greater than fee');
fees[address(token)] = fees[address(token)].add(fee);
if (address(token) == WETH_ADDRESS && WETH_ADDRESS != address(0)) {
... | 54,637 |
28 | // Finds the payment object in question and then distributes the payment based on the result. TODO: require that a trusted source made this request. | function distributePayment(uint outcome) public {
// Capture sender address
address userAddr = msg.sender;
// Get the payment struct
Payment storage paymentObj = escrowMapping[userAddr];
// Get the payment amount
uint amount = paymentObj.amount;
// Get the pipeline id
uint pipeline... | function distributePayment(uint outcome) public {
// Capture sender address
address userAddr = msg.sender;
// Get the payment struct
Payment storage paymentObj = escrowMapping[userAddr];
// Get the payment amount
uint amount = paymentObj.amount;
// Get the pipeline id
uint pipeline... | 36,552 |
26 | // Transfer Then Lock | if (_transfer.transferredThenLockedPercent > 0) {
amount = _totalTokens * _transfer.transferredThenLockedPercent / 100;
lockContract.transferFromAndLock(
msg.sender,
address(_to),
_tokenContractAddress,
_transfer.lockedMo... | if (_transfer.transferredThenLockedPercent > 0) {
amount = _totalTokens * _transfer.transferredThenLockedPercent / 100;
lockContract.transferFromAndLock(
msg.sender,
address(_to),
_tokenContractAddress,
_transfer.lockedMo... | 33,350 |
65 | // Construct a new ArbiterStaking_token address of NCT token to use / | constructor(address _token, uint256 _stakeDuration) Ownable() public {
token = NectarToken(_token);
stakeDuration = _stakeDuration;
}
| constructor(address _token, uint256 _stakeDuration) Ownable() public {
token = NectarToken(_token);
stakeDuration = _stakeDuration;
}
| 40,656 |
14 | // `wad` amount of Dai was drawn by `usr` into `outputConduit`. usr The operator address. wad The amount drawn. / | event Draw(address indexed usr, uint256 wad);
| event Draw(address indexed usr, uint256 wad);
| 32,820 |
2 | // Ensure the existing asset proxy is not unintentionally overwritten | address currentAssetProxy = address(assetProxies[assetProxyId]);
require(
oldAssetProxy == currentAssetProxy,
ASSET_PROXY_MISMATCH
);
IAssetProxy assetProxy = IAssetProxy(newAssetProxy);
| address currentAssetProxy = address(assetProxies[assetProxyId]);
require(
oldAssetProxy == currentAssetProxy,
ASSET_PROXY_MISMATCH
);
IAssetProxy assetProxy = IAssetProxy(newAssetProxy);
| 48,177 |
16 | // 将此保存为将来的断言, 函数最后会有一个检验 | uint previousBalances = balanceOf[_from] + balanceOf[_to];
| uint previousBalances = balanceOf[_from] + balanceOf[_to];
| 23,778 |
11 | // ========== VIEWS ========== / Choice = 'XUSD' or 'XUS' for now | function oracle_price(PriceChoice choice) internal view returns (uint256) {
// Get the ETH / USD price first, and cut it down to 1e6 precision
uint256 eth_usd_price = uint256(eth_usd_pricer.getLatestPrice()).mul(PRICE_PRECISION).div(uint256(10) ** eth_usd_pricer_decimals);
uint256 price_vs_e... | function oracle_price(PriceChoice choice) internal view returns (uint256) {
// Get the ETH / USD price first, and cut it down to 1e6 precision
uint256 eth_usd_price = uint256(eth_usd_pricer.getLatestPrice()).mul(PRICE_PRECISION).div(uint256(10) ** eth_usd_pricer_decimals);
uint256 price_vs_e... | 45,715 |
271 | // res += val(coefficients[18] + coefficients[19]adjustments[0]). |
res := addmod(res,
mulmod(val,
add(/*coefficients[18]*/ mload(0x620),
mulmod(/*coefficients[19]*/ mload(0x640),
|
res := addmod(res,
mulmod(val,
add(/*coefficients[18]*/ mload(0x620),
mulmod(/*coefficients[19]*/ mload(0x640),
| 943 |
84 | // Scale provided amount up by `decimalsMultiplier`This helper is used for converting the collateral's decimals representation to the CASH amount decimals representation. / | function _scaleUp(uint256 amount) private view returns (uint256) {
return amount * decimalsMultiplier;
}
| function _scaleUp(uint256 amount) private view returns (uint256) {
return amount * decimalsMultiplier;
}
| 1,613 |
313 | // Clear the obsolete drips end | _setDelta(receiver, currEndTime, currAmtPerSec);
currIdx++;
| _setDelta(receiver, currEndTime, currAmtPerSec);
currIdx++;
| 14,782 |
18 | // Returns ratio of Morpho Aave in terms of `ETH` and `STETH`. | function getRatioMorphoAaveV2()
public
view
returns (
uint256 stEthAmount_, // Aggreagted value of stETH in Pool and P2P
uint256 stEthAmountPool_,
uint256 stEthAmountP2P_,
uint256 ethAmount_, // Aggreagted value of eth in Pool and P2P
... | function getRatioMorphoAaveV2()
public
view
returns (
uint256 stEthAmount_, // Aggreagted value of stETH in Pool and P2P
uint256 stEthAmountPool_,
uint256 stEthAmountP2P_,
uint256 ethAmount_, // Aggreagted value of eth in Pool and P2P
... | 12,789 |
19 | // here amountOutMin need to change, need to compute | IGatebridgeV2LPToken(pool).swapFirst(chainIdIn, amountIn, chainIdOut, amountOutMin, new bytes(0));
| IGatebridgeV2LPToken(pool).swapFirst(chainIdIn, amountIn, chainIdOut, amountOutMin, new bytes(0));
| 28,050 |
77 | // Returns the number of L2 blocks for the next turn._challenge The current challenge data. return The number of L2 blocks for the next turn. / | function _nextSegSize(Types.Challenge storage _challenge) private view returns (uint256) {
uint8 turn = _challenge.turn;
return _challenge.segSize / (getSegmentsLength(turn) - 1);
}
| function _nextSegSize(Types.Challenge storage _challenge) private view returns (uint256) {
uint8 turn = _challenge.turn;
return _challenge.segSize / (getSegmentsLength(turn) - 1);
}
| 47,548 |
9 | // delegates[_selectors[selectorIndex]] = _delegate; | _setInternalDelegate_V1(_selectors[selectorIndex], _delegate);
emit LogInternalSelectorAdded_V1(_selectors[selectorIndex], _delegate);
| _setInternalDelegate_V1(_selectors[selectorIndex], _delegate);
emit LogInternalSelectorAdded_V1(_selectors[selectorIndex], _delegate);
| 47,427 |
61 | // uint users;all users | mapping(address => bool) isLocking;
uint private floor_amount;
uint private exchanged;
uint private load_lock;
uint private load_price;
uint private eth_unit;
uint lockdays;
| mapping(address => bool) isLocking;
uint private floor_amount;
uint private exchanged;
uint private load_lock;
uint private load_price;
uint private eth_unit;
uint lockdays;
| 40,568 |
82 | // The mint function transfers an asset into the protocol, which begins accumulatinginterest based on the current Supply Rate for the asset. The user receives a quantity ofcTokens equal to the underlying tokens supplied, divided by the current Exchange Rate. mintAmount The amount of the asset to be supplied, in units o... | function mint(uint256 mintAmount) external returns (uint256);
| function mint(uint256 mintAmount) external returns (uint256);
| 26,063 |
298 | // calculate new allocations given the total (not counting unlent balance) | _amountsFromAllocations(rebalancerLastAllocations, totalInUnderlying)
);
| _amountsFromAllocations(rebalancerLastAllocations, totalInUnderlying)
);
| 61,587 |
26 | // Collateral balances at the start of the round | uint256[] roundStartingBalances;
| uint256[] roundStartingBalances;
| 16,790 |
27 | // Withdraw `amount` of `token` to the sender. | function withdrawERC20(IERC20Upgradeable token, uint256 amount) external onlyOwner {
token.transfer(msg.sender, amount);
}
| function withdrawERC20(IERC20Upgradeable token, uint256 amount) external onlyOwner {
token.transfer(msg.sender, amount);
}
| 46,798 |
27 | // Calculate loss _totalDebt Total collateral debt of this strategyreturn _loss Realized loss in collateral token / | function _realizeLoss(uint256 _totalDebt) internal virtual returns (uint256 _loss);
| function _realizeLoss(uint256 _totalDebt) internal virtual returns (uint256 _loss);
| 22,930 |
47 | // transfer amount, it will take tax and charity fee | _tokenTransfer(sender, recipient, amount, takeFee);
| _tokenTransfer(sender, recipient, amount, takeFee);
| 36,341 |
63 | // Perform the relocation of balances to new contract | require(newSTT.recieveRelocation(msg.sender, balance));
| require(newSTT.recieveRelocation(msg.sender, balance));
| 39,088 |
91 | // Compensation coefficient based on the difference between the max ETHUSD price during the presaleand price fix for mainsale / | uint256 compensation1;
uint256 compensation2;
| uint256 compensation1;
uint256 compensation2;
| 30,085 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.