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
|
|---|---|---|---|---|
41
|
// Sets the collateral ratio needed to mint tokens _ratio uint Only owner can call it /
|
function setRatio(uint256 _ratio) external virtual onlyOwner {
require(
_ratio >= MIN_RATIO,
"VaultHandler::setRatio: ratio lower than MIN_RATIO"
);
ratio = _ratio;
emit NewRatio(msg.sender, _ratio);
}
|
function setRatio(uint256 _ratio) external virtual onlyOwner {
require(
_ratio >= MIN_RATIO,
"VaultHandler::setRatio: ratio lower than MIN_RATIO"
);
ratio = _ratio;
emit NewRatio(msg.sender, _ratio);
}
| 49,495
|
332
|
// Used for checking whether the user has approvedthe contract to buy/exercise the options on her behalf. spender The address of the contractthat is used for exercising the options tokenId The ERC721 token ID that is linked to the option /
|
{
address owner = ERC721.ownerOf(tokenId);
return (spender == owner ||
getApproved(tokenId) == spender ||
isApprovedForAll(owner, spender));
}
|
{
address owner = ERC721.ownerOf(tokenId);
return (spender == owner ||
getApproved(tokenId) == spender ||
isApprovedForAll(owner, spender));
}
| 40,292
|
76
|
// Set new recipient
|
s.routerConfigs[_router].recipient = _updated;
|
s.routerConfigs[_router].recipient = _updated;
| 23,829
|
4
|
// Emitted when a `tokenId` has been listed for a `price` by a `seller`/
|
event ItemListed(uint256 tokenId, uint256 price, address seller);
|
event ItemListed(uint256 tokenId, uint256 price, address seller);
| 6,502
|
37
|
// Crowdsale administrator
|
address public owners;
|
address public owners;
| 36,221
|
85
|
// These helper functions are exposed for changing the start and end time dynamically/
|
function changeStartTime(uint256 _startTime) external onlyOwner {startTime = _startTime;}
function changeEndTime(uint256 _endTime) external onlyOwner {endTime = _endTime;}
}
|
function changeStartTime(uint256 _startTime) external onlyOwner {startTime = _startTime;}
function changeEndTime(uint256 _endTime) external onlyOwner {endTime = _endTime;}
}
| 5,681
|
3
|
// Allow another address to spend on the caller's behalf./ Set allowance for other address and notify./ Allows `_spender` to transfer the specified TDT/ on your behalf and then ping the contract about it./ The `_spender` should implement the `ITokenRecipient`/ interface below to receive approval notifications./_spender `ITokenRecipient`-conforming contract authorized to/operate on the approved token./_tdtId The TDT they can spend./_extraData Extra information to send to the approved contract.
|
function approveAndCall(ITokenRecipient _spender, uint256 _tdtId, bytes memory _extraData) public returns (bool) {
approve(address(_spender), _tdtId);
_spender.receiveApproval(msg.sender, _tdtId, address(this), _extraData);
return true;
}
|
function approveAndCall(ITokenRecipient _spender, uint256 _tdtId, bytes memory _extraData) public returns (bool) {
approve(address(_spender), _tdtId);
_spender.receiveApproval(msg.sender, _tdtId, address(this), _extraData);
return true;
}
| 28,808
|
134
|
// Returns the number of tokens minted by `owner`. /
|
function _numberMinted(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> BITPOS_NUMBER_MINTED) & BITMASK_ADDRESS_DATA_ENTRY;
}
|
function _numberMinted(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> BITPOS_NUMBER_MINTED) & BITMASK_ADDRESS_DATA_ENTRY;
}
| 24,180
|
5
|
// Retrieve the size of the code on target address, this needs assembly .
|
codeLength := extcodesize(to)
|
codeLength := extcodesize(to)
| 31,478
|
66
|
// uint32 in seconds = 136 years
|
uint32 vestingInterval;
|
uint32 vestingInterval;
| 14,269
|
0
|
// Array log of current participants
|
address[] public participants;
mapping (address => uint) participantsArrayLocation;
uint participantsCount;
|
address[] public participants;
mapping (address => uint) participantsArrayLocation;
uint participantsCount;
| 42,006
|
33
|
// Concadenates two bytes array Author: Gonçalo Sá <goncalo.sa@consensys.net>
|
function concat(
bytes memory _preBytes,
bytes memory _postBytes
|
function concat(
bytes memory _preBytes,
bytes memory _postBytes
| 53,662
|
34
|
// Used to calculate NAV
|
address oracleAddr;
|
address oracleAddr;
| 16,794
|
103
|
// Create new instances of a PlayerToken contract and pass along msg.value (so the referee pays and not the contract)
|
function newInitialPlayerOffering(
string _name,
string _symbol,
uint _startPrice,
uint _incrementalPrice,
address _owner,
uint256 _playerId,
uint8 _promoSharesQuantity
)
external
|
function newInitialPlayerOffering(
string _name,
string _symbol,
uint _startPrice,
uint _incrementalPrice,
address _owner,
uint256 _playerId,
uint8 _promoSharesQuantity
)
external
| 14,737
|
6
|
// Refund sender any remaining tokens
|
IERC20(weth).safeTransfer(
msg.sender,
IERC20(weth).balanceOf(address(this))
);
IERC20(_to).safeTransfer(msg.sender, IERC20(_to).balanceOf(address(this)));
|
IERC20(weth).safeTransfer(
msg.sender,
IERC20(weth).balanceOf(address(this))
);
IERC20(_to).safeTransfer(msg.sender, IERC20(_to).balanceOf(address(this)));
| 26,033
|
3
|
// Now that we know what percentage of the Pool's current value the protocol should own, we can compute how much BPT we need to mint to get to this state. Since we're going to mint BPT for the protocol, the value of each BPT is going to be reduced as all LPs get diluted.
|
uint256 protocolFeeAmount = ProtocolFees.bptForPoolOwnershipPercentage(
virtualSupply,
expectedProtocolOwnershipPercentage
);
if (protocolFeeAmount > 0) {
_payProtocolFees(protocolFeeAmount);
}
|
uint256 protocolFeeAmount = ProtocolFees.bptForPoolOwnershipPercentage(
virtualSupply,
expectedProtocolOwnershipPercentage
);
if (protocolFeeAmount > 0) {
_payProtocolFees(protocolFeeAmount);
}
| 21,201
|
34
|
// Updates creditedPoints, sends all wei to the owner
|
function collectOwedDividends()
public
returns (uint _amount)
|
function collectOwedDividends()
public
returns (uint _amount)
| 45,285
|
104
|
// return tax token address /
|
function getTaxTokenAddress() external view override returns (address) {
return address(_taxTokenContract);
}
|
function getTaxTokenAddress() external view override returns (address) {
return address(_taxTokenContract);
}
| 8,500
|
27
|
// check if protocol is initialized
|
if(cycle == 0) {
|
if(cycle == 0) {
| 15,728
|
0
|
// ETH Limits
|
uint minHostTransactionValue;
uint maxHostTransactionValue;
uint dayHostMaxLimit;
uint dayHostMaxLimitForOneAddress;
uint maxHostPendingTransactionLimit;
|
uint minHostTransactionValue;
uint maxHostTransactionValue;
uint dayHostMaxLimit;
uint dayHostMaxLimitForOneAddress;
uint maxHostPendingTransactionLimit;
| 17,934
|
103
|
// Returns current auction prices for up to 50 auctions/_tokenIds - up to 50 IDs of NFT on auction that we want the prices of
|
function getCurrentAuctionPrices(uint128[] _tokenIds) public view returns (uint128[50]) {
require (_tokenIds.length <= 50);
/// @dev A fixed array we can return current auction price information in.
uint128[50] memory currentPricesArray;
for (uint8 i = 0; i < _tokenIds.length; i++) {
Auction storage auction = tokenIdToAuction[_tokenIds[i]];
if (_isOnAuction(auction)) {
uint256 price = _currentPrice(auction);
currentPricesArray[i] = uint128(price);
}
}
return currentPricesArray;
}
|
function getCurrentAuctionPrices(uint128[] _tokenIds) public view returns (uint128[50]) {
require (_tokenIds.length <= 50);
/// @dev A fixed array we can return current auction price information in.
uint128[50] memory currentPricesArray;
for (uint8 i = 0; i < _tokenIds.length; i++) {
Auction storage auction = tokenIdToAuction[_tokenIds[i]];
if (_isOnAuction(auction)) {
uint256 price = _currentPrice(auction);
currentPricesArray[i] = uint128(price);
}
}
return currentPricesArray;
}
| 311
|
13
|
// WmbApp Abstract contract to be inherited by applications to use Wanchain Message Bridge for send and receive messages between different chains.All interfaces with WmbGateway have been encapsulated, so users do not need to have any interaction with the WmbGateway contract. /
|
abstract contract WmbApp is AccessControl, Initializable, IWmbReceiver {
// The address of the WMB Gateway contract
address public wmbGateway;
// A mapping of remote chains and addresses that are trusted to send messages to this contract
// fromChainId => fromAddress => trusted
mapping (uint => mapping(address => bool)) public trustedRemotes;
/**
* @dev Initializes the contract with the given admin, WMB Gateway address, and block mode flag
* @param admin Address of the contract admin
* @param _wmbGateway Address of the WMB Gateway contract
*/
function initialize(address admin, address _wmbGateway) virtual public initializer {
// Initialize the AccessControl module with the given admin
_setupRole(DEFAULT_ADMIN_ROLE, admin);
wmbGateway = _wmbGateway;
}
/**
* @dev Function to set the trusted remote addresses
* @param fromChainIds IDs of the chains the messages are from
* @param froms Addresses of the contracts the messages are from
* @param trusted Trusted flag
* @notice This function can only be called by the admin
*/
function setTrustedRemotes(uint[] calldata fromChainIds, address[] calldata froms, bool[] calldata trusted) external {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "WmbApp: must have admin role to set trusted remotes");
require(fromChainIds.length == froms.length && froms.length == trusted.length, "WmbApp: invalid input");
for (uint i = 0; i < fromChainIds.length; i++) {
trustedRemotes[fromChainIds[i]][froms[i]] = trusted[i];
}
}
/**
* @dev Function to estimate fee in native coin for sending a message to the WMB Gateway
* @param toChain ID of the chain the message is to
* @param gasLimit Gas limit for the message
* @return fee Fee in native coin
*/
function estimateFee(uint256 toChain, uint256 gasLimit) virtual public view returns (uint256) {
return IWmbGateway(wmbGateway).estimateFee(toChain, gasLimit);
}
/**
* @dev Function to receive a WMB message from the WMB Gateway
* @param data Message data
* @param messageId Message ID
* @param fromChainId ID of the chain the message is from
* @param from Address of the contract the message is from
*/
function wmbReceive(
bytes calldata data,
bytes32 messageId,
uint256 fromChainId,
address from
) virtual external {
// Only the WMB gateway can call this function
require(msg.sender == wmbGateway, "WmbApp: Only WMB gateway can call this function");
require(trustedRemotes[fromChainId][from], "WmbApp: Remote is not trusted");
_wmbReceive(data, messageId, fromChainId, from);
}
/**
* @dev Function to be implemented by the application to handle received WMB messages
* @param data Message data
* @param messageId Message ID
* @param fromChainId ID of the chain the message is from
* @param from Address of the contract the message is from
*/
function _wmbReceive(
bytes calldata data,
bytes32 messageId,
uint256 fromChainId,
address from
) virtual internal;
/**
* @dev Function to send a WMB message to the WMB Gateway from this App
* @param toChainId ID of the chain the message is to
* @param to Address of the contract the message is to
* @param data Message data
* @return messageId Message ID
*/
function _dispatchMessage(
uint toChainId,
address to,
bytes memory data,
uint fee
) virtual internal returns (bytes32) {
return IWmbGateway(wmbGateway).dispatchMessage{value: fee}(toChainId, to, data);
}
/**
* @dev Function to send batch WMB messages to the WMB Gateway from this App
* @param toChainId ID of the chain the message is to
* @param messages Messages data
* @return messageId Message ID
*/
function _dispatchMessageBatch(uint256 toChainId, Message[] memory messages, uint fee) virtual internal returns (bytes32) {
return IWmbGateway(wmbGateway).dispatchMessageBatch{value: fee}(toChainId, messages);
}
}
|
abstract contract WmbApp is AccessControl, Initializable, IWmbReceiver {
// The address of the WMB Gateway contract
address public wmbGateway;
// A mapping of remote chains and addresses that are trusted to send messages to this contract
// fromChainId => fromAddress => trusted
mapping (uint => mapping(address => bool)) public trustedRemotes;
/**
* @dev Initializes the contract with the given admin, WMB Gateway address, and block mode flag
* @param admin Address of the contract admin
* @param _wmbGateway Address of the WMB Gateway contract
*/
function initialize(address admin, address _wmbGateway) virtual public initializer {
// Initialize the AccessControl module with the given admin
_setupRole(DEFAULT_ADMIN_ROLE, admin);
wmbGateway = _wmbGateway;
}
/**
* @dev Function to set the trusted remote addresses
* @param fromChainIds IDs of the chains the messages are from
* @param froms Addresses of the contracts the messages are from
* @param trusted Trusted flag
* @notice This function can only be called by the admin
*/
function setTrustedRemotes(uint[] calldata fromChainIds, address[] calldata froms, bool[] calldata trusted) external {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "WmbApp: must have admin role to set trusted remotes");
require(fromChainIds.length == froms.length && froms.length == trusted.length, "WmbApp: invalid input");
for (uint i = 0; i < fromChainIds.length; i++) {
trustedRemotes[fromChainIds[i]][froms[i]] = trusted[i];
}
}
/**
* @dev Function to estimate fee in native coin for sending a message to the WMB Gateway
* @param toChain ID of the chain the message is to
* @param gasLimit Gas limit for the message
* @return fee Fee in native coin
*/
function estimateFee(uint256 toChain, uint256 gasLimit) virtual public view returns (uint256) {
return IWmbGateway(wmbGateway).estimateFee(toChain, gasLimit);
}
/**
* @dev Function to receive a WMB message from the WMB Gateway
* @param data Message data
* @param messageId Message ID
* @param fromChainId ID of the chain the message is from
* @param from Address of the contract the message is from
*/
function wmbReceive(
bytes calldata data,
bytes32 messageId,
uint256 fromChainId,
address from
) virtual external {
// Only the WMB gateway can call this function
require(msg.sender == wmbGateway, "WmbApp: Only WMB gateway can call this function");
require(trustedRemotes[fromChainId][from], "WmbApp: Remote is not trusted");
_wmbReceive(data, messageId, fromChainId, from);
}
/**
* @dev Function to be implemented by the application to handle received WMB messages
* @param data Message data
* @param messageId Message ID
* @param fromChainId ID of the chain the message is from
* @param from Address of the contract the message is from
*/
function _wmbReceive(
bytes calldata data,
bytes32 messageId,
uint256 fromChainId,
address from
) virtual internal;
/**
* @dev Function to send a WMB message to the WMB Gateway from this App
* @param toChainId ID of the chain the message is to
* @param to Address of the contract the message is to
* @param data Message data
* @return messageId Message ID
*/
function _dispatchMessage(
uint toChainId,
address to,
bytes memory data,
uint fee
) virtual internal returns (bytes32) {
return IWmbGateway(wmbGateway).dispatchMessage{value: fee}(toChainId, to, data);
}
/**
* @dev Function to send batch WMB messages to the WMB Gateway from this App
* @param toChainId ID of the chain the message is to
* @param messages Messages data
* @return messageId Message ID
*/
function _dispatchMessageBatch(uint256 toChainId, Message[] memory messages, uint fee) virtual internal returns (bytes32) {
return IWmbGateway(wmbGateway).dispatchMessageBatch{value: fee}(toChainId, messages);
}
}
| 15,823
|
77
|
// calculates amount of tokens available to redeem from investor, validations are not required
|
function __redeemAmount(address investor) internal view returns (uint amount) {
// round down allowance taking into account token decimals
uint allowance = token.allowance(investor, this) / k;
// for open crowdsales we check previously tracked investor balance
uint balance = balances[investor];
// return allowance safely by checking also the balance
return balance < allowance ? balance : allowance;
}
|
function __redeemAmount(address investor) internal view returns (uint amount) {
// round down allowance taking into account token decimals
uint allowance = token.allowance(investor, this) / k;
// for open crowdsales we check previously tracked investor balance
uint balance = balances[investor];
// return allowance safely by checking also the balance
return balance < allowance ? balance : allowance;
}
| 39,631
|
234
|
// Returns whether or not there's a duplicate. Runs in O(n^2). A Array to searchreturn Returns true if duplicate, false otherwise /
|
function hasDuplicate(address[] memory A) internal pure returns (bool) {
if (A.length == 0) {
return false;
}
for (uint256 i = 0; i < A.length - 1; i++) {
for (uint256 j = i + 1; j < A.length; j++) {
if (A[i] == A[j]) {
return true;
}
}
}
return false;
}
|
function hasDuplicate(address[] memory A) internal pure returns (bool) {
if (A.length == 0) {
return false;
}
for (uint256 i = 0; i < A.length - 1; i++) {
for (uint256 j = i + 1; j < A.length; j++) {
if (A[i] == A[j]) {
return true;
}
}
}
return false;
}
| 7,135
|
21
|
// We have \sigma^{-c} at 0x1a0:0x200 And \sigma_{acc} at 0x1e0:0x200 If i = m + 1 (i.e. first output note) then we set \gamma_{acc} and \sigma_{acc} to \gamma_i, -\sigma_i
|
if eq(i, m) {
mstore(0x260, mload(0x20))
mstore(0x280, mload(0x40))
mstore(0x1e0, mload(0xe0))
mstore(0x200, sub(0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47, mload(0x100)))
}
|
if eq(i, m) {
mstore(0x260, mload(0x20))
mstore(0x280, mload(0x40))
mstore(0x1e0, mload(0xe0))
mstore(0x200, sub(0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47, mload(0x100)))
}
| 14,403
|
131
|
// Token A number of decimals /
|
uint8 private _tokenADecimals;
|
uint8 private _tokenADecimals;
| 64,103
|
36
|
// Quit the system, migrating the cdp (ink, art) to a different dst urn
|
function quit(
uint cdp,
address dst
|
function quit(
uint cdp,
address dst
| 41,909
|
131
|
// we can accept 0 as minimum because this is called only by a trusted role
|
uint256 minimum = 0;
uint256[2] memory coinAmounts = wrapCoinAmount(wbtcBalance);
ICurveFiWbtc(curve).add_liquidity(
coinAmounts, minimum
);
|
uint256 minimum = 0;
uint256[2] memory coinAmounts = wrapCoinAmount(wbtcBalance);
ICurveFiWbtc(curve).add_liquidity(
coinAmounts, minimum
);
| 43,661
|
353
|
// adjustments[9]/mload(0x4ee0), Constraint expression for pedersen/hash2/ec_subset_sum/add_points/x: column13_row0column13_row0 - pedersen__hash2__ec_subset_sum__bit_0(column11_row0 + pedersen__points__x + column11_row1).
|
let val := addmod(
mulmod(/*column13_row0*/ mload(0x31a0), /*column13_row0*/ mload(0x31a0), PRIME),
sub(
PRIME,
mulmod(
|
let val := addmod(
mulmod(/*column13_row0*/ mload(0x31a0), /*column13_row0*/ mload(0x31a0), PRIME),
sub(
PRIME,
mulmod(
| 20,785
|
118
|
// Emitted when fees are compounded back into liquidity/sender The msg.sender address/bunniKeyHash The hash of the Bunni position's key/liquidity The amount by which liquidity was increased/amount0 The amount of token0 added to the liquidity position/amount1 The amount of token1 added to the liquidity position
|
event Compound(
address indexed sender,
bytes32 indexed bunniKeyHash,
uint128 liquidity,
uint256 amount0,
uint256 amount1
);
|
event Compound(
address indexed sender,
bytes32 indexed bunniKeyHash,
uint128 liquidity,
uint256 amount0,
uint256 amount1
);
| 32,684
|
36
|
// transfer underlying from sender
|
_transferFromSenderAndApproveTo(IERC20(tokenAddress), tokenAmount, yTokenAddress);
|
_transferFromSenderAndApproveTo(IERC20(tokenAddress), tokenAmount, yTokenAddress);
| 73,156
|
3
|
// Sets the fliquidator contract address _newFliquidator: new fliquidator address /
|
function setFliquidator(address _newFliquidator) external onlyOwner {
require(_newFliquidator != address(0), Errors.VL_ZERO_ADDR);
_fliquidator = _newFliquidator;
}
|
function setFliquidator(address _newFliquidator) external onlyOwner {
require(_newFliquidator != address(0), Errors.VL_ZERO_ADDR);
_fliquidator = _newFliquidator;
}
| 28,277
|
0
|
// events relating to donation operations
|
event FiatCollectedEvent(uint indexed charity, uint usd, string ref);
event FiatToEthEvent(uint indexed charity, uint usd, uint eth);
event EthToFiatEvent(uint indexed charity, uint eth, uint usd);
event FiatDeliveredEvent(uint indexed charity, uint usd, string ref);
event EthDonationEvent(uint indexed charity, uint eth);
|
event FiatCollectedEvent(uint indexed charity, uint usd, string ref);
event FiatToEthEvent(uint indexed charity, uint usd, uint eth);
event EthToFiatEvent(uint indexed charity, uint eth, uint usd);
event FiatDeliveredEvent(uint indexed charity, uint usd, string ref);
event EthDonationEvent(uint indexed charity, uint eth);
| 41,777
|
27
|
// Sets the resolver record for a name in ENS. name The name to set the resolver for. resolver The address of the resolver /
|
function setResolver(string name, address resolver) public owner_only(keccak256(name)) {
var label = keccak256(name);
var node = keccak256(TLD_NODE, label);
ens.setResolver(node, resolver);
}
|
function setResolver(string name, address resolver) public owner_only(keccak256(name)) {
var label = keccak256(name);
var node = keccak256(TLD_NODE, label);
ens.setResolver(node, resolver);
}
| 66,621
|
160
|
// Sets asset spending allowance for a specified spender._spender holder address to set allowance to. _value amount to allow. return success. /
|
function approve(address _spender, uint _value) public returns (bool) {
if (_spender != 0x0) {
return _getAsset().__approve(_spender, _value, msg.sender);
}
else {
return false;
}
}
|
function approve(address _spender, uint _value) public returns (bool) {
if (_spender != 0x0) {
return _getAsset().__approve(_spender, _value, msg.sender);
}
else {
return false;
}
}
| 45,448
|
200
|
// Calculate the number of shares to issue for a given deposit/This is based on the realized value of underlying assets between Sett & associated Strategy
|
function _deposit(uint256 _amount) internal virtual {
uint256 _pool = balance();
uint256 _before = token.balanceOf(address(this));
token.safeTransferFrom(msg.sender, address(this), _amount);
uint256 _after = token.balanceOf(address(this));
_amount = _after.sub(_before); // Additional check for deflationary tokens
uint256 shares = 0;
if (totalSupply() == 0) {
shares = _amount;
} else {
shares = (_amount.mul(totalSupply())).div(_pool);
}
_mint(msg.sender, shares);
}
|
function _deposit(uint256 _amount) internal virtual {
uint256 _pool = balance();
uint256 _before = token.balanceOf(address(this));
token.safeTransferFrom(msg.sender, address(this), _amount);
uint256 _after = token.balanceOf(address(this));
_amount = _after.sub(_before); // Additional check for deflationary tokens
uint256 shares = 0;
if (totalSupply() == 0) {
shares = _amount;
} else {
shares = (_amount.mul(totalSupply())).div(_pool);
}
_mint(msg.sender, shares);
}
| 41,568
|
226
|
// Exchanges ETH to DVD.
|
function buyFromETH() payable external nonReentrant returns (uint256 recipientDVD, uint256 marketTax, uint256 curveTax, uint256 taxedDVD) {
return _buy(address(this), msg.sender, _swapETHToMUSD(address(this), msg.value));
}
|
function buyFromETH() payable external nonReentrant returns (uint256 recipientDVD, uint256 marketTax, uint256 curveTax, uint256 taxedDVD) {
return _buy(address(this), msg.sender, _swapETHToMUSD(address(this), msg.value));
}
| 44,784
|
158
|
// convex chef allows anyone to claim, so we have to look at reward debt differenceso that we know how much we have claimed since previous notifyRewardAmount()
|
(,uint256 rewardDebt) = IConvexChef(convexMasterChef).userInfo(chefPid, address(this));
uint256 reward = rewardDebt.sub(previousRewardDebt);
previousRewardDebt = rewardDebt;
if(reward == 0) return;
if (block.timestamp >= periodFinish) {
rewardRate = reward.div(duration);
} else {
|
(,uint256 rewardDebt) = IConvexChef(convexMasterChef).userInfo(chefPid, address(this));
uint256 reward = rewardDebt.sub(previousRewardDebt);
previousRewardDebt = rewardDebt;
if(reward == 0) return;
if (block.timestamp >= periodFinish) {
rewardRate = reward.div(duration);
} else {
| 19,372
|
40
|
// Tokens already distributed
|
uint256 public distributedTokens;
|
uint256 public distributedTokens;
| 30,603
|
147
|
// Unstake Curve LP-token
|
curveFiLPGauge.withdraw(withdrawShares);
IERC20(curveFiToken).safeApprove(address(curveFiDeposit), withdrawShares);
curveFiDeposit.remove_liquidity_one_coin(withdrawShares, int128(tokenIdx), amount, false); //DONATE_DUST - false
IERC20(token).safeTransfer(beneficiary, amount);
|
curveFiLPGauge.withdraw(withdrawShares);
IERC20(curveFiToken).safeApprove(address(curveFiDeposit), withdrawShares);
curveFiDeposit.remove_liquidity_one_coin(withdrawShares, int128(tokenIdx), amount, false); //DONATE_DUST - false
IERC20(token).safeTransfer(beneficiary, amount);
| 21,337
|
6
|
// Withdraw LP tokens without caring about pending CVP tokens. EMERGENCY ONLY.
|
function emergencyWithdraw(uint256 _pid) external;
|
function emergencyWithdraw(uint256 _pid) external;
| 40,484
|
490
|
// Checks whether one asset is effectively equal to another asset./This is the case if they have the same ERC20Proxy/ERC20BridgeProxy asset data, or if/one is the ERC20Bridge equivalent of the other./assetData1 Byte array encoded for the takerFee asset proxy./assetData2 Byte array encoded for the maker asset proxy./ return areEqual Whether or not the underlying assets are equal.
|
function _areUnderlyingAssetsEqual(
bytes memory assetData1,
bytes memory assetData2
)
internal
pure
returns (bool)
|
function _areUnderlyingAssetsEqual(
bytes memory assetData1,
bytes memory assetData2
)
internal
pure
returns (bool)
| 49,158
|
15
|
// Sends ETH to a receiver's address on the other chain. Note that if ETH is sent to asmart contract and the call fails, the ETH will be temporarily locked in theStandardBridge on the other chain until the call is replayed. If the call cannot bereplayed with any amount of gas (call always reverts), then the ETH will bepermanently locked in the StandardBridge on the other chain. ETH will alsobe locked if the receiver is the other bridge, because finalizeBridgeETH will revertin that case._toAddress of the receiver. _minGasLimit Minimum amount of gas that the bridge can be relayed with. _extraData Extra
|
function bridgeETHTo(
address _to,
uint32 _minGasLimit,
bytes calldata _extraData
|
function bridgeETHTo(
address _to,
uint32 _minGasLimit,
bytes calldata _extraData
| 43,863
|
24
|
// Allows to add a new owner. Transaction has to be sent by wallet./_owner Address of new owner.
|
function addOwner(address _owner)
public
onlyWallet
ownerDoesNotExist(_owner)
notNull(_owner)
validRequirement(owners.length + 1, required)
|
function addOwner(address _owner)
public
onlyWallet
ownerDoesNotExist(_owner)
notNull(_owner)
validRequirement(owners.length + 1, required)
| 53,309
|
17
|
// Set owners /
|
function setOwners(address[] memory ownersList) public onlyOwner {
_owners = ownersList;
}
|
function setOwners(address[] memory ownersList) public onlyOwner {
_owners = ownersList;
}
| 983
|
87
|
// Expand the FXB target liquidity
|
target_liquidity_fxb = target_liquidity_fxb.add(fxb_expansion_amount);
|
target_liquidity_fxb = target_liquidity_fxb.add(fxb_expansion_amount);
| 35,688
|
15
|
// Pays Spotlight Fee to FF treasury, and then purchase the NFT on Mirror. /
|
function purchaseOnMirror(
address mirrorAddress
|
function purchaseOnMirror(
address mirrorAddress
| 37,160
|
2
|
// Hook called by community after transfers, if token manager of transferred token implementsthis interface. operator Operator transferring tokens from Token(s) sender to Token(s) recipient id Transferred token's id /
|
function postTransferFrom(
address operator,
|
function postTransferFrom(
address operator,
| 42,275
|
147
|
// The timestamp when liquidation was activated. We initialise this to uint max, so that we know that we are under liquidation if the liquidation timestamp is in the past.
|
uint public liquidationTimestamp = ~uint(0);
|
uint public liquidationTimestamp = ~uint(0);
| 636
|
146
|
// LOTUS tokens created per block.
|
uint256 public lotusPerBlock;
|
uint256 public lotusPerBlock;
| 15,455
|
36
|
// Delegate all votes from the sender to `delegatee`.NOTE: This function assumes that you do not have partial delegationsIt will revert with "Must have an undelegated amount available to cover delegation" if you do /
|
function delegate(address delegatee) public {
require(
delegatee != msg.sender,
"Use undelegate instead of delegating to yourself"
);
require(
delegationToAddressEnabled[delegatee],
"Primary delegates must enable delegation"
);
if (!isOwnDelegate(msg.sender)) {
undelegateFromAddress(getPrimaryDelegate(msg.sender));
}
uint256 _amount = _balances[msg.sender];
_delegate(msg.sender, delegatee, _amount);
_setPrimaryDelegate(msg.sender, delegatee);
}
|
function delegate(address delegatee) public {
require(
delegatee != msg.sender,
"Use undelegate instead of delegating to yourself"
);
require(
delegationToAddressEnabled[delegatee],
"Primary delegates must enable delegation"
);
if (!isOwnDelegate(msg.sender)) {
undelegateFromAddress(getPrimaryDelegate(msg.sender));
}
uint256 _amount = _balances[msg.sender];
_delegate(msg.sender, delegatee, _amount);
_setPrimaryDelegate(msg.sender, delegatee);
}
| 9,617
|
0
|
// Each time the relay set is updated, the nonce is incremented
|
uint32 nonce;
|
uint32 nonce;
| 11,119
|
555
|
// Removes an address from the list/self The Mapping struct that this function is attached to/prevAddress The address that precedes the address to be removed.This may be the SENTINEL if at the start./addr The address to remove from the list.
|
function removeAddress(Mapping storage self, address prevAddress, address addr) internal {
require(addr != SENTINEL && addr != address(0), "Invalid address");
require(self.addressMap[prevAddress] == addr, "Invalid prevAddress");
self.addressMap[prevAddress] = self.addressMap[addr];
delete self.addressMap[addr];
self.count = self.count - 1;
}
|
function removeAddress(Mapping storage self, address prevAddress, address addr) internal {
require(addr != SENTINEL && addr != address(0), "Invalid address");
require(self.addressMap[prevAddress] == addr, "Invalid prevAddress");
self.addressMap[prevAddress] = self.addressMap[addr];
delete self.addressMap[addr];
self.count = self.count - 1;
}
| 54,893
|
7
|
// trigger event
|
emit Transfer(
_from,
_recipient,
_tokenId
);
|
emit Transfer(
_from,
_recipient,
_tokenId
);
| 24,572
|
501
|
// Set payout to cached buyerPayout
|
payout = derivativePayouts[derivativeHash][0];
|
payout = derivativePayouts[derivativeHash][0];
| 59,450
|
89
|
// pragma solidity 0.6.12; // pragma experimental ABIEncoderV2; // import "dss-exec-lib/DssExec.sol"; // import "dss-exec-lib/DssAction.sol"; /
|
contract DssSpellAction is DssAction {
// Provides a descriptive tag for bot consumption
// This should be modified weekly to provide a summary of the actions
// Hash: seth keccak -- "$(wget https://raw.githubusercontent.com/makerdao/community/2dfe2a94162345e448c0353ec0e522038572366a/governance/votes/Executive%20vote%20-%20December%203%2C%202021.md -q -O - 2>/dev/null)"
string public constant override description =
"2021-12-03 MakerDAO Executive Spell | Hash: 0x9068bf87d0ec441f57ff92e2544a3df16d42a481b3e94ec2c37a443031833b84";
// Many of the settings that change weekly rely on the rate accumulator
// described at https://docs.makerdao.com/smart-contract-modules/rates-module
// To check this yourself, use the following rate calculation (example 8%):
//
// $ bc -l <<< 'scale=27; e( l(1.08)/(60 * 60 * 24 * 365) )'
//
// A table of rates can be found at
// https://ipfs.io/ipfs/QmefQMseb3AiTapiAKKexdKHig8wroKuZbmLtPLv4u2YwW
//
// --- Rates ---
uint256 constant ZERO_ONE_PCT_RATE = 1000000000031693947650284507;
uint256 constant ONE_PCT_RATE = 1000000000315522921573372069;
uint256 constant TWO_PCT_RATE = 1000000000627937192491029810;
uint256 constant TWO_FIVE_PCT_RATE = 1000000000782997609082909351;
uint256 constant TWO_SEVEN_FIVE_PCT_RATE = 1000000000860244400048238898;
uint256 constant THREE_PCT_RATE = 1000000000937303470807876289;
uint256 constant FOUR_PCT_RATE = 1000000001243680656318820312;
uint256 constant SIX_PCT_RATE = 1000000001847694957439350562;
uint256 constant SIX_FIVE_PCT_RATE = 1000000001996917783620820123;
// --- Math ---
uint256 constant MILLION = 10 ** 6;
uint256 constant BILLION = 10 ** 9;
// --- GUNIV3DAIUSDC2-A ---
address constant GUNIV3DAIUSDC2 = 0x50379f632ca68D36E50cfBC8F78fe16bd1499d1e;
address constant MCD_JOIN_GUNIV3DAIUSDC2_A = 0xA7e4dDde3cBcEf122851A7C8F7A55f23c0Daf335;
address constant MCD_CLIP_GUNIV3DAIUSDC2_A = 0xB55da3d3100C4eBF9De755b6DdC24BF209f6cc06;
address constant MCD_CLIP_CALC_GUNIV3DAIUSDC2_A = 0xef051Ca2A2d809ba47ee0FC8caaEd06E3D832225;
address constant PIP_GUNIV3DAIUSDC2 = 0xcCBa43231aC6eceBd1278B90c3a44711a00F4e93;
// --- Wallets ---
address constant COM_WALLET = 0x1eE3ECa7aEF17D1e74eD7C447CcBA61aC76aDbA9;
address constant FLIPFLOPFLAP_WALLET = 0x688d508f3a6B0a377e266405A1583B3316f9A2B3;
address constant FEEDBLACKLOOPS_WALLET = 0x80882f2A36d49fC46C3c654F7f9cB9a2Bf0423e1;
address constant ULTRASCHUPPI_WALLET = 0x89C5d54C979f682F40b73a9FC39F338C88B434c6;
address constant FIELDTECHNOLOGIES_WALLET = 0x0988E41C02915Fe1beFA78c556f946E5F20ffBD3;
function actions() public override {
// ----------------------------- Collateral onboarding -----------------------------
// Add GUNIV3DAIUSDC2-A as a new Vault Type
// https://vote.makerdao.com/polling/QmSkHE8T?network=mainnet#poll-detail
DssExecLib.addNewCollateral(
CollateralOpts({
ilk: "GUNIV3DAIUSDC2-A",
gem: GUNIV3DAIUSDC2,
join: MCD_JOIN_GUNIV3DAIUSDC2_A,
clip: MCD_CLIP_GUNIV3DAIUSDC2_A,
calc: MCD_CLIP_CALC_GUNIV3DAIUSDC2_A,
pip: PIP_GUNIV3DAIUSDC2,
isLiquidatable: false,
isOSM: true,
whitelistOSM: true,
ilkDebtCeiling: 10 * MILLION,
minVaultAmount: 15_000,
maxLiquidationAmount: 5 * MILLION,
liquidationPenalty: 1300,
ilkStabilityFee: ONE_PCT_RATE,
startingPriceFactor: 10500,
breakerTolerance: 9500,
auctionDuration: 220 minutes,
permittedDrop: 9000,
liquidationRatio: 10500,
kprFlatReward: 300,
kprPctReward: 10
})
);
DssExecLib.setStairstepExponentialDecrease(MCD_CLIP_CALC_GUNIV3DAIUSDC2_A, 120 seconds, 9990);
DssExecLib.setIlkAutoLineParameters("GUNIV3DAIUSDC2-A", 10 * MILLION, 10 * MILLION, 8 hours);
// ----------------------------- Rates updates -----------------------------
// https://vote.makerdao.com/polling/QmNqCZGa?network=mainnet
// Increase the ETH-A Stability Fee from 2.5% to 2.75%
DssExecLib.setIlkStabilityFee("ETH-A", TWO_SEVEN_FIVE_PCT_RATE, true);
// Increase the ETH-B Stability Fee from 6.0% to 6.5%
DssExecLib.setIlkStabilityFee("ETH-B", SIX_FIVE_PCT_RATE, true);
// Increase the LINK-A Stability Fee from 1.5% to 2.5%
DssExecLib.setIlkStabilityFee("LINK-A", TWO_FIVE_PCT_RATE, true);
// Increase the MANA-A Stability Fee from 3.0% to 6.0%
DssExecLib.setIlkStabilityFee("MANA-A", SIX_PCT_RATE, true);
// Increase the UNI-A Stability Fee from 1.0% to 3.0%
DssExecLib.setIlkStabilityFee("UNI-A", THREE_PCT_RATE, true);
// Increase the GUSD-A Stability Fee from 0.0% to 1.0%
DssExecLib.setIlkStabilityFee("GUSD-A", ONE_PCT_RATE, true);
// Increase the UNIV2DAIETH-A Stability Fee from 1.5% to 2.0%
DssExecLib.setIlkStabilityFee("UNIV2DAIETH-A", TWO_PCT_RATE, true);
// Increase the UNIV2WBTCETH-A Stability Fee from 2.5% to 3.0%
DssExecLib.setIlkStabilityFee("UNIV2WBTCETH-A", THREE_PCT_RATE, true);
// Increase the UNIV2USDCETH-A Stability Fee from 2.0% to 2.5%
DssExecLib.setIlkStabilityFee("UNIV2USDCETH-A", TWO_FIVE_PCT_RATE, true);
// Increase the UNIV2UNIETH-A Stability Fee from 2.0% to 4.0%
DssExecLib.setIlkStabilityFee("UNIV2UNIETH-A", FOUR_PCT_RATE, true);
// Decrease the GUNIV3DAIUSDC1-A Stability Fee from 0.5% to 0.1%
DssExecLib.setIlkStabilityFee("GUNIV3DAIUSDC1-A", ZERO_ONE_PCT_RATE, true);
// ----------------------------- Debt Ceiling updates -----------------------------
// Increase the WBTC-A Maximum Debt Ceiling (line) from 1.5 billion DAI to 2 billion DAI
// Increase the WBTC-A Target Available Debt (gap) from 60 million DAI to 80 million DAI
// https://vote.makerdao.com/polling/QmNqCZGa?network=mainnet
DssExecLib.setIlkAutoLineParameters("WBTC-A", 2 * BILLION, 80 * MILLION, 6 hours);
// Increase the Dust Parameter from 30,000 DAI to 40,000 DAI for the ETH-B
// https://vote.makerdao.com/polling/QmZXnn16?network=mainnet#poll-detail
DssExecLib.setIlkMinVaultAmount("ETH-B", 40_000);
// Increase the Dust Parameter from 10,000 DAI to 15,000 DAI for all vault-types excluding ETH-B and ETH-C
// https://vote.makerdao.com/polling/QmUYLPcr?network=mainnet#poll-detail
DssExecLib.setIlkMinVaultAmount("ETH-A", 15_000);
DssExecLib.setIlkMinVaultAmount("USDC-A", 15_000);
DssExecLib.setIlkMinVaultAmount("WBTC-A", 15_000);
DssExecLib.setIlkMinVaultAmount("TUSD-A", 15_000);
DssExecLib.setIlkMinVaultAmount("MANA-A", 15_000);
DssExecLib.setIlkMinVaultAmount("PAXUSD-A", 15_000);
DssExecLib.setIlkMinVaultAmount("LINK-A", 15_000);
DssExecLib.setIlkMinVaultAmount("YFI-A", 15_000);
DssExecLib.setIlkMinVaultAmount("GUSD-A", 15_000);
DssExecLib.setIlkMinVaultAmount("UNI-A", 15_000);
DssExecLib.setIlkMinVaultAmount("RENBTC-A", 15_000);
DssExecLib.setIlkMinVaultAmount("UNIV2DAIETH-A", 15_000);
DssExecLib.setIlkMinVaultAmount("UNIV2WBTCETH-A", 15_000);
DssExecLib.setIlkMinVaultAmount("UNIV2USDCETH-A", 15_000);
DssExecLib.setIlkMinVaultAmount("UNIV2DAIUSDC-A", 15_000);
DssExecLib.setIlkMinVaultAmount("UNIV2UNIETH-A", 15_000);
DssExecLib.setIlkMinVaultAmount("UNIV2WBTCDAI-A", 15_000);
DssExecLib.setIlkMinVaultAmount("MATIC-A", 15_000);
DssExecLib.setIlkMinVaultAmount("GUNIV3DAIUSDC1-A", 15_000);
DssExecLib.setIlkMinVaultAmount("WSTETH-A", 15_000);
// ----------------------------- Budget distributions -----------------------------
// Core Unit Budget Distributions
DssExecLib.sendPaymentFromSurplusBuffer(COM_WALLET, 27_058);
// Delegate Compensation Payments
DssExecLib.sendPaymentFromSurplusBuffer(FLIPFLOPFLAP_WALLET, 12_000);
DssExecLib.sendPaymentFromSurplusBuffer(FEEDBLACKLOOPS_WALLET, 12_000);
DssExecLib.sendPaymentFromSurplusBuffer(ULTRASCHUPPI_WALLET, 8_144);
DssExecLib.sendPaymentFromSurplusBuffer(FIELDTECHNOLOGIES_WALLET, 3_690);
// Changelog
DssExecLib.setChangelogAddress("GUNIV3DAIUSDC2", GUNIV3DAIUSDC2);
DssExecLib.setChangelogAddress("MCD_JOIN_GUNIV3DAIUSDC2_A", MCD_JOIN_GUNIV3DAIUSDC2_A);
DssExecLib.setChangelogAddress("MCD_CLIP_GUNIV3DAIUSDC2_A", MCD_CLIP_GUNIV3DAIUSDC2_A);
DssExecLib.setChangelogAddress("MCD_CLIP_CALC_GUNIV3DAIUSDC2_A", MCD_CLIP_CALC_GUNIV3DAIUSDC2_A);
DssExecLib.setChangelogAddress("PIP_GUNIV3DAIUSDC2", PIP_GUNIV3DAIUSDC2);
DssExecLib.setChangelogVersion("1.9.12");
}
}
|
contract DssSpellAction is DssAction {
// Provides a descriptive tag for bot consumption
// This should be modified weekly to provide a summary of the actions
// Hash: seth keccak -- "$(wget https://raw.githubusercontent.com/makerdao/community/2dfe2a94162345e448c0353ec0e522038572366a/governance/votes/Executive%20vote%20-%20December%203%2C%202021.md -q -O - 2>/dev/null)"
string public constant override description =
"2021-12-03 MakerDAO Executive Spell | Hash: 0x9068bf87d0ec441f57ff92e2544a3df16d42a481b3e94ec2c37a443031833b84";
// Many of the settings that change weekly rely on the rate accumulator
// described at https://docs.makerdao.com/smart-contract-modules/rates-module
// To check this yourself, use the following rate calculation (example 8%):
//
// $ bc -l <<< 'scale=27; e( l(1.08)/(60 * 60 * 24 * 365) )'
//
// A table of rates can be found at
// https://ipfs.io/ipfs/QmefQMseb3AiTapiAKKexdKHig8wroKuZbmLtPLv4u2YwW
//
// --- Rates ---
uint256 constant ZERO_ONE_PCT_RATE = 1000000000031693947650284507;
uint256 constant ONE_PCT_RATE = 1000000000315522921573372069;
uint256 constant TWO_PCT_RATE = 1000000000627937192491029810;
uint256 constant TWO_FIVE_PCT_RATE = 1000000000782997609082909351;
uint256 constant TWO_SEVEN_FIVE_PCT_RATE = 1000000000860244400048238898;
uint256 constant THREE_PCT_RATE = 1000000000937303470807876289;
uint256 constant FOUR_PCT_RATE = 1000000001243680656318820312;
uint256 constant SIX_PCT_RATE = 1000000001847694957439350562;
uint256 constant SIX_FIVE_PCT_RATE = 1000000001996917783620820123;
// --- Math ---
uint256 constant MILLION = 10 ** 6;
uint256 constant BILLION = 10 ** 9;
// --- GUNIV3DAIUSDC2-A ---
address constant GUNIV3DAIUSDC2 = 0x50379f632ca68D36E50cfBC8F78fe16bd1499d1e;
address constant MCD_JOIN_GUNIV3DAIUSDC2_A = 0xA7e4dDde3cBcEf122851A7C8F7A55f23c0Daf335;
address constant MCD_CLIP_GUNIV3DAIUSDC2_A = 0xB55da3d3100C4eBF9De755b6DdC24BF209f6cc06;
address constant MCD_CLIP_CALC_GUNIV3DAIUSDC2_A = 0xef051Ca2A2d809ba47ee0FC8caaEd06E3D832225;
address constant PIP_GUNIV3DAIUSDC2 = 0xcCBa43231aC6eceBd1278B90c3a44711a00F4e93;
// --- Wallets ---
address constant COM_WALLET = 0x1eE3ECa7aEF17D1e74eD7C447CcBA61aC76aDbA9;
address constant FLIPFLOPFLAP_WALLET = 0x688d508f3a6B0a377e266405A1583B3316f9A2B3;
address constant FEEDBLACKLOOPS_WALLET = 0x80882f2A36d49fC46C3c654F7f9cB9a2Bf0423e1;
address constant ULTRASCHUPPI_WALLET = 0x89C5d54C979f682F40b73a9FC39F338C88B434c6;
address constant FIELDTECHNOLOGIES_WALLET = 0x0988E41C02915Fe1beFA78c556f946E5F20ffBD3;
function actions() public override {
// ----------------------------- Collateral onboarding -----------------------------
// Add GUNIV3DAIUSDC2-A as a new Vault Type
// https://vote.makerdao.com/polling/QmSkHE8T?network=mainnet#poll-detail
DssExecLib.addNewCollateral(
CollateralOpts({
ilk: "GUNIV3DAIUSDC2-A",
gem: GUNIV3DAIUSDC2,
join: MCD_JOIN_GUNIV3DAIUSDC2_A,
clip: MCD_CLIP_GUNIV3DAIUSDC2_A,
calc: MCD_CLIP_CALC_GUNIV3DAIUSDC2_A,
pip: PIP_GUNIV3DAIUSDC2,
isLiquidatable: false,
isOSM: true,
whitelistOSM: true,
ilkDebtCeiling: 10 * MILLION,
minVaultAmount: 15_000,
maxLiquidationAmount: 5 * MILLION,
liquidationPenalty: 1300,
ilkStabilityFee: ONE_PCT_RATE,
startingPriceFactor: 10500,
breakerTolerance: 9500,
auctionDuration: 220 minutes,
permittedDrop: 9000,
liquidationRatio: 10500,
kprFlatReward: 300,
kprPctReward: 10
})
);
DssExecLib.setStairstepExponentialDecrease(MCD_CLIP_CALC_GUNIV3DAIUSDC2_A, 120 seconds, 9990);
DssExecLib.setIlkAutoLineParameters("GUNIV3DAIUSDC2-A", 10 * MILLION, 10 * MILLION, 8 hours);
// ----------------------------- Rates updates -----------------------------
// https://vote.makerdao.com/polling/QmNqCZGa?network=mainnet
// Increase the ETH-A Stability Fee from 2.5% to 2.75%
DssExecLib.setIlkStabilityFee("ETH-A", TWO_SEVEN_FIVE_PCT_RATE, true);
// Increase the ETH-B Stability Fee from 6.0% to 6.5%
DssExecLib.setIlkStabilityFee("ETH-B", SIX_FIVE_PCT_RATE, true);
// Increase the LINK-A Stability Fee from 1.5% to 2.5%
DssExecLib.setIlkStabilityFee("LINK-A", TWO_FIVE_PCT_RATE, true);
// Increase the MANA-A Stability Fee from 3.0% to 6.0%
DssExecLib.setIlkStabilityFee("MANA-A", SIX_PCT_RATE, true);
// Increase the UNI-A Stability Fee from 1.0% to 3.0%
DssExecLib.setIlkStabilityFee("UNI-A", THREE_PCT_RATE, true);
// Increase the GUSD-A Stability Fee from 0.0% to 1.0%
DssExecLib.setIlkStabilityFee("GUSD-A", ONE_PCT_RATE, true);
// Increase the UNIV2DAIETH-A Stability Fee from 1.5% to 2.0%
DssExecLib.setIlkStabilityFee("UNIV2DAIETH-A", TWO_PCT_RATE, true);
// Increase the UNIV2WBTCETH-A Stability Fee from 2.5% to 3.0%
DssExecLib.setIlkStabilityFee("UNIV2WBTCETH-A", THREE_PCT_RATE, true);
// Increase the UNIV2USDCETH-A Stability Fee from 2.0% to 2.5%
DssExecLib.setIlkStabilityFee("UNIV2USDCETH-A", TWO_FIVE_PCT_RATE, true);
// Increase the UNIV2UNIETH-A Stability Fee from 2.0% to 4.0%
DssExecLib.setIlkStabilityFee("UNIV2UNIETH-A", FOUR_PCT_RATE, true);
// Decrease the GUNIV3DAIUSDC1-A Stability Fee from 0.5% to 0.1%
DssExecLib.setIlkStabilityFee("GUNIV3DAIUSDC1-A", ZERO_ONE_PCT_RATE, true);
// ----------------------------- Debt Ceiling updates -----------------------------
// Increase the WBTC-A Maximum Debt Ceiling (line) from 1.5 billion DAI to 2 billion DAI
// Increase the WBTC-A Target Available Debt (gap) from 60 million DAI to 80 million DAI
// https://vote.makerdao.com/polling/QmNqCZGa?network=mainnet
DssExecLib.setIlkAutoLineParameters("WBTC-A", 2 * BILLION, 80 * MILLION, 6 hours);
// Increase the Dust Parameter from 30,000 DAI to 40,000 DAI for the ETH-B
// https://vote.makerdao.com/polling/QmZXnn16?network=mainnet#poll-detail
DssExecLib.setIlkMinVaultAmount("ETH-B", 40_000);
// Increase the Dust Parameter from 10,000 DAI to 15,000 DAI for all vault-types excluding ETH-B and ETH-C
// https://vote.makerdao.com/polling/QmUYLPcr?network=mainnet#poll-detail
DssExecLib.setIlkMinVaultAmount("ETH-A", 15_000);
DssExecLib.setIlkMinVaultAmount("USDC-A", 15_000);
DssExecLib.setIlkMinVaultAmount("WBTC-A", 15_000);
DssExecLib.setIlkMinVaultAmount("TUSD-A", 15_000);
DssExecLib.setIlkMinVaultAmount("MANA-A", 15_000);
DssExecLib.setIlkMinVaultAmount("PAXUSD-A", 15_000);
DssExecLib.setIlkMinVaultAmount("LINK-A", 15_000);
DssExecLib.setIlkMinVaultAmount("YFI-A", 15_000);
DssExecLib.setIlkMinVaultAmount("GUSD-A", 15_000);
DssExecLib.setIlkMinVaultAmount("UNI-A", 15_000);
DssExecLib.setIlkMinVaultAmount("RENBTC-A", 15_000);
DssExecLib.setIlkMinVaultAmount("UNIV2DAIETH-A", 15_000);
DssExecLib.setIlkMinVaultAmount("UNIV2WBTCETH-A", 15_000);
DssExecLib.setIlkMinVaultAmount("UNIV2USDCETH-A", 15_000);
DssExecLib.setIlkMinVaultAmount("UNIV2DAIUSDC-A", 15_000);
DssExecLib.setIlkMinVaultAmount("UNIV2UNIETH-A", 15_000);
DssExecLib.setIlkMinVaultAmount("UNIV2WBTCDAI-A", 15_000);
DssExecLib.setIlkMinVaultAmount("MATIC-A", 15_000);
DssExecLib.setIlkMinVaultAmount("GUNIV3DAIUSDC1-A", 15_000);
DssExecLib.setIlkMinVaultAmount("WSTETH-A", 15_000);
// ----------------------------- Budget distributions -----------------------------
// Core Unit Budget Distributions
DssExecLib.sendPaymentFromSurplusBuffer(COM_WALLET, 27_058);
// Delegate Compensation Payments
DssExecLib.sendPaymentFromSurplusBuffer(FLIPFLOPFLAP_WALLET, 12_000);
DssExecLib.sendPaymentFromSurplusBuffer(FEEDBLACKLOOPS_WALLET, 12_000);
DssExecLib.sendPaymentFromSurplusBuffer(ULTRASCHUPPI_WALLET, 8_144);
DssExecLib.sendPaymentFromSurplusBuffer(FIELDTECHNOLOGIES_WALLET, 3_690);
// Changelog
DssExecLib.setChangelogAddress("GUNIV3DAIUSDC2", GUNIV3DAIUSDC2);
DssExecLib.setChangelogAddress("MCD_JOIN_GUNIV3DAIUSDC2_A", MCD_JOIN_GUNIV3DAIUSDC2_A);
DssExecLib.setChangelogAddress("MCD_CLIP_GUNIV3DAIUSDC2_A", MCD_CLIP_GUNIV3DAIUSDC2_A);
DssExecLib.setChangelogAddress("MCD_CLIP_CALC_GUNIV3DAIUSDC2_A", MCD_CLIP_CALC_GUNIV3DAIUSDC2_A);
DssExecLib.setChangelogAddress("PIP_GUNIV3DAIUSDC2", PIP_GUNIV3DAIUSDC2);
DssExecLib.setChangelogVersion("1.9.12");
}
}
| 15,333
|
29
|
// Hook to be implemented by higher-level Manager contract after redemption occurs. /
|
function _onAfterRedeem(
|
function _onAfterRedeem(
| 15,592
|
158
|
// /import "@openzeppelin/contracts/utils/math/SafeMath.sol";/ SaleKindInterface Project Erax Developers /
|
library SaleKindInterface {
/**
* Side: buy or sell.
*/
enum Side { Buy, Sell }
/**
* Currently supported kinds of sale: fixed price, Dutch auction.
* English auctions cannot be supported without stronger escrow guarantees.
* Future interesting options: Vickrey auction, nonlinear Dutch auctions.
*/
enum SaleKind { FixedPrice, DutchAuction }
/**
* @dev Check whether the parameters of a sale are valid
* @param saleKind Kind of sale
* @param expirationTime Order expiration time
* @return Whether the parameters were valid
*/
function validateParameters(SaleKind saleKind, uint expirationTime)
pure
internal
returns (bool)
{
/* Auctions must have a set expiration date. */
return (saleKind == SaleKind.FixedPrice || expirationTime > 0);
}
|
library SaleKindInterface {
/**
* Side: buy or sell.
*/
enum Side { Buy, Sell }
/**
* Currently supported kinds of sale: fixed price, Dutch auction.
* English auctions cannot be supported without stronger escrow guarantees.
* Future interesting options: Vickrey auction, nonlinear Dutch auctions.
*/
enum SaleKind { FixedPrice, DutchAuction }
/**
* @dev Check whether the parameters of a sale are valid
* @param saleKind Kind of sale
* @param expirationTime Order expiration time
* @return Whether the parameters were valid
*/
function validateParameters(SaleKind saleKind, uint expirationTime)
pure
internal
returns (bool)
{
/* Auctions must have a set expiration date. */
return (saleKind == SaleKind.FixedPrice || expirationTime > 0);
}
| 48,070
|
1
|
// Domain structure.Data(information to for making metaTransaction method uniq.) about method and contract /
|
struct EIP712Domain {
string name;
string version;
address verifyingContract;
bytes32 salt;
}
|
struct EIP712Domain {
string name;
string version;
address verifyingContract;
bytes32 salt;
}
| 12,817
|
245
|
// Verifies the reallocation table against the stored hash reallocationTable The data to verify /
|
function _verifyReallocationTable(uint256[][] memory reallocationTable) internal view {
require(reallocationTableHash == Hash.hashReallocationTable(reallocationTable), "BRLC");
}
|
function _verifyReallocationTable(uint256[][] memory reallocationTable) internal view {
require(reallocationTableHash == Hash.hashReallocationTable(reallocationTable), "BRLC");
}
| 34,727
|
97
|
// credit keeper with fee
|
erc20Balances[token][
distributorAddress != address(0) ? distributorAddress : msg.sender
] += distributorFeeAmount;
|
erc20Balances[token][
distributorAddress != address(0) ? distributorAddress : msg.sender
] += distributorFeeAmount;
| 22,585
|
326
|
// Returns the expiry of the current option the vault is shorting /
|
function currentOptionExpiry() external view returns (uint256) {
address _currentOption = currentOption;
if (_currentOption == address(0)) {
return 0;
}
OtokenInterface oToken = OtokenInterface(currentOption);
return oToken.expiryTimestamp();
}
|
function currentOptionExpiry() external view returns (uint256) {
address _currentOption = currentOption;
if (_currentOption == address(0)) {
return 0;
}
OtokenInterface oToken = OtokenInterface(currentOption);
return oToken.expiryTimestamp();
}
| 9,216
|
298
|
// Make sure quantity cap amount is provided if quantity cap is enabled
|
if (_quantityCapStatus == true) {
require (_quantityCapAmount > 0);
}
|
if (_quantityCapStatus == true) {
require (_quantityCapAmount > 0);
}
| 53,095
|
113
|
// Emitted when the pool proxy admin address has been changed. previousPoolProxyAdmin Address of the previous pool proxy admin. newPoolProxyAdmin Address of the new pool proxy admin. /
|
event SetPoolProxyAdmin(address indexed previousPoolProxyAdmin, address indexed newPoolProxyAdmin);
|
event SetPoolProxyAdmin(address indexed previousPoolProxyAdmin, address indexed newPoolProxyAdmin);
| 36,401
|
291
|
// ERC20 deposit
|
IERC20(_tokenContract).safeTransferFrom(
msg.sender,
address(this),
_amount
);
|
IERC20(_tokenContract).safeTransferFrom(
msg.sender,
address(this),
_amount
);
| 35,124
|
12
|
// store actionId so we can later execute it
|
actionId = governance.queueAction(
address(pool),
drainAllFundsPayload,
0
);
|
actionId = governance.queueAction(
address(pool),
drainAllFundsPayload,
0
);
| 18,932
|
10
|
// presale
|
_presale = true;
_whitelist[msg.sender] = true;
|
_presale = true;
_whitelist[msg.sender] = true;
| 25,364
|
68
|
// Update entry
|
_heap.entries[newInd] = can;
|
_heap.entries[newInd] = can;
| 1,465
|
9
|
// The identifying key of the pool/ token0 - Should be DAI in the V3 pool/ token1 - Should be USDC in the V3 pool/ fee - should be 100 or 1 bip
|
struct PoolKey {
address token0;
address token1;
uint24 fee;
}
|
struct PoolKey {
address token0;
address token1;
uint24 fee;
}
| 7,871
|
6
|
// Adds a new empty game to storage/Must be initialized resulting in two transactions for new games
|
function newGame() public {
address[] memory players;
uint8[] memory scores;
uint256[] memory bets;
string memory roomName;
Game memory game = Game(players, 0, scores, bets, roomName, false, Status.BetsPending);
games.push(game);
userToGameId[msg.sender] = gameCounter;
userToIndex[msg.sender] = uint8(0);
gameCounter++;
}
|
function newGame() public {
address[] memory players;
uint8[] memory scores;
uint256[] memory bets;
string memory roomName;
Game memory game = Game(players, 0, scores, bets, roomName, false, Status.BetsPending);
games.push(game);
userToGameId[msg.sender] = gameCounter;
userToIndex[msg.sender] = uint8(0);
gameCounter++;
}
| 47,812
|
4
|
// елси подлинность установленана, вернуть хэш документа
|
return tested;
|
return tested;
| 8,607
|
13
|
// Contract constructor sets initial timelock limits/_userTimeLock Time before new owner added by recovery can control proxy/_adminTimeLock Time before new owner can add/remove owners/_adminRate Time period used for rate limiting a given key for admin functionality
|
function IdentityManager(uint _userTimeLock, uint _adminTimeLock, uint _adminRate) {
require(_adminTimeLock >= _userTimeLock);
adminTimeLock = _adminTimeLock;
userTimeLock = _userTimeLock;
adminRate = _adminRate;
}
|
function IdentityManager(uint _userTimeLock, uint _adminTimeLock, uint _adminRate) {
require(_adminTimeLock >= _userTimeLock);
adminTimeLock = _adminTimeLock;
userTimeLock = _userTimeLock;
adminRate = _adminRate;
}
| 31,638
|
26
|
// Lets an account with `MINTER_ROLE` reveal the URI for a batch of 'delayed-reveal' NFTs. function reveal(uint256 _index, bytes calldata _key) external onlyRole(minterRole) returns (string memory revealedURI)
|
// {
// uint256 batchId = getBatchIdAtIndex(_index);
// revealedURI = getRevealURI(batchId, _key);
// _setEncryptedData(batchId, "");
// _setBaseURI(batchId, revealedURI);
// emit TokenURIRevealed(_index, revealedURI);
// }
|
// {
// uint256 batchId = getBatchIdAtIndex(_index);
// revealedURI = getRevealURI(batchId, _key);
// _setEncryptedData(batchId, "");
// _setBaseURI(batchId, revealedURI);
// emit TokenURIRevealed(_index, revealedURI);
// }
| 18,937
|
30
|
// Constructor that gives msg.sender all of existing tokens. /
|
function EternalToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
|
function EternalToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
| 23,917
|
265
|
// Transfers tokens from the targeted address to the given destination/Errors with 'STF' if transfer fails/token The contract address of the token to be transferred/from The originating address from which the tokens will be transferred/to The destination address of the transfer/value The amount to be transferred
|
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
|
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
| 5,298
|
100
|
// Get the right amount when playing (or not) the game With possible burn and reward
|
function _getAmount(address recipient, address sender, uint256 amount) private returns (uint256) {
if (gameStarted) {
_sendReward(amount, sender, recipient);
uint256 burnAmount = _getRandomBurnedAmount(amount);
if (burnAmount != 0) {
_burn(sender, burnAmount);
amount = amount.sub(burnAmount);
}
}
return amount;
}
|
function _getAmount(address recipient, address sender, uint256 amount) private returns (uint256) {
if (gameStarted) {
_sendReward(amount, sender, recipient);
uint256 burnAmount = _getRandomBurnedAmount(amount);
if (burnAmount != 0) {
_burn(sender, burnAmount);
amount = amount.sub(burnAmount);
}
}
return amount;
}
| 12,182
|
26
|
// Submits a new turn for a given game/_context game context/_index index identifying the game/_turnIndex a sequential number for the turn, which must be equal to the last submitted turn's index + 1/_nextPlayer address of a player responsible for next turn (can be empty, in which case no player will be held accountable for a timeout)/_playerStake amount of tokens at stake after the turn/_data game-specific turn data (array of 64-bit words)/_logger Logger instance used for storing data in the event history/_turnChunkLog2Size turn data log2size considering 64-bit words (i.e., how many 64-bit words are there in a chunk of turn data)
|
function submitTurn(
GameContext storage _context,
uint256 _index,
uint256 _turnIndex,
address _nextPlayer,
uint256 _playerStake,
bytes calldata _data,
Logger _logger,
uint8 _turnChunkLog2Size
|
function submitTurn(
GameContext storage _context,
uint256 _index,
uint256 _turnIndex,
address _nextPlayer,
uint256 _playerStake,
bytes calldata _data,
Logger _logger,
uint8 _turnChunkLog2Size
| 23,634
|
4
|
// Transfers money to attacker
|
attackerEOA.transfer(poolBalance);
|
attackerEOA.transfer(poolBalance);
| 37,519
|
6
|
// set decimals to be the same as the underlying stablecoin
|
decimals = ERC20Detailed(address(pool.stablecoin())).decimals();
|
decimals = ERC20Detailed(address(pool.stablecoin())).decimals();
| 33,678
|
458
|
// res += valcoefficients[95].
|
res := addmod(res,
mulmod(val, /*coefficients[95]*/ mload(0x1120), PRIME),
PRIME)
|
res := addmod(res,
mulmod(val, /*coefficients[95]*/ mload(0x1120), PRIME),
PRIME)
| 33,900
|
27
|
// 设置创建角色的费用与token
|
function setTokenInfo(
uint32 tokenType,
string memory key,
uint256 fee
|
function setTokenInfo(
uint32 tokenType,
string memory key,
uint256 fee
| 21,692
|
6
|
// Adds an address as whitelisted under a specific ID account The address to add did the ID to add account under /
|
function addWhitelistedWithDID(address account, string memory did)
public
onlyRegistered
onlyIdentityAdmin
whenNotPaused
|
function addWhitelistedWithDID(address account, string memory did)
public
onlyRegistered
onlyIdentityAdmin
whenNotPaused
| 17,489
|
3
|
// Constructor function for {Set} token As looping operations are expensive, checking for duplicates will be on the onus of the application developer_factoryThe factory used to create the Set Token _components A list of component address which you want to include _unitsA list of quantities in gWei of each component (corresponds to the {Set} of _components) _naturalUnitThe minimum multiple of Sets that can be issued or redeeemed _name The Set's name _symbol The Set's symbol /
|
constructor(
address _factory,
address[] _components,
uint256[] _units,
uint256 _naturalUnit,
bytes32 _name,
bytes32 _symbol
)
|
constructor(
address _factory,
address[] _components,
uint256[] _units,
uint256 _naturalUnit,
bytes32 _name,
bytes32 _symbol
)
| 14,730
|
2
|
// Get the root edge/ return e The root `Data.Edge`
|
function getRootEdge() public view returns (Data.Edge memory e);
|
function getRootEdge() public view returns (Data.Edge memory e);
| 20,772
|
70
|
// Array with all token ids, used for enumeration
|
uint256[] internal allTokens;
|
uint256[] internal allTokens;
| 30,849
|
83
|
// Must be called after crowdsale ends, to do some extra finalizationwork. Calls the contract&39;s finalization function. /
|
function finalize() onlyOwner public {
require(!isFinalized);
require(hasEnded());
finalization();
Finalized();
isFinalized = true;
}
|
function finalize() onlyOwner public {
require(!isFinalized);
require(hasEnded());
finalization();
Finalized();
isFinalized = true;
}
| 7,751
|
20
|
// emit events before setting to 0
|
emit WithdrawDeposit(id, amount - interest);
emit WithdrawProfit(id, interest);
|
emit WithdrawDeposit(id, amount - interest);
emit WithdrawProfit(id, interest);
| 37,754
|
114
|
// Withdraw LP tokens from Farm.
|
function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: can't withdraw more than deposit");
updatePool(_pid);
uint256 pendingAmount = user.amount.mul(pool.accERC20PerShare).div(1e36).sub(user.rewardDebt);
erc20Transfer(msg.sender, pendingAmount);
user.amount = user.amount.sub(_amount);
user.rewardDebt = user.amount.mul(pool.accERC20PerShare).div(1e36);
pool.lpToken.safeTransfer(address(msg.sender), _amount);
emit Withdraw(msg.sender, _pid, _amount);
}
|
function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: can't withdraw more than deposit");
updatePool(_pid);
uint256 pendingAmount = user.amount.mul(pool.accERC20PerShare).div(1e36).sub(user.rewardDebt);
erc20Transfer(msg.sender, pendingAmount);
user.amount = user.amount.sub(_amount);
user.rewardDebt = user.amount.mul(pool.accERC20PerShare).div(1e36);
pool.lpToken.safeTransfer(address(msg.sender), _amount);
emit Withdraw(msg.sender, _pid, _amount);
}
| 7,791
|
2
|
// Returns the last updated price. Decimals is 8. // Returns the timestamp of the last updated price. /
|
function latestTimestamp() external returns (uint256);
|
function latestTimestamp() external returns (uint256);
| 48,968
|
9
|
// AlreadyVoted - Error raised when some worker tries to recast a vote on the same voting session worker - address of the voter /
|
error AlreadyVoted(address worker);
|
error AlreadyVoted(address worker);
| 30,482
|
0
|
// Requires that the token exists.
|
modifier tokenExists(uint256 tokenId) {
require(ERC721A._exists(tokenId), "ERC721ACommon: Token doesn't exist");
_;
}
|
modifier tokenExists(uint256 tokenId) {
require(ERC721A._exists(tokenId), "ERC721ACommon: Token doesn't exist");
_;
}
| 47,413
|
37
|
// Return InstAaMemory Address. /
|
function getMemoryAddr() internal pure returns (address) {
return 0x8a5419CfC711B2343c17a6ABf4B2bAFaBb06957F;
}
|
function getMemoryAddr() internal pure returns (address) {
return 0x8a5419CfC711B2343c17a6ABf4B2bAFaBb06957F;
}
| 1,924
|
1,183
|
// Returns the value associated with `key`. O(1). Requirements: - `key` must be in the map. Reverts with `errorCode` otherwise. /
|
function get(
IERC20ToBytes32Map storage map,
IERC20 key,
uint256 errorCode
|
function get(
IERC20ToBytes32Map storage map,
IERC20 key,
uint256 errorCode
| 56,744
|
186
|
// This notifies someone buy fci by NAC
|
event BuyFci(address investor, uint256 valueNac, uint256 valueFci, uint timeBuyFci);
event SellFci(address investor, uint256 valueNac, uint256 valueFci, uint timeSellFci);
|
event BuyFci(address investor, uint256 valueNac, uint256 valueFci, uint timeBuyFci);
event SellFci(address investor, uint256 valueNac, uint256 valueFci, uint timeSellFci);
| 34,851
|
227
|
// Virtual value of yCRV tokens in the poolWill return sync value if inSyncreturn yTokenValue in USD. /
|
function yTokenValue() public view returns (uint256) {
if (inSync) {
return yTokenValueCache;
}
return yTokenBalance().mul(_curvePool.curve().get_virtual_price()).div(1 ether);
}
|
function yTokenValue() public view returns (uint256) {
if (inSync) {
return yTokenValueCache;
}
return yTokenBalance().mul(_curvePool.curve().get_virtual_price()).div(1 ether);
}
| 80,824
|
1
|
// 判断错误类型, 避免使用断言抛出异常,直接使用日志输出错误原因, 因为不能直接读取函数的返回值错误类型说明: /
|
contract ErrorModule {
enum RScorr {
Success,
Unknown, // Unknown error
InvalidAddr, // 无效的地址
InvalidStr, // 无效的字符串
InvalidClaimId, // 无效的资源id
InvalidUdfs, // 无效的UDFS
InvalidObj, // 无效的对象,购买一个已放弃的资源 6
Unsupported, // 未授权
ServStop, // 服务停止
ObjNotExist, // 对象不存在
ObjExist, // 对象已存在 10
ScantToken, // 代币余额不充足
ScantCredit, // 代币授权额度不足
Insolvent, // 支付能力不足 13
Insufficient, // 白名单权限不足
PermissionDenied, // 管理权限不足, 管理员权限
IdCertifyFailed, // 身份认证失败,作者身份认证
Insignificance, // 无意义的操作,更新的内容不变
ClaimAbandoned,
CidIsInvalid,
UdfsInvalid, //udfs 无效
Undefine01,
Undefine02,
Undefine03,
Undefine04,
Undefine05,
Undefine06,
Undefine07,
Undefine08,
Undefine09
}
event LogError(RScorr _errorNumber);
}
|
contract ErrorModule {
enum RScorr {
Success,
Unknown, // Unknown error
InvalidAddr, // 无效的地址
InvalidStr, // 无效的字符串
InvalidClaimId, // 无效的资源id
InvalidUdfs, // 无效的UDFS
InvalidObj, // 无效的对象,购买一个已放弃的资源 6
Unsupported, // 未授权
ServStop, // 服务停止
ObjNotExist, // 对象不存在
ObjExist, // 对象已存在 10
ScantToken, // 代币余额不充足
ScantCredit, // 代币授权额度不足
Insolvent, // 支付能力不足 13
Insufficient, // 白名单权限不足
PermissionDenied, // 管理权限不足, 管理员权限
IdCertifyFailed, // 身份认证失败,作者身份认证
Insignificance, // 无意义的操作,更新的内容不变
ClaimAbandoned,
CidIsInvalid,
UdfsInvalid, //udfs 无效
Undefine01,
Undefine02,
Undefine03,
Undefine04,
Undefine05,
Undefine06,
Undefine07,
Undefine08,
Undefine09
}
event LogError(RScorr _errorNumber);
}
| 4,694
|
4
|
// Note: fees are included in the price
|
price = pool.get_dy(
config.index - 1, // Subtract the added one
quoteTokenIndex,
10**config.decimals // One whole token
);
|
price = pool.get_dy(
config.index - 1, // Subtract the added one
quoteTokenIndex,
10**config.decimals // One whole token
);
| 36,831
|
14
|
// As described in https:eips.ethereum.org/EIPS/eip-20
|
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function name() external view returns (string memory); // optional method - see eip spec
function symbol() external view returns (string memory); // optional method - see eip spec
function decimals() external view returns (uint8); // optional method - see eip spec
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
}
|
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function name() external view returns (string memory); // optional method - see eip spec
function symbol() external view returns (string memory); // optional method - see eip spec
function decimals() external view returns (uint8); // optional method - see eip spec
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
}
| 63,838
|
103
|
// require (allowValue >= mincap);
|
msg.sender.transfer( msg.value.sub( maxcap ) );
|
msg.sender.transfer( msg.value.sub( maxcap ) );
| 4,413
|
205
|
// add some ETH for oraclize updater
|
function addEtherForOraclize () public payable {
oraclizeBalance = oraclizeBalance.add(msg.value);
}
|
function addEtherForOraclize () public payable {
oraclizeBalance = oraclizeBalance.add(msg.value);
}
| 44,742
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.