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
|
|---|---|---|---|---|
6
|
// Add address to the presale list /
|
function setAllowList(address[] calldata addresses, uint8 numAllowedToMint) external onlyOwner {
for (uint256 i = 0; i < addresses.length; i++) {
_allowList[addresses[i]] = numAllowedToMint;
}
}
|
function setAllowList(address[] calldata addresses, uint8 numAllowedToMint) external onlyOwner {
for (uint256 i = 0; i < addresses.length; i++) {
_allowList[addresses[i]] = numAllowedToMint;
}
}
| 25,443
|
20
|
// ERC20Emit and Event to the blockcahin for Approval
|
event Approval(
address indexed _owner,
address indexed _spender,
uint256 _value
);
|
event Approval(
address indexed _owner,
address indexed _spender,
uint256 _value
);
| 15,146
|
58
|
// update withdrawRequests
|
withdrawRequests[verifier][recipientToken] = withdrawRequests[verifier][recipientToken].safeAdd(returnedAmount);
totalDepositedToSCAmount[recipientToken] = totalDepositedToSCAmount[recipientToken].safeAdd(returnedAmount);
|
withdrawRequests[verifier][recipientToken] = withdrawRequests[verifier][recipientToken].safeAdd(returnedAmount);
totalDepositedToSCAmount[recipientToken] = totalDepositedToSCAmount[recipientToken].safeAdd(returnedAmount);
| 41,134
|
18
|
// Update the given pool's AMDX allocation point and `IRewarder` contract. Can only be called by the owner./_pid The index of the pool./_allocPoint New AP of the pool./_rewarder Address of the rewarder delegate./_overwrite True if _rewarder should be `set`. Otherwise `_rewarder` is ignored.
|
function set(uint256 _pid, uint256 _allocPoint, IRewarder _rewarder, bool _overwrite) external validatePoolByPid(_pid) onlyOwner {
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
poolInfo[_pid].allocPoint = _allocPoint.to64();
if (_overwrite) { rewarder[_pid] = _rewarder; }
emit LogSetPool(_pid, _allocPoint, _overwrite ? _rewarder : rewarder[_pid], _overwrite);
}
|
function set(uint256 _pid, uint256 _allocPoint, IRewarder _rewarder, bool _overwrite) external validatePoolByPid(_pid) onlyOwner {
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
poolInfo[_pid].allocPoint = _allocPoint.to64();
if (_overwrite) { rewarder[_pid] = _rewarder; }
emit LogSetPool(_pid, _allocPoint, _overwrite ? _rewarder : rewarder[_pid], _overwrite);
}
| 13,135
|
696
|
// insufficient liquidity swapfor a given currency and a given balance. /
|
function _internalInsufficientLiquiditySwap(bytes4 _curr, uint _baseMin, uint _varMin, uint _caBalance) internal {
bytes4 maxIACurr;
uint amount;
(maxIACurr,,,) = pd.getIARankDetailsByDate(pd.getLastDate());
if (_curr == maxIACurr) {
amount = (((_baseMin.add(_varMin)).mul(3)).div(2)).sub(_caBalance);
_transferInvestmentAsset(_curr, ms.getLatestAddress("P1"), amount);
} else {
IERC20 erc20 = IERC20(pd.getInvestmentAssetAddress(maxIACurr));
if ((maxIACurr == "ETH" && address(this).balance > 0) ||
(maxIACurr != "ETH" && erc20.balanceOf(address(this)) > 0))
p1.triggerExternalLiquidityTrade();
}
}
|
function _internalInsufficientLiquiditySwap(bytes4 _curr, uint _baseMin, uint _varMin, uint _caBalance) internal {
bytes4 maxIACurr;
uint amount;
(maxIACurr,,,) = pd.getIARankDetailsByDate(pd.getLastDate());
if (_curr == maxIACurr) {
amount = (((_baseMin.add(_varMin)).mul(3)).div(2)).sub(_caBalance);
_transferInvestmentAsset(_curr, ms.getLatestAddress("P1"), amount);
} else {
IERC20 erc20 = IERC20(pd.getInvestmentAssetAddress(maxIACurr));
if ((maxIACurr == "ETH" && address(this).balance > 0) ||
(maxIACurr != "ETH" && erc20.balanceOf(address(this)) > 0))
p1.triggerExternalLiquidityTrade();
}
}
| 29,407
|
49
|
// Modifier for checking that the msg.sender is a whitelisted manual setter/
|
modifier isManualSetter {
require(manualSetters[msg.sender] == 1, "SingleSpotDebtCeilingSetter/not-manual-setter");
_;
}
|
modifier isManualSetter {
require(manualSetters[msg.sender] == 1, "SingleSpotDebtCeilingSetter/not-manual-setter");
_;
}
| 31,205
|
292
|
// Decrease the boost total proportionately.
|
totalFeiBoosted -= feiAmount;
emit VaultLessened(msg.sender, vault, feiAmount);
|
totalFeiBoosted -= feiAmount;
emit VaultLessened(msg.sender, vault, feiAmount);
| 11,055
|
18
|
// Process kickback
|
uint256 stableToEldPrice = _priceResolverInstance.getStablePrice();
uint256 stableDecimals = _priceResolverInstance.getStableDecimals();
uint256 tokenKickback = _getTokenKickback(currentCharacter.price, stableToEldPrice, stableDecimals);
if (tokenKickback > 0) {
|
uint256 stableToEldPrice = _priceResolverInstance.getStablePrice();
uint256 stableDecimals = _priceResolverInstance.getStableDecimals();
uint256 tokenKickback = _getTokenKickback(currentCharacter.price, stableToEldPrice, stableDecimals);
if (tokenKickback > 0) {
| 26,569
|
7
|
// Triggered when a minting is requested _requestIdRequest ID of the request _addressRecipient address /
|
event MintRequest(bytes32 indexed _requestId, address indexed _address);
|
event MintRequest(bytes32 indexed _requestId, address indexed _address);
| 5,735
|
103
|
// Adjust lateness of Project before stage ✅
|
function adjustLatenessBeforeStage(
uint256 _id
)
internal
isProjectRunning(_id)
isCampaignRunning(projects[_id].parentCampaign)
|
function adjustLatenessBeforeStage(
uint256 _id
)
internal
isProjectRunning(_id)
isCampaignRunning(projects[_id].parentCampaign)
| 31,300
|
178
|
// allows the key manager to expire a given tokenIdand send a refund to the keyOwner based on the amount of time remaining. _tokenId The id of the key to cancel. cancel is enabled with a 10% penalty by default on all Locks. /
|
function cancelAndRefund(uint _tokenId) external;
|
function cancelAndRefund(uint _tokenId) external;
| 16,718
|
5
|
// Mint a token reservation, allowing the preminter to send the non-existing token from address 0/ return the future minted tokenId
|
function premintFor(address _preminter) external returns(uint256){
mintedTokens = mintedTokens + 1;
preminters[mintedTokens] = _preminter;
return mintedTokens;
}
|
function premintFor(address _preminter) external returns(uint256){
mintedTokens = mintedTokens + 1;
preminters[mintedTokens] = _preminter;
return mintedTokens;
}
| 16,946
|
241
|
// We swapped too much, which means that we need to swap in the backward direction But we don't want to swap in the backward direction, we need to swap less in forward direction Let's recalculate forward swap again Or, if we swapped the full amount
|
if (
state.zeroForOneAfterSwap != cache.originalZeroForOne ||
state.amountSpecifiedRemaining < EPSILON
) {
|
if (
state.zeroForOneAfterSwap != cache.originalZeroForOne ||
state.amountSpecifiedRemaining < EPSILON
) {
| 24,383
|
18
|
// contructor /
|
{
name_ = _name;
currency_ = _currency;
for (uint256 i = 0; i < _addresses.length; i++) {
registerUserPrivate(_addresses[i], _validUntilTime);
}
}
|
{
name_ = _name;
currency_ = _currency;
for (uint256 i = 0; i < _addresses.length; i++) {
registerUserPrivate(_addresses[i], _validUntilTime);
}
}
| 17,771
|
40
|
// ADD LIQUIDITY
|
function _addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin
|
function _addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin
| 3,435
|
146
|
// We read and store the key's index to prevent multiple reads from the same storage slot
|
uint256 keyIndex = map._indexes[key];
if (keyIndex == 0) { // Equivalent to !contains(map, key)
map._entries.push(MapEntry({ _key: key, _value: value }));
|
uint256 keyIndex = map._indexes[key];
if (keyIndex == 0) { // Equivalent to !contains(map, key)
map._entries.push(MapEntry({ _key: key, _value: value }));
| 681
|
168
|
// Perform actual minting of the tokens
|
function _mintTokens(address to, uint count) internal {
for(uint index = 0; index < count; index++) {
_tokenIds.increment();
uint newItemId = _tokenIds.current();
_safeMint(to, newItemId);
}
}
|
function _mintTokens(address to, uint count) internal {
for(uint index = 0; index < count; index++) {
_tokenIds.increment();
uint newItemId = _tokenIds.current();
_safeMint(to, newItemId);
}
}
| 48,125
|
12
|
// update the given pool's nft info/
|
function setNFT(
uint256 _pid,
string calldata _name,
address _contractAdd,
bool _isUsed,
uint16 _multiplier,
uint16 _startIdx,
uint16 _endIdx
|
function setNFT(
uint256 _pid,
string calldata _name,
address _contractAdd,
bool _isUsed,
uint16 _multiplier,
uint16 _startIdx,
uint16 _endIdx
| 23,014
|
117
|
// Update router address in case of pancakeswap migration
|
function setRouterAddress(address newRouter) external onlyOwner {
require(newRouter != address(router));
IRouter _newRouter = IRouter(newRouter);
address get_pair = IFactory(_newRouter.factory()).getPair(address(this), _newRouter.WETH());
if (get_pair == address(0)) {
pair = IFactory(_newRouter.factory()).createPair(address(this), _newRouter.WETH());
}
else {
pair = get_pair;
}
router = _newRouter;
}
|
function setRouterAddress(address newRouter) external onlyOwner {
require(newRouter != address(router));
IRouter _newRouter = IRouter(newRouter);
address get_pair = IFactory(_newRouter.factory()).getPair(address(this), _newRouter.WETH());
if (get_pair == address(0)) {
pair = IFactory(_newRouter.factory()).createPair(address(this), _newRouter.WETH());
}
else {
pair = get_pair;
}
router = _newRouter;
}
| 40,706
|
62
|
// Whether `a` is less than `b`. a a FixedPoint. b a FixedPoint.return True if `a < b`, or False. /
|
function isLessThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {
return a.rawValue < b.rawValue;
}
|
function isLessThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {
return a.rawValue < b.rawValue;
}
| 5,529
|
962
|
// reweights regardless of eligibility
|
function forceReweight() external;
|
function forceReweight() external;
| 39,761
|
134
|
// approve positionManager so it can pull tokens
|
_inputData.token0.approveToken(address(positionManager), amount0Pulled);
_inputData.token1.approveToken(address(positionManager), amount1Pulled);
_inputData.amount0Desired = amount0Pulled;
_inputData.amount1Desired = amount1Pulled;
uint128 liquidity;
uint256 amount0;
uint256 amount1;
(tokenId, liquidity, amount0, amount1) = _uniMint(_inputData);
|
_inputData.token0.approveToken(address(positionManager), amount0Pulled);
_inputData.token1.approveToken(address(positionManager), amount1Pulled);
_inputData.amount0Desired = amount0Pulled;
_inputData.amount1Desired = amount1Pulled;
uint128 liquidity;
uint256 amount0;
uint256 amount1;
(tokenId, liquidity, amount0, amount1) = _uniMint(_inputData);
| 31,138
|
6
|
// The Compound Faucet Test Token (non-standard) Compound A simple test token that lets anyone get more of it. /
|
contract FaucetNonStandardToken is NonStandardToken {
constructor(uint256 _initialAmount, string memory _tokenName, uint8 _decimalUnits, string memory _tokenSymbol) public
NonStandardToken(_initialAmount, _tokenName, _decimalUnits, _tokenSymbol) {
}
function allocateTo(address _owner, uint256 value) public {
balanceOf[_owner] += value;
totalSupply += value;
emit Transfer(address(this), _owner, value);
}
}
|
contract FaucetNonStandardToken is NonStandardToken {
constructor(uint256 _initialAmount, string memory _tokenName, uint8 _decimalUnits, string memory _tokenSymbol) public
NonStandardToken(_initialAmount, _tokenName, _decimalUnits, _tokenSymbol) {
}
function allocateTo(address _owner, uint256 value) public {
balanceOf[_owner] += value;
totalSupply += value;
emit Transfer(address(this), _owner, value);
}
}
| 41,826
|
4
|
// return {bool} true if metadata is valid, false otherwise /
|
function validData(uint256, uint value) public view override returns (bool) {
|
function validData(uint256, uint value) public view override returns (bool) {
| 46,373
|
5
|
// Chainlink & Randomness Assume three mint stages (0, 1, 2) requiring hashes and offsets
|
bytes32 private s_keyHash;
uint256 private s_fee;
mapping (uint256 => bytes32) public provenanceHashes;
mapping (uint256 => uint256) public offsets;
mapping (uint256 => bool) public offsetsRequested;
mapping (uint256 => uint256) public stageSizes;
mapping (bytes32 => uint256) public offsetRequestIds;
|
bytes32 private s_keyHash;
uint256 private s_fee;
mapping (uint256 => bytes32) public provenanceHashes;
mapping (uint256 => uint256) public offsets;
mapping (uint256 => bool) public offsetsRequested;
mapping (uint256 => uint256) public stageSizes;
mapping (bytes32 => uint256) public offsetRequestIds;
| 17,605
|
13
|
// setPolicyThis method is called by root key holders to configurea trustee. The caller must hold rootKeyId as mintedby the locksmith. The keyId provided as trustee, as well as the beneficiaries,needs to be in the key ring. Events are optional.rootKeyId the root key to use to set up the trustee role trusteeKeyIdthe key Id to anoint as trustee sourceKeyId the key id to use as the source of all fund movements beneficiaries the keys the trustee can move funds to eventsthe list of events that must occur before activating the role /
|
function setPolicy(uint256 rootKeyId, uint256 trusteeKeyId, uint256 sourceKeyId,
|
function setPolicy(uint256 rootKeyId, uint256 trusteeKeyId, uint256 sourceKeyId,
| 13,871
|
14
|
// Returns the encoded amounts that were transferred to the contract, only for token X reserves The reserves tokenX The token Xreturn amounts The amounts, encoded as follows:[0 - 128[: amountX[128 - 256[: empty /
|
function receivedX(bytes32 reserves, IERC20 tokenX) internal view returns (bytes32) {
uint128 reserveX = reserves.decodeX();
return (_balanceOf(tokenX) - reserveX).encodeFirst();
}
|
function receivedX(bytes32 reserves, IERC20 tokenX) internal view returns (bytes32) {
uint128 reserveX = reserves.decodeX();
return (_balanceOf(tokenX) - reserveX).encodeFirst();
}
| 30,649
|
562
|
// evaluate rewards for validator who did't sign and set latest reward per stake to new value to avoid them from getting new rewards.
|
_updateValidatorsRewards(unsignedValidators, totalUnsignedValidators, newRewardPerStake);
|
_updateValidatorsRewards(unsignedValidators, totalUnsignedValidators, newRewardPerStake);
| 22,805
|
0
|
// Overflows due to resetting x.
|
x = x + 1;
|
x = x + 1;
| 29,406
|
21
|
// Returns data about owner royaltiesreturn tuple(address pmixAddress, uint16 reSaleBasisPoint) /
|
function getOwnerRoyalties() external view returns (address, uint16) {
return (
reSell[ownerReSellPosition].userAddress,
reSell[ownerReSellPosition].basisPoint
);
}
|
function getOwnerRoyalties() external view returns (address, uint16) {
return (
reSell[ownerReSellPosition].userAddress,
reSell[ownerReSellPosition].basisPoint
);
}
| 17,104
|
9
|
// spawn the contract using `CREATE2`.
|
spawnedContract = _spawnCreate2(initCode);
|
spawnedContract = _spawnCreate2(initCode);
| 30,991
|
47
|
// transferFrom deposit from sender to contract ! needs prior approval on token contract.
|
require(token.transferFrom(msg.sender, address(this), _value));
|
require(token.transferFrom(msg.sender, address(this), _value));
| 48,137
|
188
|
// sells the liquid token by withdrawing from its reserve_amountamount of liquid tokens to sell_traderaddress of the caller who executed the conversion_beneficiary wallet to receive the conversion result return amount of reserve tokens received/
|
function sell(uint256 _amount, address _trader, address payable _beneficiary) internal returns (uint256) {
// ensure that the input amount was already deposited
require(_amount <= IDSToken(address(anchor)).balanceOf(address(this)), "ERR_INVALID_AMOUNT");
// get expected target amount and fee
(uint256 amount, uint256 fee) = saleTargetAmount(_amount);
// ensure the trade gives something in return
require(amount != 0, "ERR_ZERO_TARGET_AMOUNT");
IERC20Token reserveToken = reserveTokens[0];
// ensure that the trade will only deplete the reserve balance if the total supply is depleted as well
uint256 tokenSupply = IDSToken(address(anchor)).totalSupply();
uint256 rsvBalance = reserveBalance(reserveToken);
assert(amount < rsvBalance || (amount == rsvBalance && _amount == tokenSupply));
// destroy the tokens from the converter balance in the liquid token
IDSToken(address(anchor)).destroy(address(this), _amount);
// update the reserve balance
reserves[reserveToken].balance = reserves[reserveToken].balance.sub(amount);
// transfer funds to the beneficiary in the reserve token
if (reserveToken == ETH_RESERVE_ADDRESS)
_beneficiary.transfer(amount);
else
safeTransfer(reserveToken, _beneficiary, amount);
// dispatch the conversion event
dispatchConversionEvent(IDSToken(address(anchor)), reserveToken, _trader, _amount, amount, fee);
return amount;
}
|
function sell(uint256 _amount, address _trader, address payable _beneficiary) internal returns (uint256) {
// ensure that the input amount was already deposited
require(_amount <= IDSToken(address(anchor)).balanceOf(address(this)), "ERR_INVALID_AMOUNT");
// get expected target amount and fee
(uint256 amount, uint256 fee) = saleTargetAmount(_amount);
// ensure the trade gives something in return
require(amount != 0, "ERR_ZERO_TARGET_AMOUNT");
IERC20Token reserveToken = reserveTokens[0];
// ensure that the trade will only deplete the reserve balance if the total supply is depleted as well
uint256 tokenSupply = IDSToken(address(anchor)).totalSupply();
uint256 rsvBalance = reserveBalance(reserveToken);
assert(amount < rsvBalance || (amount == rsvBalance && _amount == tokenSupply));
// destroy the tokens from the converter balance in the liquid token
IDSToken(address(anchor)).destroy(address(this), _amount);
// update the reserve balance
reserves[reserveToken].balance = reserves[reserveToken].balance.sub(amount);
// transfer funds to the beneficiary in the reserve token
if (reserveToken == ETH_RESERVE_ADDRESS)
_beneficiary.transfer(amount);
else
safeTransfer(reserveToken, _beneficiary, amount);
// dispatch the conversion event
dispatchConversionEvent(IDSToken(address(anchor)), reserveToken, _trader, _amount, amount, fee);
return amount;
}
| 48,756
|
24
|
// Modifies the `paymentFraudproofCollateral` amount. _paymentFraudproofCollateral The new value for `paymentFraudproofCollateral` to take. /
|
function setPaymentFraudproofCollateral(uint256 _paymentFraudproofCollateral) external;
|
function setPaymentFraudproofCollateral(uint256 _paymentFraudproofCollateral) external;
| 29,751
|
15
|
// Cache value to local variable to reduce read costs.
|
uint256 id = _ids[i];
uint256 value = _values[i];
if (isNonFungible(id)) {
require(nfOwners[id] == _from);
nfOwners[id] = _to;
} else {
|
uint256 id = _ids[i];
uint256 value = _values[i];
if (isNonFungible(id)) {
require(nfOwners[id] == _from);
nfOwners[id] = _to;
} else {
| 12,539
|
31
|
// First sale uses marketplace royalties instead of secondary market.
|
royaltyLength = asset.royaltySplits.length;
|
royaltyLength = asset.royaltySplits.length;
| 36,507
|
24
|
// Get reinforcement for outcome `outcomeId`.outcomeId outcome IDreturn reinforcement for outcome `outcomeId` if defined or default value /
|
function getReinforcement(uint64 outcomeId) public view returns (uint128) {
if (reinforcements[outcomeId] != 0) return reinforcements[outcomeId];
return defaultReinforcement;
}
|
function getReinforcement(uint64 outcomeId) public view returns (uint128) {
if (reinforcements[outcomeId] != 0) return reinforcements[outcomeId];
return defaultReinforcement;
}
| 19,562
|
82
|
// The block number at which the Darknode is considered deregistered.
|
uint256 deregisteredAt;
|
uint256 deregisteredAt;
| 12,356
|
1
|
// state of the contract
|
ContractState public contractState;
|
ContractState public contractState;
| 33,861
|
99
|
// multiply by the time
|
newTmpSeed *= currentTime;
|
newTmpSeed *= currentTime;
| 50,789
|
78
|
// 1 + numOffers2
|
uint256 i = 1 + (_values[0] & mask8) * 2;
|
uint256 i = 1 + (_values[0] & mask8) * 2;
| 35,854
|
265
|
// Pad with Pool's potential cut
|
newRedeemable = newRedeemable.mul(100).div(SafeMath.sub(100, Constants.getOraclePoolRatio()));
|
newRedeemable = newRedeemable.mul(100).div(SafeMath.sub(100, Constants.getOraclePoolRatio()));
| 13,324
|
82
|
// 0x60: Invalid reveal serialization (malformed reveals are converted to this value)
|
MalformedReveal,
|
MalformedReveal,
| 59,766
|
160
|
// transfer from msg.sender and approve to
|
_transferFromSenderAndApproveTo(
IERC20(connectorsAddress[i]),
connectorsAmount[i],
spender);
|
_transferFromSenderAndApproveTo(
IERC20(connectorsAddress[i]),
connectorsAmount[i],
spender);
| 5,650
|
169
|
// View function to see pending CAKEs on frontend.
|
function pendingCake(uint256 _pid, address _user)
external
view
returns (uint256);
|
function pendingCake(uint256 _pid, address _user)
external
view
returns (uint256);
| 10,094
|
46
|
// TODO :Expand quota
|
uint256 quota_delta=price*250/100;
m_Users[msg.sender].PETH_Quota=m_Users[msg.sender].PETH_Quota+quota_delta;
|
uint256 quota_delta=price*250/100;
m_Users[msg.sender].PETH_Quota=m_Users[msg.sender].PETH_Quota+quota_delta;
| 21,350
|
166
|
// Get the current tranche or bail out if there is no tranche defined for the current block./tokensSold total amount of tokens sold, for calculating the current tranche/ return Returns the struct representing the current tranche
|
function getCurrentTranche(uint tokensSold) private view returns (Tranche storage) {
for (uint i = 0; i < tranches.length; i++) {
if (tranches[i].start <= block.timestamp && block.timestamp < tranches[i].end && tokensSold < tranches[i].amount) {
return tranches[i];
}
}
// No tranche is currently active
revert();
}
|
function getCurrentTranche(uint tokensSold) private view returns (Tranche storage) {
for (uint i = 0; i < tranches.length; i++) {
if (tranches[i].start <= block.timestamp && block.timestamp < tranches[i].end && tokensSold < tranches[i].amount) {
return tranches[i];
}
}
// No tranche is currently active
revert();
}
| 24,388
|
1
|
// returns withdrawable amount from all contractsreturn total withdrawable balance /
|
function withdrawable() external view returns (uint[][] memory) {
uint[][] memory _withdrawable = new uint[][](sweepers.length);
for (uint i = 0; i < sweepers.length; i++) {
_withdrawable[i] = ISweeper(sweepers[i]).withdrawable();
}
return _withdrawable;
}
|
function withdrawable() external view returns (uint[][] memory) {
uint[][] memory _withdrawable = new uint[][](sweepers.length);
for (uint i = 0; i < sweepers.length; i++) {
_withdrawable[i] = ISweeper(sweepers[i]).withdrawable();
}
return _withdrawable;
}
| 52,031
|
9
|
// see https:docs.chain.link/docs/vrf-contracts/configurations
|
constructor(
uint64 _vrfSubscriptionId,
bytes32 _vrfKeyHash,
address _vrfCoordinator) VRFConsumerBaseV2(_vrfCoordinator) {
COORDINATOR = VRFCoordinatorV2Interface(_vrfCoordinator);
vrfSubscriptionId = _vrfSubscriptionId;
vrfKeyHash = _vrfKeyHash;
}
|
constructor(
uint64 _vrfSubscriptionId,
bytes32 _vrfKeyHash,
address _vrfCoordinator) VRFConsumerBaseV2(_vrfCoordinator) {
COORDINATOR = VRFCoordinatorV2Interface(_vrfCoordinator);
vrfSubscriptionId = _vrfSubscriptionId;
vrfKeyHash = _vrfKeyHash;
}
| 5,070
|
29
|
// Send _value amount of tokens from address _from to address _toThe transferFrom method is used for a withdraw workflow, allowing contracts to sendtokens on your behalf, for example to "deposit" to a contract address and/or to chargefees in sub-currencies; the command should fail unless the _from account hasdeliberately authorized the sender of the message via some mechanism; we proposethese standardized APIs for approval:
|
function transferFrom( address _from, address _to, uint256 _amount )public returns (bool ok) {
require( _to != 0x0);
require(balances[_from] >= _amount && allowed[_from][msg.sender] >= _amount && _amount >= 0);
balances[_from] = (balances[_from]).sub(_amount);
allowed[_from][msg.sender] = (allowed[_from][msg.sender]).sub(_amount);
balances[_to] = (balances[_to]).add(_amount);
Transfer(_from, _to, _amount);
return true;
}
|
function transferFrom( address _from, address _to, uint256 _amount )public returns (bool ok) {
require( _to != 0x0);
require(balances[_from] >= _amount && allowed[_from][msg.sender] >= _amount && _amount >= 0);
balances[_from] = (balances[_from]).sub(_amount);
allowed[_from][msg.sender] = (allowed[_from][msg.sender]).sub(_amount);
balances[_to] = (balances[_to]).add(_amount);
Transfer(_from, _to, _amount);
return true;
}
| 11,136
|
4
|
// Performs a generic transaction. _target The address for the transaction. _value The value of the transaction. _data The data of the transaction. /
|
function invoke(address _target, uint _value, bytes calldata _data) external returns (bytes memory _result) {
bool success;
(success, _result) = _target.call{value: _value}(_data);
if (!success) {
// solhint-disable-next-line no-inline-assembly
assembly {
returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
}
}
emit Invoked(msg.sender, _target, _value, _data);
}
|
function invoke(address _target, uint _value, bytes calldata _data) external returns (bytes memory _result) {
bool success;
(success, _result) = _target.call{value: _value}(_data);
if (!success) {
// solhint-disable-next-line no-inline-assembly
assembly {
returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
}
}
emit Invoked(msg.sender, _target, _value, _data);
}
| 22,987
|
62
|
// Read and consume the next byte from the buffer as an `uint8`./buffer An instance of `Buffer`./ return value The `uint8` value of the next byte in the buffer counting from the cursor position.
|
function readUint8(Buffer memory buffer)
internal pure
withinRange(buffer.cursor, buffer.data.length)
returns (uint8 value)
|
function readUint8(Buffer memory buffer)
internal pure
withinRange(buffer.cursor, buffer.data.length)
returns (uint8 value)
| 18,886
|
4
|
// Change the hal9k vault address
|
function changeHal9kVaultAddress(address _hal9kVaultAddress) external onlyOwner {
address oldAddress = address(hal9kVault);
hal9kVault = IHal9kVault(_hal9kVaultAddress);
emit vaultAddressChanged(_hal9kVaultAddress, oldAddress);
}
|
function changeHal9kVaultAddress(address _hal9kVaultAddress) external onlyOwner {
address oldAddress = address(hal9kVault);
hal9kVault = IHal9kVault(_hal9kVaultAddress);
emit vaultAddressChanged(_hal9kVaultAddress, oldAddress);
}
| 5,043
|
18
|
// check if voter who has already voted is trying to vote again
|
require(!contains(poll.voters, msg.sender), "You cannot vote again.");
if (optionIndex == 0) {
poll.option0Votes++;
} else if (optionIndex == 1) {
|
require(!contains(poll.voters, msg.sender), "You cannot vote again.");
if (optionIndex == 0) {
poll.option0Votes++;
} else if (optionIndex == 1) {
| 24
|
300
|
// transfer xaup tokens to clients deposit address from populous server allowance
|
xa.safeTransferFrom(msg.sender, _depositAddress, _tokenId, xaup_amount, "");
|
xa.safeTransferFrom(msg.sender, _depositAddress, _tokenId, xaup_amount, "");
| 22,262
|
168
|
// ERC721
|
function tokenURI(uint256 tokenId)
public
view
override(ERC721)
returns (string memory)
|
function tokenURI(uint256 tokenId)
public
view
override(ERC721)
returns (string memory)
| 63,000
|
127
|
// safely transfer tokens without underflowing
|
function safeTokenTransfer(
address recipient,
address token,
uint256 amount
) internal returns (uint256) {
if (amount == 0) {
return 0;
}
|
function safeTokenTransfer(
address recipient,
address token,
uint256 amount
) internal returns (uint256) {
if (amount == 0) {
return 0;
}
| 62,516
|
21
|
// set withdraw only use when bugs happned.
|
function withdrawAmount (uint256 _amount) onlyContractCreator() public {
msg.sender.transfer(_amount);
totalPool = totalPool - _amount;
}
|
function withdrawAmount (uint256 _amount) onlyContractCreator() public {
msg.sender.transfer(_amount);
totalPool = totalPool - _amount;
}
| 41,630
|
69
|
// Finally, update the _from user&39;s swap balance
|
self.swap_balances[from_swaps[i]][from_swap_user_index].amount = self.swap_balances[from_swaps[i]][from_swap_user_index].amount.sub(_amount);
|
self.swap_balances[from_swaps[i]][from_swap_user_index].amount = self.swap_balances[from_swaps[i]][from_swap_user_index].amount.sub(_amount);
| 49,959
|
26
|
// The number of votes the voter had, which were cast
|
uint96 votes;
|
uint96 votes;
| 28,805
|
4
|
// Year
|
dt.year = getYear(timestamp);
buf = leapYearsBefore(dt.year) - leapYearsBefore(ORIGIN_YEAR);
secondsAccountedFor += LEAP_YEAR_IN_SECONDS * buf;
secondsAccountedFor += YEAR_IN_SECONDS * (dt.year - ORIGIN_YEAR - buf);
|
dt.year = getYear(timestamp);
buf = leapYearsBefore(dt.year) - leapYearsBefore(ORIGIN_YEAR);
secondsAccountedFor += LEAP_YEAR_IN_SECONDS * buf;
secondsAccountedFor += YEAR_IN_SECONDS * (dt.year - ORIGIN_YEAR - buf);
| 20,879
|
2
|
// emitted when an asset is added for the voting strategy asset address of the token to be added storageSlots array of storage positions of the balance mapping /
|
event VotingAssetAdd(address indexed asset, uint128[] storageSlots);
|
event VotingAssetAdd(address indexed asset, uint128[] storageSlots);
| 43,047
|
105
|
// solhint-disable no-unused-vars // solhint-disable ordering //Override to make effectively-private.
|
function transferFrom(
address from,
address to,
uint256 tokenId
|
function transferFrom(
address from,
address to,
uint256 tokenId
| 37,513
|
124
|
// 'Delete' from the array by setting the address to 0x0
|
for (uint i = 0; i < frax_pools_array.length; i++){
if (frax_pools_array[i] == pool_address) {
frax_pools_array[i] = address(0); // This will leave a null in the array and keep the indices the same
break;
}
|
for (uint i = 0; i < frax_pools_array.length; i++){
if (frax_pools_array[i] == pool_address) {
frax_pools_array[i] = address(0); // This will leave a null in the array and keep the indices the same
break;
}
| 12,200
|
80
|
// the user receives the amount per unitthe units they have or control
|
amount = (shares * globalRatio) / PRECISION;
|
amount = (shares * globalRatio) / PRECISION;
| 34,362
|
65
|
// mapping between a burn request hash and the corresponding request nonce.
|
mapping(bytes32=>uint) public burnRequestNonce;
Request[] public mintRequests;
Request[] public burnRequests;
|
mapping(bytes32=>uint) public burnRequestNonce;
Request[] public mintRequests;
Request[] public burnRequests;
| 9,529
|
0
|
// Approvals - [authoriser][delegate] Each authoriser can have multiple delegates
|
mapping(address => mapping(address => bool)) public approval;
|
mapping(address => mapping(address => bool)) public approval;
| 21,581
|
5
|
// Handle the receipt of multiple ERC1155 token types An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeBatchTransferFrom` after the balances have been updatedThis function MAY throw to revert and reject the transferReturn of other amount than the magic value WILL result in the transaction being revertedNote: The token contract address is always the message sender _operatorThe address which called the `safeBatchTransferFrom` function _fromThe address which previously owned the token _ids An array containing ids of each token being transferred _amounts An array containing amounts of each token being transferred _dataAdditional
|
function onERC1155BatchReceived(
address _operator,
|
function onERC1155BatchReceived(
address _operator,
| 40,345
|
1
|
// mints $WOOL to a recipient to the recipient of the $WOOL amount the amount of $WOOL to mint /
|
function mint(address to, uint256 amount) external {
require(controllers[msg.sender], "Only controllers can mint");
_mint(to, amount);
}
|
function mint(address to, uint256 amount) external {
require(controllers[msg.sender], "Only controllers can mint");
_mint(to, amount);
}
| 20,765
|
31
|
// Sanity check if we add a rewarder
|
if (address(_rewarder) != address(0)) {
_rewarder.onJoeReward(address(0), 0);
}
|
if (address(_rewarder) != address(0)) {
_rewarder.onJoeReward(address(0), 0);
}
| 20,508
|
4
|
// Buy only one box 只买一盒 /
|
function _pickDay(uint256 ledgerType, uint256 seed) internal returns (uint16) {
BucketStock storage bucketStock = ledgerBucketStock[ledgerType];
uint16 randIndex = _getRandomIndex(seed, bucketStock.currentBucketStock);
uint16 location = _pickLocation(randIndex, bucketStock);
uint16 category = binarySearch(bucketStock.stockPrefixSum, location);
return bucketStock.typeDays[category];
}
|
function _pickDay(uint256 ledgerType, uint256 seed) internal returns (uint16) {
BucketStock storage bucketStock = ledgerBucketStock[ledgerType];
uint16 randIndex = _getRandomIndex(seed, bucketStock.currentBucketStock);
uint16 location = _pickLocation(randIndex, bucketStock);
uint16 category = binarySearch(bucketStock.stockPrefixSum, location);
return bucketStock.typeDays[category];
}
| 9,304
|
10
|
// Time is after vesting end, return all the tokens
|
return tokenAmounts[_account];
|
return tokenAmounts[_account];
| 31,202
|
13
|
// Get short pool utilization _shortPoolReserved amount of liquidity reserved in the short poolreturn current short pool utilization as a decimal scaled 1018 /
|
function calcShortPoolUtil(uint256 _shortPoolReserved) public view returns (uint256) {
return (_shortPoolReserved * 1e18) / shortPoolBalance;
}
|
function calcShortPoolUtil(uint256 _shortPoolReserved) public view returns (uint256) {
return (_shortPoolReserved * 1e18) / shortPoolBalance;
}
| 34,013
|
30
|
// Safe May transfer function, just in case if rounding error causes pool to not have enough SUSHIs.
|
function safeSushiTransfer(address _to, uint256 _amount) internal {
uint256 mayBal = may.balanceOf(address(this));
if (_amount > mayBal) {
may.transfer(_to, mayBal);
} else {
may.transfer(_to, _amount);
}
}
|
function safeSushiTransfer(address _to, uint256 _amount) internal {
uint256 mayBal = may.balanceOf(address(this));
if (_amount > mayBal) {
may.transfer(_to, mayBal);
} else {
may.transfer(_to, _amount);
}
}
| 12,478
|
13
|
// add money pot id to author money pot list
|
addressToMoneyPot[msg.sender].push(moneyPotId);
|
addressToMoneyPot[msg.sender].push(moneyPotId);
| 15,533
|
1
|
// Adds liquidity for the given recipient/tickLower/tickUpper position/The caller of this method receives a callback in the form of IUniswapV3MintCallbackuniswapV3MintCallback/ in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends/ on tickLower, tickUpper, the amount of liquidity, and the current price./recipient The address for which the liquidity will be created/tickLower The lower tick of the position in which to add liquidity/tickUpper The upper tick of the position in which to add liquidity/amount The amount of liquidity to mint/data Any data that should be passed through to the callback/ return amount0 The amount
|
function mint(
address recipient,
int24 tickLower,
int24 tickUpper,
uint128 amount,
bytes calldata data
) external returns (uint256 amount0, uint256 amount1);
|
function mint(
address recipient,
int24 tickLower,
int24 tickUpper,
uint128 amount,
bytes calldata data
) external returns (uint256 amount0, uint256 amount1);
| 33,222
|
2
|
// Events - fire events on state changes etc
|
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
|
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
| 815
|
25
|
// Called by: Elections contract/ Notifies a new member applicable for committee (due to registration, unbanning, certification change)
|
function addMember(address addr, uint256 weight, bool isCertified) external returns (bool committeeChanged) /* onlyElectionsContract */;
|
function addMember(address addr, uint256 weight, bool isCertified) external returns (bool committeeChanged) /* onlyElectionsContract */;
| 36,640
|
283
|
// CALLABLE BY ANYBODY: Sync Set positions with enabled Compound collateral and borrow positions. For collateral assets, update cToken default position. For borrow assets, update external borrow position.- Collateral assets may come out of sync when a position is liquidated- Borrow assets may come out of sync when interest is accrued or position is liquidated and borrow is repaid_setToken Instance of the SetToken /
|
function sync(ISetToken _setToken) public nonReentrant onlyValidAndInitializedSet(_setToken) {
uint256 setTotalSupply = _setToken.totalSupply();
// Only sync positions when Set supply is not 0. This preserves debt and collateral positions on issuance / redemption
// and does not
if (setTotalSupply > 0) {
// Loop through collateral assets
address[] memory collateralCTokens = enabledAssets[_setToken].collateralCTokens;
for(uint256 i = 0; i < collateralCTokens.length; i++) {
ICErc20 collateralCToken = ICErc20(collateralCTokens[i]);
uint256 previousPositionUnit = _setToken.getDefaultPositionRealUnit(address(collateralCToken)).toUint256();
uint256 newPositionUnit = _getCollateralPosition(_setToken, collateralCToken, setTotalSupply);
// Note: Accounts for if position does not exist on SetToken but is tracked in enabledAssets
if (previousPositionUnit != newPositionUnit) {
_updateCollateralPosition(_setToken, collateralCToken, newPositionUnit);
}
}
// Loop through borrow assets
address[] memory borrowCTokens = enabledAssets[_setToken].borrowCTokens;
address[] memory borrowAssets = enabledAssets[_setToken].borrowAssets;
for(uint256 i = 0; i < borrowCTokens.length; i++) {
ICErc20 borrowCToken = ICErc20(borrowCTokens[i]);
IERC20 borrowAsset = IERC20(borrowAssets[i]);
int256 previousPositionUnit = _setToken.getExternalPositionRealUnit(address(borrowAsset), address(this));
int256 newPositionUnit = _getBorrowPosition(
_setToken,
borrowCToken,
setTotalSupply
);
// Note: Accounts for if position does not exist on SetToken but is tracked in enabledAssets
if (newPositionUnit != previousPositionUnit) {
_updateBorrowPosition(_setToken, borrowAsset, newPositionUnit);
}
}
}
}
|
function sync(ISetToken _setToken) public nonReentrant onlyValidAndInitializedSet(_setToken) {
uint256 setTotalSupply = _setToken.totalSupply();
// Only sync positions when Set supply is not 0. This preserves debt and collateral positions on issuance / redemption
// and does not
if (setTotalSupply > 0) {
// Loop through collateral assets
address[] memory collateralCTokens = enabledAssets[_setToken].collateralCTokens;
for(uint256 i = 0; i < collateralCTokens.length; i++) {
ICErc20 collateralCToken = ICErc20(collateralCTokens[i]);
uint256 previousPositionUnit = _setToken.getDefaultPositionRealUnit(address(collateralCToken)).toUint256();
uint256 newPositionUnit = _getCollateralPosition(_setToken, collateralCToken, setTotalSupply);
// Note: Accounts for if position does not exist on SetToken but is tracked in enabledAssets
if (previousPositionUnit != newPositionUnit) {
_updateCollateralPosition(_setToken, collateralCToken, newPositionUnit);
}
}
// Loop through borrow assets
address[] memory borrowCTokens = enabledAssets[_setToken].borrowCTokens;
address[] memory borrowAssets = enabledAssets[_setToken].borrowAssets;
for(uint256 i = 0; i < borrowCTokens.length; i++) {
ICErc20 borrowCToken = ICErc20(borrowCTokens[i]);
IERC20 borrowAsset = IERC20(borrowAssets[i]);
int256 previousPositionUnit = _setToken.getExternalPositionRealUnit(address(borrowAsset), address(this));
int256 newPositionUnit = _getBorrowPosition(
_setToken,
borrowCToken,
setTotalSupply
);
// Note: Accounts for if position does not exist on SetToken but is tracked in enabledAssets
if (newPositionUnit != previousPositionUnit) {
_updateBorrowPosition(_setToken, borrowAsset, newPositionUnit);
}
}
}
}
| 29,551
|
216
|
// ============ Allocation ============
|
function allocate(address recipient, uint256 count) external;
|
function allocate(address recipient, uint256 count) external;
| 72,058
|
97
|
// Destroys `amount` tokens from `account`.`amount` is then deductedfrom the caller's allowance.
|
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(
account,
_msgSender(),
_allowances[account][_msgSender()].sub(
amount,
"BEP20: burn amount exceeds allowance"
)
);
}
|
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(
account,
_msgSender(),
_allowances[account][_msgSender()].sub(
amount,
"BEP20: burn amount exceeds allowance"
)
);
}
| 4,149
|
321
|
// burn the tickets
|
ControlledToken(controlledToken).controllerBurnFrom(_msgSender(), from, amount);
|
ControlledToken(controlledToken).controllerBurnFrom(_msgSender(), from, amount);
| 23,713
|
60
|
// exchangeRate = invoke Exchange Rate Stored() //We calculate the exchange rate and the amount of underlying to be redeemed: redeemTokens = redeemTokensIn redeemAmount = redeemTokensIn x exchangeRateCurrent /
|
vars.redeemTokens = redeemTokensIn;
|
vars.redeemTokens = redeemTokensIn;
| 28,304
|
30
|
// remove order's price from list /
|
function _removeOrderPrice(
uint256 nonce,
address askAssetAddress,
address bidAssetAddress
|
function _removeOrderPrice(
uint256 nonce,
address askAssetAddress,
address bidAssetAddress
| 7,004
|
44
|
// This function makes it easy to read the `allowed[]` map/_owner The address of the account that owns the token/_spender The address of the account able to transfer the tokens/ return Amount of remaining tokens of _owner that _spender is allowed/to spend
|
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
|
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
| 6,554
|
66
|
// `numSold` at time of purchase represents the "serial number" of the NFT.
|
uint256 numSold,
uint256 amountPaid,
|
uint256 numSold,
uint256 amountPaid,
| 9,147
|
17
|
// Gets the balance of the specified address._owner The address to query the the balance of.return An uint256 representing the amount owned by the passed address./
|
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
|
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
| 4,763
|
72
|
// Previously claimed tokens must be less than what is unlocked
|
require(claimed[teamReserveWallet] < totalUnlocked);
|
require(claimed[teamReserveWallet] < totalUnlocked);
| 81,873
|
27
|
// grant backer until first 24 hours contributor address /
|
function addWhitelist(address contributor, uint256 amount) onlyOwner public returns (bool) {
Whitelist(contributor, amount);
whitelist[contributor] = amount;
return true;
}
|
function addWhitelist(address contributor, uint256 amount) onlyOwner public returns (bool) {
Whitelist(contributor, amount);
whitelist[contributor] = amount;
return true;
}
| 5,065
|
38
|
// Ensures the voter has not already claimed tokens and challenge results have been processed
|
require(challenges[_challengeID].tokenClaims[msg.sender] == false, 'tokens already claimed');
require(challenges[_challengeID].resolved == true, 'challenge not resolved');
uint voterTokens = voting.getNumPassingTokens(msg.sender, _challengeID, _salt);
uint reward = voterReward(msg.sender, _challengeID, _salt);
|
require(challenges[_challengeID].tokenClaims[msg.sender] == false, 'tokens already claimed');
require(challenges[_challengeID].resolved == true, 'challenge not resolved');
uint voterTokens = voting.getNumPassingTokens(msg.sender, _challengeID, _salt);
uint reward = voterReward(msg.sender, _challengeID, _salt);
| 53,886
|
85
|
// passing the user, id as well as the parsed blueprint to a child-implemented _mintFor method child's implementation should (at the very least) call ERC721's _safeMint(user, id)
|
_mintFor(user, id, blueprint);
|
_mintFor(user, id, blueprint);
| 68,112
|
20
|
// Require a valid commitment
|
require(commitments[commitment] + minCommitmentAge <= block.timestamp);
|
require(commitments[commitment] + minCommitmentAge <= block.timestamp);
| 53,955
|
156
|
// Withdraw a bid when the auction is not finalized
|
function withdraw(uint256 tokenId) public nonReentrant {
require(canWithdraw(tokenId), "Conditions to withdraw are not met");
// transfer funds to highest bidder always
if (auctions[tokenId].highestBid > 0) {
require(payment_token.transfer(auctions[tokenId].highestBidder, auctions[tokenId].highestBid), "Transfer failed.");
}
// finalize the auction
delete auctions[tokenId];
}
|
function withdraw(uint256 tokenId) public nonReentrant {
require(canWithdraw(tokenId), "Conditions to withdraw are not met");
// transfer funds to highest bidder always
if (auctions[tokenId].highestBid > 0) {
require(payment_token.transfer(auctions[tokenId].highestBidder, auctions[tokenId].highestBid), "Transfer failed.");
}
// finalize the auction
delete auctions[tokenId];
}
| 25,981
|
554
|
// Calculates the increase in balance since the last user interaction user The address of the user for which the interest is being accumulatedreturn The previous principal balance, the new principal balance and the balance increase / Calculation of the accrued interest since the last accumulation
|
uint256 balanceIncrease = balanceOf(user).sub(previousPrincipalBalance);
return (
previousPrincipalBalance,
previousPrincipalBalance.add(balanceIncrease),
balanceIncrease
);
|
uint256 balanceIncrease = balanceOf(user).sub(previousPrincipalBalance);
return (
previousPrincipalBalance,
previousPrincipalBalance.add(balanceIncrease),
balanceIncrease
);
| 60,750
|
85
|
// Initializes a Chainlink request Sets the ID, callback address, and callback function signature on the request self The uninitialized request _id The Job Specification ID _callbackAddress The callback address _callbackFunction The callback function signaturereturn The initialized request /
|
function initialize(
Request memory self,
bytes32 _id,
address _callbackAddress,
bytes4 _callbackFunction
|
function initialize(
Request memory self,
bytes32 _id,
address _callbackAddress,
bytes4 _callbackFunction
| 2,757
|
55
|
// reward rate 100 % per year
|
uint256 public rewardRate = 9625714525;
uint256 public rewardInterval = 365 days;
|
uint256 public rewardRate = 9625714525;
uint256 public rewardInterval = 365 days;
| 41,770
|
110
|
// Allows a request to be cancelled if it has not been fulfilled Requires keeping track of the expiration value emitted from the oracle contract.Deletes the request from the `pendingRequests` mapping.Emits ChainlinkCancelled event. requestId The request ID payment The amount of LINK sent for the request callbackFunc The callback function specified for the request expiration The time of the expiration for the request /
|
function cancelChainlinkRequest(
bytes32 requestId,
uint256 payment,
bytes4 callbackFunc,
uint256 expiration
|
function cancelChainlinkRequest(
bytes32 requestId,
uint256 payment,
bytes4 callbackFunc,
uint256 expiration
| 9,587
|
66
|
// now calculate reward
|
uint256 reward = bnbPool.mul(multiplier).mul(currentBalance).div(100).div(totalSupply);
return reward;
|
uint256 reward = bnbPool.mul(multiplier).mul(currentBalance).div(100).div(totalSupply);
return reward;
| 11,009
|
102
|
// Sets if the contract should enter emergency exit mode.// There are 2 main reasons to pause:/ 1. Need to shut down deposits in case of an emergency in one of the vaults/ 2. Need to migrate to a new transmuter// While the transmuter is paused, deposit() and distribute() are disabled//_pause if the contract should enter emergency exit mode.
|
function setPause(bool _pause) external {
require(msg.sender == governance || msg.sender == sentinel, "!(gov || sentinel)");
pause = _pause;
emit PauseUpdated(_pause);
}
|
function setPause(bool _pause) external {
require(msg.sender == governance || msg.sender == sentinel, "!(gov || sentinel)");
pause = _pause;
emit PauseUpdated(_pause);
}
| 47,753
|
184
|
// Add a price library from the mapping of tracked price libraries.Can only be called by owner of Core. _priceLibrary Address of the price library /
|
function addPriceLibrary(
address _priceLibrary
)
external
onlyOwner
timeLockUpgrade
|
function addPriceLibrary(
address _priceLibrary
)
external
onlyOwner
timeLockUpgrade
| 26,982
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.