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
|
|---|---|---|---|---|
31
|
// Mutative
|
function stake(uint256 amount) external;
function withdraw(uint256 amount) external;
function getReward() external;
function exit() external;
|
function stake(uint256 amount) external;
function withdraw(uint256 amount) external;
function getReward() external;
function exit() external;
| 1,454
|
29
|
// p proposal considered/ return the assignment associated to the proposal
|
function getAssignment(Proposal memory p) public returns (uint[] memory) {
return p.assignment;
}
|
function getAssignment(Proposal memory p) public returns (uint[] memory) {
return p.assignment;
}
| 41,282
|
71
|
// If the nested batch sell is the first hop and `useSelfBalance` for the containing multi- hop sell is false, the nested batch sell should pull tokens from `msg.sender` (so`batchSellParams.useSelfBalance` should be false). Otherwise `batchSellParams.useSelfBalance` should be true.
|
batchSellParams.useSelfBalance = state.hopIndex > 0 || params.useSelfBalance;
|
batchSellParams.useSelfBalance = state.hopIndex > 0 || params.useSelfBalance;
| 5,100
|
89
|
// The EIP-712 typehash for the delegation struct used by the contract
|
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
|
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
| 32,414
|
53
|
// only owner address can set houseEdge
|
function ownerSetHouseEdge(uint newHouseEdge) public onlyOwner
|
function ownerSetHouseEdge(uint newHouseEdge) public onlyOwner
| 50,969
|
130
|
// Calculates the amount that has already vested. allocation Allocation to calculate against /
|
function _vestedAmount(Allocation storage allocation)
internal
view
returns (uint256 amount)
|
function _vestedAmount(Allocation storage allocation)
internal
view
returns (uint256 amount)
| 11,017
|
54
|
// Returns whale balance amount /
|
function _getWhaleThreshold() internal view returns (uint256 amount) {
uint256 pairBalance = balanceOf(address(DEX_PAIR));
if (0 < pairBalance) return pairBalance * WHALE_NUMERATOR / WHALE_DENOMINATOR;
}
|
function _getWhaleThreshold() internal view returns (uint256 amount) {
uint256 pairBalance = balanceOf(address(DEX_PAIR));
if (0 < pairBalance) return pairBalance * WHALE_NUMERATOR / WHALE_DENOMINATOR;
}
| 708
|
46
|
// Set rewards portion in store balance. ex: 10 => 10% /
|
function setRewardPortion(uint256 rewardPortion) external onlyOwner returns (bool) {
require(rewardPortion >= 10 && rewardPortion <= 100, 'LiqLpStaker: reward portion should be in 10 ~ 100.');
_rewardPortion = rewardPortion;
return true;
}
|
function setRewardPortion(uint256 rewardPortion) external onlyOwner returns (bool) {
require(rewardPortion >= 10 && rewardPortion <= 100, 'LiqLpStaker: reward portion should be in 10 ~ 100.');
_rewardPortion = rewardPortion;
return true;
}
| 29,264
|
83
|
// the constructor initiates the Compliance contractmsg.sender is set automatically as the owner of the smart contract _identityStorage the address of the Identity Registry Storage linked to this Complianceemits an `IdentityRegistryAdded` event/
|
constructor (address _identityStorage) public {
identityStorage = IIdentityRegistryStorage(_identityStorage);
emit IdentityStorageAdded(_identityStorage);
}
|
constructor (address _identityStorage) public {
identityStorage = IIdentityRegistryStorage(_identityStorage);
emit IdentityStorageAdded(_identityStorage);
}
| 38,386
|
34
|
// ends minting upon maturity (and within permitted Withdrawal Time Window), gets minted XEN /
|
function claimMintReward() external {
MintInfo memory mintInfo = userMints[_msgSender()];
require(mintInfo.rank > 0, "CRank: No mint exists");
require(
block.timestamp > mintInfo.maturityTs,
"CRank: Mint maturity not reached"
);
// calculate reward and mint tokens
uint256 rewardAmount = _calculateMintReward(
mintInfo.rank,
mintInfo.term,
mintInfo.maturityTs,
mintInfo.amplifier,
mintInfo.eaaRate
) * 1 ether;
_mint(_msgSender(), rewardAmount);
_cleanUpUserMint();
emit MintClaimed(_msgSender(), rewardAmount);
}
|
function claimMintReward() external {
MintInfo memory mintInfo = userMints[_msgSender()];
require(mintInfo.rank > 0, "CRank: No mint exists");
require(
block.timestamp > mintInfo.maturityTs,
"CRank: Mint maturity not reached"
);
// calculate reward and mint tokens
uint256 rewardAmount = _calculateMintReward(
mintInfo.rank,
mintInfo.term,
mintInfo.maturityTs,
mintInfo.amplifier,
mintInfo.eaaRate
) * 1 ether;
_mint(_msgSender(), rewardAmount);
_cleanUpUserMint();
emit MintClaimed(_msgSender(), rewardAmount);
}
| 20,720
|
185
|
// Oracle Management /
|
function addWritersToMedianWhitelist(address medianizer, address[] memory feeds) internal {
DssExecLib.addWritersToMedianWhitelist(medianizer, feeds);
}
|
function addWritersToMedianWhitelist(address medianizer, address[] memory feeds) internal {
DssExecLib.addWritersToMedianWhitelist(medianizer, feeds);
}
| 31,071
|
96
|
// convert amount from underlying to protocol token
|
toRedeem.mul(10**18).div(protocol.getPriceInToken()),
address(this) // tokens are now in this contract
);
|
toRedeem.mul(10**18).div(protocol.getPriceInToken()),
address(this) // tokens are now in this contract
);
| 31,485
|
90
|
// Minimum weight for token
|
uint public constant MIN_WEIGHT = 1000000000;
|
uint public constant MIN_WEIGHT = 1000000000;
| 57,370
|
75
|
// This contract implements a proxy that is upgradeable by an admin.clashing], which can potentially be used in an attack, this contract uses thethings that go hand in hand:1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even ifthat call matches one of the admin functions exposed by the proxy itself.2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to theimplementation. If the admin tries to call a function on the implementation it will fail with an error that says"admin
|
* Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
* you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
*/
contract TransparentUpgradeableProxy is UpgradeableProxy {
/**
* @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
* optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.
*/
constructor(address _logic, address admin_, bytes memory _data) public payable UpgradeableProxy(_logic, _data) {
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_setAdmin(admin_);
}
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @dev Returns the current admin.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function admin() external ifAdmin returns (address admin_) {
admin_ = _admin();
}
/**
* @dev Returns the current implementation.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
*/
function implementation() external ifAdmin returns (address implementation_) {
implementation_ = _implementation();
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "TransparentUpgradeableProxy: new admin is the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the implementation of the proxy.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
* by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
* proxied contract.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {
_upgradeTo(newImplementation);
// solhint-disable-next-line avoid-low-level-calls
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @dev Returns the current admin.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
adm := sload(slot)
}
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.
*/
function _beforeFallback() internal override virtual {
require(msg.sender != _admin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
super._beforeFallback();
}
}
|
* Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
* you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
*/
contract TransparentUpgradeableProxy is UpgradeableProxy {
/**
* @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
* optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.
*/
constructor(address _logic, address admin_, bytes memory _data) public payable UpgradeableProxy(_logic, _data) {
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_setAdmin(admin_);
}
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @dev Returns the current admin.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function admin() external ifAdmin returns (address admin_) {
admin_ = _admin();
}
/**
* @dev Returns the current implementation.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
*/
function implementation() external ifAdmin returns (address implementation_) {
implementation_ = _implementation();
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "TransparentUpgradeableProxy: new admin is the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the implementation of the proxy.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
* by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
* proxied contract.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {
_upgradeTo(newImplementation);
// solhint-disable-next-line avoid-low-level-calls
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @dev Returns the current admin.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
adm := sload(slot)
}
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.
*/
function _beforeFallback() internal override virtual {
require(msg.sender != _admin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
super._beforeFallback();
}
}
| 12,565
|
29
|
// Set the total interest received to date.This should only be called once on contract deploy. _totalInterestReceived The amount of interest the protocol has received to date, expects 10^6 value /
|
function setTotalInterestReceived(uint256 _totalInterestReceived) public onlyAdmin {
totalInterestReceived = _totalInterestReceived;
emit BackerRewardsSetTotalInterestReceived(_msgSender(), _totalInterestReceived);
}
|
function setTotalInterestReceived(uint256 _totalInterestReceived) public onlyAdmin {
totalInterestReceived = _totalInterestReceived;
emit BackerRewardsSetTotalInterestReceived(_msgSender(), _totalInterestReceived);
}
| 26,796
|
26
|
// how many authorized logics
|
uint public logicCount;
constructor(address[] memory _initialLogics, uint256 _pendingTime) public
|
uint public logicCount;
constructor(address[] memory _initialLogics, uint256 _pendingTime) public
| 64,038
|
3
|
// The HAL9k TOKEN!
|
INBUNIERC20 public hal9k;
|
INBUNIERC20 public hal9k;
| 13,881
|
4
|
// ensure that a contract hasn't been previously deployed to target address.
|
require(
!_deployed[targetDeploymentAddress],
"Invalid contract creation - contract has already been deployed."
);
|
require(
!_deployed[targetDeploymentAddress],
"Invalid contract creation - contract has already been deployed."
);
| 18,575
|
111
|
// Reverts if the sender is not the oracle of the request.Emits ChainlinkFulfilled event. _requestId The request ID for fulfillment /
|
modifier recordChainlinkFulfillment(bytes32 _requestId) {
require(msg.sender == pendingRequests[_requestId], "Source must be the oracle of the request");
delete pendingRequests[_requestId];
emit ChainlinkFulfilled(_requestId);
_;
}
|
modifier recordChainlinkFulfillment(bytes32 _requestId) {
require(msg.sender == pendingRequests[_requestId], "Source must be the oracle of the request");
delete pendingRequests[_requestId];
emit ChainlinkFulfilled(_requestId);
_;
}
| 8,660
|
12
|
// mint end block num,about 10 years.
|
uint256 public constant MINTEND_BLOCKNUM = 103968000;
|
uint256 public constant MINTEND_BLOCKNUM = 103968000;
| 7,011
|
18
|
// Give your vote (including votes delegated to you)/ to proposal `proposals[proposal].name`.
|
function vote(uint proposal) external {
Voter storage sender = voters[msg.sender];
require(sender.weight != 0, "Has no right to vote");
require(!sender.voted, "Already voted.");
sender.voted = true;
sender.vote = proposal;
// If `proposal` is out of the range of the array,
// this will throw automatically and revert all
// changes.
proposals[proposal].voteCount += sender.weight;
}
|
function vote(uint proposal) external {
Voter storage sender = voters[msg.sender];
require(sender.weight != 0, "Has no right to vote");
require(!sender.voted, "Already voted.");
sender.voted = true;
sender.vote = proposal;
// If `proposal` is out of the range of the array,
// this will throw automatically and revert all
// changes.
proposals[proposal].voteCount += sender.weight;
}
| 27,635
|
205
|
// Set squid burn enable
|
function setBurnEnable(bool burnEnabled_) public onlyOwner {
squid.setBurnEnable(burnEnabled_);
}
|
function setBurnEnable(bool burnEnabled_) public onlyOwner {
squid.setBurnEnable(burnEnabled_);
}
| 3,035
|
1
|
// address of WETH token.This is needed because some times it is better to trade through WETH.you might get a better price using WETH.example trading from token A to WETH then WETH to token B might result in a better price
|
address private constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
event swapPerformed(address indexed to, uint256 amountFrom);
|
address private constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
event swapPerformed(address indexed to, uint256 amountFrom);
| 17,906
|
1
|
// Getter to get the count value
|
function getCount() public view returns (uint256) {
return count;
}
|
function getCount() public view returns (uint256) {
return count;
}
| 2,927
|
475
|
// Returns token's address by given id
|
function getAddressById(uint _id) public view returns (address) {
return store.get(tokenAddresses, _id);
}
|
function getAddressById(uint _id) public view returns (address) {
return store.get(tokenAddresses, _id);
}
| 50,025
|
122
|
// Payback borrowed DAI. _amount Dai amount to payback. /
|
function payback(uint256 _amount) external override onlyVaultOwner {
uint256 _vaultNum = vaultNum[msg.sender];
ManagerLike manager = ManagerLike(mcdManager);
address urn = manager.urns(_vaultNum);
address vat = manager.vat();
bytes32 ilk = collateralType[_vaultNum];
// Calculate dai debt
uint256 _daiDebt = _getVaultDebt(ilk, urn, vat);
require(_daiDebt >= _amount, "paying-excess-debt");
// Approve and join dai in vat
_joinDai(urn, _amount);
manager.frob(_vaultNum, 0, _getWipeAmount(ilk, urn, vat));
}
|
function payback(uint256 _amount) external override onlyVaultOwner {
uint256 _vaultNum = vaultNum[msg.sender];
ManagerLike manager = ManagerLike(mcdManager);
address urn = manager.urns(_vaultNum);
address vat = manager.vat();
bytes32 ilk = collateralType[_vaultNum];
// Calculate dai debt
uint256 _daiDebt = _getVaultDebt(ilk, urn, vat);
require(_daiDebt >= _amount, "paying-excess-debt");
// Approve and join dai in vat
_joinDai(urn, _amount);
manager.frob(_vaultNum, 0, _getWipeAmount(ilk, urn, vat));
}
| 23,487
|
72
|
// Deposit ether to get wrapped ether
|
function deposit() external payable;
|
function deposit() external payable;
| 1,390
|
21
|
// distribute the staking fee accumulated before updating the user's stake
|
_addPayout(_stakingFee.sub(_ownerFee));
|
_addPayout(_stakingFee.sub(_ownerFee));
| 12,556
|
101
|
// account for retained fees
|
uint oasisFee0;
uint oasisFee1;
{ // stack depth
uint64 _oasisFeeProportion = oasisFeeProportion; // gas savings
oasisFee0 = feeTaken0.mul(_oasisFeeProportion).div(FEE_DIVISOR).div(FEE_DIVISOR);
oasisFee1 = feeTaken1.mul(_oasisFeeProportion).div(FEE_DIVISOR).div(FEE_DIVISOR);
}
|
uint oasisFee0;
uint oasisFee1;
{ // stack depth
uint64 _oasisFeeProportion = oasisFeeProportion; // gas savings
oasisFee0 = feeTaken0.mul(_oasisFeeProportion).div(FEE_DIVISOR).div(FEE_DIVISOR);
oasisFee1 = feeTaken1.mul(_oasisFeeProportion).div(FEE_DIVISOR).div(FEE_DIVISOR);
}
| 15,699
|
976
|
// Helper to cancel a migration
|
function __cancelMigration(address _vaultProxy, bool _bypassFailure)
private
onlyLiveRelease
onlyMigrator(_vaultProxy)
{
IDispatcher(DISPATCHER).cancelMigration(_vaultProxy, _bypassFailure);
}
|
function __cancelMigration(address _vaultProxy, bool _bypassFailure)
private
onlyLiveRelease
onlyMigrator(_vaultProxy)
{
IDispatcher(DISPATCHER).cancelMigration(_vaultProxy, _bypassFailure);
}
| 44,434
|
53
|
// Get reward wallet address for only onwer. owner reward wallet address /
|
function getRewardWallet(address owner) external view returns (address) {
require(owner == _getOwner(), "Only owner can get this address" );
return _rewardPool;
}
|
function getRewardWallet(address owner) external view returns (address) {
require(owner == _getOwner(), "Only owner can get this address" );
return _rewardPool;
}
| 51,682
|
95
|
// Casts ray down to wad a Rayreturn a casted to wad, rounded half up to the nearest wad /
|
function rayToWad(uint256 a) internal pure returns (uint256) {
uint256 halfRatio = WAD_RAY_RATIO / 2;
uint256 result = halfRatio + a;
require(result >= halfRatio);
return result / WAD_RAY_RATIO;
}
|
function rayToWad(uint256 a) internal pure returns (uint256) {
uint256 halfRatio = WAD_RAY_RATIO / 2;
uint256 result = halfRatio + a;
require(result >= halfRatio);
return result / WAD_RAY_RATIO;
}
| 33,906
|
10
|
// Atomic increment of approved spending/
|
function addApproval(address spender, uint256 addedValue) public returns (bool success) {
uint256 oldValue = allowed[msg.sender][spender];
allowed[msg.sender][spender] = oldValue.add(addedValue);
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
return true;
}
|
function addApproval(address spender, uint256 addedValue) public returns (bool success) {
uint256 oldValue = allowed[msg.sender][spender];
allowed[msg.sender][spender] = oldValue.add(addedValue);
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
return true;
}
| 4,563
|
21
|
// compare the current parent value with the highest child, if the parent is greater, we're done
|
if (heap.elements[currentIndex].value > heap.elements[j].value) {
break;
}
|
if (heap.elements[currentIndex].value > heap.elements[j].value) {
break;
}
| 1,254
|
75
|
// handle case where token decimals is not a declared decimal constant
|
tokenDecimals = decimals[token];
|
tokenDecimals = decimals[token];
| 40,653
|
39
|
// The {SafeMath} overflow check can be skipped here, see the comment at the top
|
counter._value += 1;
|
counter._value += 1;
| 37,923
|
62
|
// Mint v2 Tokens
|
PartialIdleV2.mint(_V2, MAX, _clientProtocolAmounts);
|
PartialIdleV2.mint(_V2, MAX, _clientProtocolAmounts);
| 49,654
|
184
|
// functions callable by HolyRedeemer yield distributor
|
function harvestYield(uint256 amount) external; // pool would transfer amount tokens from caller as it's profits
|
function harvestYield(uint256 amount) external; // pool would transfer amount tokens from caller as it's profits
| 58,860
|
66
|
// The market's last updated index
|
uint224 index;
|
uint224 index;
| 6,349
|
151
|
// Sets the `debtAuctionSellSize` parameter on Aer/Can only be called by the guardian. Checks if the value is in the allowed range./debtAuctionSellSize See. Aer
|
function setDebtAuctionSellSize(uint256 debtAuctionSellSize) external isGuardian {
_inRange(debtAuctionSellSize, 0, 200_000 * WAD);
aer.setParam("debtAuctionSellSize", debtAuctionSellSize);
}
|
function setDebtAuctionSellSize(uint256 debtAuctionSellSize) external isGuardian {
_inRange(debtAuctionSellSize, 0, 200_000 * WAD);
aer.setParam("debtAuctionSellSize", debtAuctionSellSize);
}
| 58,161
|
24
|
// Calculates the new borrower and total borrow balances:newAccountBorrows = accountBorrows + borrowAmountnewTotalBorrows = totalBorrows + borrowAmount
|
BorrowSnapshot storage borrowSnapshot = accountBorrows[_borrower];
borrowSnapshot.principal = _borrowBalanceInternal(_borrower).add(
_borrowAmount
);
borrowSnapshot.interestIndex = borrowIndex;
totalBorrows = totalBorrows.add(_borrowAmount);
|
BorrowSnapshot storage borrowSnapshot = accountBorrows[_borrower];
borrowSnapshot.principal = _borrowBalanceInternal(_borrower).add(
_borrowAmount
);
borrowSnapshot.interestIndex = borrowIndex;
totalBorrows = totalBorrows.add(_borrowAmount);
| 5,107
|
241
|
// Set the anti-whale threshold. amount The anti-whale threshold. /
|
function setAntiWhaleThreshold(
uint256 amount
|
function setAntiWhaleThreshold(
uint256 amount
| 26,559
|
0
|
// Maximum amount of CryptoBlobs.
|
uint public constant MAX_CRYPTOBLOBS = 100;
|
uint public constant MAX_CRYPTOBLOBS = 100;
| 20,264
|
0
|
// IPriceOracleGetter interface Interface for the Aave price oracle. /
|
interface IPriceOracleGetter {
/**
* @dev returns the asset price in ETH
* @param asset the address of the asset
* @return the ETH price of the asset
**/
function getAssetPrice(address asset) external view returns (uint256);
}
|
interface IPriceOracleGetter {
/**
* @dev returns the asset price in ETH
* @param asset the address of the asset
* @return the ETH price of the asset
**/
function getAssetPrice(address asset) external view returns (uint256);
}
| 11,535
|
5
|
// mint option token to an address. Can only be called by corresponding margin engine _recipientwhere to mint token to _amount amount to mint /
|
function mint(address _recipient, address _vault, uint256 _amount) external override {
if (!whitelist.isVault(msg.sender)) revert Unauthorized();
uint256 tokenId = vaultToTokenId(_vault);
_totalSupply[tokenId] += _amount;
_mint(_recipient, tokenId, _amount, "");
}
|
function mint(address _recipient, address _vault, uint256 _amount) external override {
if (!whitelist.isVault(msg.sender)) revert Unauthorized();
uint256 tokenId = vaultToTokenId(_vault);
_totalSupply[tokenId] += _amount;
_mint(_recipient, tokenId, _amount, "");
}
| 24,987
|
40
|
// View game creator.Free to call externally. Used for validation purposes.Returns game creator's address. /
|
function viewGameCreator(uint _gameID) external view returns(address) {
return game[_gameID].creator;
}
|
function viewGameCreator(uint _gameID) external view returns(address) {
return game[_gameID].creator;
}
| 52,699
|
44
|
// StableToken.unitsToValue (called within getSellTokenAndSellAmount) can overflow for very large StableToken amounts. Call it here as a sanity check, so that the overflow happens here, blocking proposal creation rather than when attempting to execute the proposal, which would lock funds in this contract.
|
getSellTokenAndSellAmount(exchangeProposals[exchangeProposalCount]);
|
getSellTokenAndSellAmount(exchangeProposals[exchangeProposalCount]);
| 37,854
|
43
|
// Provides an internal minting function. /
|
function mintInternal(address receiver, uint amount) internal {
total_supply = total_supply.add(amount);
balances[receiver] = balances[receiver].add(amount);
emit Minted(receiver, amount);
// Beware: Address zero may be used for special transactions in a future fork.
// This will make the mint transaction appear in EtherScan.io
// We can remove this after there is a standardized minting event
emit Transfer(0, receiver, amount);
}
|
function mintInternal(address receiver, uint amount) internal {
total_supply = total_supply.add(amount);
balances[receiver] = balances[receiver].add(amount);
emit Minted(receiver, amount);
// Beware: Address zero may be used for special transactions in a future fork.
// This will make the mint transaction appear in EtherScan.io
// We can remove this after there is a standardized minting event
emit Transfer(0, receiver, amount);
}
| 44,269
|
72
|
// Modify the offering ETH span
|
function changeOfferSpan(uint256 num) public onlyOwner {
require(num > 0);
_offerSpan = num;
}
|
function changeOfferSpan(uint256 num) public onlyOwner {
require(num > 0);
_offerSpan = num;
}
| 10,692
|
114
|
// Set new address - This will be the 'Cake LP' address for the token pairing
|
function set_New_Pair_Address(address newPair) public onlyOwner() {
uniswapV2Pair = newPair;
}
|
function set_New_Pair_Address(address newPair) public onlyOwner() {
uniswapV2Pair = newPair;
}
| 1,702
|
169
|
// The set of all pynths that are shortable.
|
Bytes32SetLib.Bytes32Set internal _shortablePynths;
mapping(bytes32 => bytes32) public pynthToInversePynth;
|
Bytes32SetLib.Bytes32Set internal _shortablePynths;
mapping(bytes32 => bytes32) public pynthToInversePynth;
| 29,579
|
1
|
// The mapping of symbol to current time available for it /
|
mapping(string => uint64) public currentTime;
|
mapping(string => uint64) public currentTime;
| 5,782
|
25
|
// Burn the tokens.
|
balances[holder] -= burnAmount;
|
balances[holder] -= burnAmount;
| 9,664
|
16
|
// Create a new product with a struct Add the struct to the mapping, and store it on the blockchain Trigger an event that lets someone know a product was creatd
|
function createProduct(string memory _name,string memory _description, uint _price,string memory _imgipfshash,string memory _fileipfshash , Categories _categorie ) public {
// Require a valid name
require(bytes(_name).length > 0);
// Require a valid description
require(bytes(_description).length > 0);
// Require a valid price
require(_price > 0);
// Require a valid image hash
require(bytes(_imgipfshash).length > 0);
// Require a valid file hash
require(bytes(_fileipfshash).length > 0);
// Increment product count
uint256 _uploadedOn = block.timestamp;
//increment number of products
productCount ++;
//add this Product to the products map
products[productCount].id = productCount;
products[productCount].name = _name;
products[productCount].description = _description;
products[productCount].price = _price;
products[productCount].imgipfshash = _imgipfshash;
files[productCount] = _fileipfshash;
products[productCount].owner = msg.sender;
products[productCount].categorie = _categorie;
products[productCount].uploadedOn = _uploadedOn;
products[productCount].reviewsCount = 0;
products[productCount].report = 0;
products[productCount].hasReported[msg.sender] = false;
products[productCount].totalSold = 0;
products[productCount].buyers = new address[](0);
products[productCount].removed = 0;
//add this product to the customer's owned product
//create an event
emit ProductCreated(productCount, _name, _description, _price, _imgipfshash,_fileipfshash, msg.sender);
}
|
function createProduct(string memory _name,string memory _description, uint _price,string memory _imgipfshash,string memory _fileipfshash , Categories _categorie ) public {
// Require a valid name
require(bytes(_name).length > 0);
// Require a valid description
require(bytes(_description).length > 0);
// Require a valid price
require(_price > 0);
// Require a valid image hash
require(bytes(_imgipfshash).length > 0);
// Require a valid file hash
require(bytes(_fileipfshash).length > 0);
// Increment product count
uint256 _uploadedOn = block.timestamp;
//increment number of products
productCount ++;
//add this Product to the products map
products[productCount].id = productCount;
products[productCount].name = _name;
products[productCount].description = _description;
products[productCount].price = _price;
products[productCount].imgipfshash = _imgipfshash;
files[productCount] = _fileipfshash;
products[productCount].owner = msg.sender;
products[productCount].categorie = _categorie;
products[productCount].uploadedOn = _uploadedOn;
products[productCount].reviewsCount = 0;
products[productCount].report = 0;
products[productCount].hasReported[msg.sender] = false;
products[productCount].totalSold = 0;
products[productCount].buyers = new address[](0);
products[productCount].removed = 0;
//add this product to the customer's owned product
//create an event
emit ProductCreated(productCount, _name, _description, _price, _imgipfshash,_fileipfshash, msg.sender);
}
| 26,374
|
86
|
// Set the rest of the contract variables . /
|
pancakeswapV2Router = _pancakeswapV2Router;
|
pancakeswapV2Router = _pancakeswapV2Router;
| 46,257
|
123
|
// Store the registry object in memory to save gas.
|
IProxyRegistry proxyRegistry = registry;
|
IProxyRegistry proxyRegistry = registry;
| 21,144
|
19
|
// purpose uint256 representing the purpose of the the keyreturn keysByPurpose array of hashes containing all the keys for the provided purposereturn keyTypes array of uint containing the types for the keysreturn keysRevokedAt array of uint containing the revocation blocks for the keys /
|
function getKeysByPurpose(uint256 purpose)
external
view
returns (bytes32[] memory keysByPurpose,uint256[] memory keyTypes, uint32[] memory keysRevokedAt)
|
function getKeysByPurpose(uint256 purpose)
external
view
returns (bytes32[] memory keysByPurpose,uint256[] memory keyTypes, uint32[] memory keysRevokedAt)
| 16,942
|
259
|
// Encrypted symetric encryption key (in Hex). When decrypted, this passphrase can regenerate the symetric encryption key. This key encrypts and decrypts data to be shared with many people. Uses 0.5 SSTORAGE for AES 128.
|
bytes symetricEncryptionEncryptedKey;
|
bytes symetricEncryptionEncryptedKey;
| 14,940
|
271
|
// Set before minting
|
function setPreProvenanceHash(string memory _preprovenanceHash) public onlyOwner {
BEAR_PRE_PROVENANCE = _preprovenanceHash;
}
|
function setPreProvenanceHash(string memory _preprovenanceHash) public onlyOwner {
BEAR_PRE_PROVENANCE = _preprovenanceHash;
}
| 18,083
|
42
|
// Settles, distribute the pending POPS rewards for given user./_user The user address for settling rewards./_pid The pool id./_boostMultiplier The user boost multiplier in specific pool id.
|
function settlePendingPops(
address _user,
uint256 _pid,
uint256 _boostMultiplier
|
function settlePendingPops(
address _user,
uint256 _pid,
uint256 _boostMultiplier
| 33,283
|
49
|
// 3. claim rewards
|
if (_option == ClaimOption.None) {
return (_withdrawable, 0);
} else {
|
if (_option == ClaimOption.None) {
return (_withdrawable, 0);
} else {
| 60,785
|
56
|
// notify the pending owner if supports LSP1
|
msg.sender.tryNotifyUniversalReceiver(
_TYPEID_LSP0_OwnershipTransferred_RecipientNotification,
""
);
|
msg.sender.tryNotifyUniversalReceiver(
_TYPEID_LSP0_OwnershipTransferred_RecipientNotification,
""
);
| 22,895
|
18
|
// Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE /TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE /THEY MAY BE PERMANENTLY LOST /Throws unless `msg.sender` is the current owner, an authorized /operator, or the approved address for this NFT. Throws if `_from` is /not the current owner. Throws if `_to` is the zero address. Throws if /`_tokenId` is not a valid NFT. /_from The current owner of the NFT /_to The new owner /_tokenId The NFT to transfer
|
function transferFrom(address _from, address _to, uint256 _tokenId) external payable;
|
function transferFrom(address _from, address _to, uint256 _tokenId) external payable;
| 20,709
|
295
|
// minime.destroyTokens() never returns false, only reverts on failure
|
token.destroyTokens(_holder, _amount);
|
token.destroyTokens(_holder, _amount);
| 14,235
|
467
|
// Validates transfer and reverts on rejection. May emit logs. aToken Asset being transferred src The account which sources the tokens dst The account which receives the tokens transferTokens The number of aTokens to transfer /
|
function transferVerify(address aToken, address src, address dst, uint transferTokens) external {
// Shh - currently unused
aToken;
src;
dst;
transferTokens;
// Shh - we don't ever want this hook to be marked pure
if (false) {
maxAssets = maxAssets;
}
}
|
function transferVerify(address aToken, address src, address dst, uint transferTokens) external {
// Shh - currently unused
aToken;
src;
dst;
transferTokens;
// Shh - we don't ever want this hook to be marked pure
if (false) {
maxAssets = maxAssets;
}
}
| 21,546
|
15
|
// Return the cooldown end time
|
function aaveCooldown_Show_Cooldowns() external view returns (uint256) {
return stkAAVE.stakersCooldowns(address(this));
}
|
function aaveCooldown_Show_Cooldowns() external view returns (uint256) {
return stkAAVE.stakersCooldowns(address(this));
}
| 5,240
|
7
|
// Enable or disable the whitelist. _value Flag that enables or disables the whitelist. /
|
function toggleOpenWhitelist(bool _value) external onlySuperAdmin {
_isDisabledWitelist = _value;
}
|
function toggleOpenWhitelist(bool _value) external onlySuperAdmin {
_isDisabledWitelist = _value;
}
| 8,290
|
137
|
// Check balance
|
uint256 b = token.balanceOf(address(this));
if (b < withdrawAmount) {
uint256 _withdraw = withdrawAmount.sub(b);
IStrategy(strategy).withdraw(_withdraw);
uint256 _after = token.balanceOf(address(this));
uint256 _diff = _after.sub(b);
if (_diff < _withdraw) {
withdrawAmount = b.add(_diff);
}
|
uint256 b = token.balanceOf(address(this));
if (b < withdrawAmount) {
uint256 _withdraw = withdrawAmount.sub(b);
IStrategy(strategy).withdraw(_withdraw);
uint256 _after = token.balanceOf(address(this));
uint256 _diff = _after.sub(b);
if (_diff < _withdraw) {
withdrawAmount = b.add(_diff);
}
| 674
|
675
|
// get user's premium balance. account user's account/
|
// function getUserLatestPremium(address /*account*/,address /*premiumCoin*/)public view returns(uint256){
// delegateToViewAndReturn();
// }
|
// function getUserLatestPremium(address /*account*/,address /*premiumCoin*/)public view returns(uint256){
// delegateToViewAndReturn();
// }
| 74,707
|
230
|
// returns whether or not the Licence DAO address is locked
|
function licenceDAOLocked() public view returns (bool) {
return _lockedLicenceDAO;
}
|
function licenceDAOLocked() public view returns (bool) {
return _lockedLicenceDAO;
}
| 42,701
|
54
|
// View function to see pending Token/_pid The index of the pool. See `poolInfo`./_user Address of user./ return pending SUSHI reward for a given user.
|
function pendingToken(uint256 _pid, address _user) public view returns (uint256 pending) {
PoolInfo memory pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accToken1PerShare = pool.accToken1PerShare;
uint256 lpSupply = IMasterChefV2(MASTERCHEF_V2).lpToken(_pid).balanceOf(MASTERCHEF_V2);
if (block.timestamp > pool.lastRewardTime && lpSupply != 0) {
uint256 time = block.timestamp.sub(pool.lastRewardTime);
uint256 sushiReward = time.mul(rewardPerSecond);
accToken1PerShare = accToken1PerShare.add(sushiReward.mul(ACC_TOKEN_PRECISION) / lpSupply);
}
pending = (user.amount.mul(accToken1PerShare) / ACC_TOKEN_PRECISION).sub(user.rewardDebt).add(user.unpaidRewards);
}
|
function pendingToken(uint256 _pid, address _user) public view returns (uint256 pending) {
PoolInfo memory pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accToken1PerShare = pool.accToken1PerShare;
uint256 lpSupply = IMasterChefV2(MASTERCHEF_V2).lpToken(_pid).balanceOf(MASTERCHEF_V2);
if (block.timestamp > pool.lastRewardTime && lpSupply != 0) {
uint256 time = block.timestamp.sub(pool.lastRewardTime);
uint256 sushiReward = time.mul(rewardPerSecond);
accToken1PerShare = accToken1PerShare.add(sushiReward.mul(ACC_TOKEN_PRECISION) / lpSupply);
}
pending = (user.amount.mul(accToken1PerShare) / ACC_TOKEN_PRECISION).sub(user.rewardDebt).add(user.unpaidRewards);
}
| 26,783
|
77
|
// 要新增的魚數量
|
_addFishAmount = _addFishAmount.add(systemFishAmount[globalData.fishPrice]);
|
_addFishAmount = _addFishAmount.add(systemFishAmount[globalData.fishPrice]);
| 54,223
|
41
|
// check if dna is already minted
|
if(PlaygroundDnaToClaimedMap[_dna]) revert DaaaaaaaaangThisMferIsAlreadyTaken();
|
if(PlaygroundDnaToClaimedMap[_dna]) revert DaaaaaaaaangThisMferIsAlreadyTaken();
| 37,726
|
130
|
// about $1USD at $600usd/eth
|
uint public commBallotPriceWei = 1666666666000000;
|
uint public commBallotPriceWei = 1666666666000000;
| 4,080
|
13
|
// transfer balance to owner
|
function withdrawEther(uint256 amount) public {
if(msg.sender != owner) revert();
owner.transfer(amount);
}
|
function withdrawEther(uint256 amount) public {
if(msg.sender != owner) revert();
owner.transfer(amount);
}
| 54,949
|
103
|
// ======== POLICY FUNCTIONS ======== //withdraws asset from treasury, deposits asset into lending pool, then deposits crvToken into convextoken addressamount uintamounts uint[]minAmount uint /
|
function deposit( address token, uint amount, uint[4] calldata amounts, uint minAmount ) public onlyPolicy() {
require( !exceedsLimit( token, amount ) ); // ensure deposit is within bounds
address curveToken = tokenInfo[ token ].curveToken;
treasury.manage( token, amount ); // retrieve amount of asset from treasury
// account for deposit
uint value = treasury.valueOf( token, amount );
accountingFor( token, amount, value, true );
IERC20(token).approve(address(curve3Pool), amount); // approve curve pool to spend tokens
uint curveAmount = curve3Pool.add_liquidity(curveToken, amounts, minAmount); // deposit into curve
IERC20( curveToken ).approve( address(booster), curveAmount ); // approve to deposit to convex
booster.deposit( pidForReserve[ token ], curveAmount, true ); // deposit into convex
}
|
function deposit( address token, uint amount, uint[4] calldata amounts, uint minAmount ) public onlyPolicy() {
require( !exceedsLimit( token, amount ) ); // ensure deposit is within bounds
address curveToken = tokenInfo[ token ].curveToken;
treasury.manage( token, amount ); // retrieve amount of asset from treasury
// account for deposit
uint value = treasury.valueOf( token, amount );
accountingFor( token, amount, value, true );
IERC20(token).approve(address(curve3Pool), amount); // approve curve pool to spend tokens
uint curveAmount = curve3Pool.add_liquidity(curveToken, amounts, minAmount); // deposit into curve
IERC20( curveToken ).approve( address(booster), curveAmount ); // approve to deposit to convex
booster.deposit( pidForReserve[ token ], curveAmount, true ); // deposit into convex
}
| 31,332
|
151
|
// Function for user to bet on launch outcome
|
function bet(uint option) public payable {
require(canBet() == true);
require(msg.value >= MIN_BET);
require(betterInfo[msg.sender].betAmount == 0 || betterInfo[msg.sender].betOption == option);
// Add better to better list if they
// aren't already in it
if (betterInfo[msg.sender].betAmount == 0) {
betterInfo[msg.sender].betOption = option;
numberOfBets[option]++;
betters.push(msg.sender);
}
// Perform bet
betterInfo[msg.sender].betAmount += msg.value;
totalBetAmount += msg.value;
totalAmountsBet[option] += msg.value;
BetMade(); // Trigger event
}
|
function bet(uint option) public payable {
require(canBet() == true);
require(msg.value >= MIN_BET);
require(betterInfo[msg.sender].betAmount == 0 || betterInfo[msg.sender].betOption == option);
// Add better to better list if they
// aren't already in it
if (betterInfo[msg.sender].betAmount == 0) {
betterInfo[msg.sender].betOption = option;
numberOfBets[option]++;
betters.push(msg.sender);
}
// Perform bet
betterInfo[msg.sender].betAmount += msg.value;
totalBetAmount += msg.value;
totalAmountsBet[option] += msg.value;
BetMade(); // Trigger event
}
| 8,031
|
223
|
// require both father parents not to be mother
|
require(pepes[_father].mother != _mother && pepes[_father].father != _mother);
Pepe storage father = pepes[_father];
Pepe storage mother = pepes[_mother];
approved[_father] = address(0);
approved[_mother] = address(0);
uint256[2] memory newGenotype = breed(father.genotype, mother.genotype, pepes.length);
|
require(pepes[_father].mother != _mother && pepes[_father].father != _mother);
Pepe storage father = pepes[_father];
Pepe storage mother = pepes[_mother];
approved[_father] = address(0);
approved[_mother] = address(0);
uint256[2] memory newGenotype = breed(father.genotype, mother.genotype, pepes.length);
| 12,465
|
14
|
// Set the pending governor, which will be the governor once accepted./addr The address of the pending governor.
|
function setPendingGovernor(address addr) external onlyGov {
pendingGovernor = addr;
}
|
function setPendingGovernor(address addr) external onlyGov {
pendingGovernor = addr;
}
| 61,792
|
5
|
// Total amount of tokens from a specific partition at a specific `_blockNumber`. partition The partition from which to retrieve the total supply _blockNumber The block number when the totalSupply is queriedreturn The total amount of tokens from `partition` at `_blockNumber` /
|
function totalSupplyAt(
bytes32 partition,
uint256 _blockNumber
|
function totalSupplyAt(
bytes32 partition,
uint256 _blockNumber
| 21,301
|
1
|
// ============== Constants ==============
|
uint256 public constant ONE = 1e18;
uint256 public constant ONE_DAY = 60 * 60 * 24;
uint256 public constant ONE_WEEK = ONE_DAY * 7;
uint256 public constant TWO_WEEKS = ONE_WEEK * 2;
uint256 public immutable SHORT_BOOST;
uint256 public immutable MEDIUM_BOOST;
uint256 public immutable LONG_BOOST;
|
uint256 public constant ONE = 1e18;
uint256 public constant ONE_DAY = 60 * 60 * 24;
uint256 public constant ONE_WEEK = ONE_DAY * 7;
uint256 public constant TWO_WEEKS = ONE_WEEK * 2;
uint256 public immutable SHORT_BOOST;
uint256 public immutable MEDIUM_BOOST;
uint256 public immutable LONG_BOOST;
| 27,829
|
15
|
// Unpause Start investment actions. /
|
function unpause() external onlyMultisigOrGov {
_unpause();
}
|
function unpause() external onlyMultisigOrGov {
_unpause();
}
| 20,933
|
39
|
// Get minimum common size. Size must be the same
|
if(allowanceYieldToken <= allowanceCHIP) allowanceSize = allowanceYieldToken;
else allowanceSize = allowanceCHIP;
|
if(allowanceYieldToken <= allowanceCHIP) allowanceSize = allowanceYieldToken;
else allowanceSize = allowanceCHIP;
| 7,715
|
10
|
// 1 minuteuint constant private AVAILABLE_GAME_TIME = 0;
|
uint constant private MINIMUM_BET = 50000000000000000;
uint constant private MAXIMUM_BET = 50000000000000000;
uint public gameId;
uint private jackpot;
uint private gameBet;
|
uint constant private MINIMUM_BET = 50000000000000000;
uint constant private MAXIMUM_BET = 50000000000000000;
uint public gameId;
uint private jackpot;
uint private gameBet;
| 36,807
|
333
|
// Calculate SetTokens to mint to issuer
|
uint256 denominator = _setTotalSupply.preciseMul(setTokenValuation).add(normalizedTotalReserveQuantityNetFees).sub(normalizedTotalReserveQuantityNetFeesAndPremium);
return normalizedTotalReserveQuantityNetFeesAndPremium.preciseMul(_setTotalSupply).preciseDiv(denominator);
|
uint256 denominator = _setTotalSupply.preciseMul(setTokenValuation).add(normalizedTotalReserveQuantityNetFees).sub(normalizedTotalReserveQuantityNetFeesAndPremium);
return normalizedTotalReserveQuantityNetFeesAndPremium.preciseMul(_setTotalSupply).preciseDiv(denominator);
| 52,202
|
99
|
// 1 etheretherUsdRate10
|
return _weiAmount.mul(rate).mul(10);
|
return _weiAmount.mul(rate).mul(10);
| 54,245
|
7
|
// Constructor should transition the state to StartState
|
assert(State == StateType.Created);
|
assert(State == StateType.Created);
| 35,317
|
121
|
// Set pool_address to saffron pool that created token
|
pool_address = msg.sender;
|
pool_address = msg.sender;
| 35,360
|
286
|
// Pays out pending amount in a stream streamId The id of the stream to payout.return The amount paid out in underlying /
|
function payout(uint256 streamId)
public
returns (uint256 paidOut)
|
function payout(uint256 streamId)
public
returns (uint256 paidOut)
| 34,131
|
4
|
// token id => token uri
|
mapping(uint256 => string) _tokenUris;
event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
|
mapping(uint256 => string) _tokenUris;
event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
| 22,828
|
30
|
// Calculate how many follow-ups have occured
|
uint256 followUps = 0;
if (_chunk.followUpDuration > 0) {
followUps = _timestamp.sub(startTime.add(_chunks[_i].effectiveDate)).div(_chunk.followUpDuration);
}
|
uint256 followUps = 0;
if (_chunk.followUpDuration > 0) {
followUps = _timestamp.sub(startTime.add(_chunks[_i].effectiveDate)).div(_chunk.followUpDuration);
}
| 16,583
|
15
|
// clears claim and transfers collateral to holder
|
function clearClaimFromToken(address holder) external;
|
function clearClaimFromToken(address holder) external;
| 25,796
|
31
|
// Interface to deposit the NFT contract
|
IERC721 nftToken = IERC721(users[_msgSender()].nftAddress);
|
IERC721 nftToken = IERC721(users[_msgSender()].nftAddress);
| 22,259
|
3
|
// function createZombie(string memory _name, uint _dna) public {
|
function _createZombie(string memory _name, uint _dna) private {
|
function _createZombie(string memory _name, uint _dna) private {
| 9,043
|
12
|
// get remaining supply
|
function getRemainingSupply() external view returns (uint256) {
return _maxSupply - totalSupply();
}
|
function getRemainingSupply() external view returns (uint256) {
return _maxSupply - totalSupply();
}
| 45,300
|
31
|
// (uint)(crr_d) / (uint)(crr_d-crr_n); The total reward to be distributed amongst the masses is the fee (in Ether) multiplied by the bonus co-efficient.
|
var holderReward = fee * bonusCoEff;
buyerFee -= holderReward;
|
var holderReward = fee * bonusCoEff;
buyerFee -= holderReward;
| 27,718
|
19
|
// Get the total supply
|
uint256 totalSupply = LPToken_V1.totalSupply();
(uint112 reserve0, uint112 reserve1, ) = LPToken_V1.getReserves();
|
uint256 totalSupply = LPToken_V1.totalSupply();
(uint112 reserve0, uint112 reserve1, ) = LPToken_V1.getReserves();
| 19,434
|
165
|
// Sets redeem to true _tokenId Which NFT we want to remove. /
|
function redeem(
uint256 _tokenId
)
external
onlyOwner
|
function redeem(
uint256 _tokenId
)
external
onlyOwner
| 8,327
|
147
|
// update the approval
|
approvals[_tokenId] = _operator;
|
approvals[_tokenId] = _operator;
| 24,779
|
57
|
// returns the Limbo state for the account
|
function GetLimboState(address account) public view returns (bool) {
return _limboState[account];
}
|
function GetLimboState(address account) public view returns (bool) {
return _limboState[account];
}
| 29,004
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.