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
15
// global term controller contract
ITermController internal termController;
ITermController internal termController;
35,389
31
// remove and transfer token
if (_from != _to) { assert(tokenOwnerToTokenCount[_from] > 0); tokenOwnerToTokenCount[_from]--; tokenIdToTokenOwner[_tokenId] = _to; _holderTokens[_from].remove(_tokenId); _holderTokens[_to].add(_tokenId); tokenOwnerToTokenCount[_to]++; ...
if (_from != _to) { assert(tokenOwnerToTokenCount[_from] > 0); tokenOwnerToTokenCount[_from]--; tokenIdToTokenOwner[_tokenId] = _to; _holderTokens[_from].remove(_tokenId); _holderTokens[_to].add(_tokenId); tokenOwnerToTokenCount[_to]++; ...
9,024
21
// Updates the validator set with new validators and powers/ (requires signatures from at least `threshold_num/threshold_denom`/ validators, otherwise reverts)/ _newValidators The new validator set/ _newPowers The new list of powers corresponding to the validator set/ _signersIndexes Array of indexes of the validator's...
function rotateValidators( address[] calldata _newValidators, uint64[] calldata _newPowers, uint256[] calldata _signersIndexes, // Based on: https://github.com/cosmos/peggy/blob/master/ethereum-contracts/contracts/Valset.sol#L75 uint8[] calldata _v, bytes32[] calldata _r, ...
function rotateValidators( address[] calldata _newValidators, uint64[] calldata _newPowers, uint256[] calldata _signersIndexes, // Based on: https://github.com/cosmos/peggy/blob/master/ethereum-contracts/contracts/Valset.sol#L75 uint8[] calldata _v, bytes32[] calldata _r, ...
18,197
33
// transfer function signature
mstore(0x7c, ERC20_TRANSFER_ID)
mstore(0x7c, ERC20_TRANSFER_ID)
41,452
13
// Present.
event Present(address indexed fromAddress, address indexed toAddress, uint256 amount, uint256 presentTime);
event Present(address indexed fromAddress, address indexed toAddress, uint256 amount, uint256 presentTime);
24,948
66
// registration(0x1beE1FAD0E6Cd41e4E3CAaeF65b8a8b09f3Aa31B, referrerAddress);registration(0x1BEe1FaD0e6Cd41E4E3CAAef65b8a8B09f3AA31c, referrerAddress);
registration(0x1beE1FaD0e6CD41e4e3CAaEf65b8a8B09F3aa31d, 0x1beE1FAD0E6Cd41e4E3CAaeF65b8a8b09f3Aa31B); registration(0x1BEE1FAD0e6cD41E4E3caaEf65B8A8b09f3AA31E, 0x1beE1FAD0E6Cd41e4E3CAaeF65b8a8b09f3Aa31B);
registration(0x1beE1FaD0e6CD41e4e3CAaEf65b8a8B09F3aa31d, 0x1beE1FAD0E6Cd41e4E3CAaeF65b8a8b09f3Aa31B); registration(0x1BEE1FAD0e6cD41E4E3caaEf65B8A8b09f3AA31E, 0x1beE1FAD0E6Cd41e4E3CAaeF65b8a8b09f3Aa31B);
5,515
76
// update timelock,if timelock has been set, only timelock can be call. Otherwise the owner can call.
function updateTimelock(address _timelock) external { require((timelock == address(0) && msg.sender == owner()) || msg.sender == timelock, "NO PERMISSION"); require(_timelock != address(0),"INVALID ADDRESS"); timelock = _timelock; }
function updateTimelock(address _timelock) external { require((timelock == address(0) && msg.sender == owner()) || msg.sender == timelock, "NO PERMISSION"); require(_timelock != address(0),"INVALID ADDRESS"); timelock = _timelock; }
11,296
183
// zero all bytes to the right
exp(0x100, sub(32, mlength)) ),
exp(0x100, sub(32, mlength)) ),
6,777
7
// validate
require(whitelist[staking] == ModuleFactoryType.Staking, "f1"); require(whitelist[reward] == ModuleFactoryType.Reward, "f2");
require(whitelist[staking] == ModuleFactoryType.Staking, "f1"); require(whitelist[reward] == ModuleFactoryType.Reward, "f2");
1,031
0
// 自定义结构类型商业募捐活动
struct Campaign { address owner; //发起者地址 string title; string description; uint256 target; //想要达到的目前金额数量 uint256 deadline; //募捐的截止时间 uint256 amountCollected; //已经募捐到的数量 string image; //我们将在这里放置图像URL address[] donators; //捐助者地址数组 uint256[] donat...
struct Campaign { address owner; //发起者地址 string title; string description; uint256 target; //想要达到的目前金额数量 uint256 deadline; //募捐的截止时间 uint256 amountCollected; //已经募捐到的数量 string image; //我们将在这里放置图像URL address[] donators; //捐助者地址数组 uint256[] donat...
23,168
55
// the signature must be valid
require(signer == from, "Invalid Signature for subscription cancellation");
require(signer == from, "Invalid Signature for subscription cancellation");
58,690
39
// Returns the state variable `_CALLER` in the Primitive Router. /
function getCaller() public view override returns (address) { return _primitiveRouter.getCaller(); }
function getCaller() public view override returns (address) { return _primitiveRouter.getCaller(); }
13,146
14
// Remove recipe from recipes array
if(_index != accountData.recipes.length - 1 ) { accountData.recipes[_index] = accountData.recipes[accountData.recipes.length - 1]; }
if(_index != accountData.recipes.length - 1 ) { accountData.recipes[_index] = accountData.recipes[accountData.recipes.length - 1]; }
23,583
25
// generate path
address [] memory path = new address[](2); path[0] = address(this); path[1] = uniswapRouter.WETH();
address [] memory path = new address[](2); path[0] = address(this); path[1] = uniswapRouter.WETH();
19,998
8
// storing to memory
newplayerregistered = Players(_playeraddress,_playername, 0,playerbalance ); _playerstore[_playeraddress].playeraddress = _playeraddress; _playerstore[_playeraddress].playername = _playername; _playerstore[_playeraddress].playerscore = 0; _playerstore[_pl...
newplayerregistered = Players(_playeraddress,_playername, 0,playerbalance ); _playerstore[_playeraddress].playeraddress = _playeraddress; _playerstore[_playeraddress].playername = _playername; _playerstore[_playeraddress].playerscore = 0; _playerstore[_pl...
17,484
17
// 记录各个账户的释放时间
mapping(address => uint) public cronoutOf;
mapping(address => uint) public cronoutOf;
40,867
5
// Think of these as a hash table, with the key as a uint and value of the struct Candidate/Voter.mappings will be used in the majority of our transactions/calls
mapping (uint => Candidate) candidates; mapping (uint => Voter) voters;
mapping (uint => Candidate) candidates; mapping (uint => Voter) voters;
16,230
12
// Долг составил только $25 млрд ^^^^^^^^^^
pattern ЧислоЦифрами0
pattern ЧислоЦифрами0
48,342
151
// modify the sub payee
Payee storage sp = subPayees[_requestId][_payeeIndex-1]; sp.balance = sp.balance.add(_deltaAmount);
Payee storage sp = subPayees[_requestId][_payeeIndex-1]; sp.balance = sp.balance.add(_deltaAmount);
5,058
199
// Return contract metadata for opensea view
function contractURI() public view returns (string memory) { return string(abi.encodePacked(baseURI(), "contract_metadata", '.json')); }
function contractURI() public view returns (string memory) { return string(abi.encodePacked(baseURI(), "contract_metadata", '.json')); }
54,354
138
// Returns the rate at which MAXI may be redeemed for HEDRON. return Rate at which MAXI may be redeemed for HDRN./
function getHedronRedemptionRate() external view returns (uint256) {return HEDRON_REDEMPTION_RATE;}
function getHedronRedemptionRate() external view returns (uint256) {return HEDRON_REDEMPTION_RATE;}
42,305
37
// 5nd, 6nd, 7nd year effective annual interest rate is 50%
interest = (435 * maxMintProofOfStake).div(100);
interest = (435 * maxMintProofOfStake).div(100);
46,080
175
// function allowing to freeze tokens partially in batchIMPORTANT : THIS TRANSACTION COULD EXCEED GAS LIMIT IF `_userAddresses.length` IS TOO HIGH,USE WITH CARE OR YOU COULD LOSE TX FEES WITH AN "OUT OF GAS" TRANSACTION _userAddresses The addresses on which tokens need to be frozen _amounts the amount of tokens to free...
function batchFreezePartialTokens(address[] calldata _userAddresses, uint256[] calldata _amounts) external;
function batchFreezePartialTokens(address[] calldata _userAddresses, uint256[] calldata _amounts) external;
14,148
19
// stake LP /
function stake(uint256 _amount) external; // owner
function stake(uint256 _amount) external; // owner
43,205
8
// Authorization granted /
function authorize1(string publicKey, string token, string URIresource, string base64Esk) external { payment storage record = pendingPayments[token]; //require (msg.sender == record.acp); msg.sender.transfer(record.price); delete pendingPayments[token]; emit authGrantedEvent(...
function authorize1(string publicKey, string token, string URIresource, string base64Esk) external { payment storage record = pendingPayments[token]; //require (msg.sender == record.acp); msg.sender.transfer(record.price); delete pendingPayments[token]; emit authGrantedEvent(...
14,475
119
// Set a new account on a given role and emit a `RoleModified` eventif the role holder has changed. Only the owner may call this function. role The role that the account will be set for. account The account to set as the designated role bearer. /
function setRole(Role role, address account) external onlyOwner { require(account != address(0), "Must supply an account."); _setRole(role, account); }
function setRole(Role role, address account) external onlyOwner { require(account != address(0), "Must supply an account."); _setRole(role, account); }
42,617
20
// get back collateral as WETH from Compound /
function _redeemWETH(uint256 _redeemAmount) internal { uint256 error = cEth.redeem(_redeemAmount); require(error == 0, "CEth.redeem Error"); // todo: use exchange rate to calculate how much eth we got back weth.deposit{value: address(this).balance}(); }
function _redeemWETH(uint256 _redeemAmount) internal { uint256 error = cEth.redeem(_redeemAmount); require(error == 0, "CEth.redeem Error"); // todo: use exchange rate to calculate how much eth we got back weth.deposit{value: address(this).balance}(); }
39,810
75
// Intentionally commented out so users can pay gas for others claims require(account == msg.sender, "TokenDistributor: Can only claim for own account.");
require(getCurrentRewardsRate() > 0, "TokenDistributor: Past rewards claim period."); require(!isClaimed(index), "TokenDistributor: Drop already claimed.");
require(getCurrentRewardsRate() > 0, "TokenDistributor: Past rewards claim period."); require(!isClaimed(index), "TokenDistributor: Drop already claimed.");
14,004
35
// Modify price
_offerPrice.changePrice(tranEthAmount, tranTokenAmount, tranTokenAddress, offerPriceData.blockNum.add(_blockLimit)); emit OfferTran(address(msg.sender), address(0x0), tranEthAmount, address(tranTokenAddress), tranTokenAmount, contractAddress, offerPriceData.owner);
_offerPrice.changePrice(tranEthAmount, tranTokenAmount, tranTokenAddress, offerPriceData.blockNum.add(_blockLimit)); emit OfferTran(address(msg.sender), address(0x0), tranEthAmount, address(tranTokenAddress), tranTokenAmount, contractAddress, offerPriceData.owner);
36,753
8
// The protection market we borrow from / repay to
address public immutable protectionMarket;
address public immutable protectionMarket;
59,244
39
// Burn numberOfDxnBatches for multiplierInstead of burning deposit DXN to this contract, all of it would be used as rewards for participantion numberOfDxnBatches number of DXN batches, 0 <= batches < 10000 /
function burnDxnBatch(uint256 numberOfDxnBatches)
function burnDxnBatch(uint256 numberOfDxnBatches)
30,221
60
// Require that the new exchange portal is permitted by permittedAddresses
require(permittedAddresses.permittedAddresses(_newExchangePortalAddress)); exchangePortalAddress = _newExchangePortalAddress;
require(permittedAddresses.permittedAddresses(_newExchangePortalAddress)); exchangePortalAddress = _newExchangePortalAddress;
51,865
17
// USER FUNCTIONS/ //
function beginStaking() public { require(!isStaking[msg.sender], "This user is already staking."); isStaking[msg.sender] = true; if (stakingPeriod[msg.sender] == 0) stakingPeriod[msg.sender] = block.number; }
function beginStaking() public { require(!isStaking[msg.sender], "This user is already staking."); isStaking[msg.sender] = true; if (stakingPeriod[msg.sender] == 0) stakingPeriod[msg.sender] = block.number; }
5,921
3
// Errors library Aave Defines the error messages emitted by the different contracts of the Aave protocol Error messages prefix glossary: - VL = ValidationLogic - MATH = Math libraries - CT = Common errors between tokens (AToken, VariableDebtToken and StableDebtToken) - AT = AToken - SDT = StableDebtToken - VDT = Varia...
library Errors { //common errors string public constant CALLER_NOT_POOL_ADMIN = '33'; // 'The caller must be the pool admin' string public constant BORROW_ALLOWANCE_NOT_ENOUGH = '59'; // User borrows on behalf, but allowance are too small //contract specific errors string public constant VL_INVALID_AMOUNT = ...
library Errors { //common errors string public constant CALLER_NOT_POOL_ADMIN = '33'; // 'The caller must be the pool admin' string public constant BORROW_ALLOWANCE_NOT_ENOUGH = '59'; // User borrows on behalf, but allowance are too small //contract specific errors string public constant VL_INVALID_AMOUNT = ...
4,130
80
// for ETH and ERC20 fund this asset different
address public coreFundAsset;
address public coreFundAsset;
47,330
9
// define pointer
let p := mload(0x40)
let p := mload(0x40)
11,287
229
// Group 0: No grouping
totalNumVotes += total[0]; numVotes += signed[0];
totalNumVotes += total[0]; numVotes += signed[0];
3,654
181
// Transfers 'tokenId' from 'from' to 'to'.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - 'to' cannot be the zero address. * - 'tokenId' token must be owned by 'from'. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) i...
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - 'to' cannot be the zero address. * - 'tokenId' token must be owned by 'from'. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) i...
26,392
4
// do the approval for the Collats Contract
IERC20Upgradeable(token).safeApprove(address(collats), amount);
IERC20Upgradeable(token).safeApprove(address(collats), amount);
8,046
6
// Burn handles disbursing a share of tokens in this contract to a given address./_to The address to disburse to/_amount The amount of TKN that will be burned if this succeeds
function burn(address payable _to, uint256 _amount) external onlyBurner returns (bool) { if (_amount == 0) { return true; } // The burner token deducts from the supply before calling. uint256 supply = IBurner(_burner).currentSupply().add(_amount); address[] memory...
function burn(address payable _to, uint256 _amount) external onlyBurner returns (bool) { if (_amount == 0) { return true; } // The burner token deducts from the supply before calling. uint256 supply = IBurner(_burner).currentSupply().add(_amount); address[] memory...
35,566
11
// Sets the contract URI for contract metadata.newContractURI The new contract URI. /
function setContractURI(string calldata newContractURI) external override onlyOwner
function setContractURI(string calldata newContractURI) external override onlyOwner
11,802
146
// Vars for use in the boost calculations
uint256 private constant MIN_DEPOSIT = 1e18; uint256 private constant MAX_VMTA = 600000e18; uint256 private constant MAX_BOOST = 3e18; uint256 private constant MIN_BOOST = 1e18; uint256 private constant FLOOR = 98e16; uint256 public immutable boostCoeff; // scaled by 10 uint256 public immuta...
uint256 private constant MIN_DEPOSIT = 1e18; uint256 private constant MAX_VMTA = 600000e18; uint256 private constant MAX_BOOST = 3e18; uint256 private constant MIN_BOOST = 1e18; uint256 private constant FLOOR = 98e16; uint256 public immutable boostCoeff; // scaled by 10 uint256 public immuta...
15,476
5
// Allows you to change the owner of the contract.
function changeOwner(address newOwner) public onlyOwner virtual
function changeOwner(address newOwner) public onlyOwner virtual
28,846
5
// Claim all the COMP accrued by specific holders in specific markets for their supplies and/or borrows
function claimComp( address[] memory holders, CToken[] memory cTokens, bool borrowers, bool suppliers ) external virtual;
function claimComp( address[] memory holders, CToken[] memory cTokens, bool borrowers, bool suppliers ) external virtual;
37,035
105
// max ether sender can spent
spendable = reversePercent( balances[msg.sender], applyCoeff(takeFee, msg.sender) );
spendable = reversePercent( balances[msg.sender], applyCoeff(takeFee, msg.sender) );
41,738
118
// Checking that the y-coordinates are same.
require( leftSegment.right.y == rightSegment.left.y, "given polyline is not a continuous function" ); int256 nextGradientNumerator = int256(rightSegment.right.y) - int256(rightSegment.left.y); int256 nextGradientDenominator...
require( leftSegment.right.y == rightSegment.left.y, "given polyline is not a continuous function" ); int256 nextGradientNumerator = int256(rightSegment.right.y) - int256(rightSegment.left.y); int256 nextGradientDenominator...
33,168
40
// investor -> option -> vested eth
mapping(address => mapping(uint256 => uint256)) public vests;
mapping(address => mapping(uint256 => uint256)) public vests;
18,302
11
// 添加 value 到数组中
function addValue(uint256[] storage array, uint256 value) internal { uint256 index; bool isInArray; (isInArray, index) = firstIndexOf(array, value); // 如果不存在于数组中 if (!isInArray) { array.push(value); } }
function addValue(uint256[] storage array, uint256 value) internal { uint256 index; bool isInArray; (isInArray, index) = firstIndexOf(array, value); // 如果不存在于数组中 if (!isInArray) { array.push(value); } }
34,005
114
// This turns the input data into a 100-sided die by dividing by ceil(2 ^ 256 / 100).
uint256 factor = 1157920892373161954235709850086879078532699846656405640394575840079131296399; saltForRandom += uint256(msg.sender) % 100 + uint256(uint256(hashVal) / factor); return saltForRandom;
uint256 factor = 1157920892373161954235709850086879078532699846656405640394575840079131296399; saltForRandom += uint256(msg.sender) % 100 + uint256(uint256(hashVal) / factor); return saltForRandom;
11,068
50
// Burns a mint pass. Intended to be called when minting a QQL token.
function burn(uint256 tokenId) external { if (msg.sender != burner_) revert("MintPass: unauthorized"); _burn(tokenId); }
function burn(uint256 tokenId) external { if (msg.sender != burner_) revert("MintPass: unauthorized"); _burn(tokenId); }
34,032
10
// Modifier that requires the "ContractOwner" account to be the function caller /
modifier requireContractOwner() { require(msg.sender == contractOwner, "Caller is not contract owner."); _; }
modifier requireContractOwner() { require(msg.sender == contractOwner, "Caller is not contract owner."); _; }
38,333
65
// Returns the owner of the contract. /
function owner() public override view returns (address) { return _owner; }
function owner() public override view returns (address) { return _owner; }
6,868
23
// Pay out requisite `virtual&39; dividends.
address _customerAddress = msg.sender; payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude); _dividends += referralBalance_[_customerAddress]; referralBalance_[_customerAddress] = 0; uint _tokens = purchaseTokens(_divide...
address _customerAddress = msg.sender; payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude); _dividends += referralBalance_[_customerAddress]; referralBalance_[_customerAddress] = 0; uint _tokens = purchaseTokens(_divide...
16,519
65
// Getters
function getBaseBuyFees() external view returns (uint8,uint8, uint8) { return (_base.targetAFeeOnBuy,_base.targetBFeeOnBuy, _base.targetCFeeOnBuy); }
function getBaseBuyFees() external view returns (uint8,uint8, uint8) { return (_base.targetAFeeOnBuy,_base.targetBFeeOnBuy, _base.targetCFeeOnBuy); }
23,219
32
// first instruction must be account initializer. actually by design, we must initialize account for every giveTokenAddress+beneficiary pair, but right for simplicity reasons we assume that batches may contain orders with the same giveTokenAddress, so only a single initialization is required
instructionsData = EncodeSolanaDlnMessage.encodeInitWalletIfNeededInstruction( _beneficiary, giveTokenAddress, _initWalletIfNeededInstructionReward );
instructionsData = EncodeSolanaDlnMessage.encodeInitWalletIfNeededInstruction( _beneficiary, giveTokenAddress, _initWalletIfNeededInstructionReward );
13,465
25
// Read only function to see the 2 children of a node in Company forced matrixreturn 2 branches /
function viewUserReferralMatrix1(address _user) public view returns(address[] memory) { return users[_user].referralMatrix1; }
function viewUserReferralMatrix1(address _user) public view returns(address[] memory) { return users[_user].referralMatrix1; }
34,598
269
// Function to purchase tokens. It will be called either with DAI or ETH. DAIAmountContributed Amount of DAI contributed /
function buyTokens(uint256 DAIAmountContributed) public nonReentrant payable { uint256 DAIAmount = DAIAmountContributed; uint256 weiAmount = msg.value; address beneficiary = msg.sender; _preValidatePurchase(beneficiary, weiAmount, DAIAmountContributed); require(whiteLis...
function buyTokens(uint256 DAIAmountContributed) public nonReentrant payable { uint256 DAIAmount = DAIAmountContributed; uint256 weiAmount = msg.value; address beneficiary = msg.sender; _preValidatePurchase(beneficiary, weiAmount, DAIAmountContributed); require(whiteLis...
28,773
40
// Deposit `_value` additional tokens for `msg.sender` without modifying the unlock time/_value Amount of tokens to deposit and add to the lock
function increase_amount(uint _value) external nonReentrant onlyUserOrWhitelist notUnlocked { _increase_amount(_value); }
function increase_amount(uint _value) external nonReentrant onlyUserOrWhitelist notUnlocked { _increase_amount(_value); }
3,112
35
// Stakes a certain amount of tokens, this MUST transfer the given amount from the user MUST trigger Staked event _amount uint256 the amount of tokens to stake _data bytes optional data to include in the Stake event /
function stake(uint256 _amount, bytes _data) public { createStake( msg.sender, _amount, defaultLockInDuration, _data); }
function stake(uint256 _amount, bytes _data) public { createStake( msg.sender, _amount, defaultLockInDuration, _data); }
28
4
// The escrow with liquidityAmount is the one to call applyCreditToJob, the other should call unbondLiquidityFromJob
if (Keep3rV1.liquidityAmount(address(Escrow1), address(Liquidity), address(Keep3rSugarMommy)) > 0 && Keep3rV1.liquidityApplied(address(Escrow1), address(Liquidity), address(Keep3rSugarMommy)) < now) { return (Escrow1, Actions.applyCreditToJob); }
if (Keep3rV1.liquidityAmount(address(Escrow1), address(Liquidity), address(Keep3rSugarMommy)) > 0 && Keep3rV1.liquidityApplied(address(Escrow1), address(Liquidity), address(Keep3rSugarMommy)) < now) { return (Escrow1, Actions.applyCreditToJob); }
54,048
16
// This function allows a user to withdraw their funds from a batch before that batch has been processed batchId From which batch should funds be withdrawn from owner address that owns the account balance amount amount of tokens to withdraw from batch recipient address that will receive the token transfer. if address(0...
function withdraw( bytes32 batchId, address owner, uint256 amount, address recipient
function withdraw( bytes32 batchId, address owner, uint256 amount, address recipient
18,031
79
// Clear payee arary list. /
function clearPayees() public onlyOwner{ for (uint index=0; index<_payees.length; index++) { delete _shares[_payees[index]]; } _payees.length = 0; delete _payees; }
function clearPayees() public onlyOwner{ for (uint index=0; index<_payees.length; index++) { delete _shares[_payees[index]]; } _payees.length = 0; delete _payees; }
41,417
60
// JZMToken JZMToken is a token that provide lock function /
contract JZMToken is PausableToken { event TransferWithLock(address indexed from, address indexed to, address indexed locked, uint256 amount, uint256 releaseTime); mapping (address => address[] ) public balancesLocked; function transferWithLock(address _to, uint256 _amount, uint256 _releaseTime) publ...
contract JZMToken is PausableToken { event TransferWithLock(address indexed from, address indexed to, address indexed locked, uint256 amount, uint256 releaseTime); mapping (address => address[] ) public balancesLocked; function transferWithLock(address _to, uint256 _amount, uint256 _releaseTime) publ...
7,536
0
// token name and token abbreviation are hard coded 21 million tokens are minted to the address that deploys the contract
constructor() ERC20("Basic Token", "BASIC") { _mint(msg.sender, 21000000 * (10 ** uint256(decimals()))); }
constructor() ERC20("Basic Token", "BASIC") { _mint(msg.sender, 21000000 * (10 ** uint256(decimals()))); }
17,014
23
// Name: auditBankAction Description : This is an internal function is to track all the actions done by any bank Parameters:
* param {address} changesDoneBy : Ethereum address of the Bank who made the change * param {BankActions} bankAction : The ENUM value of action done by the bank * *******************************************************************************************************************/ f...
* param {address} changesDoneBy : Ethereum address of the Bank who made the change * param {BankActions} bankAction : The ENUM value of action done by the bank * *******************************************************************************************************************/ f...
1,802
1
// A single input for token amount calculation and approval
struct Input { address token; // Token address uint256 balanceBps; // Basis points for calculating the amount, set 0 to use amountOrOffset as amount uint256 amountOrOffset; // Read as amount if balanceBps is 0; otherwise, read as byte offset of amount in `Logic.data` for replacement, or set ...
struct Input { address token; // Token address uint256 balanceBps; // Basis points for calculating the amount, set 0 to use amountOrOffset as amount uint256 amountOrOffset; // Read as amount if balanceBps is 0; otherwise, read as byte offset of amount in `Logic.data` for replacement, or set ...
9,216
20
// SNGT Implemantation of the SNGT token /
contract SNGTContract is Ownable, ERC20Interface { using SafeMath for uint256; string public constant symbol = "SNGT"; string public constant name = "SNGT"; uint8 public constant decimals = 18; uint256 private _unmintedTokens = 500000000 * uint(10) ** decimals; mapping(address => uint256) bala...
contract SNGTContract is Ownable, ERC20Interface { using SafeMath for uint256; string public constant symbol = "SNGT"; string public constant name = "SNGT"; uint8 public constant decimals = 18; uint256 private _unmintedTokens = 500000000 * uint(10) ** decimals; mapping(address => uint256) bala...
20,427
3
// Create array to store cat index to owner address // Create array to store cat release id to price in wei for all cats in that release // Create array to store cat index to any exception price deviating from release price // Create an array with all balances // Store type descriptor string for each attribute number /...
struct Offer { bool isForSale; // flag identifying if cat is for sale uint catIndex; address seller; // owner address uint minPrice; // price in ETH owner is willing to sell cat for address sellOnlyTo; // address identifying only buyer that seller is...
struct Offer { bool isForSale; // flag identifying if cat is for sale uint catIndex; address seller; // owner address uint minPrice; // price in ETH owner is willing to sell cat for address sellOnlyTo; // address identifying only buyer that seller is...
59,867
164
// set trading for public
function setTrading(bool _tradingOpen) public onlyOwner { tradingOpen = _tradingOpen; }
function setTrading(bool _tradingOpen) public onlyOwner { tradingOpen = _tradingOpen; }
44,076
87
// Reserved base is not enough. The trade is partially executed and a fraction of frozenQuote is returned to the taker.
return (buyTrade.frozenQuote.mul(reservedQuote).div(effectiveQuote), reservedBase);
return (buyTrade.frozenQuote.mul(reservedQuote).div(effectiveQuote), reservedBase);
14,776
187
// Ensure that current leverage ratio must be greater than leverage threshold
require(currentLeverageRatio >= incentivizedLeverageRatio, "Must be above incentivized leverage ratio"); _delever( currentLeverageRatio, maxLeverageRatio, // The target new leverage ratio is always the max leverage ratio ripcordInfo, incentivizedS...
require(currentLeverageRatio >= incentivizedLeverageRatio, "Must be above incentivized leverage ratio"); _delever( currentLeverageRatio, maxLeverageRatio, // The target new leverage ratio is always the max leverage ratio ripcordInfo, incentivizedS...
15,896
53
// The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. /
bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
995
70
// Transfer the balance between two accounts within the fund
function fundTransferWithin(address _from, address _to, uint256 _amount) public { require(fundManagers[msg.sender]); require(_amount > 0); require(balances[msg.sender] >= _amount); require(fundBalances[msg.sender][_from] >= _amount); fundBalances[msg.sender][_from] = fundBa...
function fundTransferWithin(address _from, address _to, uint256 _amount) public { require(fundManagers[msg.sender]); require(_amount > 0); require(balances[msg.sender] >= _amount); require(fundBalances[msg.sender][_from] >= _amount); fundBalances[msg.sender][_from] = fundBa...
26,454
207
// 2.11
function BurnRootx_mintSrootx (uint256 _amount) public { require(IERC20Upgradeable(ROOTxTokenAddress).allowance(msg.sender, 0x871770E3e03bFAEFa3597056e540A1A9c9aC7f6b) >= _amount, "You have to approve rootx to staking contract"); IERC20Upgradeable(ROOTxTokenAddress).transferFrom(msg.sender, 0x871770...
function BurnRootx_mintSrootx (uint256 _amount) public { require(IERC20Upgradeable(ROOTxTokenAddress).allowance(msg.sender, 0x871770E3e03bFAEFa3597056e540A1A9c9aC7f6b) >= _amount, "You have to approve rootx to staking contract"); IERC20Upgradeable(ROOTxTokenAddress).transferFrom(msg.sender, 0x871770...
29,641
98
// The roads contract's address
address public roadsContract;
address public roadsContract;
39,816
90
// Pay the Yield debt - ExportCdpProxy pays FYDai to remove the debt of `user` Controller should take exactly all fyDai flash minted.
controller.repayFYDai(WETH, fyDai.maturity(), address(this), user, fyDaiAmount);
controller.repayFYDai(WETH, fyDai.maturity(), address(this), user, fyDaiAmount);
5,180
1
// event
emit LotteryCreated(newLottery);
emit LotteryCreated(newLottery);
7,276
189
// Restricted access function which updates base URI used to construct ERC721Metadata.tokenURI_newBaseURI new base URI to set /
function setBaseURI(string memory _newBaseURI) external onlyRole(URI_MANAGER_ROLE)
function setBaseURI(string memory _newBaseURI) external onlyRole(URI_MANAGER_ROLE)
71,082
18
// First open priority request id
uint64 public firstPriorityRequestId;
uint64 public firstPriorityRequestId;
24,547
60
// adds 'record' to 'database' id, unique id of profiles price, price of NFT assets which will be generated based on profile sell_price, when we will buy out from owner (burn) url, url of NFT assets which will be generated based on profile /
function addNFTProfile(uint32 id, uint256 price, uint256 sell_price, string calldata url, uint32 limit) external onlyOwnerOrPriceManager { NFTProfile memory temp = NFTProfile(id,price,sell_price,url, limit); nftProfiles.push(temp); }
function addNFTProfile(uint32 id, uint256 price, uint256 sell_price, string calldata url, uint32 limit) external onlyOwnerOrPriceManager { NFTProfile memory temp = NFTProfile(id,price,sell_price,url, limit); nftProfiles.push(temp); }
124
38
// those methods are called by the legacy contract and they must ensure msg.sender to be the contract address
uint public _totalSupply; function transferByLegacy(address from, address to, uint value) public returns (bool); function transferFromByLegacy(address sender, address from, address spender, uint value) public returns (bool); function approveByLegacy(address from, address spender, uint value) public retu...
uint public _totalSupply; function transferByLegacy(address from, address to, uint value) public returns (bool); function transferFromByLegacy(address sender, address from, address spender, uint value) public returns (bool); function approveByLegacy(address from, address spender, uint value) public retu...
12,911
125
// if X is less than 1, then just calculate X
if (integerX == 0) { return expHybrid(Xcopy, precomputePrecision, maclaurinPrecision); }
if (integerX == 0) { return expHybrid(Xcopy, precomputePrecision, maclaurinPrecision); }
17,744
42
// Mint regular assassin with count /
function mintRegularTokens(uint256 _count) external payable saleIsOpen { address wallet = _msgSender(); uint256 total = _tokenIdRegularTracker.current() + REGULAR_START_AT; // Set limit to mint per transaction require(_count > 0 && _count <= 3, "Max 3 NFTs per transaction"); // Set max limit of r...
function mintRegularTokens(uint256 _count) external payable saleIsOpen { address wallet = _msgSender(); uint256 total = _tokenIdRegularTracker.current() + REGULAR_START_AT; // Set limit to mint per transaction require(_count > 0 && _count <= 3, "Max 3 NFTs per transaction"); // Set max limit of r...
38,598
19
// | Bytes | Bits | Field| | ----- | ---- | ---------------------------------------------------- | | 8 | 64 | Nonce | 1 | 8| Maker Src Address Size (!=0) | | N | 8N| Maker Src Address| | 32| 256| Give Chain Id| | 1 | 8| Give Token Address Size (!=0)| | N | 8N| Give Token Address | | 32| 256| Give Amount| | 32| 256| Tak...
encoded = abi.encodePacked( _order.makerOrderNonce, (uint8)(_order.makerSrc.length), _order.makerSrc ); { encoded = abi.encodePacked( encoded, _order.giveChainId,
encoded = abi.encodePacked( _order.makerOrderNonce, (uint8)(_order.makerSrc.length), _order.makerSrc ); { encoded = abi.encodePacked( encoded, _order.giveChainId,
13,437
15
// pop first byte before parsting receipt
bytes memory typedBytes = receipt.raw; bytes memory result = new bytes(typedBytes.length - 1); uint256 srcPtr; uint256 destPtr; assembly { srcPtr := add(33, typedBytes) destPtr := add(0x20, result) }
bytes memory typedBytes = receipt.raw; bytes memory result = new bytes(typedBytes.length - 1); uint256 srcPtr; uint256 destPtr; assembly { srcPtr := add(33, typedBytes) destPtr := add(0x20, result) }
27,543
165
// Lets a HA decrease the `margin` in a perpetual she controls for this/ stablecoin/collateral pair/perpetualID ID of the perpetual from which collateral should be removed/amount Amount to remove from the perpetual's `margin`/to Address which will receive the collateral removed from this perpetual
function removeFromPerpetual( uint256 perpetualID, uint256 amount, address to ) external;
function removeFromPerpetual( uint256 perpetualID, uint256 amount, address to ) external;
13,127
1
// Value to the index in `_values` array, plus 1 because index 0 means a value is not in the set.
mapping(uint256 => uint256) _valueToIndexMap;
mapping(uint256 => uint256) _valueToIndexMap;
23,539
4
// Refund all
if (msg.value > 0) { if (!msg.sender.send(msg.value)) throw; }
if (msg.value > 0) { if (!msg.sender.send(msg.value)) throw; }
46,518
166
// Fill result arrays
tokens = new address[](receivedRewardTokensCount); amounts = new uint256[](receivedRewardTokensCount); if(receivedRewardTokensCount > 0) { uint256 j; for(uint256 i = 0; i < rewardTokens.length; i++) { if(rewardAmounts[i] > 0) { tokens[j...
tokens = new address[](receivedRewardTokensCount); amounts = new uint256[](receivedRewardTokensCount); if(receivedRewardTokensCount > 0) { uint256 j; for(uint256 i = 0; i < rewardTokens.length; i++) { if(rewardAmounts[i] > 0) { tokens[j...
18,042
8
// ERC20 requires totalSupply, balanceOf, and allowance
uint256 public totalSupply; mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; mapping (uint => Tournament) public tournaments; // tournamentID
uint256 public totalSupply; mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; mapping (uint => Tournament) public tournaments; // tournamentID
32,387
252
// Check a pod's launch status.s _id - Id of pod. /
function hasLaunched(uint256 _id) public view returns (bool) { return launchStatus[_id]; }
function hasLaunched(uint256 _id) public view returns (bool) { return launchStatus[_id]; }
32,936
111
// `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
5,148
191
// Ensure that a user signing key is set on this smart wallet.
if (userSigningKey == address(0)) { revert(_revertReason(14)); }
if (userSigningKey == address(0)) { revert(_revertReason(14)); }
43,581
130
// emit BondPriceChanged( bondPriceInUSD(), _bondPrice(), debtRatio() );
adjust(); // control variable is adjusted return payout;
adjust(); // control variable is adjusted return payout;
78,854
53
// Emit event
emit TokenSwapped(msg.sender,destination,tokentoSwap,block.timestamp,_tokenSwapTo);
emit TokenSwapped(msg.sender,destination,tokentoSwap,block.timestamp,_tokenSwapTo);
26,919
88
// Add DAI
addToken(0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063, 0x4746DeC9e833A82EC7C2C1356372CcF2cfcD2F3D);
addToken(0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063, 0x4746DeC9e833A82EC7C2C1356372CcF2cfcD2F3D);
27,529
93
// the referenced Uniswap pair contract
IUniswapV2Pair public override pair;
IUniswapV2Pair public override pair;
58,361
11
// Its a payable function works as a token factory.
receive() external payable { createTokens(); }
receive() external payable { createTokens(); }
7,135
2
// Execute the given orders at once with the specified fill specification/orders The order definitions and valid signatures to execute/fillContract The contract which will fill the order/fillData The fillData to pass to the fillContract callback
function executeBatch(SignedOrder[] calldata orders, IReactorCallback fillContract, bytes calldata fillData) external payable;
function executeBatch(SignedOrder[] calldata orders, IReactorCallback fillContract, bytes calldata fillData) external payable;
16,514
24
// ------------------------------------------------------------------------ An account can unlock their 2y locked tokens 2y after token launch date ------------------------------------------------------------------------
function unlock2Y() { require(now >= LOCKED_2Y_DATE); uint amount = balancesLocked2Y[msg.sender]; require(amount > 0); balancesLocked2Y[msg.sender] = 0; totalSupplyLocked2Y = totalSupplyLocked2Y.sub(amount); if (!tokenContract.transfer(msg.sender, amount)) throw; ...
function unlock2Y() { require(now >= LOCKED_2Y_DATE); uint amount = balancesLocked2Y[msg.sender]; require(amount > 0); balancesLocked2Y[msg.sender] = 0; totalSupplyLocked2Y = totalSupplyLocked2Y.sub(amount); if (!tokenContract.transfer(msg.sender, amount)) throw; ...
23,292