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
|
|---|---|---|---|---|
21
|
// Subscribe to or update an Armor plan. _protocol Protocols to be covered for. _coverAmount Ether amounts (in Wei) to purchase cover for. /
|
function subscribe(address _protocol, uint256 _coverAmount) internal {
IPlanManager planManager = IPlanManager(getModule("PLAN"));
address[] memory protocols = new address[](1);
protocols[0] = _protocol;
uint256[] memory amounts = new uint256[](1);
amounts[0] = _coverAmount;
planManager.updatePlan(protocols, amounts);
}
|
function subscribe(address _protocol, uint256 _coverAmount) internal {
IPlanManager planManager = IPlanManager(getModule("PLAN"));
address[] memory protocols = new address[](1);
protocols[0] = _protocol;
uint256[] memory amounts = new uint256[](1);
amounts[0] = _coverAmount;
planManager.updatePlan(protocols, amounts);
}
| 59,193
|
10
|
// this function will be count total public key integrated at token id.tokenId is token id to be check /
|
function getTotalPublicKeyByTokenId(
uint256 tokenId
|
function getTotalPublicKeyByTokenId(
uint256 tokenId
| 13,611
|
430
|
// Nexus
|
function getModule(bytes32) external view returns (address);
|
function getModule(bytes32) external view returns (address);
| 80,841
|
3
|
// Gets the owner for an address. account Address to check ownership of. /
|
function ownerOf(address account) internal view returns (address) {
return AccessControlStorageLib.store().owners[account];
|
function ownerOf(address account) internal view returns (address) {
return AccessControlStorageLib.store().owners[account];
| 1,570
|
6
|
// Lock the contract (and store some information about the delivery in temporary storage)
|
startDelivery(
fromWormholeFormat(instruction.targetAddress),
fromWormholeFormat(instruction.refundDeliveryProvider),
instruction.refundChain,
instruction.refundAddress
);
DeliveryVAAInfo memory deliveryVaaInfo = DeliveryVAAInfo({
sourceChain: vm.emitterChainId,
sourceSequence: vm.sequence,
|
startDelivery(
fromWormholeFormat(instruction.targetAddress),
fromWormholeFormat(instruction.refundDeliveryProvider),
instruction.refundChain,
instruction.refundAddress
);
DeliveryVAAInfo memory deliveryVaaInfo = DeliveryVAAInfo({
sourceChain: vm.emitterChainId,
sourceSequence: vm.sequence,
| 21,165
|
12
|
// must always read from latest tier settings
|
t.includedBlocks = tiers[t.id].includedBlocks;
t.includedBlocksStarted = block.number;
|
t.includedBlocks = tiers[t.id].includedBlocks;
t.includedBlocksStarted = block.number;
| 5,389
|
33
|
// Check if the NFT being transferred is a new NFT
|
if (from == address(0)) {
|
if (from == address(0)) {
| 23,174
|
54
|
// Mirror gov token for voting power.
|
address token;
|
address token;
| 36,141
|
7
|
// SET UP
|
function setNftContractAddress(address _nftContractAddress) public whenNotPaused{
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender));
nftContractAddress = _nftContractAddress;
}
|
function setNftContractAddress(address _nftContractAddress) public whenNotPaused{
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender));
nftContractAddress = _nftContractAddress;
}
| 873
|
2
|
// testing retrieval of a single pet's owner
|
function testGetAdopterAddressByPetId() public {
address adopter = adoption.adopters(expectedPetId);
Assert.equal(adopter, expectedAdopter, 'Owner of the expected pet should be this contract.');
}
|
function testGetAdopterAddressByPetId() public {
address adopter = adoption.adopters(expectedPetId);
Assert.equal(adopter, expectedAdopter, 'Owner of the expected pet should be this contract.');
}
| 41,998
|
44
|
// Delegates execution to an implementation contract It returns to the external caller whatever the implementation returns or forwards reverts /
|
function () external payable {
require(msg.value == 0,"PYLONDelegator:fallback: cannot send value to fallback");
// delegate all other functions to current implementation
delegateAndReturn();
}
|
function () external payable {
require(msg.value == 0,"PYLONDelegator:fallback: cannot send value to fallback");
// delegate all other functions to current implementation
delegateAndReturn();
}
| 8,857
|
4
|
// Allows for the transfer of the admin contract/a New admin
|
function setAdmin(address a) external authorized(admin) {
admin = a;
}
|
function setAdmin(address a) external authorized(admin) {
admin = a;
}
| 23,528
|
60
|
// Burnable Token Token that can be irreversibly burned (destroyed). /
|
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Burn(burner, _value);
}
}
|
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Burn(burner, _value);
}
}
| 876
|
31
|
// Computes then returns the winning proposal, taking all previous votes into account. electionID ID of election /
|
function winningProposal(uint electionID) internal view returns (uint) {
Election storage e = elections[electionID];
// uint winningVoteCount = 0;
// uint wProposal;
uint prop0 = e.proposals[0].voteCount;
uint prop1 = e.proposals[1].voteCount;
if (prop0 > prop1){
return 0;
} else if (prop1 > prop0) {
return 1;
} else { // it's a tie
return 2;
}
}
|
function winningProposal(uint electionID) internal view returns (uint) {
Election storage e = elections[electionID];
// uint winningVoteCount = 0;
// uint wProposal;
uint prop0 = e.proposals[0].voteCount;
uint prop1 = e.proposals[1].voteCount;
if (prop0 > prop1){
return 0;
} else if (prop1 > prop0) {
return 1;
} else { // it's a tie
return 2;
}
}
| 37,821
|
273
|
// Unblock funds, and move funds from _blockedBalances into _balances. _account address to unblock funds. _amount of funds to unblock. /
|
function unblock(address _account, uint256 _amount) public onlyBlockerOrOperator {
_balances[_account] = _balances[_account].add(_amount);
_blockedBalances[_account] = _blockedBalances[_account].sub(_amount);
totalBlockedBalance = totalBlockedBalance.sub(_amount);
emit UnBlocked(msg.sender, _account, _amount);
}
|
function unblock(address _account, uint256 _amount) public onlyBlockerOrOperator {
_balances[_account] = _balances[_account].add(_amount);
_blockedBalances[_account] = _blockedBalances[_account].sub(_amount);
totalBlockedBalance = totalBlockedBalance.sub(_amount);
emit UnBlocked(msg.sender, _account, _amount);
}
| 8,199
|
17
|
// mini game information/
|
mapping(uint256 => Game) public games;
|
mapping(uint256 => Game) public games;
| 36,863
|
0
|
// -- State --
|
IGraphTokenLockManager public manager;
uint256 public usedAmount;
uint256 private constant MAX_UINT256 = 2**256 - 1;
|
IGraphTokenLockManager public manager;
uint256 public usedAmount;
uint256 private constant MAX_UINT256 = 2**256 - 1;
| 23,617
|
51
|
// Returns the subtraction of two unsigned integers, reverting onoverflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow. /
|
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
|
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
| 5,755
|
16
|
// Allows the owner of the factory to transfer ownership to a new address, for transitioning to decentralization newOwner_: address of the new owner /
|
function setOwner(address newOwner_) public onlyOwner {
_owner = newOwner_;
}
|
function setOwner(address newOwner_) public onlyOwner {
_owner = newOwner_;
}
| 31,705
|
11
|
// The execution phase. tos The handlers of combo. datas The combo datas. /
|
function _execs(address[] memory tos, bytes[] memory datas) internal {
require(
tos.length == datas.length,
"Tos and datas length inconsistent"
);
for (uint256 i = 0; i < tos.length; i++) {
_exec(tos[i], datas[i]);
// Setup the process to be triggered in the post-process phase
_setPostProcess(tos[i]);
}
}
|
function _execs(address[] memory tos, bytes[] memory datas) internal {
require(
tos.length == datas.length,
"Tos and datas length inconsistent"
);
for (uint256 i = 0; i < tos.length; i++) {
_exec(tos[i], datas[i]);
// Setup the process to be triggered in the post-process phase
_setPostProcess(tos[i]);
}
}
| 11,845
|
2
|
// - Front-running attacks are currently mitigated by the following mechanisms:TODO - minimum return argument for each conversion provides a way to define a minimum/maximum price for the transaction- gas price limit prevents users from having control over the order of execution/
|
uint256 public gasPrice = 0 wei; // maximum gas price for bancor transactions
|
uint256 public gasPrice = 0 wei; // maximum gas price for bancor transactions
| 49,975
|
13
|
// Update ABS and if it was already up to date, check if identities already counted
|
if (
updateABS(
_abs,
currentSlot,
lastSlot,
overflow
))
{
_abs.lastBlockNumber = _blockNumber;
} else {
|
if (
updateABS(
_abs,
currentSlot,
lastSlot,
overflow
))
{
_abs.lastBlockNumber = _blockNumber;
} else {
| 50,951
|
16
|
// See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is notrequired by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowanceis the maximum `uint256`. Requirements: - `sender` and `recipient` cannot be the zero address.- `sender` must have a balance of at least `amount`.- the caller must have allowance for ``sender``'s tokens of at least`amount`. /
|
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
uint256 currentAllowance = _allowances[sender][_msgSender()];
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
|
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
uint256 currentAllowance = _allowances[sender][_msgSender()];
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
| 15,867
|
14
|
// internal signature validation function.
|
function _isValidSignature(
bytes memory signature,
address _address,
uint256 _phase
|
function _isValidSignature(
bytes memory signature,
address _address,
uint256 _phase
| 19,311
|
50
|
// The order of these function calls are dependent on each other Beware when changing order or modifying code
|
emit EndGame(currentGameNumber);
|
emit EndGame(currentGameNumber);
| 35,525
|
35
|
// Init USDC-PSM ilk in Vat & Jug
|
VatAbstract(MCD_VAT).init(ilk);
JugAbstract(MCD_JUG).init(ilk);
|
VatAbstract(MCD_VAT).init(ilk);
JugAbstract(MCD_JUG).init(ilk);
| 7,790
|
18
|
// Set the auction minimum bid increment percentage. Only callable by the owner. /
|
function setMinBidIncrementPercentage(uint8 _minBidIncrementPercentage) external override onlyOwner {
minBidIncrementPercentage = _minBidIncrementPercentage;
emit AuctionMinBidIncrementPercentageUpdated(_minBidIncrementPercentage);
}
|
function setMinBidIncrementPercentage(uint8 _minBidIncrementPercentage) external override onlyOwner {
minBidIncrementPercentage = _minBidIncrementPercentage;
emit AuctionMinBidIncrementPercentageUpdated(_minBidIncrementPercentage);
}
| 19,284
|
110
|
// burn short option tokens from multiple underwriters
|
_burnShortTokenLoop(
l,
maturity,
strike64x64,
contractSize,
exerciseValue,
isCall,
false
);
|
_burnShortTokenLoop(
l,
maturity,
strike64x64,
contractSize,
exerciseValue,
isCall,
false
);
| 79,955
|
145
|
// Divides one `Signed` by an unscaled int256, reverting on overflow or division by 0. This will "floor" the quotient. a a FixedPoint numerator. b an int256 denominator.return the quotient of `a` divided by `b`. /
|
function div(Signed memory a, int256 b) internal pure returns (Signed memory) {
return Signed(a.rawValue.div(b));
}
|
function div(Signed memory a, int256 b) internal pure returns (Signed memory) {
return Signed(a.rawValue.div(b));
}
| 26,683
|
5
|
// The leverage factor of the vault, multiplied by 10^9/ For a vault with X usd of collateral and marginal factor T >= 1, total assets (collateral + debt) should be equal to XT
|
function marginalFactorD9() external view returns (uint256);
|
function marginalFactorD9() external view returns (uint256);
| 5,987
|
132
|
// NOTE: theoretically possible overflow of (_offset + 1)
|
function readBool(bytes memory _data, uint256 _offset) internal pure returns (uint256 new_offset, bool r) {
new_offset = _offset + 1;
r = uint8(_data[_offset]) != 0;
}
|
function readBool(bytes memory _data, uint256 _offset) internal pure returns (uint256 new_offset, bool r) {
new_offset = _offset + 1;
r = uint8(_data[_offset]) != 0;
}
| 24,967
|
36
|
// Admin function for setting the voting delay newVotingDelay new voting delay, in blocks /
|
function _setVotingDelay(uint256 newVotingDelay) external {
require(msg.sender == admin, 'NounsDAO::_setVotingDelay: admin only');
require(
newVotingDelay >= MIN_VOTING_DELAY && newVotingDelay <= MAX_VOTING_DELAY,
'NounsDAO::_setVotingDelay: invalid voting delay'
);
uint256 oldVotingDelay = votingDelay;
votingDelay = newVotingDelay;
emit VotingDelaySet(oldVotingDelay, votingDelay);
}
|
function _setVotingDelay(uint256 newVotingDelay) external {
require(msg.sender == admin, 'NounsDAO::_setVotingDelay: admin only');
require(
newVotingDelay >= MIN_VOTING_DELAY && newVotingDelay <= MAX_VOTING_DELAY,
'NounsDAO::_setVotingDelay: invalid voting delay'
);
uint256 oldVotingDelay = votingDelay;
votingDelay = newVotingDelay;
emit VotingDelaySet(oldVotingDelay, votingDelay);
}
| 65,103
|
209
|
// Get the price for the given asset amount
|
return mulScalar(scaledPrice, assetAmount);
|
return mulScalar(scaledPrice, assetAmount);
| 20,989
|
165
|
// Interface for the $SOS erc20 token contract /
|
interface ISOS {
function approve(address from, uint256 amount) external returns(bool);
function transferFrom(address from, address to, uint256 amount) external;
function balanceOf(address owner) external view returns(uint256);
}
|
interface ISOS {
function approve(address from, uint256 amount) external returns(bool);
function transferFrom(address from, address to, uint256 amount) external;
function balanceOf(address owner) external view returns(uint256);
}
| 52,725
|
15
|
// instead of a interestBearingAmount we use a accumulated interest rate index (chi)
|
uint updatedChi = _chargeInterest(chi ,ratePerSecond, lastUpdated, block.timestamp);
return (updatedChi, safeSub(rmul(updatedChi, pie), rmul(chi, pie)));
|
uint updatedChi = _chargeInterest(chi ,ratePerSecond, lastUpdated, block.timestamp);
return (updatedChi, safeSub(rmul(updatedChi, pie), rmul(chi, pie)));
| 32,644
|
23
|
// A mapping of buyers and their amounts of total tokens due
|
mapping(address => uint256) public tokenBuyersMapping;
|
mapping(address => uint256) public tokenBuyersMapping;
| 77,362
|
154
|
// Confirm that the orders do match and are valid. makerOrder The maker order data structure. takerOrder The taker order data structure.return Bool if the orders passes all checks. /
|
function __ordersMatch_and_AreVaild__(
Order makerOrder,
Order takerOrder
) private
returns (bool)
|
function __ordersMatch_and_AreVaild__(
Order makerOrder,
Order takerOrder
) private
returns (bool)
| 22,725
|
77
|
// This function prepares a condition by initializing a payout vector associated with the condition./oracle The account assigned to report the result for the prepared condition./questionId An identifier for the question to be answered by the oracle./outcomeSlotCount The number of outcome slots which should be used for this condition. Must not exceed 256.
|
function prepareCondition(address oracle, bytes32 questionId, uint outcomeSlotCount) external {
// Limit of 256 because we use a partition array that is a number of 256 bits.
require(outcomeSlotCount <= 256, "too many outcome slots");
require(outcomeSlotCount > 1, "there should be more than one outcome slot");
bytes32 conditionId = CTHelpers.getConditionId(oracle, questionId, outcomeSlotCount);
require(payoutNumerators[conditionId].length == 0, "condition already prepared");
payoutNumerators[conditionId] = new uint[](outcomeSlotCount);
emit ConditionPreparation(conditionId, oracle, questionId, outcomeSlotCount);
}
|
function prepareCondition(address oracle, bytes32 questionId, uint outcomeSlotCount) external {
// Limit of 256 because we use a partition array that is a number of 256 bits.
require(outcomeSlotCount <= 256, "too many outcome slots");
require(outcomeSlotCount > 1, "there should be more than one outcome slot");
bytes32 conditionId = CTHelpers.getConditionId(oracle, questionId, outcomeSlotCount);
require(payoutNumerators[conditionId].length == 0, "condition already prepared");
payoutNumerators[conditionId] = new uint[](outcomeSlotCount);
emit ConditionPreparation(conditionId, oracle, questionId, outcomeSlotCount);
}
| 49,042
|
111
|
// inverse of calcOutToken0 amountOut = amountIn.mul(_op.ethAmount).mul(K_BASE).mul(THETA_BASE.sub(_op.theta)).div(_op.erc20Amount).div(K_BASE.add(_op.K)).div(THETA_BASE);
|
amountInNeeded = amountOut.mul(_op.erc20Amount).mul(K_BASE.add(_op.K)).mul(THETA_BASE).div(_op.ethAmount).div(K_BASE).div(THETA_BASE.sub(_op.theta));
if (_op.theta != 0) {
|
amountInNeeded = amountOut.mul(_op.erc20Amount).mul(K_BASE.add(_op.K)).mul(THETA_BASE).div(_op.ethAmount).div(K_BASE).div(THETA_BASE.sub(_op.theta));
if (_op.theta != 0) {
| 42,301
|
121
|
// Is the contract being run on the test network. Note: this variable should be set on construction and never modified.
|
bool public isTest;
uint private currentTime;
|
bool public isTest;
uint private currentTime;
| 46,193
|
17
|
// Returns the information description for a given class info Every bond contract can have their own list of class information /
|
function classInfoDescription(uint256 classInfo) external view returns (string memory);
|
function classInfoDescription(uint256 classInfo) external view returns (string memory);
| 28,806
|
50
|
// Address early participation whitelist status changed
|
event Whitelisted(address addr, bool status);
|
event Whitelisted(address addr, bool status);
| 45,885
|
49
|
// Deciding how many tokens can be bought with the ether received
|
uint tokens = getAttoTokensAmountPerWeiInternal(msg.value);
|
uint tokens = getAttoTokensAmountPerWeiInternal(msg.value);
| 18,766
|
64
|
// Emit new underwriting event
|
emit LoanUnderwritten(_loanId, msg.sender);
|
emit LoanUnderwritten(_loanId, msg.sender);
| 8,942
|
14
|
// ERC20-style token metadata 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE address is used for ETH
|
struct TokenMetadata {
address token;
string name;
string symbol;
uint8 decimals;
}
|
struct TokenMetadata {
address token;
string name;
string symbol;
uint8 decimals;
}
| 55,693
|
269
|
// keccak256("ProxyAdmin");
|
bytes32 internal constant KEY_PROXY_ADMIN =
0x96ed0203eb7e975a4cbcaa23951943fa35c5d8288117d50c12b3d48b0fab48d1;
|
bytes32 internal constant KEY_PROXY_ADMIN =
0x96ed0203eb7e975a4cbcaa23951943fa35c5d8288117d50c12b3d48b0fab48d1;
| 36,023
|
15
|
// Total fees claimed;
|
uint256 public totalFeesClaimed;
|
uint256 public totalFeesClaimed;
| 8,533
|
247
|
// Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call:- if using `revokeRole`, it is the admin role bearer- if using `renounceRole`, it is the role bearer (i.e. `account`) /
|
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
|
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
| 671
|
20
|
// invoked by Messenger on L2
|
function completeDeposit(address account, uint256 depositAmount) external onlyOptimismBridge {
// now tell PeriFinance to mint these tokens, deposited in L1, into the same account for L2
periFinance().mintSecondary(account, depositAmount);
emit MintedSecondary(account, depositAmount);
}
|
function completeDeposit(address account, uint256 depositAmount) external onlyOptimismBridge {
// now tell PeriFinance to mint these tokens, deposited in L1, into the same account for L2
periFinance().mintSecondary(account, depositAmount);
emit MintedSecondary(account, depositAmount);
}
| 15,109
|
63
|
// The minimum absolute borrow value of an account There must be sufficient incentivize to liquidate undercollateralized accounts
|
Monetary.Value minBorrowedValue;
|
Monetary.Value minBorrowedValue;
| 21,241
|
96
|
// ========== OWNER FUNCTIONS ========== //set terms for new addresscannot lower for address or exceed maximum total allocation_address address_max uint_rate uint_hasClaimed uint /
|
function setTerms(address _address, uint _max, uint _rate, uint _hasClaimed ) external {
require( msg.sender == owner, "Sender is not owner" );
require( _max >= terms[ _address ].max, "cannot lower amount claimable" );
require( _rate >= terms[ _address ].percent, "cannot lower vesting rate" );
require( totalAllocated.add( _rate ) <= maximumAllocated, "Cannot allocate more" );
if( terms[ _address ].max == 0 ) {
terms[ _address ].wClaimed = wOHM.sOHMTowOHM( _hasClaimed );
}
terms[ _address ].max = _max;
terms[ _address ].percent = _rate;
totalAllocated = totalAllocated.add( _rate );
}
|
function setTerms(address _address, uint _max, uint _rate, uint _hasClaimed ) external {
require( msg.sender == owner, "Sender is not owner" );
require( _max >= terms[ _address ].max, "cannot lower amount claimable" );
require( _rate >= terms[ _address ].percent, "cannot lower vesting rate" );
require( totalAllocated.add( _rate ) <= maximumAllocated, "Cannot allocate more" );
if( terms[ _address ].max == 0 ) {
terms[ _address ].wClaimed = wOHM.sOHMTowOHM( _hasClaimed );
}
terms[ _address ].max = _max;
terms[ _address ].percent = _rate;
totalAllocated = totalAllocated.add( _rate );
}
| 29,131
|
123
|
// Marketing Reward
|
if (_marketingRewardEnabled) {
sendFeeToAddress(marketingAddress, values.rMarketingFee, values.tMarketingFee);
}
|
if (_marketingRewardEnabled) {
sendFeeToAddress(marketingAddress, values.rMarketingFee, values.tMarketingFee);
}
| 33,482
|
81
|
// Set the address of the Voucher Sets token contract, an ERC1155 contract _voucherSetTokenAddress The address of the Vouchers token contract /
|
function setVoucherSetTokenAddress(address _voucherSetTokenAddress)
external
override
onlyOwner
notZeroAddress(_voucherSetTokenAddress)
whenPaused
|
function setVoucherSetTokenAddress(address _voucherSetTokenAddress)
external
override
onlyOwner
notZeroAddress(_voucherSetTokenAddress)
whenPaused
| 10,125
|
131
|
// Compute hash
|
result := keccak256(memPtr, 160)
|
result := keccak256(memPtr, 160)
| 4,895
|
93
|
// divisor cannot be zero with existing outflow
|
return totalRewardLeft / totalCFAOutFlowrate > int256(liquidationPeriod - patricianPeriod);
|
return totalRewardLeft / totalCFAOutFlowrate > int256(liquidationPeriod - patricianPeriod);
| 10,535
|
18
|
// validate and get shares
|
uint256 burned = _shares(user, amount);
|
uint256 burned = _shares(user, amount);
| 38,115
|
204
|
// strategy specific: https:github.com/makerdao/mcd-changelog
|
address public wbtc_collateral = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;
address public link_btc_usd = 0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c;
uint256 public wbtc_collateral_decimal = 1e8;
bytes32 public wbtc_ilk = "WBTC-A";
address public wbtc_apt = 0xBF72Da2Bd84c5170618Fbe5914B0ECA9638d5eb5;
uint256 public constant weth_price_decimal = 1;
bool public constant wbtc_price_eth = false;
address public constant curve3crvPool = 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7;
address public constant usdcToken = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
|
address public wbtc_collateral = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;
address public link_btc_usd = 0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c;
uint256 public wbtc_collateral_decimal = 1e8;
bytes32 public wbtc_ilk = "WBTC-A";
address public wbtc_apt = 0xBF72Da2Bd84c5170618Fbe5914B0ECA9638d5eb5;
uint256 public constant weth_price_decimal = 1;
bool public constant wbtc_price_eth = false;
address public constant curve3crvPool = 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7;
address public constant usdcToken = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
| 14,036
|
1
|
// Returns the current emission rate (per epoch) for vault rewards and the current number of epoch (start from 1).
|
function rate() external view returns (uint256 _rate, uint256 _epoch);
|
function rate() external view returns (uint256 _rate, uint256 _epoch);
| 7
|
21
|
// emit RequestRandomness(msg.sender, selection);
| 45,390
|
||
114
|
// Constructs a `Signed` from an unscaled int, e.g., `b=5` gets stored internally as `5(1018)`. a int to convert into a FixedPoint.Signed.return the converted FixedPoint.Signed. /
|
function fromUnscaledInt(int256 a) internal pure returns (Signed memory) {
return Signed(a.mul(SFP_SCALING_FACTOR));
}
|
function fromUnscaledInt(int256 a) internal pure returns (Signed memory) {
return Signed(a.mul(SFP_SCALING_FACTOR));
}
| 26,652
|
81
|
// increment the number of tranches released, even after fully vested.
|
tranchesReleased++;
|
tranchesReleased++;
| 21,839
|
2
|
// Returns the current address for a contract located in the ecosystem/name is the string name of the contract/ return contractAddress is the address of the input name contract
|
function getAddress(string calldata name)
public
view
returns (address contractAddress)
|
function getAddress(string calldata name)
public
view
returns (address contractAddress)
| 6,090
|
114
|
// Returns the vesting schedule information for a given holder and index. return the vesting schedule structure information/
|
function getVestingScheduleByAddressAndIndex(address holder, uint256 index)
external
view
|
function getVestingScheduleByAddressAndIndex(address holder, uint256 index)
external
view
| 62,946
|
17
|
// @Proteu5 - Change State For Public Sale check mintlist price
|
function SetupPublicSaleInfo(
uint64 _publicPriceWei
|
function SetupPublicSaleInfo(
uint64 _publicPriceWei
| 2,690
|
90
|
// TramsBar is the coolest place in town. You come in with some Trams, and leave with more! The longer you stay, the more Trams you get. This contract handles swapping to and from xTrams, TramsDex's staking token.
|
contract TramsBar is ERC20("TramsBar", "xTRAMS"){
using SafeMath for uint256;
IERC20 public trams;
// Define the Trams token contract
constructor(IERC20 _trams) public {
require(address(_trams) != address(0), "invalid address");
trams = _trams;
}
// Enter the bar. Pay some TRAMS. Earn some shares.
// Locks Trams and mints xTRAMS
function enter(uint256 _amount) public {
// Gets the amount of Trams locked in the contract
uint256 totalTrams = trams.balanceOf(address(this));
// Gets the amount of xTrams in existence
uint256 totalShares = totalSupply();
// If no xTrams exists, mint it 1:1 to the amount put in
if (totalShares == 0 || totalTrams == 0) {
_mint(msg.sender, _amount);
}
// Calculate and mint the amount of xTrams the Trams is worth. The ratio will change overtime, as xTrams is burned/minted and Trams deposited + gained from fees / withdrawn.
else {
uint256 what = _amount.mul(totalShares).div(totalTrams);
_mint(msg.sender, what);
}
// Lock the Trams in the contract
trams.transferFrom(msg.sender, address(this), _amount);
}
// Leave the bar. Claim back your TRAMS.
// Unclocks the staked + gained Trams and burns xTrams
function leave(uint256 _share) public {
// Gets the amount of xTrams in existence
uint256 totalShares = totalSupply();
// Calculates the amount of Trams the xTrams is worth
uint256 what = _share.mul(trams.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
trams.transfer(msg.sender, what);
}
}
|
contract TramsBar is ERC20("TramsBar", "xTRAMS"){
using SafeMath for uint256;
IERC20 public trams;
// Define the Trams token contract
constructor(IERC20 _trams) public {
require(address(_trams) != address(0), "invalid address");
trams = _trams;
}
// Enter the bar. Pay some TRAMS. Earn some shares.
// Locks Trams and mints xTRAMS
function enter(uint256 _amount) public {
// Gets the amount of Trams locked in the contract
uint256 totalTrams = trams.balanceOf(address(this));
// Gets the amount of xTrams in existence
uint256 totalShares = totalSupply();
// If no xTrams exists, mint it 1:1 to the amount put in
if (totalShares == 0 || totalTrams == 0) {
_mint(msg.sender, _amount);
}
// Calculate and mint the amount of xTrams the Trams is worth. The ratio will change overtime, as xTrams is burned/minted and Trams deposited + gained from fees / withdrawn.
else {
uint256 what = _amount.mul(totalShares).div(totalTrams);
_mint(msg.sender, what);
}
// Lock the Trams in the contract
trams.transferFrom(msg.sender, address(this), _amount);
}
// Leave the bar. Claim back your TRAMS.
// Unclocks the staked + gained Trams and burns xTrams
function leave(uint256 _share) public {
// Gets the amount of xTrams in existence
uint256 totalShares = totalSupply();
// Calculates the amount of Trams the xTrams is worth
uint256 what = _share.mul(trams.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
trams.transfer(msg.sender, what);
}
}
| 42,263
|
37
|
// uint256 amount = msg.valueexchangeRate;
|
uint256 amount = msg.value;
require(balances[owner] >= amount);
balances[owner] = balances[owner].sub(amount);
balances[msg.sender] = balances[msg.sender].add(amount);
Transfer(owner, msg.sender, amount);
|
uint256 amount = msg.value;
require(balances[owner] >= amount);
balances[owner] = balances[owner].sub(amount);
balances[msg.sender] = balances[msg.sender].add(amount);
Transfer(owner, msg.sender, amount);
| 33,152
|
39
|
// 是否冻结帐户的列表
|
mapping (address => bool) public frozenAccount;
|
mapping (address => bool) public frozenAccount;
| 25,117
|
19
|
// Decrease the amount of tokens that an owner allowed to a spender. approve should be called when _allowed[msg.sender][spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol Emits an Approval event.spender The address which will spend the funds.subtractedValue The amount of tokens to decrease the allowance by./
|
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
|
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
| 21,611
|
5
|
// : Gets the amount of locked/funded tokens by address._symbol: The asset's symbol. /
|
function getLockedFunds(address _token) public view returns (uint256) {
event LogUnlock(
address _to,
address _token,
string _symbol,
uint256 _value,
bytes32 _interchainTX
);
event LogRefund(
address _to,
address _token,
string _symbol,
uint256 _value,
uint256 _nonce
);
event LogUnlockFee(
address _owner,
address _token,
string _symbol,
uint256 _fee,
bytes32 _interchainTX
);
address thisadd = address(this);
if (_token == address(0)) {
return thisadd.balance;
}
return IERC20(_token).balanceOf(thisadd);
}
|
function getLockedFunds(address _token) public view returns (uint256) {
event LogUnlock(
address _to,
address _token,
string _symbol,
uint256 _value,
bytes32 _interchainTX
);
event LogRefund(
address _to,
address _token,
string _symbol,
uint256 _value,
uint256 _nonce
);
event LogUnlockFee(
address _owner,
address _token,
string _symbol,
uint256 _fee,
bytes32 _interchainTX
);
address thisadd = address(this);
if (_token == address(0)) {
return thisadd.balance;
}
return IERC20(_token).balanceOf(thisadd);
}
| 27,329
|
30
|
// By default, reverts. This is to ensure the call path is not used unless this function is overridden by the inheriting class
|
revert Connector__processMessage_notUsed();
|
revert Connector__processMessage_notUsed();
| 22,697
|
1,182
|
// Uniswap PCV Deposit constructor/_core Fei Core for reference/_pair Uniswap Pair to deposit to/_router Uniswap Router/_oracle oracle for reference
|
constructor(
address _core,
address _pair,
address _router,
address _oracle
|
constructor(
address _core,
address _pair,
address _router,
address _oracle
| 39,822
|
320
|
// Grants the minter role to a non-minter. account The account to grant the minter role to. /
|
function addMinter(address account) public onlyMinter {
require(!isMinter(account), "MinterRole: add an account already minter");
grantRole(DEFAULT_ADMIN_ROLE, account);
emit MinterAdded(account);
}
|
function addMinter(address account) public onlyMinter {
require(!isMinter(account), "MinterRole: add an account already minter");
grantRole(DEFAULT_ADMIN_ROLE, account);
emit MinterAdded(account);
}
| 4,731
|
137
|
// only check for Unstake token
|
if(isHarvest == false){
_amount = leaveStakeUser();
require(_amount > 0, "Invalid amount");
}
|
if(isHarvest == false){
_amount = leaveStakeUser();
require(_amount > 0, "Invalid amount");
}
| 27,259
|
132
|
// create a new fragment by linear interpolation between a and b
|
int256[12] memory newFragment = ShackledMath.vector12Lerp(
fa,
fb,
ir,
lerpScaleFactor
);
newFragment[0] = vars.x;
newFragment[1] = vars.y;
|
int256[12] memory newFragment = ShackledMath.vector12Lerp(
fa,
fb,
ir,
lerpScaleFactor
);
newFragment[0] = vars.x;
newFragment[1] = vars.y;
| 45,296
|
14
|
// We need to expose this since exec() in Module is internal so our ArbitrateFacet can call itself
|
function execute(
address _to,
uint256 _value,
bytes memory _data,
Enum.Operation _operation
|
function execute(
address _to,
uint256 _value,
bytes memory _data,
Enum.Operation _operation
| 46,258
|
317
|
// get the reserve token return before burning the caller's shares
|
(uint256 reserveAmount, ) = removeLiquidityReturnAndFee(_poolToken, _amount);
require(reserveAmount >= _minReturn, "ERR_RETURN_TOO_LOW");
|
(uint256 reserveAmount, ) = removeLiquidityReturnAndFee(_poolToken, _amount);
require(reserveAmount >= _minReturn, "ERR_RETURN_TOO_LOW");
| 17,399
|
58
|
// low level token purchase function override to create custom buy
|
function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(rate);
// update state
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
emit TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
}
|
function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(rate);
// update state
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
emit TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
}
| 53,659
|
10
|
// set 3D state on metadata
|
function setThreeDState(bytes calldata signature, uint256 tokenId, uint256 state0, uint256 state1) external {
require(ownerOf(tokenId) == msg.sender, "You are not the owner of this QBE");
auth.validatePositions(signature, state0, state1);
metadata.setThreeDState(tokenId, state0, state1);
}
|
function setThreeDState(bytes calldata signature, uint256 tokenId, uint256 state0, uint256 state1) external {
require(ownerOf(tokenId) == msg.sender, "You are not the owner of this QBE");
auth.validatePositions(signature, state0, state1);
metadata.setThreeDState(tokenId, state0, state1);
}
| 30,638
|
7
|
// mint NFT for reword
|
uint256 rewardTokenId = _mintNft(address(rewardToken), reward, interval, NftTypes.bonus);
emit StakeEvent(
msg.sender,
stakedAmountTokenId,
rewardTokenId,
stakedAmount,
interval,
reward
);
|
uint256 rewardTokenId = _mintNft(address(rewardToken), reward, interval, NftTypes.bonus);
emit StakeEvent(
msg.sender,
stakedAmountTokenId,
rewardTokenId,
stakedAmount,
interval,
reward
);
| 56,256
|
52
|
// num_tokens_auctioned = total number of Rei (RDNtoken_multiplier) that is auctioned
|
uint required_wei_at_price = num_tokens_auctioned * price() / token_multiplier;
if (required_wei_at_price <= received_wei) {
return 0;
}
|
uint required_wei_at_price = num_tokens_auctioned * price() / token_multiplier;
if (required_wei_at_price <= received_wei) {
return 0;
}
| 14,445
|
163
|
// Deposit LP tokens to MasterChef for PROFIT allocation.
|
function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accPROFITPerShare).div(1e12).sub(user.rewardDebt);
safePROFITTransfer(msg.sender, pending);
}
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
user.amount = user.amount.add(_amount);
user.rewardDebt = user.amount.mul(pool.accPROFITPerShare).div(1e12);
emit Deposit(msg.sender, _pid, _amount);
}
|
function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accPROFITPerShare).div(1e12).sub(user.rewardDebt);
safePROFITTransfer(msg.sender, pending);
}
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
user.amount = user.amount.add(_amount);
user.rewardDebt = user.amount.mul(pool.accPROFITPerShare).div(1e12);
emit Deposit(msg.sender, _pid, _amount);
}
| 39,638
|
10
|
// To change the approve amount you first have to reduce the addresses`allowance to zero by calling `approve(_spender, 0)` if it is notalready 0 to mitigate the race condition described here:https:github.com/ethereum/EIPs/issues/20issuecomment-263524729
|
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
|
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
| 41,163
|
86
|
// convert collateral to GHST
|
uint256 convertedCollateralToGhst = _stakeAmount * (ISettings(settingsContract).collateralTypeToGhst(collateralType) / 10**8);
ownerContributedCollateral[msg.sender][portalFundingNumber] += _stakeAmount;
ownerCollateralType[msg.sender][portalFundingNumber] = collateralType;
ownerContributedToPortalFunding[msg.sender][portalFundingNumber] += convertedCollateralToGhst;
totalContributedToPortalFunding += convertedCollateralToGhst;
ownerTotalContributedInGhst[msg.sender] += convertedCollateralToGhst;
currentBalanceInGhst += convertedCollateralToGhst;
portalFundingContributor[msg.sender].push(portalFundingNumber);
emit ContributedPortalFunding(
msg.sender,
|
uint256 convertedCollateralToGhst = _stakeAmount * (ISettings(settingsContract).collateralTypeToGhst(collateralType) / 10**8);
ownerContributedCollateral[msg.sender][portalFundingNumber] += _stakeAmount;
ownerCollateralType[msg.sender][portalFundingNumber] = collateralType;
ownerContributedToPortalFunding[msg.sender][portalFundingNumber] += convertedCollateralToGhst;
totalContributedToPortalFunding += convertedCollateralToGhst;
ownerTotalContributedInGhst[msg.sender] += convertedCollateralToGhst;
currentBalanceInGhst += convertedCollateralToGhst;
portalFundingContributor[msg.sender].push(portalFundingNumber);
emit ContributedPortalFunding(
msg.sender,
| 18,509
|
23
|
// Generate report for current profit and loss. Also liquidate asset to paybackexcess debt, if any.return _profit Calculate any realized profit and convert it to collateral, if not already.return _loss Calculate any loss that strategy has made on investment. Convert into collateral token.return _payback If strategy has any excess debt, we have to liquidate asset to payback excess debt. /
|
function _generateReport()
internal
virtual
returns (
uint256 _profit,
uint256 _loss,
|
function _generateReport()
internal
virtual
returns (
uint256 _profit,
uint256 _loss,
| 20,890
|
29
|
// Agreement Whitelisting /
|
function registerAgreementClass(ISuperAgreement agreementClassLogic) external onlyGovernance override {
bytes32 agreementType = agreementClassLogic.agreementType();
if (_agreementClassIndices[agreementType] != 0) {
revert HOST_AGREEMENT_ALREADY_REGISTERED();
}
if (_agreementClasses.length >= 256) revert HOST_MAX_256_AGREEMENTS();
ISuperAgreement agreementClass;
if (!NON_UPGRADABLE_DEPLOYMENT) {
// initialize the proxy
UUPSProxy proxy = new UUPSProxy();
proxy.initializeProxy(address(agreementClassLogic));
agreementClass = ISuperAgreement(address(proxy));
} else {
agreementClass = ISuperAgreement(address(agreementClassLogic));
}
// register the agreement proxy
_agreementClasses.push((agreementClass));
_agreementClassIndices[agreementType] = _agreementClasses.length;
emit AgreementClassRegistered(agreementType, address(agreementClassLogic));
}
|
function registerAgreementClass(ISuperAgreement agreementClassLogic) external onlyGovernance override {
bytes32 agreementType = agreementClassLogic.agreementType();
if (_agreementClassIndices[agreementType] != 0) {
revert HOST_AGREEMENT_ALREADY_REGISTERED();
}
if (_agreementClasses.length >= 256) revert HOST_MAX_256_AGREEMENTS();
ISuperAgreement agreementClass;
if (!NON_UPGRADABLE_DEPLOYMENT) {
// initialize the proxy
UUPSProxy proxy = new UUPSProxy();
proxy.initializeProxy(address(agreementClassLogic));
agreementClass = ISuperAgreement(address(proxy));
} else {
agreementClass = ISuperAgreement(address(agreementClassLogic));
}
// register the agreement proxy
_agreementClasses.push((agreementClass));
_agreementClassIndices[agreementType] = _agreementClasses.length;
emit AgreementClassRegistered(agreementType, address(agreementClassLogic));
}
| 17,489
|
306
|
// This is used by any one to increase the available/ liquidity for a given asset on behalf of a router/amount The amount of liquidity to add for the router/assetId The address (or `address(0)` if native asset) of the/asset you're adding liquidity for/router The router you are adding liquidity on behalf of
|
function addLiquidityFor(uint256 amount, address assetId, address router) external payable override whenNotPaused {
_addLiquidityForRouter(amount, assetId, router);
}
|
function addLiquidityFor(uint256 amount, address assetId, address router) external payable override whenNotPaused {
_addLiquidityForRouter(amount, assetId, router);
}
| 37,171
|
9
|
// Exit fee falls over period of 30 days
|
uint256 constant internal exitFeeFallDuration_ = 30 days;
|
uint256 constant internal exitFeeFallDuration_ = 30 days;
| 12,778
|
4
|
// this is to make sure our bankroll can cover the maximum payoutfor your stake and also to make sure your stake is greater than zero.
|
require(msg.value > 0 && msg.value <= maxStake); //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC
|
require(msg.value > 0 && msg.value <= maxStake); //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC
| 17,216
|
86
|
// Internal vote casting mechanism: Check that the vote is pending, that it has not been cast yet, retrieve
|
* voting weight using {getVotes} and call the {_countVote} internal function.
*
* Emits a {VoteCast} event.
*/
function _castVote(
uint256 proposalId,
address account,
uint8 support,
string memory reason
) internal virtual {
require(
state(proposalId) == ProposalState.Active,
"Governance: not active"
);
_countVote(proposalId, account, support);
emit VoteCast(account, proposalId, support, reason);
}
|
* voting weight using {getVotes} and call the {_countVote} internal function.
*
* Emits a {VoteCast} event.
*/
function _castVote(
uint256 proposalId,
address account,
uint8 support,
string memory reason
) internal virtual {
require(
state(proposalId) == ProposalState.Active,
"Governance: not active"
);
_countVote(proposalId, account, support);
emit VoteCast(account, proposalId, support, reason);
}
| 22,122
|
14
|
// How many token units a buyer gets per wei
|
uint256 public rate;
|
uint256 public rate;
| 22,555
|
10
|
// handle cases where certain tokens do not spend allowance for role-based burn
|
IERC20(_token).safeApprove(pegBridge, 0);
|
IERC20(_token).safeApprove(pegBridge, 0);
| 25,032
|
53
|
// The Ether received will be logged with {PaymentReceived} events. Note that these events are not fullyreliable: it's possible for a contract to receive Ether without triggering this function. This only affects thereliability of the events, and not the actual splitting of Ether. To learn more about this see the Solidity documentation forfunctions]. /
|
receive() external payable virtual {
emit PaymentReceived(_msgSender(), msg.value);
}
|
receive() external payable virtual {
emit PaymentReceived(_msgSender(), msg.value);
}
| 2,757
|
102
|
// 1: Beneficiary - simple the recipient address
|
Beneficiary,
|
Beneficiary,
| 45,040
|
32
|
// Constructor,
|
function EXOToken(
address _accForBounty,
address _accForTeam,
address _accFoundation,
address _accPreICO,
address _accICO)
public
|
function EXOToken(
address _accForBounty,
address _accForTeam,
address _accFoundation,
address _accPreICO,
address _accICO)
public
| 45,540
|
7
|
// set old address
|
address oldPriceProviderAddress = address(priceProviderMoC);
|
address oldPriceProviderAddress = address(priceProviderMoC);
| 5,041
|
30
|
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
|
(bool success, ) = recipient.call{ value: amount }("");
|
(bool success, ) = recipient.call{ value: amount }("");
| 21,061
|
112
|
// Verifying whether or not this transaction exceeds the maximum allowed Ethereum transfer cap.
|
require(checkIfValidWeiTransfer(requiredBalance), "Access is denied.");
require
(
address(this).balance >= requiredBalance,
"You don't have sufficient funds to transfer amount this big."
);
for (uint256 i = 0; i < destinations.length; i++) {
|
require(checkIfValidWeiTransfer(requiredBalance), "Access is denied.");
require
(
address(this).balance >= requiredBalance,
"You don't have sufficient funds to transfer amount this big."
);
for (uint256 i = 0; i < destinations.length; i++) {
| 35,976
|
314
|
// 0. Pay out to Fund
|
uint256 rewards = newSupply.mul(getSupplyIncreaseFundRatio()).div(10000);
uint256 devReward = rewards.mul(Constants.getFundDevPct()).div(100);
uint256 treasuryReward = rewards.sub(devReward);
if (devReward != 0) {
dollar().mint(Constants.getDevAddress(), devReward);
}
|
uint256 rewards = newSupply.mul(getSupplyIncreaseFundRatio()).div(10000);
uint256 devReward = rewards.mul(Constants.getFundDevPct()).div(100);
uint256 treasuryReward = rewards.sub(devReward);
if (devReward != 0) {
dollar().mint(Constants.getDevAddress(), devReward);
}
| 1,665
|
186
|
// Check cross multiplication of 3/100
|
uint256 crossMultiple1 = percent.numerator * 100;
uint256 crossMultiple2 = percent.denominator * 3;
if (crossMultiple1 < crossMultiple2) {
return false;
}
|
uint256 crossMultiple1 = percent.numerator * 100;
uint256 crossMultiple2 = percent.denominator * 3;
if (crossMultiple1 < crossMultiple2) {
return false;
}
| 36,202
|
16
|
// Allows the current owner to transfer the bZx contract owner to a new contract addressnewBZxContractAddress The bZx contract address to transfer ownership to./
|
function transferBZxOwnership(address newBZxContractAddress) public onlyOwner {
require(newBZxContractAddress != address(0) && newBZxContractAddress != owner, "transferBZxOwnership::unauthorized");
emit BZxOwnershipTransferred(bZxContractAddress, newBZxContractAddress);
bZxContractAddress = newBZxContractAddress;
}
|
function transferBZxOwnership(address newBZxContractAddress) public onlyOwner {
require(newBZxContractAddress != address(0) && newBZxContractAddress != owner, "transferBZxOwnership::unauthorized");
emit BZxOwnershipTransferred(bZxContractAddress, newBZxContractAddress);
bZxContractAddress = newBZxContractAddress;
}
| 4,756
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.