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
|
|---|---|---|---|---|
8
|
// Deposit FoldToken to the FoldToken Pool _amount Amount in FoldToken _lpAddress Address of desired LP token to deposit /
|
function depositLP(uint256 _amount, address _lpAddress) public {
updatePool();
if(allowedLPs[_lpAddress]){
Position storage position = addressPosition[msg.sender];
|
function depositLP(uint256 _amount, address _lpAddress) public {
updatePool();
if(allowedLPs[_lpAddress]){
Position storage position = addressPosition[msg.sender];
| 4,578
|
29
|
// owner = msg.sender;for testing
|
balances[owner] = INITIAL_SUPPLY;
tokenAllocated = 0;
transfersEnabled = true;
|
balances[owner] = INITIAL_SUPPLY;
tokenAllocated = 0;
transfersEnabled = true;
| 49,431
|
655
|
// Selector of `log(string,uint256,string,string)`.
|
mstore(0x00, 0x5ab84e1f)
mstore(0x20, 0x80)
mstore(0x40, p1)
mstore(0x60, 0xc0)
mstore(0x80, 0x100)
writeString(0xa0, p0)
writeString(0xe0, p2)
writeString(0x120, p3)
|
mstore(0x00, 0x5ab84e1f)
mstore(0x20, 0x80)
mstore(0x40, p1)
mstore(0x60, 0xc0)
mstore(0x80, 0x100)
writeString(0xa0, p0)
writeString(0xe0, p2)
writeString(0x120, p3)
| 30,760
|
8
|
// Function for freelancers to accept a project and release escrowed budget
|
function acceptProject(uint256 _projectId) external {
Project storage project = projects[_projectId];
require(project.freelancer == address(0), "Project already accepted");
require(
msg.sender == project.client,
"Only Client can accept the project"
);
project.freelancer = payable(msg.sender);
uint256 fee = (project.budget * platformFee) / 100;
platformAddress.transfer(fee);
uint256 amount = project.budget - fee;
project.completed = true;
project.paid = true;
project.freelancer.transfer(amount);
emit ProjectAccepted(_projectId);
emit PaymentReleased(_projectId);
}
|
function acceptProject(uint256 _projectId) external {
Project storage project = projects[_projectId];
require(project.freelancer == address(0), "Project already accepted");
require(
msg.sender == project.client,
"Only Client can accept the project"
);
project.freelancer = payable(msg.sender);
uint256 fee = (project.budget * platformFee) / 100;
platformAddress.transfer(fee);
uint256 amount = project.budget - fee;
project.completed = true;
project.paid = true;
project.freelancer.transfer(amount);
emit ProjectAccepted(_projectId);
emit PaymentReleased(_projectId);
}
| 2,989
|
9
|
// Gets the stored public key for a particular `recipient` and `topicHash`. Return value will be 0 lengthif no public key has been set. Senders may need this public key to encrypt messages that only the `recipient` can read. If the public keyis communicated offchain, this field may be left empty. /
|
function getPublicKey(address recipient, bytes32 topicHash) external view returns (bytes memory) {
return recipients[recipient].topics[topicHash].publicKey;
}
|
function getPublicKey(address recipient, bytes32 topicHash) external view returns (bytes memory) {
return recipients[recipient].topics[topicHash].publicKey;
}
| 22,091
|
394
|
// get link to a user data structure, we will write into it later
|
User storage user = users[_staker];
|
User storage user = users[_staker];
| 68,112
|
36
|
// Transfer margins from seller to Match
|
tokenSpender.claimTokens(marginToken, _rightOrder.makerAddress, address(this), margins[1].mul(_fillable));
|
tokenSpender.claimTokens(marginToken, _rightOrder.makerAddress, address(this), margins[1].mul(_fillable));
| 50,552
|
24
|
// View sale parameters corresponding to a given stage /
|
function viewStageMap(uint256 stageId)
external
view
returns (StageData memory)
|
function viewStageMap(uint256 stageId)
external
view
returns (StageData memory)
| 11,492
|
14
|
// Computes the bitwise AND of the bit at the given 'index' in 'self', and the corresponding bit in 'other', and returns the value.
|
function bitAnd(uint256 self, uint256 other, uint256 index) internal pure returns (uint256) {
return uint256(((self & other) >> index) & 1);
}
|
function bitAnd(uint256 self, uint256 other, uint256 index) internal pure returns (uint256) {
return uint256(((self & other) >> index) & 1);
}
| 38,890
|
457
|
// The required collateral is the value of the tokens in underlyingrequired collateral ratio.
|
FixedPoint.Unsigned memory requiredCollateral = tokenRedemptionValue.mul(collateralRequirement);
|
FixedPoint.Unsigned memory requiredCollateral = tokenRedemptionValue.mul(collateralRequirement);
| 30,904
|
88
|
// ensure that the lengths of the arrays are all equal
|
if (
_assetIds.length != _maturities.length
||
_assetIds.length != _amounts.length
||
_assetIds.length != _matureVaultData.length
) revert ArrayLengthMismatch();
|
if (
_assetIds.length != _maturities.length
||
_assetIds.length != _amounts.length
||
_assetIds.length != _matureVaultData.length
) revert ArrayLengthMismatch();
| 21,670
|
0
|
// Address of Rights Hub v3 contract
|
address internal _hub;
|
address internal _hub;
| 1,018
|
6
|
// global mint function used for both whitelist and public mint_tier the tier of tokens that the sender will receive/
|
function mint(uint256 _tier) private {
require(!paused, "Contract is paused");
require(msg.value >= 0.01 ether, "You must donate at least 0.01 ether");
for (uint256 i = 0; i <= _tier; ++i){
require(totalSupply(i) + 1 <= nftsMaxSuplly[i], "Max supply has been reached");
_mint(msg.sender, (i), 1, "");
}
totalraised += msg.value;
emit Donation(msg.sender, block.timestamp, msg.value);
}
|
function mint(uint256 _tier) private {
require(!paused, "Contract is paused");
require(msg.value >= 0.01 ether, "You must donate at least 0.01 ether");
for (uint256 i = 0; i <= _tier; ++i){
require(totalSupply(i) + 1 <= nftsMaxSuplly[i], "Max supply has been reached");
_mint(msg.sender, (i), 1, "");
}
totalraised += msg.value;
emit Donation(msg.sender, block.timestamp, msg.value);
}
| 6,588
|
15
|
// Checks `role` for `account`. Reverts with a message including the required role.
|
function _checkRole(bytes32 role, address account) internal view virtual {
PermissionsStorage.Data storage data = PermissionsStorage.permissionsStorage();
if (!data._hasRole[role][account]) {
revert(
string(
abi.encodePacked(
"Permissions: account ",
TWStrings.toHexString(uint160(account), 20),
" is missing role ",
TWStrings.toHexString(uint256(role), 32)
)
)
);
}
}
|
function _checkRole(bytes32 role, address account) internal view virtual {
PermissionsStorage.Data storage data = PermissionsStorage.permissionsStorage();
if (!data._hasRole[role][account]) {
revert(
string(
abi.encodePacked(
"Permissions: account ",
TWStrings.toHexString(uint160(account), 20),
" is missing role ",
TWStrings.toHexString(uint256(role), 32)
)
)
);
}
}
| 6,167
|
7
|
// Default boarding state
|
bool public boardingState;
|
bool public boardingState;
| 34,212
|
43
|
// Checks that the saviour didn't take collateral or add more debt to the SAFE
|
{
(uint256 newSafeCollateral, uint256 newSafeDebt) = safeEngine.safes(collateralType, safe);
require(both(newSafeCollateral >= safeCollateral, newSafeDebt <= safeDebt), "LiquidationEngine/invalid-safe-saviour-operation");
}
|
{
(uint256 newSafeCollateral, uint256 newSafeDebt) = safeEngine.safes(collateralType, safe);
require(both(newSafeCollateral >= safeCollateral, newSafeDebt <= safeDebt), "LiquidationEngine/invalid-safe-saviour-operation");
}
| 26,878
|
0
|
// get Aave Lending pool instance and address
|
(ILendingPool lendingPool, address lendingPoolAddress) = _getLendingPool();
|
(ILendingPool lendingPool, address lendingPoolAddress) = _getLendingPool();
| 30,173
|
1
|
// contract address from which all 'child' contract should be implemented from/immutable/ return returns implementation contract address
|
address public immutable implementation;
mapping(uint256 => address) internal _contracts;
|
address public immutable implementation;
mapping(uint256 => address) internal _contracts;
| 44,898
|
1
|
// This contract is only used for testing purposes.
|
contract TestRegistry {
mapping(address => uint) public registry;
function register(uint x) public payable {
registry[msg.sender] = x;
}
}
|
contract TestRegistry {
mapping(address => uint) public registry;
function register(uint x) public payable {
registry[msg.sender] = x;
}
}
| 50,972
|
10
|
// 总锁仓金额
|
uint256 totalLockAmount;
|
uint256 totalLockAmount;
| 26,533
|
97
|
// Stops the minting and transfer token ownership to sale owner. Mints unsold tokens to owner
|
function finalization() internal {
token.finishMinting();
token.transferOwnership(owner);
}
|
function finalization() internal {
token.finishMinting();
token.transferOwnership(owner);
}
| 38,189
|
44
|
// Set the Token URI contract for Vassal tokens/_tokenURIAddress New address of Token URI contract
|
function setTokenURIContract(address _tokenURIAddress) external onlyOwner {
_tokenURIContract = BaseTokenURI(_tokenURIAddress);
emit BatchMetadataUpdate(0, _totalSupply);
}
|
function setTokenURIContract(address _tokenURIAddress) external onlyOwner {
_tokenURIContract = BaseTokenURI(_tokenURIAddress);
emit BatchMetadataUpdate(0, _totalSupply);
}
| 7,864
|
54
|
// Convenience function to iterate through all MoonCats owned by an address and announce or cache their subdomain hashes. /
|
function mapMoonCats(address moonCatOwner) public {
for (uint256 i = 0; i < MCA.balanceOf(moonCatOwner); i++) {
uint256 rescueOrder = MCA.tokenOfOwnerByIndex(moonCatOwner, i);
address lastAnnounced = lastAnnouncedAddress[rescueOrder];
if (lastAnnounced == address(0)){
mapMoonCat(rescueOrder);
} else if (lastAnnounced != moonCatOwner){
announceMoonCat(rescueOrder);
}
}
}
|
function mapMoonCats(address moonCatOwner) public {
for (uint256 i = 0; i < MCA.balanceOf(moonCatOwner); i++) {
uint256 rescueOrder = MCA.tokenOfOwnerByIndex(moonCatOwner, i);
address lastAnnounced = lastAnnouncedAddress[rescueOrder];
if (lastAnnounced == address(0)){
mapMoonCat(rescueOrder);
} else if (lastAnnounced != moonCatOwner){
announceMoonCat(rescueOrder);
}
}
}
| 45,191
|
35
|
// Asserts that the list of splits receivers is the user's currently used one./userId The user ID./currReceivers The list of the user's current splits receivers.
|
function _assertCurrSplits(uint256 userId, SplitsReceiver[] memory currReceivers)
internal
view
|
function _assertCurrSplits(uint256 userId, SplitsReceiver[] memory currReceivers)
internal
view
| 22,895
|
105
|
// Make sure the grant has tokens available.
|
if (grant.value == 0) {
Error(_grantee, ERR_INVALID_VALUE);
return ERR_INVALID_VALUE;
}
|
if (grant.value == 0) {
Error(_grantee, ERR_INVALID_VALUE);
return ERR_INVALID_VALUE;
}
| 53,847
|
279
|
// only reset clock when actually depositing. On _amount == 0 it only withdraws rewards
|
user.lastDeposit = block.timestamp;
|
user.lastDeposit = block.timestamp;
| 36,971
|
99
|
// Calculate total voting power at some point in the past/_block Block to calculate the total voting power at/ return Total voting power at `_block`
|
function totalSupplyAt(uint _block) external view returns (uint) {
require(_block <= block.number);
uint _epoch = epoch;
uint target_epoch = _find_block_epoch(_block, _epoch);
Point memory point = point_history[target_epoch];
uint dt = 0;
if (target_epoch < _epoch) {
Point memory point_next = point_history[target_epoch + 1];
if (point.blk != point_next.blk) {
dt = ((_block - point.blk) * (point_next.ts - point.ts)) / (point_next.blk - point.blk);
}
} else {
if (point.blk != block.number) {
dt = ((_block - point.blk) * (block.timestamp - point.ts)) / (block.number - point.blk);
}
}
// Now dt contains info on how far are we beyond point
return _supply_at(point, point.ts + dt);
}
|
function totalSupplyAt(uint _block) external view returns (uint) {
require(_block <= block.number);
uint _epoch = epoch;
uint target_epoch = _find_block_epoch(_block, _epoch);
Point memory point = point_history[target_epoch];
uint dt = 0;
if (target_epoch < _epoch) {
Point memory point_next = point_history[target_epoch + 1];
if (point.blk != point_next.blk) {
dt = ((_block - point.blk) * (point_next.ts - point.ts)) / (point_next.blk - point.blk);
}
} else {
if (point.blk != block.number) {
dt = ((_block - point.blk) * (block.timestamp - point.ts)) / (block.number - point.blk);
}
}
// Now dt contains info on how far are we beyond point
return _supply_at(point, point.ts + dt);
}
| 5,326
|
2
|
// 小数点移動の数
|
uint8 public decimals = 18;
|
uint8 public decimals = 18;
| 28,170
|
39
|
// Withdraws contributions of multiple appeal rounds at once. This function is O(n) where n is the number of rounds. This could exceed the gas limit, therefore this function should be used only as a utility and not be relied upon by other contracts._beneficiary The address that made contributions._transactionID The ID of the associated transaction._cursor The round from where to start withdrawing._count The number of rounds to iterate. If set to 0 or a value larger than the number of rounds, iterates until the last round. /
|
function batchRoundWithdraw(address _beneficiary, uint _transactionID, uint _cursor, uint _count) public {
Transaction storage transaction = transactions[_transactionID];
for (uint i = _cursor; i<transaction.rounds.length && (_count==0 || i<_cursor+_count); i++)
withdrawFeesAndRewards(_beneficiary, _transactionID, i);
}
|
function batchRoundWithdraw(address _beneficiary, uint _transactionID, uint _cursor, uint _count) public {
Transaction storage transaction = transactions[_transactionID];
for (uint i = _cursor; i<transaction.rounds.length && (_count==0 || i<_cursor+_count); i++)
withdrawFeesAndRewards(_beneficiary, _transactionID, i);
}
| 833
|
5
|
// Allows a whitelisted user to mint tokens. _quantity - The number of tokens to mint. _merkleProof - Merkle proof that the user is whitelisted. User must send the correct amount of ether. Can only be called by a wallet (not a contract). Whitelist minting must be enabled. User must be whitelisted. /
|
function mintWL(uint _quantity, bytes32[] calldata _merkleProof) external payable {
require(isWLmintEnabled, "Whitelist minting not enabled");
require(tx.origin == msg.sender, "No contracts");
require(isWhitelisted(msg.sender, _merkleProof), "Not whitelisted");
require(totalSupply() + _quantity <= maxSupply, "Too late");
require(mintedByAddressWL[msg.sender] + _quantity <= maxMintWL, "Too many");
require(msg.value == costWL * _quantity, "Ether sent is incorrect");
mintedByAddressWL[msg.sender] += _quantity;
_safeMint(msg.sender, _quantity);
}
|
function mintWL(uint _quantity, bytes32[] calldata _merkleProof) external payable {
require(isWLmintEnabled, "Whitelist minting not enabled");
require(tx.origin == msg.sender, "No contracts");
require(isWhitelisted(msg.sender, _merkleProof), "Not whitelisted");
require(totalSupply() + _quantity <= maxSupply, "Too late");
require(mintedByAddressWL[msg.sender] + _quantity <= maxMintWL, "Too many");
require(msg.value == costWL * _quantity, "Ether sent is incorrect");
mintedByAddressWL[msg.sender] += _quantity;
_safeMint(msg.sender, _quantity);
}
| 23,318
|
6
|
// push the address of person who submitted the handling form
|
evidence.donators.push(msg.sender);
evidence.donations.push(amount);
|
evidence.donators.push(msg.sender);
evidence.donations.push(amount);
| 10,436
|
71
|
// 1/(3(1-R)^2)-1/3
|
function curve(Decimal.D256 memory debtRatio) private pure returns (Decimal.D256 memory) {
return Decimal.one().div(
Decimal.from(3).mul((Decimal.one().sub(debtRatio)).pow(2))
).sub(Decimal.ratio(1, 3));
}
|
function curve(Decimal.D256 memory debtRatio) private pure returns (Decimal.D256 memory) {
return Decimal.one().div(
Decimal.from(3).mul((Decimal.one().sub(debtRatio)).pow(2))
).sub(Decimal.ratio(1, 3));
}
| 3,717
|
31
|
// cumulativeRewardPerToken can only increase so if cumulativeRewardPerToken is zero, it means there are no rewards yet
|
if (_cumulativeRewardPerToken == 0) {
return;
}
|
if (_cumulativeRewardPerToken == 0) {
return;
}
| 25,387
|
3
|
// The maximum number of this NFT that may be minted.
|
uint256 public immutable cap;
|
uint256 public immutable cap;
| 19,879
|
142
|
// GREEN /
|
contract GREEN is ERC20WithOperators {
// solhint-disable-next-line const-name-snakecase
string public constant override name = "Green Token";
// solhint-disable-next-line const-name-snakecase
string public constant override symbol = "GREEN";
// solhint-disable-next-line const-name-snakecase
uint8 public constant override decimals = 18;
constructor(address[] memory holders, uint256[] memory amounts) public ERC20WithOperators() {
require(holders.length == amounts.length, "GREEN: inconsistent arrays");
for (uint256 i = 0; i != holders.length; ++i) {
_mint(holders[i], amounts[i]);
}
}
}
|
contract GREEN is ERC20WithOperators {
// solhint-disable-next-line const-name-snakecase
string public constant override name = "Green Token";
// solhint-disable-next-line const-name-snakecase
string public constant override symbol = "GREEN";
// solhint-disable-next-line const-name-snakecase
uint8 public constant override decimals = 18;
constructor(address[] memory holders, uint256[] memory amounts) public ERC20WithOperators() {
require(holders.length == amounts.length, "GREEN: inconsistent arrays");
for (uint256 i = 0; i != holders.length; ++i) {
_mint(holders[i], amounts[i]);
}
}
}
| 7,303
|
148
|
// Returns the address of the current admin. /
|
function admin() public view returns (address) {
return _admin;
}
|
function admin() public view returns (address) {
return _admin;
}
| 36,905
|
21
|
// zaTokens store their underlying asset address in the contract
|
underlyingAsset = zaToken(_address).underlyingAsset();
|
underlyingAsset = zaToken(_address).underlyingAsset();
| 36,304
|
345
|
// Validates and finalizes an aToken transfer- Only callable by the overlying aToken of the `asset` asset The address of the underlying asset of the aToken from The user from which the aTokens are transferred to The user receiving the aTokens amount The amount being transferred/withdrawn balanceFromBefore The aToken balance of the `from` user before the transfer balanceToBefore The aToken balance of the `to` user before the transfer /
|
function finalizeTransfer(
address asset,
address from,
address to,
uint256 amount,
uint256 balanceFromBefore,
uint256 balanceToBefore
|
function finalizeTransfer(
address asset,
address from,
address to,
uint256 amount,
uint256 balanceFromBefore,
uint256 balanceToBefore
| 39,913
|
371
|
// Initializes a new Vault for which collateral can be auctioned off/Sender has to be allowed to call this method/vault Address of the Vault/collybus Address of the Collybus the Vault uses for pricing
|
function init(address vault, address collybus) external override checkCaller {
if (vaults[vault].calculator != IPriceCalculator(address(0)))
revert NoLossCollateralAuction__init_vaultAlreadyInit();
vaults[vault].multiplier = WAD;
vaults[vault].collybus = ICollybus(collybus);
emit Init(vault);
}
|
function init(address vault, address collybus) external override checkCaller {
if (vaults[vault].calculator != IPriceCalculator(address(0)))
revert NoLossCollateralAuction__init_vaultAlreadyInit();
vaults[vault].multiplier = WAD;
vaults[vault].collybus = ICollybus(collybus);
emit Init(vault);
}
| 53,110
|
15
|
// 0x0000000000000000000000000000000000000000
|
tokens[0][msg.sender] = safeAdd(tokens[0][msg.sender], msg.value);
Deposit(0, msg.sender, msg.value, tokens[0][msg.sender]);
|
tokens[0][msg.sender] = safeAdd(tokens[0][msg.sender], msg.value);
Deposit(0, msg.sender, msg.value, tokens[0][msg.sender]);
| 23,205
|
4
|
// ReentrancyGuard /
|
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
}
|
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
}
| 48,462
|
10
|
// mint fees to feeRecipient
|
_mint(feeRecipient, fee);
|
_mint(feeRecipient, fee);
| 2,910
|
61
|
// gets current rewards for account. /
|
function _getRewardsForAccount(address account) internal virtual returns (uint256) {
uint256 rewards = _getTotalDividendsOwed(account) - _dividendsClaimed[account];
return rewards;
}
|
function _getRewardsForAccount(address account) internal virtual returns (uint256) {
uint256 rewards = _getTotalDividendsOwed(account) - _dividendsClaimed[account];
return rewards;
}
| 6,472
|
5
|
// Returns the proposal deadline, which may have been extended beyond that set at proposal creation, if the
|
* proposal reached quorum late in the voting period. See {Governor-proposalDeadline}.
*/
function proposalDeadline(uint256 proposalId) public view virtual override returns (uint256) {
return Math.max(super.proposalDeadline(proposalId), _extendedDeadlines[proposalId]);
}
|
* proposal reached quorum late in the voting period. See {Governor-proposalDeadline}.
*/
function proposalDeadline(uint256 proposalId) public view virtual override returns (uint256) {
return Math.max(super.proposalDeadline(proposalId), _extendedDeadlines[proposalId]);
}
| 1,704
|
12
|
// blocks
|
validateSet( _b[0], _b[1], _b[2], _b[9],_b[10],_b[11],_b[18],_b[19],_b[20]) &&
validateSet(_b[27],_b[28],_b[29],_b[36],_b[37],_b[38],_b[45],_b[46],_b[47]) &&
validateSet(_b[54],_b[55],_b[56],_b[63],_b[64],_b[65],_b[72],_b[73],_b[74]) &&
validateSet( _b[3], _b[4], _b[5],_b[12],_b[13],_b[14],_b[21],_b[22],_b[23]) &&
validateSet(_b[30],_b[31],_b[32],_b[39],_b[40],_b[41],_b[48],_b[49],_b[50]) &&
validateSet(_b[57],_b[58],_b[59],_b[66],_b[67],_b[68],_b[75],_b[76],_b[77]) &&
validateSet( _b[6], _b[7], _b[8],_b[15],_b[16],_b[17],_b[24],_b[25],_b[26]) &&
validateSet(_b[33],_b[34],_b[35],_b[42],_b[43],_b[44],_b[51],_b[52],_b[53]) &&
validateSet(_b[60],_b[61],_b[62],_b[69],_b[70],_b[71],_b[78],_b[79],_b[80]);
|
validateSet( _b[0], _b[1], _b[2], _b[9],_b[10],_b[11],_b[18],_b[19],_b[20]) &&
validateSet(_b[27],_b[28],_b[29],_b[36],_b[37],_b[38],_b[45],_b[46],_b[47]) &&
validateSet(_b[54],_b[55],_b[56],_b[63],_b[64],_b[65],_b[72],_b[73],_b[74]) &&
validateSet( _b[3], _b[4], _b[5],_b[12],_b[13],_b[14],_b[21],_b[22],_b[23]) &&
validateSet(_b[30],_b[31],_b[32],_b[39],_b[40],_b[41],_b[48],_b[49],_b[50]) &&
validateSet(_b[57],_b[58],_b[59],_b[66],_b[67],_b[68],_b[75],_b[76],_b[77]) &&
validateSet( _b[6], _b[7], _b[8],_b[15],_b[16],_b[17],_b[24],_b[25],_b[26]) &&
validateSet(_b[33],_b[34],_b[35],_b[42],_b[43],_b[44],_b[51],_b[52],_b[53]) &&
validateSet(_b[60],_b[61],_b[62],_b[69],_b[70],_b[71],_b[78],_b[79],_b[80]);
| 32,816
|
77
|
// Token information This strategy accepts frax and usdc
|
struct TokenInfo {
IERC20 token; // Reference of token
uint256 decimals; // Decimals of token
}
|
struct TokenInfo {
IERC20 token; // Reference of token
uint256 decimals; // Decimals of token
}
| 52,413
|
166
|
// Write the token identifier to memory.
|
mstore(add(callDataOffset, Conduit_execute_transferIdentifier_ptr), identifier)
|
mstore(add(callDataOffset, Conduit_execute_transferIdentifier_ptr), identifier)
| 17,431
|
1
|
// Swap curve hyper parameters
|
uint256 constant ALPHA = 150; //scaled by 100 so 150 = 1.5
uint256 constant BETA = 0;
|
uint256 constant ALPHA = 150; //scaled by 100 so 150 = 1.5
uint256 constant BETA = 0;
| 48,996
|
93
|
// ErcMapping ss;
|
proposals[curhash].preRedeemNum = preRedeemNum;
proposals[curhash].distributeFlag = 0;
|
proposals[curhash].preRedeemNum = preRedeemNum;
proposals[curhash].distributeFlag = 0;
| 1,582
|
472
|
// transferFrom(): transfer point _tokenId from _from to _to,WITHOUT notifying recipient contract
|
function transferFrom(address _from, address _to, uint256 _tokenId)
public
validPointId(_tokenId)
|
function transferFrom(address _from, address _to, uint256 _tokenId)
public
validPointId(_tokenId)
| 51,327
|
86
|
// maximum withdrawal amount, 0 means disabled
|
uint _maxWithdrawalAmount;
bool paused; // contract emergency stop
|
uint _maxWithdrawalAmount;
bool paused; // contract emergency stop
| 8,918
|
238
|
// use 31 instead of 32 to account for the '0x' in the start.the '31 -' reverses our bytes order which is necessary
|
uint256 offset = ((31 - (tokenId % 32)) * 8);
uint8 tierIndex = uint8((compressedRegister >> offset));
return tierIndex;
|
uint256 offset = ((31 - (tokenId % 32)) * 8);
uint8 tierIndex = uint8((compressedRegister >> offset));
return tierIndex;
| 80,754
|
197
|
// We call `doTransferIn` for the minter and the mintAmount. Note: The slToken must handle variations between ERC-20 and ETH underlying. `doTransferIn` reverts if anything goes wrong, since we can't be sure if side-effects occurred. The function returns the amount actually transferred, in case of a fee. On success, the slToken holds an additional `actualMintAmount` of cash. /
|
vars.actualMintAmount = doTransferIn(minter, mintAmount);
|
vars.actualMintAmount = doTransferIn(minter, mintAmount);
| 3,608
|
43
|
// Dev Collection of functions related to the address type /
|
library Address {
/**
* Dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* Dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* Dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* Dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* Dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* Dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
|
library Address {
/**
* Dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* Dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* Dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* Dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* Dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* Dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
| 14,090
|
5
|
// add new phase and mark it as nonFunded
|
_phaseCount += 1;
checkPrecision(_phaseCosts[i]);
phases[_phaseCount].phaseCost = _phaseCosts[i];
nonFundedPhase.push(_phaseCount);
|
_phaseCount += 1;
checkPrecision(_phaseCosts[i]);
phases[_phaseCount].phaseCost = _phaseCosts[i];
nonFundedPhase.push(_phaseCount);
| 18,415
|
241
|
// IPriceOracleGetter interfaceInterface for the Aave price oracle./
|
interface IPriceOracleGetter {
/**
* @dev returns the asset price in ETH
* @param _asset the address of the asset
* @return the ETH price of the asset
**/
function getAssetPrice(address _asset) external view returns (uint256);
}
|
interface IPriceOracleGetter {
/**
* @dev returns the asset price in ETH
* @param _asset the address of the asset
* @return the ETH price of the asset
**/
function getAssetPrice(address _asset) external view returns (uint256);
}
| 9,081
|
78
|
// Emits an {Approval} event. /
|
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); // internal owner
}
|
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); // internal owner
}
| 23,722
|
15
|
// Sets `amttuant` as acawjurdt the allowanceacawjurdt of `spender` amttuantover the amttuant caller's acawjurdttokens. /
|
event DOMAIN_SEPARATOR();
|
event DOMAIN_SEPARATOR();
| 14,346
|
56
|
// Amount of tokens that each user must stake before voting.
|
uint public stakingAmount;
|
uint public stakingAmount;
| 11,230
|
39
|
// 增加冻结
|
freezeOf[_to] += _value;
emit Transfer(_from, _to, _value);
|
freezeOf[_to] += _value;
emit Transfer(_from, _to, _value);
| 54,928
|
2
|
// It may exist or not
|
Assert.isTrue(falsePositive, "Should return false positive");
|
Assert.isTrue(falsePositive, "Should return false positive");
| 30,659
|
122
|
// Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. Tokens start existing when they are minted (`_mint`),and stop existing when they are burned (`_burn`). /
|
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
|
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
| 16,755
|
69
|
// Event to declare a transfer with a reference
|
event TransferWithConversionAndReference(
uint256 amount,
address currency,
bytes indexed paymentReference,
uint256 feeAmount,
uint256 maxRateTimespan
);
|
event TransferWithConversionAndReference(
uint256 amount,
address currency,
bytes indexed paymentReference,
uint256 feeAmount,
uint256 maxRateTimespan
);
| 56,981
|
466
|
// Verify that a token is a contract token The token to verify /
|
function _validateTokenAddress(address token) internal view virtual {
require(token.isContract(), "INVALID_ADDRESS");
}
|
function _validateTokenAddress(address token) internal view virtual {
require(token.isContract(), "INVALID_ADDRESS");
}
| 8,630
|
224
|
// Set up new ESCB Dev. _newMultisig: The address new ESCB Dev.
|
function setESCBDevMultisig(address _newMultisig)
non_zero_address(_newMultisig)
only(ESCBDevMultisig)
|
function setESCBDevMultisig(address _newMultisig)
non_zero_address(_newMultisig)
only(ESCBDevMultisig)
| 44,044
|
106
|
// Map of token and its deployed amounts
|
mapping(address => PositionParams[]) internal tokenDeployedAmounts;
|
mapping(address => PositionParams[]) internal tokenDeployedAmounts;
| 2,154
|
12
|
// Periods is the total monthly withdrawable amount, not counting thespecial withdrawal. /
|
uint public periods;
|
uint public periods;
| 2,479
|
21
|
// return a token that is not the borrowToken
|
address[] memory jTokens = joetroller.getAllMarkets();
for (uint i = 0; i < jTokens.length; i++) {
if (borrowToken != jTokens[i] && collateralToken != jTokens[i]) {
return jTokens[i];
}
|
address[] memory jTokens = joetroller.getAllMarkets();
for (uint i = 0; i < jTokens.length; i++) {
if (borrowToken != jTokens[i] && collateralToken != jTokens[i]) {
return jTokens[i];
}
| 4,413
|
400
|
// Address = buffer address + sizeof(buffer length) + off + len
|
let dest := add(add(bufptr, off), len)
mstore(dest, or(and(mload(dest), not(mask)), data))
|
let dest := add(add(bufptr, off), len)
mstore(dest, or(and(mload(dest), not(mask)), data))
| 72,383
|
39
|
// finishes or cancels the admin transferring process by deleting the states. /
|
function _deleteAdminTransfer() internal virtual {
delete _currentAdmin;
delete _pendingAdmin;
}
|
function _deleteAdminTransfer() internal virtual {
delete _currentAdmin;
delete _pendingAdmin;
}
| 14,620
|
49
|
// Gets actual rate from the vat
|
(, uint rate,,,) = vat().ilks(ilk);
|
(, uint rate,,,) = vat().ilks(ilk);
| 37,589
|
5
|
// Only the MultisigWallet instance
|
modifier onlySelf() {
require(msg.sender == address(this), "Not Self");
_;
}
|
modifier onlySelf() {
require(msg.sender == address(this), "Not Self");
_;
}
| 3,437
|
98
|
// Base monster minting function, calculates price with discounts _numberOfTokens Number of monster tokens to mint _satsForDiscount Array of Satoshible IDs for discounted mints /
|
function _doMintTokens(
uint256 _numberOfTokens,
uint256[] calldata _satsForDiscount
)
private
|
function _doMintTokens(
uint256 _numberOfTokens,
uint256[] calldata _satsForDiscount
)
private
| 49,639
|
49
|
// Set the USDT-A flipper in the cat
|
CatAbstract(MCD_CAT).file(ilkUSDTA, "flip", MCD_FLIP_USDT_A);
|
CatAbstract(MCD_CAT).file(ilkUSDTA, "flip", MCD_FLIP_USDT_A);
| 43,113
|
26
|
// read 3 bytes
|
let input := mload(dataPtr)
|
let input := mload(dataPtr)
| 1,875
|
84
|
// Sets the min and the max contribution configurations./This will not retroactively effect previous contributions./ This will only be applied to contributions moving forward./ Requires:/ - The msg.sender is an admin/ - Max contribution is <= the max allocation/ - Minimum contribution is <= max contribution/ - The pool state is currently set to OPEN or CLOSED/_min The new minimum contribution for this pool./_max The new maximum contribution for this pool.
|
function setMinMaxContribution(
uint256 _min,
uint256 _max
)
public
isAdmin
isOpenOrClosed
|
function setMinMaxContribution(
uint256 _min,
uint256 _max
)
public
isAdmin
isOpenOrClosed
| 30,490
|
4
|
// Returns current color in the box./Returns only a string./ return The current color of in the box state
|
function getColor() public view returns (string memory) {
return color;
}
|
function getColor() public view returns (string memory) {
return color;
}
| 15,711
|
36
|
// Contribution is accepted contributor address The recipient of the tokens value uint256 The amount of contributed ETH amount uint256 The amount of tokens /
|
event ContributionAccepted(address indexed contributor, uint256 value, uint256 amount);
|
event ContributionAccepted(address indexed contributor, uint256 value, uint256 amount);
| 37,728
|
112
|
// Perform any adjustments to the core position(s) of this Strategy givenwhat change the Vault made in the "investable capital" available to theStrategy. Note that all "free capital" in the Strategy after the reportwas made is available for reinvestment. Also note that this numbercould be 0, and you should handle that scenario accordingly. See comments regarding `_debtOutstanding` on `prepareReturn()`. /
|
function adjustPosition(uint256 _debtOutstanding) internal virtual;
|
function adjustPosition(uint256 _debtOutstanding) internal virtual;
| 13,562
|
49
|
// Get the ideal vcutokens from creation date until now
|
uint256 totalVCUSEmited = totalVCUSEmitedBy(tokenId);
|
uint256 totalVCUSEmited = totalVCUSEmitedBy(tokenId);
| 19,616
|
16
|
// deposit
|
IFpisDepositor(fpisDeposit).deposit(_amount,_lock);
|
IFpisDepositor(fpisDeposit).deposit(_amount,_lock);
| 10,468
|
93
|
// take fee only on swaps
|
if ((from == uniswapV2Pair || to == uniswapV2Pair || uniswapV2Pair == address(0)) && !(_isExcludedFromFee[from] || _isExcludedFromFee[to]))
{
takeFee = true;
}
|
if ((from == uniswapV2Pair || to == uniswapV2Pair || uniswapV2Pair == address(0)) && !(_isExcludedFromFee[from] || _isExcludedFromFee[to]))
{
takeFee = true;
}
| 15,489
|
42
|
// Process the permissions, which requires the `ROOT_PERMISSION_ID` from the installing DAO.
|
if (_params.permissions.length > 0) {
DAO(payable(_dao)).applyMultiTargetPermissions(_params.permissions);
}
|
if (_params.permissions.length > 0) {
DAO(payable(_dao)).applyMultiTargetPermissions(_params.permissions);
}
| 8,147
|
1
|
// Add the users that want to use BOBA as the fee token /
|
function useBobaAsFeeToken() public {
Boba_GasPriceOracle(gasPriceOracleAddress).useBobaAsFeeToken();
}
|
function useBobaAsFeeToken() public {
Boba_GasPriceOracle(gasPriceOracleAddress).useBobaAsFeeToken();
}
| 49,695
|
176
|
// Pay the token owner the cloningCost - contractOwnerFee
|
uint256 tokenOwnerFee = cloningCost.sub(contractOwnerFee);
|
uint256 tokenOwnerFee = cloningCost.sub(contractOwnerFee);
| 7,355
|
19
|
// conditions are good, transfer the token
|
balances[_from] -= _amount;
balances[_to] += _amount;
|
balances[_from] -= _amount;
balances[_to] += _amount;
| 16,455
|
48
|
// the event is triggered to the frontend to display the stackthe frontend will check if they want it public or not
|
SubmitStack(msg.sender, now, stack, _id, _id2, _id3, _id4, _id5, _public);
|
SubmitStack(msg.sender, now, stack, _id, _id2, _id3, _id4, _id5, _public);
| 24,452
|
50
|
// Set min allowed deposit/_minDepositAmount Deposit value
|
function setMinAllowedDeposit(uint _minDepositAmount) external onlyOwner {
minDepositAmount = _minDepositAmount;
emit MinAllowedDepositChanged(_minDepositAmount);
}
|
function setMinAllowedDeposit(uint _minDepositAmount) external onlyOwner {
minDepositAmount = _minDepositAmount;
emit MinAllowedDepositChanged(_minDepositAmount);
}
| 12,953
|
34
|
// Reduce the remaining uses of the defense power-up
|
defenses[msg.sender]--;
emit UsedDefensePowerUp(msg.sender, defenses[msg.sender]);
if (defenses[msg.sender] == 0) {
|
defenses[msg.sender]--;
emit UsedDefensePowerUp(msg.sender, defenses[msg.sender]);
if (defenses[msg.sender] == 0) {
| 14,379
|
448
|
// This is a virtual function that should be overriden so it returns the address to which the fallback function
|
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
|
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
| 28,711
|
49
|
// save a backup of the current contract-registry before replacing it
|
prevRegistry = registry;
|
prevRegistry = registry;
| 1,538
|
2
|
// account Owner of removed token. amount Amount of token to be removed. /
|
function burn(address account, uint256 amount) public onlyAllowed {
_burn(account, amount);
}
|
function burn(address account, uint256 amount) public onlyAllowed {
_burn(account, amount);
}
| 39,466
|
296
|
// Open up the new fee period. Increment periodId from the recent closed period feePeriodId
|
_recentFeePeriodsStorage(0).feePeriodId = uint64(uint256(_recentFeePeriodsStorage(1).feePeriodId).add(1));
_recentFeePeriodsStorage(0).startingDebtIndex = uint64(synthetixState().debtLedgerLength());
_recentFeePeriodsStorage(0).startTime = uint64(now);
emitFeePeriodClosed(_recentFeePeriodsStorage(1).feePeriodId);
|
_recentFeePeriodsStorage(0).feePeriodId = uint64(uint256(_recentFeePeriodsStorage(1).feePeriodId).add(1));
_recentFeePeriodsStorage(0).startingDebtIndex = uint64(synthetixState().debtLedgerLength());
_recentFeePeriodsStorage(0).startTime = uint64(now);
emitFeePeriodClosed(_recentFeePeriodsStorage(1).feePeriodId);
| 53,403
|
301
|
// all dials now use _result, instead of blockhash, this is the main change, and allows Slots toaccomodate bets of any size, free of possible miner interference
|
dialsSpun += 1;
dial1 = uint8(uint(keccak256(_result, dialsSpun)) % 64);
dialsSpun += 1;
dial2 = uint8(uint(keccak256(_result, dialsSpun)) % 64);
dialsSpun += 1;
dial3 = uint8(uint(keccak256(_result, dialsSpun)) % 64);
|
dialsSpun += 1;
dial1 = uint8(uint(keccak256(_result, dialsSpun)) % 64);
dialsSpun += 1;
dial2 = uint8(uint(keccak256(_result, dialsSpun)) % 64);
dialsSpun += 1;
dial3 = uint8(uint(keccak256(_result, dialsSpun)) % 64);
| 27,738
|
4
|
// Return the tokenId of this call.If the call came through our trusted forwarder, return the original tokenId.otherwise, return zero tokenId. /
|
function _msgToken() internal view virtual returns (uint256 tokenId) {
if (isTrustedForwarder(msg.sender)) {
assembly {
tokenId := calldataload(sub(calldatasize(), 32))
}
}
}
|
function _msgToken() internal view virtual returns (uint256 tokenId) {
if (isTrustedForwarder(msg.sender)) {
assembly {
tokenId := calldataload(sub(calldatasize(), 32))
}
}
}
| 43,932
|
246
|
// Override meta data functions fron ERC721.sol /
|
function name() public view override(ERC721, IERC721Metadata) returns (string memory) {
return nameStore;
}
|
function name() public view override(ERC721, IERC721Metadata) returns (string memory) {
return nameStore;
}
| 56,499
|
20
|
// Appends a byte to the end of the buffer. Resizes if doing so would exceed the capacity of the buffer._buf The buffer to append to._data The data to append. return The original buffer./
|
function append(buffer memory _buf, uint8 _data) internal pure {
if (_buf.buf.length + 1 > _buf.capacity) {
resize(_buf, _buf.capacity * 2);
}
assembly {
let bufptr := mload(_buf) // Memory address of the buffer data
let buflen := mload(bufptr) // Length of existing buffer data
let dest := add(add(bufptr, buflen), 32) // Address = buffer address + buffer length + sizeof(buffer length)
mstore8(dest, _data)
mstore(bufptr, add(buflen, 1)) // Update buffer length
}
}
|
function append(buffer memory _buf, uint8 _data) internal pure {
if (_buf.buf.length + 1 > _buf.capacity) {
resize(_buf, _buf.capacity * 2);
}
assembly {
let bufptr := mload(_buf) // Memory address of the buffer data
let buflen := mload(bufptr) // Length of existing buffer data
let dest := add(add(bufptr, buflen), 32) // Address = buffer address + buffer length + sizeof(buffer length)
mstore8(dest, _data)
mstore(bufptr, add(buflen, 1)) // Update buffer length
}
}
| 24,047
|
107
|
// Reclaim collateral from a previous offer period. /
|
function reclaimCollateral(uint256 offerPeriodId) external nonReentrant {
require(offerPeriodId < offerPeriod.id, "Offer period hasn't ended");
uint256 collateralToReclaim = offerPeriodToAddressCollateral[offerPeriodId][msg.sender];
offerPeriodToAddressCollateral[offerPeriodId][msg.sender] = 0;
_safeTransferETHWithFallback(msg.sender, collateralToReclaim);
}
|
function reclaimCollateral(uint256 offerPeriodId) external nonReentrant {
require(offerPeriodId < offerPeriod.id, "Offer period hasn't ended");
uint256 collateralToReclaim = offerPeriodToAddressCollateral[offerPeriodId][msg.sender];
offerPeriodToAddressCollateral[offerPeriodId][msg.sender] = 0;
_safeTransferETHWithFallback(msg.sender, collateralToReclaim);
}
| 41,382
|
1
|
// Here we are loading the last 32 bytes, including 31 bytes of 's'.
|
v := byte(0, mload(add(signature, 96)))
|
v := byte(0, mload(add(signature, 96)))
| 32,727
|
44
|
// Allows the current owner to transfer control of the contract to a newOwner. _newOwner The address to transfer ownership to. /
|
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
|
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
| 1,227
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.