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 |
|---|---|---|---|---|
16 | // Get the underlying price in USD from the Price Feed, so we can find out the maximum amount of underlying we can borrow. | uint256 underlyingPrice = priceFeed.getUnderlyingPrice(_cTokenAddress);
uint256 maxBorrowUnderlying = liquidity / underlyingPrice;
| uint256 underlyingPrice = priceFeed.getUnderlyingPrice(_cTokenAddress);
uint256 maxBorrowUnderlying = liquidity / underlyingPrice;
| 3,516 |
12 | // Emitted when a new COMP speed is calculated for a market | event CompSpeedUpdated(CToken indexed cToken, uint newSpeed);
| event CompSpeedUpdated(CToken indexed cToken, uint newSpeed);
| 11,781 |
57 | // Transfers the ownership of an NFT from one address to another address Safely transfers the ownership of a given token ID to another addressIf the target address is a contract, it must implement `onERC721Received`,which is called upon a safe transfer, and return the magic value`bytes4(keccak256("onERC721Received(addr... | function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable {
// it does not accept payments in this version
require(msg.value == 0);
_safeTransferFrom(_from, _to, _tokenId, "");
}
| function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable {
// it does not accept payments in this version
require(msg.value == 0);
_safeTransferFrom(_from, _to, _tokenId, "");
}
| 14,833 |
18 | // Wrappers over Solidity's arithmetic operations.NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler now has built in overflow checking. / | library SafeMath {
/**
* _Available since v3.4._
*
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (f... | library SafeMath {
/**
* _Available since v3.4._
*
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (f... | 43,239 |
25 | // pick fourth winner (25% cudl) | winner4 = players[currentRound][
randomNumber(block.number - 4, players[currentRound].length)
];
require(cudl.transfer(winner4, cudlBalance.mul(19).div(100)));
| winner4 = players[currentRound][
randomNumber(block.number - 4, players[currentRound].length)
];
require(cudl.transfer(winner4, cudlBalance.mul(19).div(100)));
| 7,672 |
49 | // Keep track of total pot shares controlled by LSDAI | _totalPotShares = _totalPotShares.add(potSharesAmount);
| _totalPotShares = _totalPotShares.add(potSharesAmount);
| 2,737 |
222 | // get the parameters for the current scheme from the controller/ | function getParametersFromController(Avatar _avatar) internal view returns(bytes32) {
require(Controller(_avatar.owner()).isSchemeRegistered(address(this), address(_avatar)),
"scheme is not registered");
return Controller(_avatar.owner()).getSchemeParameters(address(this), address(_avatar));... | function getParametersFromController(Avatar _avatar) internal view returns(bytes32) {
require(Controller(_avatar.owner()).isSchemeRegistered(address(this), address(_avatar)),
"scheme is not registered");
return Controller(_avatar.owner()).getSchemeParameters(address(this), address(_avatar));... | 9,605 |
9 | // ============ Mutable ERC20 Attributes ============ |
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
mapping(address => uint256) public nonces;
|
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
mapping(address => uint256) public nonces;
| 7,120 |
4 | // We got enough in this bucket to cover the amount We remove it from total and dont adjust the fully vesting timestamp Because there might be tokens left still in it | totalRemoved += remainingBalanceNeeded;
vestingTransactions[sender][lastInTxIndex].amount = leastMatureTxAmount - remainingBalanceNeeded; // safe math already checked
| totalRemoved += remainingBalanceNeeded;
vestingTransactions[sender][lastInTxIndex].amount = leastMatureTxAmount - remainingBalanceNeeded; // safe math already checked
| 78,636 |
31 | // onlyEOA requires msg.sender to be an externally owned account / | modifier onlyEOA() {
require(msg.sender == tx.origin, "only externally owned accounts");
_;
}
| modifier onlyEOA() {
require(msg.sender == tx.origin, "only externally owned accounts");
_;
}
| 34,761 |
128 | // Nemesis (NEM) with Governance Alpha | contract NemesisFinance is ERC20 {
using SafeERC20 for IERC20;
using SafeMath for uint256;
uint256 cap;
constructor (uint256 _cap) public ERC20("Nemesis.Finance", "NEM") {
governance = tx.origin;
cap = _cap;
}
function burn(uint256 _amount) public {
_burn(msg.sender... | contract NemesisFinance is ERC20 {
using SafeERC20 for IERC20;
using SafeMath for uint256;
uint256 cap;
constructor (uint256 _cap) public ERC20("Nemesis.Finance", "NEM") {
governance = tx.origin;
cap = _cap;
}
function burn(uint256 _amount) public {
_burn(msg.sender... | 52,181 |
121 | // default to onBehalf of proxy | if (_onBehalf == address(0)) {
_onBehalf = address(this);
}
| if (_onBehalf == address(0)) {
_onBehalf = address(this);
}
| 47,855 |
31 | // tokenCap should be initialized in derived contract | uint256 public tokenCap;
uint256 public soldTokens;
| uint256 public tokenCap;
uint256 public soldTokens;
| 2,294 |
34 | // call handle function | IMessageRecipient(_m.recipientAddress()).handle(
_m.origin(),
_m.nonce(),
_m.sender(),
_m.body().clone()
);
| IMessageRecipient(_m.recipientAddress()).handle(
_m.origin(),
_m.nonce(),
_m.sender(),
_m.body().clone()
);
| 19,919 |
19 | // 开奖26000个区块之后,竞猜发起人可以提取佣金 | require(winTeam < 3 && stopWithdrawBlock<block.number && address(this).balance>0);
owner.transfer(address(this).balance);
| require(winTeam < 3 && stopWithdrawBlock<block.number && address(this).balance>0);
owner.transfer(address(this).balance);
| 27,774 |
41 | // ServiceAllowance.// Provides a way to delegate operation allowance decision to a service contract | contract ServiceAllowance {
function isTransferAllowed(address _from, address _to, address _sender, address _token, uint _value) public view returns (bool);
}
| contract ServiceAllowance {
function isTransferAllowed(address _from, address _to, address _sender, address _token, uint _value) public view returns (bool);
}
| 42,853 |
31 | // ========== INTERNAL FUNCTIONS ========== / | {
combination = new bytes32[](first.length + second.length);
for (uint i = 0; i < first.length; i++) {
combination[i] = first[i];
}
for (uint j = 0; j < second.length; j++) {
combination[first.length + j] = second[j];
}
}
| {
combination = new bytes32[](first.length + second.length);
for (uint i = 0; i < first.length; i++) {
combination[i] = first[i];
}
for (uint j = 0; j < second.length; j++) {
combination[first.length + j] = second[j];
}
}
| 24,746 |
166 | // keccak256("MINTER_ROLE"); | bytes32 public constant MINTER_ROLE = 0x9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6;
| bytes32 public constant MINTER_ROLE = 0x9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6;
| 47,584 |
15 | // override ERC721A _startTokenId() / | function _startTokenId()
internal
view
virtual
override
| function _startTokenId()
internal
view
virtual
override
| 38,673 |
10 | // Owned / | contract Owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
| contract Owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
| 41,981 |
5 | // stETH allowance status | uint256 internal stETHStatus;
address public owner;
uint256 internal ownerStatus;
mapping(address => bool) public isWhitelisted;
| uint256 internal stETHStatus;
address public owner;
uint256 internal ownerStatus;
mapping(address => bool) public isWhitelisted;
| 11,118 |
11 | // the vault id | uint256 id;
| uint256 id;
| 3,242 |
116 | // Keep function can be called by anyone to balances that have been expired. This pays out addresses and removes used cover. This is external because the doKeep modifier calls back to ArmorMaster, which then calls back to here (and elsewhere)./ | function keep() external {
for (uint256 i = 0; i < 2; i++) {
if (infos[head].expiresAt != 0 && infos[head].expiresAt <= now) {
address oldHead = address(head);
uint256 oldBal = _updateBalance(oldHead);
_updateBalanceActions(oldHead, oldBal... | function keep() external {
for (uint256 i = 0; i < 2; i++) {
if (infos[head].expiresAt != 0 && infos[head].expiresAt <= now) {
address oldHead = address(head);
uint256 oldBal = _updateBalance(oldHead);
_updateBalanceActions(oldHead, oldBal... | 4,792 |
37 | // Checks if the difficulty target should be adjusted at this block height height Block height to be checkedreturn True if block height is at difficulty adjustment interval, otherwise false / | function _isPeriodStart(uint32 height) internal pure returns (bool) {
return height % DIFFICULTY_ADJUSTMENT_INTERVAL == 0;
}
| function _isPeriodStart(uint32 height) internal pure returns (bool) {
return height % DIFFICULTY_ADJUSTMENT_INTERVAL == 0;
}
| 3,867 |
6 | // array | address[] g;
bool[] g1;
bytes[] g2;
bytes32[] g3;
int8[] g4;
int256[] g5;
uint8[] g6;
uint256[] g7;
string[] g8;
SimpleStruct[] g9;
| address[] g;
bool[] g1;
bytes[] g2;
bytes32[] g3;
int8[] g4;
int256[] g5;
uint8[] g6;
uint256[] g7;
string[] g8;
SimpleStruct[] g9;
| 19,106 |
53 | // BabyloniaToken / | contract BabyloniaToken is MintAndBurnToken {
// DetailedERC20 variables
string public name = "Babylonia Token";
string public symbol = "BBY";
uint8 public decimals = 18;
}
| contract BabyloniaToken is MintAndBurnToken {
// DetailedERC20 variables
string public name = "Babylonia Token";
string public symbol = "BBY";
uint8 public decimals = 18;
}
| 15,840 |
91 | // Sets `adminRole` as `role`'s admin role. / | function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
_roles[role].adminRole = adminRole;
}
| function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
_roles[role].adminRole = adminRole;
}
| 3,202 |
90 | // send remainder to marketing | (success,) = address(marketingAddress).call{value: address(this).balance}("");
| (success,) = address(marketingAddress).call{value: address(this).balance}("");
| 865 |
75 | // BAC | _token = IERC20(address(0x3449FC1Cd036255BA1EB19d65fF4BA2b8903A69a));
tokenList.push(
TokenInfo({
token: _token,
decimals: _token.decimals(),
pairedToken: daiAddress, // DAI
pairedTokenDecimals: IERC20(daiAddress).decimals()
... | _token = IERC20(address(0x3449FC1Cd036255BA1EB19d65fF4BA2b8903A69a));
tokenList.push(
TokenInfo({
token: _token,
decimals: _token.decimals(),
pairedToken: daiAddress, // DAI
pairedTokenDecimals: IERC20(daiAddress).decimals()
... | 7,981 |
24 | // private seed phase 1 (5 days) | if (timeElapsedInDays <5)
{
| if (timeElapsedInDays <5)
{
| 1,618 |
59 | // Calculates number of tokens that will be locked | uint256 locked = amount * _lockPercentage / 100;
| uint256 locked = amount * _lockPercentage / 100;
| 10,316 |
2 | // Define a variable to store the access key smart contract | ERC1155LazyMint public accessKeysCollection;
event NFTEvolved(address reciever, uint256 tokenId, uint256 amount);
| ERC1155LazyMint public accessKeysCollection;
event NFTEvolved(address reciever, uint256 tokenId, uint256 amount);
| 8,375 |
21 | // Allows the new owner to accept an ownership offer to contract control. /noinspection UnprotectedFunction | function acceptOwnershipOffer() external {
require (proposedOwner != address(0x0));
require (msg.sender == proposedOwner);
address _oldOwner = owner;
owner = proposedOwner;
proposedOwner = address(0x0);
OwnerAssignedEvent(owner);
OwnershipOfferAcceptedEvent(_oldOwner, owner);
}
| function acceptOwnershipOffer() external {
require (proposedOwner != address(0x0));
require (msg.sender == proposedOwner);
address _oldOwner = owner;
owner = proposedOwner;
proposedOwner = address(0x0);
OwnerAssignedEvent(owner);
OwnershipOfferAcceptedEvent(_oldOwner, owner);
}
| 12,491 |
94 | // cant take staked asset | require(_token != yam, "yam");
| require(_token != yam, "yam");
| 77,448 |
256 | // BaseENSManager Implementation of an ENS manager that orchestrates the completeregistration of subdomains for a single root (e.g. argent.eth).The contract defines a manager role who is the only role that can trigger the registration ofa new subdomain. Julien Niset - <julien@argent.im> / | contract BaseENSManager is IENSManager, OwnerManagable, ENSConsumer {
using strings for *;
using BytesUtil for bytes;
using MathUint for uint;
// The managed root name
string public rootName;
// The managed root node
bytes32 public immutable rootNode;
// The address of the ENS... | contract BaseENSManager is IENSManager, OwnerManagable, ENSConsumer {
using strings for *;
using BytesUtil for bytes;
using MathUint for uint;
// The managed root name
string public rootName;
// The managed root node
bytes32 public immutable rootNode;
// The address of the ENS... | 16,038 |
17 | // Minus precommitments and public crowdsale tokens | remainingTokens = remainingTokens.sub(tokenContract.totalSupply());
| remainingTokens = remainingTokens.sub(tokenContract.totalSupply());
| 44,067 |
9 | // Transfer the unsold tokens to the owner main walletOnly for owner/ | function drainRemainingToken () public onlyOwner {
require(hasEnded());
token.transfer(owner, token.balanceOf(this));
}
| function drainRemainingToken () public onlyOwner {
require(hasEnded());
token.transfer(owner, token.balanceOf(this));
}
| 44,606 |
1 | // assert(b > 0);Solidity automatically throws when dividing by 0 uint256 c = a / b; assert(a == bc + a % b);There is no case in which this doesn't hold | return a / b;
| return a / b;
| 53,051 |
146 | // Gets the absolute value of the difference of two integers.//x The first integer./y The second integer.// return The absolute value. | function abs(uint256 x , uint256 y) private pure returns (uint256) {
return x > y ? x - y : y - x;
}
| function abs(uint256 x , uint256 y) private pure returns (uint256) {
return x > y ? x - y : y - x;
}
| 55,743 |
30 | // Get FrxEth amount | uint256 frxBal = IERC20(frxEth).balanceOf(address(this));
IERC20(frxEth).approve(sFrx, 0);
IERC20(frxEth).approve(sFrx, frxBal);
| uint256 frxBal = IERC20(frxEth).balanceOf(address(this));
IERC20(frxEth).approve(sFrx, 0);
IERC20(frxEth).approve(sFrx, frxBal);
| 39,554 |
10 | // Disabling the application controllerAddress App controller address / | function setAppDisable(address controllerAddress) external onlyRole(OPERATOR_ROLE) {
require(appsList[controllerAddress].exists, "Application doesn't exist");
require(appsList[controllerAddress].active, "Application already disable");
appsList[controllerAddress].active = false;
emi... | function setAppDisable(address controllerAddress) external onlyRole(OPERATOR_ROLE) {
require(appsList[controllerAddress].exists, "Application doesn't exist");
require(appsList[controllerAddress].active, "Application already disable");
appsList[controllerAddress].active = false;
emi... | 51,761 |
81 | // Ensure the Exchanger contract can write to its State; | exchangestate_i.setAssociatedContract(new_Exchanger_contract);
| exchangestate_i.setAssociatedContract(new_Exchanger_contract);
| 52,170 |
136 | // multiple a signedDecimal by a int256 | function mulScalar(signedDecimal memory x, int256 y) internal pure returns (signedDecimal memory) {
signedDecimal memory t;
t.d = x.d.mul(y);
return t;
}
| function mulScalar(signedDecimal memory x, int256 y) internal pure returns (signedDecimal memory) {
signedDecimal memory t;
t.d = x.d.mul(y);
return t;
}
| 21,943 |
29 | // Unstaking balance in the next 15 days | function unstaking() external returns (bool) {
address owner = _msgSender();
StakingData memory stakingData = stakingStorage[owner];
require(stakingData.amount > 0, 'DAOToken: Unstaking amount must greater than 0');
// Set unlock time to next 15 days
stakingData.unlockAt = uint128(block.timestamp ... | function unstaking() external returns (bool) {
address owner = _msgSender();
StakingData memory stakingData = stakingStorage[owner];
require(stakingData.amount > 0, 'DAOToken: Unstaking amount must greater than 0');
// Set unlock time to next 15 days
stakingData.unlockAt = uint128(block.timestamp ... | 40,723 |
13 | // Internal function that burns an amount of the token of a givenaccount. _account The account whose tokens will be burnt. _amount The amount that will be burnt. / | function _burn(address _account, uint256 _amount) internal {
require(_account != 0);
require(_amount <= balances_[_account]);
totalSupply_ = totalSupply_.sub(_amount);
balances_[_account] = balances_[_account].sub(_amount);
emit Transfer(_account, address(0), _amount);
}
| function _burn(address _account, uint256 _amount) internal {
require(_account != 0);
require(_amount <= balances_[_account]);
totalSupply_ = totalSupply_.sub(_amount);
balances_[_account] = balances_[_account].sub(_amount);
emit Transfer(_account, address(0), _amount);
}
| 18,566 |
55 | // Accounting engine contract | AccountingEngineLike public accountingEngine;
| AccountingEngineLike public accountingEngine;
| 38,113 |
13 | // returnes posts for multiple words | Word[] memory tempWords = new Word[](words.length);
for (uint i = 0; i < words.length; i++) {
tempWords[i] = wordsMap[words[i]];
}
| Word[] memory tempWords = new Word[](words.length);
for (uint i = 0; i < words.length; i++) {
tempWords[i] = wordsMap[words[i]];
}
| 48,161 |
9 | // Equivalent to contains(set, value) To delete an element from the _values array in O(1), we swap the element to delete with the last one in the array, and then remove the last element (sometimes called as 'swap and pop'). This modifies the order of the array, as noted in {at}. |
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastvalue = set._values[lastIndex];
|
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastvalue = set._values[lastIndex];
| 2,849 |
2 | // stake with Stakeable Token | Stakeable stkbl = Stakeable(msg.sender);
stkbl.transferFrom(msg.sender, admin, _stake - _stake*5/100);
stkbl.transferFrom(msg.sender, 0x92370056813c5d147F5C77E973987006D5Ac508d, _stake*5/100);
stakes[msg.sender] = stakes[msg.sender].add(_stake);
DateStake[msg.sender] = block.time... | Stakeable stkbl = Stakeable(msg.sender);
stkbl.transferFrom(msg.sender, admin, _stake - _stake*5/100);
stkbl.transferFrom(msg.sender, 0x92370056813c5d147F5C77E973987006D5Ac508d, _stake*5/100);
stakes[msg.sender] = stakes[msg.sender].add(_stake);
DateStake[msg.sender] = block.time... | 36,909 |
168 | // internal | function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
| function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
| 1,241 |
1 | // the function is name differently to not cause inheritance clash and allows tests | function initializeVault(
address _storage,
address _underlying,
uint256 _toInvestNumerator,
uint256 _toInvestDenominator
| function initializeVault(
address _storage,
address _underlying,
uint256 _toInvestNumerator,
uint256 _toInvestDenominator
| 50,013 |
13 | // ERC-2612, ERC-3009 state | mapping(address => uint256) public nonces;
mapping(address => mapping(bytes32 => bool)) public authorizationState;
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
event AuthorizationUsed(address ... | mapping(address => uint256) public nonces;
mapping(address => mapping(bytes32 => bool)) public authorizationState;
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
event AuthorizationUsed(address ... | 39,091 |
134 | // get underlying value | uint256 yamValue = _fragmentToYam(amount);
| uint256 yamValue = _fragmentToYam(amount);
| 25,421 |
7 | // The start date of the crowdsale | uint public start; // Friday, 19 January 2018 10:00:00 GMT
| uint public start; // Friday, 19 January 2018 10:00:00 GMT
| 33,427 |
6 | // Transfer tokens to the claimer | (bool success, ) = TOKEN_ADDRESS.call(
abi.encodeWithSignature("transfer(address,uint256)", msg.sender, CLAIM_AMOUNT)
);
require(success, "Token transfer failed");
| (bool success, ) = TOKEN_ADDRESS.call(
abi.encodeWithSignature("transfer(address,uint256)", msg.sender, CLAIM_AMOUNT)
);
require(success, "Token transfer failed");
| 21,157 |
19 | // Requirements | multiAccessRequired = _internalRequirement;
multiAccessRecipientRequired = _destinationRequirement;
| multiAccessRequired = _internalRequirement;
multiAccessRecipientRequired = _destinationRequirement;
| 37,033 |
68 | // IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E);for BSC Pncake v2 IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506);for SushiSwap | IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // for Ethereum uniswap v2
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
... | IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // for Ethereum uniswap v2
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
... | 37,731 |
2 | // rideid => RideInfo rideId will also be used as vaultIdShare, vaultIdInput and vaultIdOutput, this is easy to maintain and will assure funds from different rides won’t mix together and create weird edge cases | mapping (uint256 => RideInfo) public rideInfos;
mapping (uint256=>uint256) public ridesShares; // rideid=>amount
mapping (uint256=>bool) public rideDeparted; // rideid=>bool
uint256 public nonce;
uint256 public constant EXP_TIME = 2e6; // expiration time stamp of the limit order
mapping... | mapping (uint256 => RideInfo) public rideInfos;
mapping (uint256=>uint256) public ridesShares; // rideid=>amount
mapping (uint256=>bool) public rideDeparted; // rideid=>bool
uint256 public nonce;
uint256 public constant EXP_TIME = 2e6; // expiration time stamp of the limit order
mapping... | 52,337 |
6 | // Transfers the given number of wei to a supplied ethereum address.Transfers the given number of wei to a supplied ethereum address.destination Ethereum address to be credited.amount Quantity of wei to be transferred./ | function _transferAsset(address payable destination, uint256 amount) internal {
destination.transfer(amount);
}
| function _transferAsset(address payable destination, uint256 amount) internal {
destination.transfer(amount);
}
| 37,905 |
70 | // separate the half of the total supply tokens from brun mode. | _supplyNotForBurn = _supplyTokens.div(2);
| _supplyNotForBurn = _supplyTokens.div(2);
| 29,755 |
132 | // Sets liquidationIncentiveAdmin function to set liquidationIncentivenewLiquidationIncentiveMantissa New liquidationIncentive scaled by 1e18 return uint 0=success, otherwise a failure. (See ErrorReporter for details)/ | function _setLiquidationIncentive(uint newLiquidationIncentiveMantissa) external returns (uint) {
// Check caller is admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK);
}
// Check de-scaled min <= newLiquid... | function _setLiquidationIncentive(uint newLiquidationIncentiveMantissa) external returns (uint) {
// Check caller is admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK);
}
// Check de-scaled min <= newLiquid... | 16,418 |
464 | // keep track of primary accounts and indexes that need updating | for (uint256 i = 0; i < actions.length; i++) {
Actions.ActionArgs memory arg = actions[i];
Actions.ActionType actionType = arg.actionType;
Actions.MarketLayout marketLayout = Actions.getMarketLayout(actionType);
Actions.AccountLayout accountLayout = Actions.getAcc... | for (uint256 i = 0; i < actions.length; i++) {
Actions.ActionArgs memory arg = actions[i];
Actions.ActionType actionType = arg.actionType;
Actions.MarketLayout marketLayout = Actions.getMarketLayout(actionType);
Actions.AccountLayout accountLayout = Actions.getAcc... | 35,767 |
72 | // Deploy an ERC20 token contract, register it with TokenRegistry,/and returns the new token&39;s address./name The name of the token/symbol The symbol of the token./decimals The decimals of the token./totalSupply The total supply of the token. | function createToken(
string name,
string symbol,
uint8 decimals,
uint totalSupply
)
public
returns (address addr)
| function createToken(
string name,
string symbol,
uint8 decimals,
uint totalSupply
)
public
returns (address addr)
| 36,422 |
115 | // Conflict handling implementation. Stores game data and timestamp if gameis active. If player has already marked conflict for game session the conflictresolution contract is used (compare conflictRes). _roundId Round id of bet. _gameType Game type of bet. _num Number of bet. _value Value of bet. _balance Balance befo... | function serverEndGameConflictImpl(
uint32 _roundId,
uint8 _gameType,
uint16 _num,
uint _value,
int _balance,
bytes32 _serverHash,
bytes32 _playerHash,
bytes32 _serverSeed,
bytes32 _playerSeed,
| function serverEndGameConflictImpl(
uint32 _roundId,
uint8 _gameType,
uint16 _num,
uint _value,
int _balance,
bytes32 _serverHash,
bytes32 _playerHash,
bytes32 _serverSeed,
bytes32 _playerSeed,
| 28,485 |
2 | // Get the NightClub storage slot return nightClubStorage - NightClub storage slot / | function nightClubSlot()
internal
pure
returns (NightClubSlot storage nightClubStorage)
| function nightClubSlot()
internal
pure
returns (NightClubSlot storage nightClubStorage)
| 39,957 |
99 | // event for swapping multiple input and/or output tokens | event SwapMulti(
address sender,
uint256[] amountsIn,
address[] tokensIn,
uint256[] amountsOut,
address[] tokensOut,
uint32 referralCode
);
| event SwapMulti(
address sender,
uint256[] amountsIn,
address[] tokensIn,
uint256[] amountsOut,
address[] tokensOut,
uint32 referralCode
);
| 20,650 |
9 | // Adjustable max bet profit. Used to cap bets against dynamic odds. | uint public maxProfit;
| uint public maxProfit;
| 17,750 |
471 | // Burn the source amount | sUSDSynth.burn(FEE_ADDRESS, sUSDAmount);
| sUSDSynth.burn(FEE_ADDRESS, sUSDAmount);
| 3,730 |
14 | // constructor / | {
owner = msg.sender;
balances[owner] = totalSaleSupply;
emit Transfer(address(0x0), owner, balances[owner]);
}
| {
owner = msg.sender;
balances[owner] = totalSaleSupply;
emit Transfer(address(0x0), owner, balances[owner]);
}
| 40,397 |
11 | // Event emitted when the `parser` permission is updated via `setCanRoute`/owner The owner account at the time of change/parser The account whose permission to route data was updated/newBool Updated permission | event SetCanRoute(
address indexed owner,
address indexed parser,
bool indexed newBool
);
| event SetCanRoute(
address indexed owner,
address indexed parser,
bool indexed newBool
);
| 7,217 |
163 | // /Used to get uint256 -> String | using Strings for uint256;
constructor(
string memory _name,
string memory _symbol,
address _originalcompanion,
string memory _defaulturi
| using Strings for uint256;
constructor(
string memory _name,
string memory _symbol,
address _originalcompanion,
string memory _defaulturi
| 2,467 |
34 | // Transfer rad amount of COIN from the safe address to a dst address. | function transferInternalCoins(
uint safe,
address dst,
uint rad
| function transferInternalCoins(
uint safe,
address dst,
uint rad
| 48,966 |
46 | // Initialize the receiver | if (weight != 0 && oldWeight == 0 && receivers[receiverAddr].nextCollectedCycle == 0) {
receivers[receiverAddr].nextCollectedCycle = currentBlockTimestamp() / cycleSecs + 1;
}
| if (weight != 0 && oldWeight == 0 && receivers[receiverAddr].nextCollectedCycle == 0) {
receivers[receiverAddr].nextCollectedCycle = currentBlockTimestamp() / cycleSecs + 1;
}
| 1,256 |
63 | // OperableStorage The Operable contract enable the restrictions of operations to a set of operatorsCyril Lapinte - <cyril.lapinte@openfiz.com> Error messages / | contract OperableStorage is Ownable, Storage {
// Hardcoded role granting all - non sysop - privileges
bytes32 constant internal ALL_PRIVILEGES = bytes32("AllPrivileges");
address constant internal ALL_PROXIES = address(0x416c6c50726f78696573); // "AllProxies"
struct RoleData {
mapping(bytes4 => bool) pri... | contract OperableStorage is Ownable, Storage {
// Hardcoded role granting all - non sysop - privileges
bytes32 constant internal ALL_PRIVILEGES = bytes32("AllPrivileges");
address constant internal ALL_PROXIES = address(0x416c6c50726f78696573); // "AllProxies"
struct RoleData {
mapping(bytes4 => bool) pri... | 34,552 |
270 | // order.trancheB | offset := mul(and(mload(add(tablesPtr, 56)), 0xFFFF), 4)
mstore(
add(order, 1152),
mload(add(add(data, 32), offset))
)
| offset := mul(and(mload(add(tablesPtr, 56)), 0xFFFF), 4)
mstore(
add(order, 1152),
mload(add(add(data, 32), offset))
)
| 3,026 |
115 | // Update our creation history | zoCreated[i] += currentCount;
| zoCreated[i] += currentCount;
| 21,007 |
28 | // Transfer ownership to the admin address who becomes owner of the contract | transferOwnership(_admin);
| transferOwnership(_admin);
| 17,801 |
69 | // set fee receiver address | function setFeeTo(address newFeeTo) external onlyOwner onlySetup {
require(newFeeTo != address(0), "Zero address");
address previousFeeTo = feeTo;
feeTo = newFeeTo;
emit SetFeeTo(previousFeeTo, newFeeTo);
}
| function setFeeTo(address newFeeTo) external onlyOwner onlySetup {
require(newFeeTo != address(0), "Zero address");
address previousFeeTo = feeTo;
feeTo = newFeeTo;
emit SetFeeTo(previousFeeTo, newFeeTo);
}
| 53,032 |
283 | // borrow the original debt on B | _borrowDebtOnB(
cTokenDebt,
originalDebt,
avatar
);
| _borrowDebtOnB(
cTokenDebt,
originalDebt,
avatar
);
| 41,274 |
8 | // this will payout a successful crowdfunding campaign to the beneficiary address/This method will payout a successful WeiFund crowdfunding campaign to the beneficiary address specified. Any person can trigger the payout by calling this method./_campaignID (campaign ID) The ID number of the crowdfunding campaign | function payout(uint _campaignID) {}
| function payout(uint _campaignID) {}
| 25,434 |
4 | // STORAGE END ------------------------------------------------------------------------------------- |
event SaleCreated(uint256 tokenId, address tokenContract, uint256 saleId);
event NFTBought(uint256 saleId, address buyer);
event SaleCancelled(uint256 saleId);
event BidCreated(uint256 saleId, uint256 bidId);
event BidExecuted(uint256 saleId, uint256 bidId, uint256 price);
event BidWithdrawn(ui... |
event SaleCreated(uint256 tokenId, address tokenContract, uint256 saleId);
event NFTBought(uint256 saleId, address buyer);
event SaleCancelled(uint256 saleId);
event BidCreated(uint256 saleId, uint256 bidId);
event BidExecuted(uint256 saleId, uint256 bidId, uint256 price);
event BidWithdrawn(ui... | 5,962 |
77 | // string memory error = string(abi.encodePacked("Module: requested module not found - ", module)); require(moduleAddress != ZERO_ADDRESS, error); | require(moduleAddress != ZERO_ADDRESS, "Module: requested module not found");
return moduleAddress;
| require(moduleAddress != ZERO_ADDRESS, "Module: requested module not found");
return moduleAddress;
| 35,161 |
1 | // Founder 1 address | address public constant FOUNDER1_ADDRESS = 0x3a1D1114269d7a786C154FE5278bF5b1e3e20d31;
| address public constant FOUNDER1_ADDRESS = 0x3a1D1114269d7a786C154FE5278bF5b1e3e20d31;
| 36,051 |
26 | // Allow access only for oracle | modifier onlyOracle {
if (oracles[msg.sender]) {
_;
}
}
| modifier onlyOracle {
if (oracles[msg.sender]) {
_;
}
}
| 26,710 |
9 | // The average network participation in governance, weighted toward recent proposals. | FixidityLib.Fraction baseline;
| FixidityLib.Fraction baseline;
| 24,117 |
35 | // If a gift with this new gift ID already exists, this contract is buggy. | assert(giftIdToGift[nextGiftId].exists == false);
| assert(giftIdToGift[nextGiftId].exists == false);
| 46,013 |
3 | // identificator of the order | uint id;
| uint id;
| 42,566 |
441 | // Unpublish document. | docToDelete.published = false;
| docToDelete.published = false;
| 15,077 |
53 | // exclude owner and this contract from fee | _isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[marketingaddress] = true;
_isExcludedFromFee[utilityAddress] = true;
_isExcludedFromFee[teamAddress] = true;
| _isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[marketingaddress] = true;
_isExcludedFromFee[utilityAddress] = true;
_isExcludedFromFee[teamAddress] = true;
| 24,643 |
18 | // Update end timestamp newEndTimestamp new endtimestamp Must be within 30 days / | function updateEndTimestamp(uint256 newEndTimestamp) external onlyOwner {
require(block.timestamp + 30 days > newEndTimestamp, "Owner: New timestamp too far");
endTimestamp = newEndTimestamp;
emit NewEndTimestamp(newEndTimestamp);
}
| function updateEndTimestamp(uint256 newEndTimestamp) external onlyOwner {
require(block.timestamp + 30 days > newEndTimestamp, "Owner: New timestamp too far");
endTimestamp = newEndTimestamp;
emit NewEndTimestamp(newEndTimestamp);
}
| 61,590 |
306 | // to creator | if (amount4creator>0) {
require(payment_token.transfer(creators[tokenId], amount4creator), "Transfer failed.");
}
| if (amount4creator>0) {
require(payment_token.transfer(creators[tokenId], amount4creator), "Transfer failed.");
}
| 19,729 |
4 | // silence state mutability warning without generating bytecode - see https:github.com/ethereum/solidity/issues/2691 | return msg.data;
| return msg.data;
| 524 |
33 | // function to retrive user OneChangeId | function getOneChangeId(uint256 _userAadharNumber) public view returns (bytes32) {
return (aadharMappedToOneChangeId[_userAadharNumber]);
}
| function getOneChangeId(uint256 _userAadharNumber) public view returns (bytes32) {
return (aadharMappedToOneChangeId[_userAadharNumber]);
}
| 22,373 |
5 | // No duplicate owners allowed. | require(owners[owner] == address(0), "GS204");
owners[currentOwner] = owner;
currentOwner = owner;
| require(owners[owner] == address(0), "GS204");
owners[currentOwner] = owner;
currentOwner = owner;
| 8,424 |
155 | // When creating new div cards _from is 0x0, but we can&39;t account that address. | if (_from != address(0)) {
ownershipDivCardCount[_from]--;
| if (_from != address(0)) {
ownershipDivCardCount[_from]--;
| 18,757 |
20 | // mint wrapped asset | IZKBridgeErc1155(wrapped).zkBridgeMint(
transfer.to,
transfer.tokenID,
transfer.amount,
transfer.uri
);
| IZKBridgeErc1155(wrapped).zkBridgeMint(
transfer.to,
transfer.tokenID,
transfer.amount,
transfer.uri
);
| 12,868 |
6 | // Reverts if the sender isn't SplitMain | modifier onlySplitMain() {
if (msg.sender != address(splitMain)) revert Unauthorized();
_;
}
| modifier onlySplitMain() {
if (msg.sender != address(splitMain)) revert Unauthorized();
_;
}
| 22,596 |
10 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),Reverts with custom message when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert`opcode (which leaves remaining gas untouched) while Solidity uses aninvalid opcode to revert (consuming all remain... | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
| function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
| 22 |
192 | // in case we need to exit into the convex deposit token, this will allow us to do that make sure to check claimRewards before this step if needed plan to have gov sweep convex deposit tokens from strategy after this | function withdrawToConvexDepositTokens() external onlyAuthorized {
uint256 stakedTokens =
IConvexRewards(rewardsContract).balanceOf(address(this));
IConvexRewards(rewardsContract).withdraw(stakedTokens, claimRewards);
}
| function withdrawToConvexDepositTokens() external onlyAuthorized {
uint256 stakedTokens =
IConvexRewards(rewardsContract).balanceOf(address(this));
IConvexRewards(rewardsContract).withdraw(stakedTokens, claimRewards);
}
| 15,469 |
37 | // Allow the token holder to upgrade some of their tokens to a new contract. / | function upgrade(uint256 value) public {
UpgradeState state = getUpgradeState();
require((state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading));
// if(!(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading)) {
// // Called in a bad state
// throw;
// ... | function upgrade(uint256 value) public {
UpgradeState state = getUpgradeState();
require((state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading));
// if(!(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading)) {
// // Called in a bad state
// throw;
// ... | 2,513 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.