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 |
|---|---|---|---|---|
29 | // Retrieve the tokens owned by the caller. / | function myTokens()
public
view
returns(uint256)
| function myTokens()
public
view
returns(uint256)
| 8,819 |
121 | // amount is lp check | if (liquidityPoolData.amountIsLiquidityPool || !_setupsInfo[_setups[setupIndex].infoIndex].involvingETH) {
require(msg.value == 0, "ETH not involved");
}
| if (liquidityPoolData.amountIsLiquidityPool || !_setupsInfo[_setups[setupIndex].infoIndex].involvingETH) {
require(msg.value == 0, "ETH not involved");
}
| 29,948 |
34 | // Add to log info about rule delete execution.pIndex The index of the proposal.ruleIndex Index of the deleted rule.initiator Address of the deletion initiator.time The time when proposal deleted./ | event ProposalDeleted(
| event ProposalDeleted(
| 12,028 |
0 | // Emitted when a checkpoint is set./checkpointId The checkpoint identifier./timestamp The timestamp associated to the checkpoint. | event CheckpointSet(bytes32 checkpointId, uint256 timestamp);
| event CheckpointSet(bytes32 checkpointId, uint256 timestamp);
| 35,993 |
4 | // subscriber The address of the subscriber./ | function getSubscriberName(address subscriber) public view returns (string){
require(subscriber != address(0));
return subscribers[subscriber].name;
}
| function getSubscriberName(address subscriber) public view returns (string){
require(subscriber != address(0));
return subscribers[subscriber].name;
}
| 10,899 |
417 | // lockdays are passed as seconds | function deleteLockMultiplier(uint256 lockDays) external onlyOwner {
delete lockMultipliers[lockDays];
}
| function deleteLockMultiplier(uint256 lockDays) external onlyOwner {
delete lockMultipliers[lockDays];
}
| 18,997 |
332 | // Start ramping up or down A parameter towards given futureA and futureTimeChecks if the change is too rapid, and commits the new A value only when it falls underthe limit range. futureA the new A to ramp towards futureTime timestamp when the new A should be reached / | function rampA(uint256 futureA, uint256 futureTime) external onlyOwner {
swapStorage.rampA(futureA, futureTime);
}
| function rampA(uint256 futureA, uint256 futureTime) external onlyOwner {
swapStorage.rampA(futureA, futureTime);
}
| 80,380 |
14 | // Change the paused state of the contract Only the contract owner may call this. / | function setPaused(bool _paused) external onlyOwner {
// Ensure we're actually changing the state before we do anything
if (_paused == paused) {
return;
}
// Set our paused state.
paused = _paused;
// If applicable, set the last pause time.
if (paused) {
lastPauseTime = now;
}
// Let everyone know that our pause state has changed.
emit PauseChanged(paused);
}
| function setPaused(bool _paused) external onlyOwner {
// Ensure we're actually changing the state before we do anything
if (_paused == paused) {
return;
}
// Set our paused state.
paused = _paused;
// If applicable, set the last pause time.
if (paused) {
lastPauseTime = now;
}
// Let everyone know that our pause state has changed.
emit PauseChanged(paused);
}
| 643 |
61 | // Compute the SGR worth of a given SGN amount at a given minting-point. _amount The amount of SGN. _index The minting-point index.return The equivalent amount of SGR. / | function sgn2sgr(uint256 _amount, uint256 _index) external view returns (uint256);
| function sgn2sgr(uint256 _amount, uint256 _index) external view returns (uint256);
| 48,075 |
154 | // liquidationDiscount for collateral when liquidating borrows/ | Exp public liquidationDiscount;
| Exp public liquidationDiscount;
| 17,405 |
7 | // Getter to check the Token contract address. / | function tokenContractAddress() public view returns (address) {
return address(_Robinet);
}
| function tokenContractAddress() public view returns (address) {
return address(_Robinet);
}
| 8,759 |
48 | // the file must exist | require(record.timestamp != 0);
| require(record.timestamp != 0);
| 51,579 |
32 | // 判斷罷免活動是否為CONFIRMING狀態 | modifier isRecallConfirming{
require(recallActivity.recallPhase == RecallPhase.CONFIRMING, "not at CONFIRMING phase.");
_;
}
| modifier isRecallConfirming{
require(recallActivity.recallPhase == RecallPhase.CONFIRMING, "not at CONFIRMING phase.");
_;
}
| 19,473 |
12 | // MIP14: Protocol Dai Transfer Hash: seth keccak -- "$(wget https:raw.githubusercontent.com/makerdao/mips/3eb4e3d26ac79d93874dea07d095a0d991a14d20/MIP14/mip14.md -q -O - 2>/dev/null)" | string constant public MIP15 = "0x70f6c28c1b5ef1657a8a901636f31f9479ff5d32c251dd4eda84b8c00655fdba";
| string constant public MIP15 = "0x70f6c28c1b5ef1657a8a901636f31f9479ff5d32c251dd4eda84b8c00655fdba";
| 17,428 |
35 | // make sure that requested balances not exceeds channel balance | require(channels[channelID].balanceAlice + channels[channelID].balanceBob >=
balanceAlice + balanceBob);
| require(channels[channelID].balanceAlice + channels[channelID].balanceBob >=
balanceAlice + balanceBob);
| 25,110 |
156 | // Make sure the duration values are in harmony with interval (both should be an exact multiple of interval). | require(
duration % interval == 0 && cliffDuration % interval == 0,
"invalid cliff/duration for interval"
);
| require(
duration % interval == 0 && cliffDuration % interval == 0,
"invalid cliff/duration for interval"
);
| 39,629 |
57 | // If we need to reset tickets from a previous raffle | if (purchases.raffleId != itemRaffleRareId) {
purchases.numPurchases = 0;
purchases.raffleId = itemRaffleRareId;
itemRafflePlayers[itemRaffleRareId].push(msg.sender); // Add user to raffle
}
| if (purchases.raffleId != itemRaffleRareId) {
purchases.numPurchases = 0;
purchases.raffleId = itemRaffleRareId;
itemRafflePlayers[itemRaffleRareId].push(msg.sender); // Add user to raffle
}
| 62,005 |
99 | // count number of digits | 7,846 | ||
13 | // EIP 191 style signatures Arguments when calculating hash to validate 1: byte(0x19) - the initial 0x19 byte 2: byte(0) - the version byte (data with intended validator) 3: this - the validator address --Application specific data 4 : checkpoint section_index(uint64) 5 : checkpoint hash (bytes32) hash = keccak256(checkpoint_index, section_head, cht_root, bloom_root) | bytes32 signedHash = keccak256(abi.encodePacked(byte(0x19), byte(0), this, _sectionIndex, _hash));
address lastVoter = address(0);
| bytes32 signedHash = keccak256(abi.encodePacked(byte(0x19), byte(0), this, _sectionIndex, _hash));
address lastVoter = address(0);
| 49,725 |
31 | // Sets the vote-unready threshold/governance function called only by the functional manager/voteUnreadyPercentMilleThreshold is the minimum threshold in percent-mille (0-100,000) | function setVoteUnreadyPercentMilleThreshold(uint32 voteUnreadyPercentMilleThreshold) external /* onlyFunctionalManager */;
| function setVoteUnreadyPercentMilleThreshold(uint32 voteUnreadyPercentMilleThreshold) external /* onlyFunctionalManager */;
| 40,688 |
11 | // throws when allow list is not active / | modifier isAllowListActive() {
require(allowListActive, "Allow list is not active");
_;
}
| modifier isAllowListActive() {
require(allowListActive, "Allow list is not active");
_;
}
| 16,414 |
106 | // recovers stuck ETH to make sure it isnt burnt/lostonly callablewhen liquidity is unlocked | function recoverETH() external onlyOwner {
require(block.timestamp >= _liquidityUnlockTime, "Not yet unlocked");
_liquidityUnlockTime=block.timestamp;
_sendEth(msg.sender, address(this).balance);
}
| function recoverETH() external onlyOwner {
require(block.timestamp >= _liquidityUnlockTime, "Not yet unlocked");
_liquidityUnlockTime=block.timestamp;
_sendEth(msg.sender, address(this).balance);
}
| 27,326 |
27 | // Fallback function for funding smart contract./ | function() external payable {
fund();
}
| function() external payable {
fund();
}
| 10,308 |
273 | // Mint token rewards for an active transcoder and its delegators and update the transcoder pool using an optional list hint if needed If the caller is in the transcoder pool, the caller can provide an optional hint for its insertion position in thepool via the `_newPosPrev` and `_newPosNext` params. A linear search will be executed starting at the hint to find the correct position.In the best case, the hint is the correct position so no search is executed. See SortedDoublyLL.sol for details on list hints _newPosPrev Address of previous transcoder in pool if the caller is in the pool _newPosNext | function rewardWithHint(address _newPosPrev, address _newPosNext) public whenSystemNotPaused currentRoundInitialized {
uint256 currentRound = roundsManager().currentRound();
require(isActiveTranscoder(msg.sender), "caller must be an active transcoder");
require(transcoders[msg.sender].lastRewardRound != currentRound, "caller has already called reward for the current round");
Transcoder storage t = transcoders[msg.sender];
EarningsPool.Data storage earningsPool = t.earningsPoolPerRound[currentRound];
// Set last round that transcoder called reward
t.lastRewardRound = currentRound;
earningsPool.setCommission(t.rewardCut, t.feeShare);
// If transcoder didn't receive stake updates during the previous round and hasn't called reward for > 1 round
// the 'totalStake' and 'claimableStake' on its 'EarningsPool' for the current round wouldn't be initialized
// Thus we sync the the transcoder's stake to when it was last updated
// 'updateTrancoderWithRewards()' will set the update round to 'currentRound +1' so this synchronization shouldn't occur frequently
uint256 lastUpdateRound = t.lastActiveStakeUpdateRound;
if (lastUpdateRound < currentRound) {
earningsPool.setStake(t.earningsPoolPerRound[lastUpdateRound].totalStake);
}
// Create reward based on active transcoder's stake relative to the total active stake
// rewardTokens = (current mintable tokens for the round * active transcoder stake) / total active stake
uint256 rewardTokens = minter().createReward(earningsPool.totalStake, currentRoundTotalActiveStake);
updateTranscoderWithRewards(msg.sender, rewardTokens, currentRound, _newPosPrev, _newPosNext);
emit Reward(msg.sender, rewardTokens);
}
| function rewardWithHint(address _newPosPrev, address _newPosNext) public whenSystemNotPaused currentRoundInitialized {
uint256 currentRound = roundsManager().currentRound();
require(isActiveTranscoder(msg.sender), "caller must be an active transcoder");
require(transcoders[msg.sender].lastRewardRound != currentRound, "caller has already called reward for the current round");
Transcoder storage t = transcoders[msg.sender];
EarningsPool.Data storage earningsPool = t.earningsPoolPerRound[currentRound];
// Set last round that transcoder called reward
t.lastRewardRound = currentRound;
earningsPool.setCommission(t.rewardCut, t.feeShare);
// If transcoder didn't receive stake updates during the previous round and hasn't called reward for > 1 round
// the 'totalStake' and 'claimableStake' on its 'EarningsPool' for the current round wouldn't be initialized
// Thus we sync the the transcoder's stake to when it was last updated
// 'updateTrancoderWithRewards()' will set the update round to 'currentRound +1' so this synchronization shouldn't occur frequently
uint256 lastUpdateRound = t.lastActiveStakeUpdateRound;
if (lastUpdateRound < currentRound) {
earningsPool.setStake(t.earningsPoolPerRound[lastUpdateRound].totalStake);
}
// Create reward based on active transcoder's stake relative to the total active stake
// rewardTokens = (current mintable tokens for the round * active transcoder stake) / total active stake
uint256 rewardTokens = minter().createReward(earningsPool.totalStake, currentRoundTotalActiveStake);
updateTranscoderWithRewards(msg.sender, rewardTokens, currentRound, _newPosPrev, _newPosNext);
emit Reward(msg.sender, rewardTokens);
}
| 1,810 |
300 | // 1 -> use flash loan to leverage | if (_dataCopy[0] == 0x31){
deposit();
require(getBorrowable() >= total, '!borrowableFlashRepay');
require(ICToken(cwbtc).borrow(total) == 0, "!borrowFlashLeverage");
emit FlashLoanLeverage(_amount, _loanFee, _data, ERC20(mwbtc).name());
}
| if (_dataCopy[0] == 0x31){
deposit();
require(getBorrowable() >= total, '!borrowableFlashRepay');
require(ICToken(cwbtc).borrow(total) == 0, "!borrowFlashLeverage");
emit FlashLoanLeverage(_amount, _loanFee, _data, ERC20(mwbtc).name());
}
| 75,209 |
21 | // Track the next head pointer, starting with initial head value. | let mPtrHeadNext := mPtrHead
| let mPtrHeadNext := mPtrHead
| 21,017 |
107 | // add address to whitelist_addr wallet address to be added to whitelist/ | function addToWhitelist(address _addr) public onlyOwner returns (bool) {
require(_addr != address(0));
if (!whitelist[_addr]) {
whitelist[_addr] = true;
numWhitelisted++;
}
purchaseLog[_addr].kycApproved = true;
return true;
}
| function addToWhitelist(address _addr) public onlyOwner returns (bool) {
require(_addr != address(0));
if (!whitelist[_addr]) {
whitelist[_addr] = true;
numWhitelisted++;
}
purchaseLog[_addr].kycApproved = true;
return true;
}
| 32,058 |
17 | // Provides information about the current execution context, including thesender of the transaction and its data. While these are generally availablevia msg.sender and msg.data, they should not be accessed in such a directmanner, since when dealing with meta-transactions the account sending andpaying for execution may not be the actual sender (as far as an applicationis concerned). This contract is only required for intermediate, library-like contracts. / | abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
| abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
| 557 |
7 | // Gets list of subscription ids that are underfunded and returns a keeper-compatible payload.return upkeepNeeded signals if upkeep is needed, performData is an abi encoded list of subscription ids that need funds / | function checkUpkeep(
bytes calldata
| function checkUpkeep(
bytes calldata
| 19,592 |
517 | // Implementation of Eternal Storage for ElasticDAO - This contract is used for storing contract network data ElasticDAO network contracts can read/write from this contract / | contract EternalModel {
struct Storage {
mapping(bytes32 => address) addressStorage;
mapping(bytes32 => bool) boolStorage;
mapping(bytes32 => bytes) bytesStorage;
mapping(bytes32 => int256) intStorage;
mapping(bytes32 => string) stringStorage;
mapping(bytes32 => uint256) uIntStorage;
}
Storage internal s;
/**
* @notice Getter Functions
*/
/**
* @notice Gets stored contract data in unit256 format
* @param _key bytes32 location should be keccak256 and abi.encodePacked
* @return uint256 _value from storage _key location
*/
function getUint(bytes32 _key) internal view returns (uint256) {
return s.uIntStorage[_key];
}
/**
* @notice Get stored contract data in string format
* @param _key bytes32 location should be keccak256 and abi.encodePacked
* @return string _value from storage _key location
*/
function getString(bytes32 _key) internal view returns (string memory) {
return s.stringStorage[_key];
}
/**
* @notice Get stored contract data in address format
* @param _key bytes32 location should be keccak256 and abi.encodePacked
* @return address _value from storage _key location
*/
function getAddress(bytes32 _key) internal view returns (address) {
return s.addressStorage[_key];
}
/**
* @notice Get stored contract data in bool format
* @param _key bytes32 location should be keccak256 and abi.encodePacked
* @return bool _value from storage _key location
*/
function getBool(bytes32 _key) internal view returns (bool) {
return s.boolStorage[_key];
}
/**
* @notice Setters Functions
*/
/**
* @notice Store contract data in uint256 format
* @dev restricted to latest ElasticDAO Networks contracts
* @param _key bytes32 location should be keccak256 and abi.encodePacked
* @param _value uint256 value
*/
function setUint(bytes32 _key, uint256 _value) internal {
s.uIntStorage[_key] = _value;
}
/**
* @notice Store contract data in string format
* @dev restricted to latest ElasticDAO Networks contracts
* @param _key bytes32 location should be keccak256 and abi.encodePacked
* @param _value string value
*/
function setString(bytes32 _key, string memory _value) internal {
s.stringStorage[_key] = _value;
}
/**
* @notice Store contract data in address format
* @dev restricted to latest ElasticDAO Networks contracts
* @param _key bytes32 location should be keccak256 and abi.encodePacked
* @param _value address value
*/
function setAddress(bytes32 _key, address _value) internal {
s.addressStorage[_key] = _value;
}
/**
* @notice Store contract data in bool format
* @dev restricted to latest ElasticDAO Networks contracts
* @param _key bytes32 location should be keccak256 and abi.encodePacked
* @param _value bool value
*/
function setBool(bytes32 _key, bool _value) internal {
s.boolStorage[_key] = _value;
}
}
| contract EternalModel {
struct Storage {
mapping(bytes32 => address) addressStorage;
mapping(bytes32 => bool) boolStorage;
mapping(bytes32 => bytes) bytesStorage;
mapping(bytes32 => int256) intStorage;
mapping(bytes32 => string) stringStorage;
mapping(bytes32 => uint256) uIntStorage;
}
Storage internal s;
/**
* @notice Getter Functions
*/
/**
* @notice Gets stored contract data in unit256 format
* @param _key bytes32 location should be keccak256 and abi.encodePacked
* @return uint256 _value from storage _key location
*/
function getUint(bytes32 _key) internal view returns (uint256) {
return s.uIntStorage[_key];
}
/**
* @notice Get stored contract data in string format
* @param _key bytes32 location should be keccak256 and abi.encodePacked
* @return string _value from storage _key location
*/
function getString(bytes32 _key) internal view returns (string memory) {
return s.stringStorage[_key];
}
/**
* @notice Get stored contract data in address format
* @param _key bytes32 location should be keccak256 and abi.encodePacked
* @return address _value from storage _key location
*/
function getAddress(bytes32 _key) internal view returns (address) {
return s.addressStorage[_key];
}
/**
* @notice Get stored contract data in bool format
* @param _key bytes32 location should be keccak256 and abi.encodePacked
* @return bool _value from storage _key location
*/
function getBool(bytes32 _key) internal view returns (bool) {
return s.boolStorage[_key];
}
/**
* @notice Setters Functions
*/
/**
* @notice Store contract data in uint256 format
* @dev restricted to latest ElasticDAO Networks contracts
* @param _key bytes32 location should be keccak256 and abi.encodePacked
* @param _value uint256 value
*/
function setUint(bytes32 _key, uint256 _value) internal {
s.uIntStorage[_key] = _value;
}
/**
* @notice Store contract data in string format
* @dev restricted to latest ElasticDAO Networks contracts
* @param _key bytes32 location should be keccak256 and abi.encodePacked
* @param _value string value
*/
function setString(bytes32 _key, string memory _value) internal {
s.stringStorage[_key] = _value;
}
/**
* @notice Store contract data in address format
* @dev restricted to latest ElasticDAO Networks contracts
* @param _key bytes32 location should be keccak256 and abi.encodePacked
* @param _value address value
*/
function setAddress(bytes32 _key, address _value) internal {
s.addressStorage[_key] = _value;
}
/**
* @notice Store contract data in bool format
* @dev restricted to latest ElasticDAO Networks contracts
* @param _key bytes32 location should be keccak256 and abi.encodePacked
* @param _value bool value
*/
function setBool(bytes32 _key, bool _value) internal {
s.boolStorage[_key] = _value;
}
}
| 25,015 |
309 | // transfers a specific amount of the native token/ERC20 token from a specific holder using the allowance mechanism note that the function does not perform any action if the native token is provided / | function safeTransferFrom(
Token token,
address from,
address to,
uint256 amount
| function safeTransferFrom(
Token token,
address from,
address to,
uint256 amount
| 35,175 |
47 | // Fear Implementation of Fear NFTs / | contract Fear is ERC20 {
constructor (
string memory name,
string memory symbol,
uint256 initialBalance
) ERC20(name, symbol) {
_mint(msg.sender, initialBalance);
}
} | contract Fear is ERC20 {
constructor (
string memory name,
string memory symbol,
uint256 initialBalance
) ERC20(name, symbol) {
_mint(msg.sender, initialBalance);
}
} | 16,691 |
6 | // return the token being held. / | function token() public view virtual returns (IERC721) {
return _token;
}
| function token() public view virtual returns (IERC721) {
return _token;
}
| 7,966 |
193 | // Get the current D, then solve the stableswap invariant y_i for D - tokenAmount | uint256[] memory xp = _xp(self);
CalculateWithdrawOneTokenDYInfo memory v = CalculateWithdrawOneTokenDYInfo(0, 0, 0, 0, 0);
v.preciseA = _getAPrecise(self);
v.d0 = getD(xp, v.preciseA);
v.d1 = v.d0.sub(tokenAmount.mul(v.d0).div(self.lpToken.totalSupply()));
require(tokenAmount <= xp[tokenIndex], "Withdraw exceeds available");
v.newY = getYD(v.preciseA, tokenIndex, xp, v.d1);
| uint256[] memory xp = _xp(self);
CalculateWithdrawOneTokenDYInfo memory v = CalculateWithdrawOneTokenDYInfo(0, 0, 0, 0, 0);
v.preciseA = _getAPrecise(self);
v.d0 = getD(xp, v.preciseA);
v.d1 = v.d0.sub(tokenAmount.mul(v.d0).div(self.lpToken.totalSupply()));
require(tokenAmount <= xp[tokenIndex], "Withdraw exceeds available");
v.newY = getYD(v.preciseA, tokenIndex, xp, v.d1);
| 17,359 |
10 | // create project ["0x5b38da6a701c568545dcfcb03fcb875f56beddc4", "0x00000000000000000000000000000000000000000000000000000000000000fa", "0x0000000000000000000000000000000000000000000000000000000063d98c57", "0x0000000000000000000000000000000000000000000000000000000063d98c57"]/ get project ["0x5b38da6a701c568545dcfcb03fcb875f56beddc4"]/ change end date ["0x5b38da6a701c568545dcfcb03fcb875f56beddc4", "0x000000000000000000000000000000000000000000000000000000004c11bfc7"]/ process claim project output ["0x5b38da6a701c568545dcfcb03fcb875f56beddc4", "0x625f30303230", "0x00000000000000000000000000000000000000000000000000000000000000c8", "0x46435255", "0x6578616d706c652e636f6d2f6d657461646174612f6d2d303031", "0x5b38da6a701c568545dcfcb03fcb875f56beddc4"]/ process claim buffer output. ["0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2", "0x625f30303034", "0x00000000000000000000000000000000000000000000000000000000000000c8", "0x46435255", "0x6578616d706c652e636f6d2f6d657461646174612f6d2d303031", "0x5b38da6a701c568545dcfcb03fcb875f56beddc4"] | contract CASProxy is Ownable {
/// initialized registry manager contract address
address private registryManagerContractAddress;
/**
* @dev Setter for a new registry manager contract address
* @param _registryManagerContractAddress the new address of the registry manager contract
*/
function setRegistryManagerContractAddress(address _registryManagerContractAddress) public onlyOwner {
registryManagerContractAddress = _registryManagerContractAddress;
}
/**
* @dev Get the registry manager contract address
* @return projectAddress Current registry manager contract address
*/
function getRegistryManagerContractAddress() public view returns(address) {
return registryManagerContractAddress;
}
/**
* @dev Initialization of a new project
* @param bytesParams (
* project_address: bytes(address),
* project_id: bytes(int),
* start_date: bytes(string),
* end_date: bytes(string)
* )
* @notice All parameters must be passed in bytes and opened in the contract as the required type
*/
function createProject(bytes[] memory bytesParams) public onlyOwner {
IRegistryManager(registryManagerContractAddress).createProject(bytesParams);
}
/**
* @dev Function to change end date parameter
* @param bytesParams (
* projectAddress: bytes(address),
* end_date: bytes(string)
* )
* @notice All parameters must be passed in bytes and opened in the contract as the required type
*/
function changeProjectEndDate(bytes[] memory bytesParams) public onlyOwner {
IRegistryManager(registryManagerContractAddress).changeProjectEndDate(bytesParams);
}
/**
* @dev Get project parameters
* @param bytesParams (
* project_address: bytes(address)
* )
* `projectAddress` parameter must be passed in bytes and opened in the contract as the required type
* @return projectId Returns `projectId`, `startDate`, `endDate` of a given project
* @return startDate Returns `projectId`, `startDate`, `endDate` of a given project
* @return endDate Returns `projectId`, `startDate`, `endDate` of a given project
*/
function getProject(bytes[] memory bytesParams) public view returns(uint projectId, uint startDate, uint endDate) {
return IRegistryManager(registryManagerContractAddress).getProject(bytesParams);
}
/**
* @dev create claim for a project (give FCRU to it)
* @param projectOutput (
* projectAddress: bytes(address),
* bundleId: bytes(string),
* bundleVolume: bytes(int),
* unitType: bytes(string),
* metadataUrl: bytes(string)
* projectAddress: bytes(address)
* )
* @param bufferOutput (
* bufferAddress: bytes(address),
* outputBundleId: bytes(string),
* bundleVolume: bytes(int),
* unitType: bytes(string),
* metadataUrl: bytes(string)
* projectAddress: bytes(address)
* )
* @notice All parameters must be passed in bytes and opened in the contract as the required type
*/
function processClaim(bytes[] memory projectOutput, bytes[] memory bufferOutput) public onlyOwner {
IRegistryManager(registryManagerContractAddress).processClaim(projectOutput, bufferOutput);
}
/**
* @dev assign tokens from the project to the holder
* @param projectInput (
* projectAddress: bytes(address),
* bundleId: bytes(string),
* bundleVolume: bytes(int),
* unitType: bytes(string),
* metadataUrl: bytes(string)
* projectAddress: bytes(address)
* )
* @param holderOutput (
* holderAddress: bytes(address),
* outputBundleId: bytes(string),
* bundleVolume: bytes(int),
* unitType: bytes(string),
* metadataUrl: bytes(string)
* projectAddress: bytes(address)
* )
* @notice All parameters must be passed in bytes and opened in the contract as the required type
*/
function assignProjectTokens(bytes[] memory projectInput, bytes[] memory holderOutput) public onlyOwner {
IRegistryManager(registryManagerContractAddress).assignTokens(projectInput, holderOutput);
}
} | contract CASProxy is Ownable {
/// initialized registry manager contract address
address private registryManagerContractAddress;
/**
* @dev Setter for a new registry manager contract address
* @param _registryManagerContractAddress the new address of the registry manager contract
*/
function setRegistryManagerContractAddress(address _registryManagerContractAddress) public onlyOwner {
registryManagerContractAddress = _registryManagerContractAddress;
}
/**
* @dev Get the registry manager contract address
* @return projectAddress Current registry manager contract address
*/
function getRegistryManagerContractAddress() public view returns(address) {
return registryManagerContractAddress;
}
/**
* @dev Initialization of a new project
* @param bytesParams (
* project_address: bytes(address),
* project_id: bytes(int),
* start_date: bytes(string),
* end_date: bytes(string)
* )
* @notice All parameters must be passed in bytes and opened in the contract as the required type
*/
function createProject(bytes[] memory bytesParams) public onlyOwner {
IRegistryManager(registryManagerContractAddress).createProject(bytesParams);
}
/**
* @dev Function to change end date parameter
* @param bytesParams (
* projectAddress: bytes(address),
* end_date: bytes(string)
* )
* @notice All parameters must be passed in bytes and opened in the contract as the required type
*/
function changeProjectEndDate(bytes[] memory bytesParams) public onlyOwner {
IRegistryManager(registryManagerContractAddress).changeProjectEndDate(bytesParams);
}
/**
* @dev Get project parameters
* @param bytesParams (
* project_address: bytes(address)
* )
* `projectAddress` parameter must be passed in bytes and opened in the contract as the required type
* @return projectId Returns `projectId`, `startDate`, `endDate` of a given project
* @return startDate Returns `projectId`, `startDate`, `endDate` of a given project
* @return endDate Returns `projectId`, `startDate`, `endDate` of a given project
*/
function getProject(bytes[] memory bytesParams) public view returns(uint projectId, uint startDate, uint endDate) {
return IRegistryManager(registryManagerContractAddress).getProject(bytesParams);
}
/**
* @dev create claim for a project (give FCRU to it)
* @param projectOutput (
* projectAddress: bytes(address),
* bundleId: bytes(string),
* bundleVolume: bytes(int),
* unitType: bytes(string),
* metadataUrl: bytes(string)
* projectAddress: bytes(address)
* )
* @param bufferOutput (
* bufferAddress: bytes(address),
* outputBundleId: bytes(string),
* bundleVolume: bytes(int),
* unitType: bytes(string),
* metadataUrl: bytes(string)
* projectAddress: bytes(address)
* )
* @notice All parameters must be passed in bytes and opened in the contract as the required type
*/
function processClaim(bytes[] memory projectOutput, bytes[] memory bufferOutput) public onlyOwner {
IRegistryManager(registryManagerContractAddress).processClaim(projectOutput, bufferOutput);
}
/**
* @dev assign tokens from the project to the holder
* @param projectInput (
* projectAddress: bytes(address),
* bundleId: bytes(string),
* bundleVolume: bytes(int),
* unitType: bytes(string),
* metadataUrl: bytes(string)
* projectAddress: bytes(address)
* )
* @param holderOutput (
* holderAddress: bytes(address),
* outputBundleId: bytes(string),
* bundleVolume: bytes(int),
* unitType: bytes(string),
* metadataUrl: bytes(string)
* projectAddress: bytes(address)
* )
* @notice All parameters must be passed in bytes and opened in the contract as the required type
*/
function assignProjectTokens(bytes[] memory projectInput, bytes[] memory holderOutput) public onlyOwner {
IRegistryManager(registryManagerContractAddress).assignTokens(projectInput, holderOutput);
}
} | 24,326 |
13 | // Create a mask with the highest `_len` bits set | function leftMask(uint8 _len) private pure returns (uint256 mask) {
assembly {
// solium-disable-previous-line security/no-inline-assembly
mask := sar(
sub(_len, 1),
0x8000000000000000000000000000000000000000000000000000000000000000
)
}
}
| function leftMask(uint8 _len) private pure returns (uint256 mask) {
assembly {
// solium-disable-previous-line security/no-inline-assembly
mask := sar(
sub(_len, 1),
0x8000000000000000000000000000000000000000000000000000000000000000
)
}
}
| 35,743 |
142 | // Equals to bytes4(keccak256("addOperationKey(address,address)")) | bytes4 private constant ADD_OPERATION_KEY = 0x9a7f6101;
| bytes4 private constant ADD_OPERATION_KEY = 0x9a7f6101;
| 24,756 |
272 | // price to mint in usd with 8 decimals | uint256 private mintPrice = 300000000000;
address private ownert = 0xd9d1688677FFE82f431EF6F5E7382123189c6C79;
AggregatorV3Interface internal priceFeed;
| uint256 private mintPrice = 300000000000;
address private ownert = 0xd9d1688677FFE82f431EF6F5E7382123189c6C79;
AggregatorV3Interface internal priceFeed;
| 6,167 |
6 | // Updates RGT distribution speeds for each pool given one `pool` whose balance should be refreshed. pool The pool whose balance should be refreshed. / | function refreshDistributionSpeeds(RariPool pool) external;
| function refreshDistributionSpeeds(RariPool pool) external;
| 12,151 |
64 | // Throws unless `msg.sender` is the current owner, an authorized operator, or theapproved address for this NFT. Throws if `_from` is not the current owner. Throws if `_to` isthe zero address. Throws if `_tokenId` is not a valid NFT. When transfer is complete, thisfunction checks if `_to` is a smart contract (code size > 0). If so, it calls`onERC721Received` on `_to` and throws if the return value is not`bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`. Transfers the ownership of an NFT from one address to another address. This function canbe changed to payable. _from The current owner of the NFT. _to The new owner. _tokenId The NFT | function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId,
bytes calldata _data
)
external
override
| function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId,
bytes calldata _data
)
external
override
| 36,845 |
57 | // Match storage (match details are indexed by [buyID][sellID]) | mapping(bytes32 => mapping(bytes32 => uint256)) public matchTimestamp;
| mapping(bytes32 => mapping(bytes32 => uint256)) public matchTimestamp;
| 56,475 |
74 | // for removing liquidity (returns ETH removed, ERC20 Removed) |
function removeLiquidity(
uint256 amount,
uint256 min_eth,
uint256 min_tokens,
uint256 deadline
|
function removeLiquidity(
uint256 amount,
uint256 min_eth,
uint256 min_tokens,
uint256 deadline
| 51,247 |
24 | // Current unique ballot ID | uint currentBallotId;
| uint currentBallotId;
| 48,476 |
67 | // Return tokens to the curator | TokenUtils.pushTokens(graphToken(), msg.sender, tokensOut);
emit GRTWithdrawn(_graphAccount, _subgraphNumber, msg.sender, curatorNSignal, tokensOut);
| TokenUtils.pushTokens(graphToken(), msg.sender, tokensOut);
emit GRTWithdrawn(_graphAccount, _subgraphNumber, msg.sender, curatorNSignal, tokensOut);
| 50,143 |
210 | // Function that allows multi Collateral to burn a certain number of synths from an account. account Account to burn synths from amount Number of synths / | function burn(address account, uint amount) external onlyInternalContracts {
super._internalBurn(account, amount);
}
| function burn(address account, uint amount) external onlyInternalContracts {
super._internalBurn(account, amount);
}
| 35,268 |
36 | // update the time gap between the distribution_intervalTime update the time in seconds / | function updateIntervalTime(uint256 _intervalTime) external onlyOwner {
intervalTime = _intervalTime;
emit UpdateIntervalTime(intervalTime);
}
| function updateIntervalTime(uint256 _intervalTime) external onlyOwner {
intervalTime = _intervalTime;
emit UpdateIntervalTime(intervalTime);
}
| 24,078 |
563 | // optimistically transfer tokens | if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out);
| if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out);
| 13,290 |
40 | // visit https:KickTheCoin.com | contract KickTheCoin {
address houseAddress;
address creator;
address owner;
address airDroper;
address lastPlayerToKickTheCoin;
uint kickerCount;
address firstKicker;
address secondKicker;
uint costToKickTheCoin;
uint numberOfBlocksPerKick;
uint targetBlockNumber;
// set to true when game contract should stop new games from starting
bool isSundown;
// The blocknumber at which the current sundown grace period will end
uint sundownGraceTargetBlock;
// The index is incremented on each new game (via initGame)
uint gameIndex;
uint currentValue;
mapping(address => uint) shares;
event LatestKicker(uint curGameIndex, address kicker, uint curVal, uint targetBlockNum);
event FirstKicker(uint curGameIndex, address kicker, uint curVal);
event SecondKicker(uint curGameIndex, address kicker, uint curVal);
event Withdraw(address kicker, uint curVal);
event Winner(uint curGameIndex, address winner, uint curVal);
modifier onlyBy(address _account)
{
require(msg.sender == _account);
_;
}
modifier onlyByOwnerAndOnlyIfGameIsNotActive() {
require(msg.sender == owner && !isGameActive());
_;
}
modifier onlyDuringNormalOperations() {
require(!isSundown);
_;
}
function KickTheCoin()
public
payable
{
creator = msg.sender;
owner = creator;
houseAddress = creator;
airDroper = creator;
gameIndex = 0;
isSundown = false;
costToKickTheCoin = 0.17 ether;
numberOfBlocksPerKick = 5;
initGame();
}
function()
public
payable
{
kickTheCoin();
}
function kickTheCoin()
public
payable
onlyDuringNormalOperations()
{
require(msg.value == costToKickTheCoin);
if (hasWinner()) {
storeWinnerShare();
initGame();
}
kickerCount += 1;
processKick();
lastPlayerToKickTheCoin = msg.sender;
targetBlockNumber = block.number + numberOfBlocksPerKick;
LatestKicker(gameIndex, msg.sender, currentValue, targetBlockNumber);
}
function withdrawShares()
public
{
if (hasWinner()) {
storeWinnerShare();
initGame();
}
pullShares(msg.sender);
}
function checkShares(address shareHolder)
public
constant
returns (uint)
{
return shares[shareHolder];
}
function isGameActive()
public
constant
returns (bool)
{
return targetBlockNumber >= block.number;
}
function hasWinner()
public
constant
returns (bool)
{
return currentValue > 0 && !isGameActive();
}
function getCurrentValue()
public
constant
returns (uint)
{
if (isGameActive()) {
return currentValue;
} else {
return 0;
}
}
function getLastKicker()
public
constant
returns (address)
{
if (isGameActive()) {
return lastPlayerToKickTheCoin;
} else {
return address(0);
}
}
function pullShares(address shareHolder)
public
{
var share = shares[shareHolder];
if (share == 0) {
return;
}
shares[shareHolder] = 0;
shareHolder.transfer(share);
Withdraw(shareHolder, share);
}
function airDrop(address player)
public
payable
onlyBy(airDroper)
{
player.transfer(1);
if (msg.value > 1) {
msg.sender.transfer(msg.value - 1);
}
}
function getTargetBlockNumber()
public
constant
returns (uint)
{
return targetBlockNumber;
}
function getBlocksLeftInCurrentKick()
public
constant
returns (uint)
{
if (targetBlockNumber < block.number) {
return 0;
}
return targetBlockNumber - block.number;
}
function getNumberOfBlocksPerKick()
public
constant
returns (uint)
{
return numberOfBlocksPerKick;
}
function getCostToKick()
public
constant
returns (uint)
{
return costToKickTheCoin;
}
function getCurrentBlockNumber()
public
constant
returns (uint)
{
return block.number;
}
function getGameIndex()
public
constant
returns (uint)
{
return gameIndex;
}
function changeOwner(address _newOwner)
public
onlyBy(owner)
{
owner = _newOwner;
}
function changeHouseAddress(address _newHouseAddress)
public
onlyBy(owner)
{
houseAddress = _newHouseAddress;
}
function changeAirDroper(address _airDroper)
public
onlyBy(owner)
{
airDroper = _airDroper;
}
function changeGameParameters(uint _costToKickTheCoin, uint _numberOfBlocksPerKick)
public
onlyByOwnerAndOnlyIfGameIsNotActive()
{
costToKickTheCoin = _costToKickTheCoin;
numberOfBlocksPerKick = _numberOfBlocksPerKick;
}
function sundown()
public
onlyByOwnerAndOnlyIfGameIsNotActive()
{
isSundown = true;
sundownGraceTargetBlock = block.number + 100000;
}
function gameIsSundown()
public
constant
returns (bool)
{
return isSundown;
}
function getSundownGraceTargetBlock()
public
constant
returns (uint)
{
return sundownGraceTargetBlock;
}
function sunrise()
public
onlyByOwnerAndOnlyIfGameIsNotActive()
{
isSundown = false;
sundownGraceTargetBlock = 0;
}
function clear()
public
{
if (isSundown &&
sundownGraceTargetBlock != 0 &&
sundownGraceTargetBlock < block.number) {
houseAddress.transfer(this.balance);
}
}
function initGame()
private
{
gameIndex += 1;
targetBlockNumber = 0;
currentValue = 0;
kickerCount = 0;
firstKicker = address(0);
secondKicker = address(0);
lastPlayerToKickTheCoin = address(0);
}
function storeWinnerShare()
private
{
var share = currentValue;
currentValue = 0;
shares[lastPlayerToKickTheCoin] += share;
if (share > 0) {
Winner(gameIndex, lastPlayerToKickTheCoin, share);
}
}
function setShares()
private
{
// 1.0% commission to the house
shares[houseAddress] += (msg.value * 10)/1000;
// 2.5% commission to first kicker
shares[firstKicker] += (msg.value * 25)/1000;
// 1.5% commission to second kicker
shares[secondKicker] += (msg.value * 15)/1000;
}
function processKick()
private
{
if (kickerCount == 1) {
currentValue = msg.value; // no commission on first kick
firstKicker = msg.sender;
FirstKicker(gameIndex, msg.sender, currentValue);
} else if (kickerCount == 2) {
currentValue += msg.value; // no commission on second kick
secondKicker = msg.sender;
SecondKicker(gameIndex, msg.sender, currentValue);
} else {
// 5% is used. 2.5% for first kicker, 1.5% for second, 1% for house
// leaving 95% for the winner
currentValue += (msg.value * 950)/1000;
setShares();
}
}
}
| contract KickTheCoin {
address houseAddress;
address creator;
address owner;
address airDroper;
address lastPlayerToKickTheCoin;
uint kickerCount;
address firstKicker;
address secondKicker;
uint costToKickTheCoin;
uint numberOfBlocksPerKick;
uint targetBlockNumber;
// set to true when game contract should stop new games from starting
bool isSundown;
// The blocknumber at which the current sundown grace period will end
uint sundownGraceTargetBlock;
// The index is incremented on each new game (via initGame)
uint gameIndex;
uint currentValue;
mapping(address => uint) shares;
event LatestKicker(uint curGameIndex, address kicker, uint curVal, uint targetBlockNum);
event FirstKicker(uint curGameIndex, address kicker, uint curVal);
event SecondKicker(uint curGameIndex, address kicker, uint curVal);
event Withdraw(address kicker, uint curVal);
event Winner(uint curGameIndex, address winner, uint curVal);
modifier onlyBy(address _account)
{
require(msg.sender == _account);
_;
}
modifier onlyByOwnerAndOnlyIfGameIsNotActive() {
require(msg.sender == owner && !isGameActive());
_;
}
modifier onlyDuringNormalOperations() {
require(!isSundown);
_;
}
function KickTheCoin()
public
payable
{
creator = msg.sender;
owner = creator;
houseAddress = creator;
airDroper = creator;
gameIndex = 0;
isSundown = false;
costToKickTheCoin = 0.17 ether;
numberOfBlocksPerKick = 5;
initGame();
}
function()
public
payable
{
kickTheCoin();
}
function kickTheCoin()
public
payable
onlyDuringNormalOperations()
{
require(msg.value == costToKickTheCoin);
if (hasWinner()) {
storeWinnerShare();
initGame();
}
kickerCount += 1;
processKick();
lastPlayerToKickTheCoin = msg.sender;
targetBlockNumber = block.number + numberOfBlocksPerKick;
LatestKicker(gameIndex, msg.sender, currentValue, targetBlockNumber);
}
function withdrawShares()
public
{
if (hasWinner()) {
storeWinnerShare();
initGame();
}
pullShares(msg.sender);
}
function checkShares(address shareHolder)
public
constant
returns (uint)
{
return shares[shareHolder];
}
function isGameActive()
public
constant
returns (bool)
{
return targetBlockNumber >= block.number;
}
function hasWinner()
public
constant
returns (bool)
{
return currentValue > 0 && !isGameActive();
}
function getCurrentValue()
public
constant
returns (uint)
{
if (isGameActive()) {
return currentValue;
} else {
return 0;
}
}
function getLastKicker()
public
constant
returns (address)
{
if (isGameActive()) {
return lastPlayerToKickTheCoin;
} else {
return address(0);
}
}
function pullShares(address shareHolder)
public
{
var share = shares[shareHolder];
if (share == 0) {
return;
}
shares[shareHolder] = 0;
shareHolder.transfer(share);
Withdraw(shareHolder, share);
}
function airDrop(address player)
public
payable
onlyBy(airDroper)
{
player.transfer(1);
if (msg.value > 1) {
msg.sender.transfer(msg.value - 1);
}
}
function getTargetBlockNumber()
public
constant
returns (uint)
{
return targetBlockNumber;
}
function getBlocksLeftInCurrentKick()
public
constant
returns (uint)
{
if (targetBlockNumber < block.number) {
return 0;
}
return targetBlockNumber - block.number;
}
function getNumberOfBlocksPerKick()
public
constant
returns (uint)
{
return numberOfBlocksPerKick;
}
function getCostToKick()
public
constant
returns (uint)
{
return costToKickTheCoin;
}
function getCurrentBlockNumber()
public
constant
returns (uint)
{
return block.number;
}
function getGameIndex()
public
constant
returns (uint)
{
return gameIndex;
}
function changeOwner(address _newOwner)
public
onlyBy(owner)
{
owner = _newOwner;
}
function changeHouseAddress(address _newHouseAddress)
public
onlyBy(owner)
{
houseAddress = _newHouseAddress;
}
function changeAirDroper(address _airDroper)
public
onlyBy(owner)
{
airDroper = _airDroper;
}
function changeGameParameters(uint _costToKickTheCoin, uint _numberOfBlocksPerKick)
public
onlyByOwnerAndOnlyIfGameIsNotActive()
{
costToKickTheCoin = _costToKickTheCoin;
numberOfBlocksPerKick = _numberOfBlocksPerKick;
}
function sundown()
public
onlyByOwnerAndOnlyIfGameIsNotActive()
{
isSundown = true;
sundownGraceTargetBlock = block.number + 100000;
}
function gameIsSundown()
public
constant
returns (bool)
{
return isSundown;
}
function getSundownGraceTargetBlock()
public
constant
returns (uint)
{
return sundownGraceTargetBlock;
}
function sunrise()
public
onlyByOwnerAndOnlyIfGameIsNotActive()
{
isSundown = false;
sundownGraceTargetBlock = 0;
}
function clear()
public
{
if (isSundown &&
sundownGraceTargetBlock != 0 &&
sundownGraceTargetBlock < block.number) {
houseAddress.transfer(this.balance);
}
}
function initGame()
private
{
gameIndex += 1;
targetBlockNumber = 0;
currentValue = 0;
kickerCount = 0;
firstKicker = address(0);
secondKicker = address(0);
lastPlayerToKickTheCoin = address(0);
}
function storeWinnerShare()
private
{
var share = currentValue;
currentValue = 0;
shares[lastPlayerToKickTheCoin] += share;
if (share > 0) {
Winner(gameIndex, lastPlayerToKickTheCoin, share);
}
}
function setShares()
private
{
// 1.0% commission to the house
shares[houseAddress] += (msg.value * 10)/1000;
// 2.5% commission to first kicker
shares[firstKicker] += (msg.value * 25)/1000;
// 1.5% commission to second kicker
shares[secondKicker] += (msg.value * 15)/1000;
}
function processKick()
private
{
if (kickerCount == 1) {
currentValue = msg.value; // no commission on first kick
firstKicker = msg.sender;
FirstKicker(gameIndex, msg.sender, currentValue);
} else if (kickerCount == 2) {
currentValue += msg.value; // no commission on second kick
secondKicker = msg.sender;
SecondKicker(gameIndex, msg.sender, currentValue);
} else {
// 5% is used. 2.5% for first kicker, 1.5% for second, 1% for house
// leaving 95% for the winner
currentValue += (msg.value * 950)/1000;
setShares();
}
}
}
| 32,564 |
1 | // Current owner address. / | address public owner;
| address public owner;
| 10,709 |
34 | // Store the function selector of `TransferFromFailed()`. | mstore(0x00, 0x7939f424)
| mstore(0x00, 0x7939f424)
| 35,202 |
21 | // Functions with this modifier can only be executed by the owner | modifier onlyOwner() {
require (msg.sender == owner);
_;
}
| modifier onlyOwner() {
require (msg.sender == owner);
_;
}
| 31,000 |
28 | // create a stash to handle extra incentives | address stash = IStashFactory(stashFactory).createStash(
pid,
_gauge,
staker
);
if (stash == address(0)) {
revert InvalidStash();
}
| address stash = IStashFactory(stashFactory).createStash(
pid,
_gauge,
staker
);
if (stash == address(0)) {
revert InvalidStash();
}
| 9,821 |
34 | // https:forum.makerdao.com/t/mip10c9-sp8-whitelist-ddex-on-wbtcusd-oracle/4094 | MedianAbstract(BTCUSD).kiss(DDEX);
| MedianAbstract(BTCUSD).kiss(DDEX);
| 51,047 |
109 | // Increment the reward to transfer | rewardInDexTokenToTransfer += rewardForTicketId;
| rewardInDexTokenToTransfer += rewardForTicketId;
| 33,939 |
88 | // default function for foundation input miner coins. / | function()external payable{
}
| function()external payable{
}
| 56,506 |
1 | // opyn oracle address | IOracle public oracle;
| IOracle public oracle;
| 3,447 |
24 | // number of user registred / | function userCount() public view returns (uint256) {
return userCount;
}
| function userCount() public view returns (uint256) {
return userCount;
}
| 38,595 |
14 | // Complete Sets Exposes functions to purchase or sell complete sets of shares for a market / | contract CompleteSets is Initializable, ReentrancyGuard, ICompleteSets {
using SafeMathUint256 for uint256;
IAugur public augur;
ICash public cash;
address public fillOrder;
function initialize(IAugur _augur) public beforeInitialized {
endInitialization();
augur = _augur;
fillOrder = augur.lookup("FillOrder");
cash = ICash(augur.lookup("Cash"));
}
/**
* @notice Buy some amount of complete sets for a market
* @param _market The market to purchase complete sets in
* @param _amount The number of complete sets to purchase
* @return Bool True
*/
function publicBuyCompleteSets(IMarket _market, uint256 _amount) external returns (bool) {
this.buyCompleteSets(msg.sender, _market, _amount);
augur.logCompleteSetsPurchased(_market.getUniverse(), _market, msg.sender, _amount);
_market.assertBalances();
return true;
}
function buyCompleteSets(address _sender, IMarket _market, uint256 _amount) external nonReentrant returns (bool) {
require(augur.isKnownMarket(_market));
require(msg.sender == fillOrder || msg.sender == address(this) || _market.getUniverse().isOpenInterestCash(msg.sender));
require(_sender != address(0));
uint256 _numOutcomes = _market.getNumberOfOutcomes();
uint256 _cost = _amount.mul(_market.getNumTicks());
IUniverse _universe = _market.getUniverse();
_universe.deposit(_sender, _cost, address(_market));
for (uint256 _outcome = 0; _outcome < _numOutcomes; ++_outcome) {
_market.getShareToken(_outcome).createShares(_sender, _amount);
}
if (!_market.isFinalized()) {
_universe.incrementOpenInterest(_cost);
}
augur.logMarketOIChanged(_universe, _market);
return true;
}
function jointBuyCompleteSets(IMarket _market, uint256 _amount, address _longParticipant, address _shortParticipant, uint256 _longOutcome, address _longRecipient, address _shortRecipient, uint256 _price) external nonReentrant {
require(augur.isKnownMarket(_market));
require(msg.sender == fillOrder);
uint256 _cost = _amount.mul(_market.getNumTicks());
uint256 _longCost = _amount.mul(_price);
uint256 _shortCost = _cost.sub(_longCost);
IUniverse _universe = _market.getUniverse();
// Transfer cost from both participants. If the funds were already escrowed in the market do nothing.
if (_longParticipant != address(_market)) {
_universe.deposit(_longParticipant, _longCost, address(_market));
}
if (_shortParticipant != address(_market)) {
_universe.deposit(_shortParticipant, _shortCost, address(_market));
}
// Mint shares as specified to recipients
_market.getShareToken(_longOutcome).createShares(_longRecipient, _amount);
for (uint256 _outcome = 0; _outcome < _market.getNumberOfOutcomes(); ++_outcome) {
if (_longOutcome == _outcome) {
continue;
}
_market.getShareToken(_outcome).createShares(_shortRecipient, _amount);
}
if (!_market.isFinalized()) {
_universe.incrementOpenInterest(_cost);
}
augur.logMarketOIChanged(_universe, _market);
}
/**
* @notice Sell some amount of complete sets for a market
* @param _market The market to sell complete sets in
* @param _amount The number of complete sets to sell
* @return Bool True
*/
function publicSellCompleteSets(IMarket _market, uint256 _amount) external returns (bool) {
(uint256 _creatorFee, uint256 _reportingFee) = this.sellCompleteSets(msg.sender, _market, _amount, address(0));
augur.logCompleteSetsSold(_market.getUniverse(), _market, msg.sender, _amount, _creatorFee.add(_reportingFee));
_market.assertBalances();
return true;
}
function sellCompleteSets(address _sender, IMarket _market, uint256 _amount, address _affiliateAddress) external nonReentrant returns (uint256 _creatorFee, uint256 _reportingFee) {
require(augur.isKnownMarket(_market));
require(msg.sender == fillOrder || msg.sender == address(this));
require(_sender != address(0));
uint256 _numOutcomes = _market.getNumberOfOutcomes();
uint256 _payout = _amount.mul(_market.getNumTicks());
IUniverse _universe = _market.getUniverse();
if (!_market.isFinalized()) {
_universe.decrementOpenInterest(_payout);
}
_creatorFee = _market.deriveMarketCreatorFeeAmount(_payout);
uint256 _reportingFeeDivisor = _universe.getOrCacheReportingFeeDivisor();
_reportingFee = _payout.div(_reportingFeeDivisor);
_payout = _payout.sub(_creatorFee).sub(_reportingFee);
// Takes shares away from participant and decreases the amount issued in the market since we're exchanging complete sets
for (uint256 _outcome = 0; _outcome < _numOutcomes; ++_outcome) {
_market.getShareToken(_outcome).destroyShares(_sender, _amount);
}
if (_creatorFee != 0) {
_market.recordMarketCreatorFees(_creatorFee, _affiliateAddress);
}
_market.getUniverse().withdraw(address(this), _payout.add(_reportingFee), address(_market));
if (_reportingFee != 0) {
require(cash.transfer(address(_universe.getOrCreateNextDisputeWindow(false)), _reportingFee));
}
require(cash.transfer(_sender, _payout));
augur.logMarketOIChanged(_universe, _market);
return (_creatorFee, _reportingFee);
}
function jointSellCompleteSets(IMarket _market, uint256 _amount, address _shortParticipant, address _longParticipant, uint256 _shortOutcome, address _shortRecipient, address _longRecipient, uint256 _price, address _affiliateAddress) external nonReentrant returns (uint256 _creatorFee, uint256 _reportingFee) {
require(augur.isKnownMarket(_market));
require(msg.sender == fillOrder);
uint256 _payout = _amount.mul(_market.getNumTicks());
IUniverse _universe = _market.getUniverse();
if (!_market.isFinalized()) {
_universe.decrementOpenInterest(_payout);
}
_creatorFee = _market.deriveMarketCreatorFeeAmount(_payout);
_reportingFee = _payout.div(_universe.getOrCacheReportingFeeDivisor());
_payout = _payout.sub(_creatorFee).sub(_reportingFee);
// Takes shares away from participants
_market.getShareToken(_shortOutcome).destroyShares(_shortParticipant, _amount);
for (uint256 _outcome = 0; _outcome < _market.getNumberOfOutcomes(); ++_outcome) {
if (_outcome == _shortOutcome) {
continue;
}
_market.getShareToken(_outcome).destroyShares(_longParticipant, _amount);
}
distributePayout(_market, _price, _shortRecipient, _longRecipient, _payout, _creatorFee, _reportingFee, _affiliateAddress);
augur.logMarketOIChanged(_universe, _market);
return (_creatorFee, _reportingFee);
}
function distributePayout(IMarket _market, uint256 _price, address _shortRecipient, address _longRecipient, uint256 _payout, uint256 _creatorFee, uint256 _reportingFee, address _affiliateAddress) private {
// Distribute fees
if (_creatorFee != 0) {
_market.recordMarketCreatorFees(_creatorFee, _affiliateAddress);
}
_market.getUniverse().withdraw(address(this), _payout.add(_reportingFee), address(_market));
if (_reportingFee != 0) {
require(cash.transfer(address(_market.getUniverse().getOrCreateNextDisputeWindow(false)), _reportingFee));
}
// Distribute cash to the recipients
uint256 _shortPayout = _payout.mul(_price) / _market.getNumTicks();
require(cash.transfer(_shortRecipient, _shortPayout));
require(cash.transfer(_longRecipient, _payout.sub(_shortPayout)));
}
}
| contract CompleteSets is Initializable, ReentrancyGuard, ICompleteSets {
using SafeMathUint256 for uint256;
IAugur public augur;
ICash public cash;
address public fillOrder;
function initialize(IAugur _augur) public beforeInitialized {
endInitialization();
augur = _augur;
fillOrder = augur.lookup("FillOrder");
cash = ICash(augur.lookup("Cash"));
}
/**
* @notice Buy some amount of complete sets for a market
* @param _market The market to purchase complete sets in
* @param _amount The number of complete sets to purchase
* @return Bool True
*/
function publicBuyCompleteSets(IMarket _market, uint256 _amount) external returns (bool) {
this.buyCompleteSets(msg.sender, _market, _amount);
augur.logCompleteSetsPurchased(_market.getUniverse(), _market, msg.sender, _amount);
_market.assertBalances();
return true;
}
function buyCompleteSets(address _sender, IMarket _market, uint256 _amount) external nonReentrant returns (bool) {
require(augur.isKnownMarket(_market));
require(msg.sender == fillOrder || msg.sender == address(this) || _market.getUniverse().isOpenInterestCash(msg.sender));
require(_sender != address(0));
uint256 _numOutcomes = _market.getNumberOfOutcomes();
uint256 _cost = _amount.mul(_market.getNumTicks());
IUniverse _universe = _market.getUniverse();
_universe.deposit(_sender, _cost, address(_market));
for (uint256 _outcome = 0; _outcome < _numOutcomes; ++_outcome) {
_market.getShareToken(_outcome).createShares(_sender, _amount);
}
if (!_market.isFinalized()) {
_universe.incrementOpenInterest(_cost);
}
augur.logMarketOIChanged(_universe, _market);
return true;
}
function jointBuyCompleteSets(IMarket _market, uint256 _amount, address _longParticipant, address _shortParticipant, uint256 _longOutcome, address _longRecipient, address _shortRecipient, uint256 _price) external nonReentrant {
require(augur.isKnownMarket(_market));
require(msg.sender == fillOrder);
uint256 _cost = _amount.mul(_market.getNumTicks());
uint256 _longCost = _amount.mul(_price);
uint256 _shortCost = _cost.sub(_longCost);
IUniverse _universe = _market.getUniverse();
// Transfer cost from both participants. If the funds were already escrowed in the market do nothing.
if (_longParticipant != address(_market)) {
_universe.deposit(_longParticipant, _longCost, address(_market));
}
if (_shortParticipant != address(_market)) {
_universe.deposit(_shortParticipant, _shortCost, address(_market));
}
// Mint shares as specified to recipients
_market.getShareToken(_longOutcome).createShares(_longRecipient, _amount);
for (uint256 _outcome = 0; _outcome < _market.getNumberOfOutcomes(); ++_outcome) {
if (_longOutcome == _outcome) {
continue;
}
_market.getShareToken(_outcome).createShares(_shortRecipient, _amount);
}
if (!_market.isFinalized()) {
_universe.incrementOpenInterest(_cost);
}
augur.logMarketOIChanged(_universe, _market);
}
/**
* @notice Sell some amount of complete sets for a market
* @param _market The market to sell complete sets in
* @param _amount The number of complete sets to sell
* @return Bool True
*/
function publicSellCompleteSets(IMarket _market, uint256 _amount) external returns (bool) {
(uint256 _creatorFee, uint256 _reportingFee) = this.sellCompleteSets(msg.sender, _market, _amount, address(0));
augur.logCompleteSetsSold(_market.getUniverse(), _market, msg.sender, _amount, _creatorFee.add(_reportingFee));
_market.assertBalances();
return true;
}
function sellCompleteSets(address _sender, IMarket _market, uint256 _amount, address _affiliateAddress) external nonReentrant returns (uint256 _creatorFee, uint256 _reportingFee) {
require(augur.isKnownMarket(_market));
require(msg.sender == fillOrder || msg.sender == address(this));
require(_sender != address(0));
uint256 _numOutcomes = _market.getNumberOfOutcomes();
uint256 _payout = _amount.mul(_market.getNumTicks());
IUniverse _universe = _market.getUniverse();
if (!_market.isFinalized()) {
_universe.decrementOpenInterest(_payout);
}
_creatorFee = _market.deriveMarketCreatorFeeAmount(_payout);
uint256 _reportingFeeDivisor = _universe.getOrCacheReportingFeeDivisor();
_reportingFee = _payout.div(_reportingFeeDivisor);
_payout = _payout.sub(_creatorFee).sub(_reportingFee);
// Takes shares away from participant and decreases the amount issued in the market since we're exchanging complete sets
for (uint256 _outcome = 0; _outcome < _numOutcomes; ++_outcome) {
_market.getShareToken(_outcome).destroyShares(_sender, _amount);
}
if (_creatorFee != 0) {
_market.recordMarketCreatorFees(_creatorFee, _affiliateAddress);
}
_market.getUniverse().withdraw(address(this), _payout.add(_reportingFee), address(_market));
if (_reportingFee != 0) {
require(cash.transfer(address(_universe.getOrCreateNextDisputeWindow(false)), _reportingFee));
}
require(cash.transfer(_sender, _payout));
augur.logMarketOIChanged(_universe, _market);
return (_creatorFee, _reportingFee);
}
function jointSellCompleteSets(IMarket _market, uint256 _amount, address _shortParticipant, address _longParticipant, uint256 _shortOutcome, address _shortRecipient, address _longRecipient, uint256 _price, address _affiliateAddress) external nonReentrant returns (uint256 _creatorFee, uint256 _reportingFee) {
require(augur.isKnownMarket(_market));
require(msg.sender == fillOrder);
uint256 _payout = _amount.mul(_market.getNumTicks());
IUniverse _universe = _market.getUniverse();
if (!_market.isFinalized()) {
_universe.decrementOpenInterest(_payout);
}
_creatorFee = _market.deriveMarketCreatorFeeAmount(_payout);
_reportingFee = _payout.div(_universe.getOrCacheReportingFeeDivisor());
_payout = _payout.sub(_creatorFee).sub(_reportingFee);
// Takes shares away from participants
_market.getShareToken(_shortOutcome).destroyShares(_shortParticipant, _amount);
for (uint256 _outcome = 0; _outcome < _market.getNumberOfOutcomes(); ++_outcome) {
if (_outcome == _shortOutcome) {
continue;
}
_market.getShareToken(_outcome).destroyShares(_longParticipant, _amount);
}
distributePayout(_market, _price, _shortRecipient, _longRecipient, _payout, _creatorFee, _reportingFee, _affiliateAddress);
augur.logMarketOIChanged(_universe, _market);
return (_creatorFee, _reportingFee);
}
function distributePayout(IMarket _market, uint256 _price, address _shortRecipient, address _longRecipient, uint256 _payout, uint256 _creatorFee, uint256 _reportingFee, address _affiliateAddress) private {
// Distribute fees
if (_creatorFee != 0) {
_market.recordMarketCreatorFees(_creatorFee, _affiliateAddress);
}
_market.getUniverse().withdraw(address(this), _payout.add(_reportingFee), address(_market));
if (_reportingFee != 0) {
require(cash.transfer(address(_market.getUniverse().getOrCreateNextDisputeWindow(false)), _reportingFee));
}
// Distribute cash to the recipients
uint256 _shortPayout = _payout.mul(_price) / _market.getNumTicks();
require(cash.transfer(_shortRecipient, _shortPayout));
require(cash.transfer(_longRecipient, _payout.sub(_shortPayout)));
}
}
| 49,310 |
286 | // round 0 | t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 14397397413755236225575615486459253198602422701513067526754101844196324375522)
t0, t1, t2, t3, t4 := sbox_full(t0, t1, t2, t3, t4, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 14397397413755236225575615486459253198602422701513067526754101844196324375522)
t0, t1, t2, t3, t4 := sbox_full(t0, t1, t2, t3, t4, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| 51,120 |
15 | // Set reward token and claim contract, get from Curve's registry | function setFeeInfo() external {
require(msg.sender==feeManager, "!auth");
feeDistro = IRegistry(registry).get_address(distributionAddressId);
address _feeToken = IFeeDistro(feeDistro).token();
if(feeToken != _feeToken){
//create a new reward contract for the new token
lockFees = IRewardFactory(rewardFactory).CreateTokenRewards(_feeToken,lockRewards,address(this));
feeToken = _feeToken;
}
}
| function setFeeInfo() external {
require(msg.sender==feeManager, "!auth");
feeDistro = IRegistry(registry).get_address(distributionAddressId);
address _feeToken = IFeeDistro(feeDistro).token();
if(feeToken != _feeToken){
//create a new reward contract for the new token
lockFees = IRewardFactory(rewardFactory).CreateTokenRewards(_feeToken,lockRewards,address(this));
feeToken = _feeToken;
}
}
| 34,963 |
22 | // Multiplies two numbers, reverts on overflow. _factor1 Factor number. _factor2 Factor number.return The product of the two factors. / | function mul(
uint256 _factor1,
uint256 _factor2
)
internal
pure
| function mul(
uint256 _factor1,
uint256 _factor2
)
internal
pure
| 5,098 |
1 | // Address of the Aave V2 weth gateway contract | IWETHGateway public immutable wethGateway;
| IWETHGateway public immutable wethGateway;
| 26,724 |
73 | // Version | version = 1;
| version = 1;
| 7,956 |
19 | // Collect new funds into reserve | CurationPool storage curationPool = pools[_subgraphDeploymentID];
curationPool.tokens = curationPool.tokens.add(_tokens);
emit Collected(_subgraphDeploymentID, _tokens);
| CurationPool storage curationPool = pools[_subgraphDeploymentID];
curationPool.tokens = curationPool.tokens.add(_tokens);
emit Collected(_subgraphDeploymentID, _tokens);
| 22,429 |
360 | // Constructor inherits VRFConsumerBase Network: RinkebyChainlink VRF Coordinator address: 0xb3dCcb4Cf7a26f6cf6B120Cf5A73875B7BBc655BLINK token address:0x01BE23585060835E02B77ef475b0Cc51aA1e0709Key Hash: 0x2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c1311 / | constructor()
public
VRFConsumerBase(
0xb3dCcb4Cf7a26f6cf6B120Cf5A73875B7BBc655B, // VRF Coordinator
0x01BE23585060835E02B77ef475b0Cc51aA1e0709 // LINK Token
)
| constructor()
public
VRFConsumerBase(
0xb3dCcb4Cf7a26f6cf6B120Cf5A73875B7BBc655B, // VRF Coordinator
0x01BE23585060835E02B77ef475b0Cc51aA1e0709 // LINK Token
)
| 6,228 |
114 | // calculate player earning from their own buy (only based on the keys they just bought).& update player earnings mask | uint256 _pearn = (_ppt.mul(_keys)) / (1000000000000000000);
plyrRnds_[_pID][_rID].mask = (((round_[_rID].mask.mul(_keys)) / (1000000000000000000)).sub(_pearn)).add(plyrRnds_[_pID][_rID].mask);
| uint256 _pearn = (_ppt.mul(_keys)) / (1000000000000000000);
plyrRnds_[_pID][_rID].mask = (((round_[_rID].mask.mul(_keys)) / (1000000000000000000)).sub(_pearn)).add(plyrRnds_[_pID][_rID].mask);
| 6,939 |
348 | // Type could not be Invalid, thus this condition says us that type was not cached before | if (syntheticType != SyntheticTypes.Invalid) {
return;
}
| if (syntheticType != SyntheticTypes.Invalid) {
return;
}
| 59,326 |
181 | // mint tokens ._amount amount of token to mint _beneficiary beneficiary addressreturn bool which represents a success / | function mintTokens(uint256 _amount, address _beneficiary, address _avatar)
external
onlyRegisteredScheme
onlySubjectToConstraint("mintTokens")
isAvatarValid(_avatar)
returns(bool)
| function mintTokens(uint256 _amount, address _beneficiary, address _avatar)
external
onlyRegisteredScheme
onlySubjectToConstraint("mintTokens")
isAvatarValid(_avatar)
returns(bool)
| 7,631 |
69 | // the non static callback should not return empty ctx | if (CallUtils.isValidAbiEncodedBytes(returnedData)) {
newCtx = abi.decode(returnedData, (bytes));
if (!_isCtxValid(newCtx)) {
if (!isTermination) {
revert APP_RULE(SuperAppDefinitions.APP_RULE_CTX_IS_READONLY);
} else {
| if (CallUtils.isValidAbiEncodedBytes(returnedData)) {
newCtx = abi.decode(returnedData, (bytes));
if (!_isCtxValid(newCtx)) {
if (!isTermination) {
revert APP_RULE(SuperAppDefinitions.APP_RULE_CTX_IS_READONLY);
} else {
| 33,753 |
8 | // Provide more token 1 and token 2 into the pool - Expands the pool 1. Calculate LP token for LP provider2. Reduce amount token1 and token2 from user balances 3. Increase the total amount token 1 and token 2 4. Calculate new constant 5. Increase total amount of LP tokens in pool 6. Assign the LP token calculated into user's LP token balances/ | function provideLiquidity(uint256 _amountToken1, uint256 _amountToken2) validAmountCheck(token_1_balance, _amountToken1) validAmountCheck(token_2_balance, _amountToken2) public returns(uint256 LP_token){
LP_token = _amountToken1 + _amountToken2;
require(LP_token > 0, "Asset value less than threshold for contribution!");
token_1_balance[msg.sender] -= _amountToken1;
token_2_balance[msg.sender] -= _amountToken2;
liquidityPool.total_token_1 += _amountToken1;
liquidityPool.total_token_2 += _amountToken2;
liquidityPool.K = liquidityPool.total_token_1.mul(liquidityPool.total_token_2);
liquidityPool.total_LPTokens += LP_token;
LP_Tokens[msg.sender] += LP_token;
}
| function provideLiquidity(uint256 _amountToken1, uint256 _amountToken2) validAmountCheck(token_1_balance, _amountToken1) validAmountCheck(token_2_balance, _amountToken2) public returns(uint256 LP_token){
LP_token = _amountToken1 + _amountToken2;
require(LP_token > 0, "Asset value less than threshold for contribution!");
token_1_balance[msg.sender] -= _amountToken1;
token_2_balance[msg.sender] -= _amountToken2;
liquidityPool.total_token_1 += _amountToken1;
liquidityPool.total_token_2 += _amountToken2;
liquidityPool.K = liquidityPool.total_token_1.mul(liquidityPool.total_token_2);
liquidityPool.total_LPTokens += LP_token;
LP_Tokens[msg.sender] += LP_token;
}
| 40,537 |
244 | // Add minter/burner | function grantMinterBurnerRoles(address account) public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), 'sXPZ: Need DEFAULT_ADMIN_ROLE ser!');
grantRole(MINTER_ROLE, account);
grantRole(BURNER_ROLE, account);
}
| function grantMinterBurnerRoles(address account) public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), 'sXPZ: Need DEFAULT_ADMIN_ROLE ser!');
grantRole(MINTER_ROLE, account);
grantRole(BURNER_ROLE, account);
}
| 9,199 |
8 | // ICHI tokens created per block. | uint256 public ichiPerBlock;
| uint256 public ichiPerBlock;
| 40,093 |
5 | // Returns the number of Sponsorships assigned to the context.Returns the number of Sponsorships assigned to the context.contextName The context's name./ | function totalContextBalance(bytes32 contextName)
external
view
returns (uint256)
| function totalContextBalance(bytes32 contextName)
external
view
returns (uint256)
| 49,438 |
20 | // Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend)./ | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
| function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
| 13,474 |
4 | // ADD DAILY TICKETS | dailyTicketPurchases storage dailyPurchases = dailyTicketsBoughtByPlayer[msg.sender];
| dailyTicketPurchases storage dailyPurchases = dailyTicketsBoughtByPlayer[msg.sender];
| 10,486 |
180 | // compare the root of two Nodees / | function isSameRootNode(uint32 _node1, uint32 _node2)
external
view
returns (uint8);
| function isSameRootNode(uint32 _node1, uint32 _node2)
external
view
returns (uint8);
| 5,428 |
136 | // Allows the pendingAdmin address to finalize the change admin process. / | function claimAdmin() public {
require(pendingAdmin == msg.sender, "not pending");
emit AdminClaimed(pendingAdmin, admin);
admin = pendingAdmin;
pendingAdmin = address(0);
}
| function claimAdmin() public {
require(pendingAdmin == msg.sender, "not pending");
emit AdminClaimed(pendingAdmin, admin);
admin = pendingAdmin;
pendingAdmin = address(0);
}
| 13,664 |
33 | // Due to the high interest rate for the first two years, compounding should be taken into account. Effective annual interest rate = (1 + (nominal rate / number of compounding periods)) ^ (number of compounding periods) - 1 | if((_now.sub(stakeStartTime)).div(1 years) == 0) {
| if((_now.sub(stakeStartTime)).div(1 years) == 0) {
| 45,692 |
18 | // can't call this method if you are already delegate | require(!isDelegate[msg.sender]);
isDelegate[msg.sender] = true;
allDelegates.push(Delegate({
user: msg.sender,
storageHash: _storageHash,
exists: true
}));
| require(!isDelegate[msg.sender]);
isDelegate[msg.sender] = true;
allDelegates.push(Delegate({
user: msg.sender,
storageHash: _storageHash,
exists: true
}));
| 21,991 |
1,198 | // 601 | entry "agrief" : ENG_ADVERB
| entry "agrief" : ENG_ADVERB
| 21,437 |
13 | // Set max negative PnL % on trade opening | function setMaxNegativePnlOnOpenP(uint value) external onlyManager{
maxNegativePnlOnOpenP = value;
emit MaxNegativePnlOnOpenPUpdated(value);
}
| function setMaxNegativePnlOnOpenP(uint value) external onlyManager{
maxNegativePnlOnOpenP = value;
emit MaxNegativePnlOnOpenPUpdated(value);
}
| 19,958 |
45 | // return The result of safely dividing x and y. The return value is a highprecision decimal.y is divided after the product of x and the standard precision unitis evaluated, so the product of x and UNIT must be less than 2256. Asthis is an integer division, the result is always rounded down.This helps save on gas. Rounding is more expensive on gas. / | function divideDecimal(uint x, uint y) internal pure returns (uint) {
/* Reintroduce the UNIT factor that will be divided out by y. */
return x.mul(UNIT).div(y);
}
| function divideDecimal(uint x, uint y) internal pure returns (uint) {
/* Reintroduce the UNIT factor that will be divided out by y. */
return x.mul(UNIT).div(y);
}
| 2,162 |
47 | // can later be changed with {transferOwnership}./ Initializes the contract setting the deployer as the initial owner. / | constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
| constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
| 2,398 |
0 | // compaign that store these information | struct Campaign{
address owner;
string title;
string description;
uint256 target;
uint256 deadline;
uint256 amountCollected;
string image;
address[] donators;
uint256[] donations;
}
| struct Campaign{
address owner;
string title;
string description;
uint256 target;
uint256 deadline;
uint256 amountCollected;
string image;
address[] donators;
uint256[] donations;
}
| 12,492 |
94 | // ===== Modifiers ===== | modifier onlyPendingGovernance() {
require(msg.sender == pendingGovernance, "onlyPendingGovernance");
_;
}
| modifier onlyPendingGovernance() {
require(msg.sender == pendingGovernance, "onlyPendingGovernance");
_;
}
| 28,702 |
80 | // change the minimum amount of tokens to sell from fees | function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool){
require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply.");
require(newAmount <= totalSupply() * 5 / 1000, "Swap amount cannot be higher than 0.5% total supply.");
swapTokensAtAmount = newAmount;
return true;
}
| function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool){
require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply.");
require(newAmount <= totalSupply() * 5 / 1000, "Swap amount cannot be higher than 0.5% total supply.");
swapTokensAtAmount = newAmount;
return true;
}
| 45,956 |
57 | // Only monitor contract is able to call execute on users proxy/_owner Address of cdp owner (users DSProxy address)/_aaveSaverProxy Address of AaveSaverProxy/_data Data to send to AaveSaverProxy | function callExecute(address _owner, address _aaveSaverProxy, bytes memory _data) public payable onlyMonitor {
// execute reverts if calling specific method fails
DSProxyInterface(_owner).execute{value: msg.value}(_aaveSaverProxy, _data);
// return if anything left
if (address(this).balance > 0) {
msg.sender.transfer(address(this).balance);
}
}
| function callExecute(address _owner, address _aaveSaverProxy, bytes memory _data) public payable onlyMonitor {
// execute reverts if calling specific method fails
DSProxyInterface(_owner).execute{value: msg.value}(_aaveSaverProxy, _data);
// return if anything left
if (address(this).balance > 0) {
msg.sender.transfer(address(this).balance);
}
}
| 2,639 |
0 | // The two choices for your vote. Note that these are just symbolic and for display purposes only.In practice, the user | string public choice1;
string public choice2;
| string public choice1;
string public choice2;
| 11,114 |
233 | // transfer to op account | opVaultAddr.transfer(opEth);
| opVaultAddr.transfer(opEth);
| 77,323 |
19 | // The ACO factory address. / | address public acoFactory;
| address public acoFactory;
| 873 |
52 | // variable for staking pause and unpause mechanism | bool public paused = false;
| bool public paused = false;
| 22,892 |
10 | // ready is a list large enough to hold all possible gauges count is the number of ready gauges that were inserted into ready this assembly shrinks ready to length count such that it removes empty elements | assembly {
mstore(ready, count)
}
| assembly {
mstore(ready, count)
}
| 14,352 |
49 | // The event fires every time a new buyer enters the fundraiser._address The address of the buyer. _ethers The number of ethers funded. _tokens The number of tokens purchased. / | event FundsReceived(address indexed _address, uint _ethers, uint _tokens);
| event FundsReceived(address indexed _address, uint _ethers, uint _tokens);
| 11,251 |
228 | // Read the length of a CBOR indifinite-length item (arrays, maps, byte strings and text) from a buffer, consuming/ as many bytes as specified by the first byte. | function readIndefiniteStringLength(Witnet.Buffer memory _buffer, uint8 majorType) private pure returns(uint64) {
uint8 initialByte = _buffer.readUint8();
if (initialByte == 0xff) {
return _UINT64_MAX;
}
uint64 length = readLength(_buffer, initialByte & 0x1f);
require(length < _UINT64_MAX && (initialByte >> 5) == majorType, "Invalid indefinite length");
return length;
}
| function readIndefiniteStringLength(Witnet.Buffer memory _buffer, uint8 majorType) private pure returns(uint64) {
uint8 initialByte = _buffer.readUint8();
if (initialByte == 0xff) {
return _UINT64_MAX;
}
uint64 length = readLength(_buffer, initialByte & 0x1f);
require(length < _UINT64_MAX && (initialByte >> 5) == majorType, "Invalid indefinite length");
return length;
}
| 22,447 |
6 | // Array of abi encoded calldata to pass to each entry in `contracts`. | bytes[] data;
| bytes[] data;
| 14,837 |
12 | // Subtracts two signed integers, returns false 2nd param on overflow. / | function add(
int256 a,
int256 b
)
internal
pure
returns (int256 result, bool ok)
| function add(
int256 a,
int256 b
)
internal
pure
returns (int256 result, bool ok)
| 47,824 |
48 | // Compute the balance slot and load its value. | mstore(0x0c, _BALANCE_SLOT_SEED)
mstore(0x00, caller())
let fromBalanceSlot := keccak256(0x0c, 0x20)
let fromBalance := sload(fromBalanceSlot)
| mstore(0x0c, _BALANCE_SLOT_SEED)
mstore(0x00, caller())
let fromBalanceSlot := keccak256(0x0c, 0x20)
let fromBalance := sload(fromBalanceSlot)
| 33,356 |
118 | // calculate trading fee | function _getTradingFee(
uint256 feeTokenAmount)
internal
view
returns (uint256)
| function _getTradingFee(
uint256 feeTokenAmount)
internal
view
returns (uint256)
| 22,796 |
33 | // Denominator for constraints: 'public_memory_addr_zero', 'public_memory_value_zero'. denominators[7] = point^(trace_length / 8) - 1. | mstore(0x3f00,
addmod(/*point^(trace_length / 8)*/ mload(0x3920), sub(PRIME, 1), PRIME))
| mstore(0x3f00,
addmod(/*point^(trace_length / 8)*/ mload(0x3920), sub(PRIME, 1), PRIME))
| 19,470 |
41 | // Get if `_acct` is an authorized module _acct Module addressreturn Operation status / | function getModule(address _acct) external view returns (bool) {
return modules[_acct];
}
| function getModule(address _acct) external view returns (bool) {
return modules[_acct];
}
| 30,410 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.