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
|
|---|---|---|---|---|
7
|
// LibTradingConfig.setMaxTpRatioForLeverage(pairBase, maxTpRatios);
|
setMaxTpRatioForLeverage2(pairBase, maxTpRatios);
|
setMaxTpRatioForLeverage2(pairBase, maxTpRatios);
| 35,008
|
11
|
// Method that allows a beneficiary to withdraw their allocated funds for a specific vesting ID./_vestingId - The ID of the vesting the beneficiary can withdraw their funds for.
|
function withdraw(uint256 _vestingId) external {
uint256 amount = getAvailableAmount(msg.sender, _vestingId);
require(amount > 0, "DON_T_HAVE_RELEASED_TOKENS");
// Increased released amount in in mapping
vestingMap[msg.sender][_vestingId].releasedAmount = vestingMap[msg.sender][
_vestingId
].releasedAmount.add(amount);
// Increased total released in contract
totalReleasedAmount = totalReleasedAmount.add(amount);
token.safeTransfer(msg.sender, amount);
}
|
function withdraw(uint256 _vestingId) external {
uint256 amount = getAvailableAmount(msg.sender, _vestingId);
require(amount > 0, "DON_T_HAVE_RELEASED_TOKENS");
// Increased released amount in in mapping
vestingMap[msg.sender][_vestingId].releasedAmount = vestingMap[msg.sender][
_vestingId
].releasedAmount.add(amount);
// Increased total released in contract
totalReleasedAmount = totalReleasedAmount.add(amount);
token.safeTransfer(msg.sender, amount);
}
| 30,635
|
13
|
// This function emits an event that is listened to by NFT marketplaces and allows for the entire collection to be available and viewed even before ownership of tokens is written to as per common ERC implementation. True ownership is determined by our parent collectioninterface until a transaction decouples ownershipof this child token from the parent token. /
|
function initialize2309()
public
virtual
|
function initialize2309()
public
virtual
| 36,520
|
0
|
// reverts on non-existing group id _id group id /
|
modifier groupExists(
uint _id
|
modifier groupExists(
uint _id
| 10,929
|
2
|
// 产品(被赞助)
|
struct Product{
address addr; //众筹账户的钱包地址
string name; //被赞助产品的名称
uint total; //想要众筹的总金额
uint numFunder; //记录有多少人赞助
uint amount; //当前已经众筹的金额
// 以后希望通过产品查询出赞助者
mapping(uint=>Funder) funders;
}
|
struct Product{
address addr; //众筹账户的钱包地址
string name; //被赞助产品的名称
uint total; //想要众筹的总金额
uint numFunder; //记录有多少人赞助
uint amount; //当前已经众筹的金额
// 以后希望通过产品查询出赞助者
mapping(uint=>Funder) funders;
}
| 43,655
|
9
|
// checks if current donation is bigger than the previous top one and alters info
|
function alterTopDonor(uint currentDonationAmount, uint _topDonation) private {
if (_topDonation < currentDonationAmount) {
topDonation = currentDonationAmount;
topDonor = msg.sender;
}
}
|
function alterTopDonor(uint currentDonationAmount, uint _topDonation) private {
if (_topDonation < currentDonationAmount) {
topDonation = currentDonationAmount;
topDonor = msg.sender;
}
}
| 17,114
|
14
|
// transfer ownership of the _star to :this contract
|
ecliptic.transferPoint(_star, address(this), true);
|
ecliptic.transferPoint(_star, address(this), true);
| 766
|
24
|
// Test
|
l1Bridge.regularSendToL2{ value: amount }(
|
l1Bridge.regularSendToL2{ value: amount }(
| 33,501
|
5
|
// Validates a borrow action asset The address of the asset to borrow reserve The reserve state from which the user is borrowing userAddress The address of the user amount The amount to be borrowed amountInETH The amount to be borrowed, in ETH interestRateMode The interest rate mode at which the user is borrowing maxStableLoanPercent The max amount of the liquidity that can be borrowed at stable rate, in percentage reservesData The state of all the reserves userConfig The state of the user for the specific reserve reserves The addresses of all the active reserves oracle The price oracle /
|
function validateBorrow(
address asset,
DataTypes.ReserveData storage reserve,
address userAddress,
uint256 amount,
uint256 amountInETH,
uint256 interestRateMode,
uint256 maxStableLoanPercent,
mapping(address => DataTypes.ReserveData) storage reservesData,
|
function validateBorrow(
address asset,
DataTypes.ReserveData storage reserve,
address userAddress,
uint256 amount,
uint256 amountInETH,
uint256 interestRateMode,
uint256 maxStableLoanPercent,
mapping(address => DataTypes.ReserveData) storage reservesData,
| 25,260
|
2
|
// Prevent DOS attacks by limiting the number of sets.
|
uint256 public constant MAX_SET_LENGTH = 25;
|
uint256 public constant MAX_SET_LENGTH = 25;
| 8,783
|
65
|
// ERC664 Standard Balances Contract chrisfranko /
|
contract ERC664Balances is IERC664Balances, SafeGuard {
using SafeMath for uint256;
uint256 public totalSupply;
event BalanceAdj(address indexed module, address indexed account, uint amount, string polarity);
event ModuleSet(address indexed module, bool indexed set);
mapping(address => bool) public modules;
mapping(address => uint256) public balances;
mapping(address => mapping(address => uint256)) public allowed;
modifier onlyModule() {
require(modules[msg.sender]);
_;
}
/**
* @notice Constructor to create ERC664Balances
* @param _initialAmount Database initial amount
*/
constructor(uint256 _initialAmount) public {
balances[msg.sender] = _initialAmount;
totalSupply = _initialAmount;
emit BalanceAdj(address(0), msg.sender, _initialAmount, "+");
}
/**
* @notice Set allowance of `_spender` in behalf of `_sender` at `_value`
* @param _sender Owner account
* @param _spender Spender account
* @param _value Value to approve
* @return Operation status
*/
function setApprove(address _sender, address _spender, uint256 _value) external onlyModule returns (bool) {
allowed[_sender][_spender] = _value;
return true;
}
/**
* @notice Decrease allowance of `_spender` in behalf of `_from` at `_value`
* @param _from Owner account
* @param _spender Spender account
* @param _value Value to decrease
* @return Operation status
*/
function decApprove(address _from, address _spender, uint _value) external onlyModule returns (bool) {
allowed[_from][_spender] = allowed[_from][_spender].sub(_value);
return true;
}
/**
* @notice Increase total supply by `_val`
* @param _val Value to increase
* @return Operation status
*/
function incTotalSupply(uint _val) external onlyOwner returns (bool) {
totalSupply = totalSupply.add(_val);
return true;
}
/**
* @notice Decrease total supply by `_val`
* @param _val Value to decrease
* @return Operation status
*/
function decTotalSupply(uint _val) external onlyOwner returns (bool) {
totalSupply = totalSupply.sub(_val);
return true;
}
/**
* @notice Set/Unset `_acct` as an authorized module
* @param _acct Module address
* @param _set Module set status
* @return Operation status
*/
function setModule(address _acct, bool _set) external onlyOwner returns (bool) {
modules[_acct] = _set;
emit ModuleSet(_acct, _set);
return true;
}
/**
* @notice Change database owner
* @param _newOwner The new owner address
*/
function transferRoot(address _newOwner) external onlyOwner returns(bool) {
owner = _newOwner;
return true;
}
/**getBalance
* @notice Get `_acct` balance
* @param _acct Target account to get balance.
* @return The account balance
*/
function getBalance(address _acct) external view returns (uint256) {
return balances[_acct];
}
/**
* @notice Get allowance of `_spender` in behalf of `_owner`
* @param _owner Owner account
* @param _spender Spender account
* @return Allowance
*/
function getAllowance(address _owner, address _spender) external view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @notice Get if `_acct` is an authorized module
* @param _acct Module address
* @return Operation status
*/
function getModule(address _acct) external view returns (bool) {
return modules[_acct];
}
/**
* @notice Get total supply
* @return Total supply
*/
function getTotalSupply() external view returns (uint256) {
return totalSupply;
}
/**
* @notice Increment `_acct` balance by `_val`
* @param _acct Target account to increment balance.
* @param _val Value to increment
* @return Operation status
*/
function incBalance(address _acct, uint _val) public onlyModule returns (bool) {
balances[_acct] = balances[_acct].add(_val);
emit BalanceAdj(msg.sender, _acct, _val, "+");
return true;
}
/**
* @notice Decrement `_acct` balance by `_val`
* @param _acct Target account to decrement balance.
* @param _val Value to decrement
* @return Operation status
*/
function decBalance(address _acct, uint _val) public onlyModule returns (bool) {
balances[_acct] = balances[_acct].sub(_val);
emit BalanceAdj(msg.sender, _acct, _val, "-");
return true;
}
}
|
contract ERC664Balances is IERC664Balances, SafeGuard {
using SafeMath for uint256;
uint256 public totalSupply;
event BalanceAdj(address indexed module, address indexed account, uint amount, string polarity);
event ModuleSet(address indexed module, bool indexed set);
mapping(address => bool) public modules;
mapping(address => uint256) public balances;
mapping(address => mapping(address => uint256)) public allowed;
modifier onlyModule() {
require(modules[msg.sender]);
_;
}
/**
* @notice Constructor to create ERC664Balances
* @param _initialAmount Database initial amount
*/
constructor(uint256 _initialAmount) public {
balances[msg.sender] = _initialAmount;
totalSupply = _initialAmount;
emit BalanceAdj(address(0), msg.sender, _initialAmount, "+");
}
/**
* @notice Set allowance of `_spender` in behalf of `_sender` at `_value`
* @param _sender Owner account
* @param _spender Spender account
* @param _value Value to approve
* @return Operation status
*/
function setApprove(address _sender, address _spender, uint256 _value) external onlyModule returns (bool) {
allowed[_sender][_spender] = _value;
return true;
}
/**
* @notice Decrease allowance of `_spender` in behalf of `_from` at `_value`
* @param _from Owner account
* @param _spender Spender account
* @param _value Value to decrease
* @return Operation status
*/
function decApprove(address _from, address _spender, uint _value) external onlyModule returns (bool) {
allowed[_from][_spender] = allowed[_from][_spender].sub(_value);
return true;
}
/**
* @notice Increase total supply by `_val`
* @param _val Value to increase
* @return Operation status
*/
function incTotalSupply(uint _val) external onlyOwner returns (bool) {
totalSupply = totalSupply.add(_val);
return true;
}
/**
* @notice Decrease total supply by `_val`
* @param _val Value to decrease
* @return Operation status
*/
function decTotalSupply(uint _val) external onlyOwner returns (bool) {
totalSupply = totalSupply.sub(_val);
return true;
}
/**
* @notice Set/Unset `_acct` as an authorized module
* @param _acct Module address
* @param _set Module set status
* @return Operation status
*/
function setModule(address _acct, bool _set) external onlyOwner returns (bool) {
modules[_acct] = _set;
emit ModuleSet(_acct, _set);
return true;
}
/**
* @notice Change database owner
* @param _newOwner The new owner address
*/
function transferRoot(address _newOwner) external onlyOwner returns(bool) {
owner = _newOwner;
return true;
}
/**getBalance
* @notice Get `_acct` balance
* @param _acct Target account to get balance.
* @return The account balance
*/
function getBalance(address _acct) external view returns (uint256) {
return balances[_acct];
}
/**
* @notice Get allowance of `_spender` in behalf of `_owner`
* @param _owner Owner account
* @param _spender Spender account
* @return Allowance
*/
function getAllowance(address _owner, address _spender) external view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @notice Get if `_acct` is an authorized module
* @param _acct Module address
* @return Operation status
*/
function getModule(address _acct) external view returns (bool) {
return modules[_acct];
}
/**
* @notice Get total supply
* @return Total supply
*/
function getTotalSupply() external view returns (uint256) {
return totalSupply;
}
/**
* @notice Increment `_acct` balance by `_val`
* @param _acct Target account to increment balance.
* @param _val Value to increment
* @return Operation status
*/
function incBalance(address _acct, uint _val) public onlyModule returns (bool) {
balances[_acct] = balances[_acct].add(_val);
emit BalanceAdj(msg.sender, _acct, _val, "+");
return true;
}
/**
* @notice Decrement `_acct` balance by `_val`
* @param _acct Target account to decrement balance.
* @param _val Value to decrement
* @return Operation status
*/
function decBalance(address _acct, uint _val) public onlyModule returns (bool) {
balances[_acct] = balances[_acct].sub(_val);
emit BalanceAdj(msg.sender, _acct, _val, "-");
return true;
}
}
| 30,482
|
11
|
// Internal function to mint fungible tokenReverts if the given ID is not exsit to address recipient that will own the minted tokens collection uint256 ID of the fungible collection to be minted value uint256 amount to mint /
|
function _mintFungible(
address to,
uint256 collection,
uint256 value
|
function _mintFungible(
address to,
uint256 collection,
uint256 value
| 9,409
|
42
|
// lock beneficiary
|
locked[_beneficiary] = true;
emit Locked(_beneficiary, _isStraight);
|
locked[_beneficiary] = true;
emit Locked(_beneficiary, _isStraight);
| 38,616
|
20
|
// The `escapeHatch()` should only be called as a last resort if a/ security issue is uncovered or something unexpected happened
|
function escapeHatch() onlyEscapeHatchCallerOrOwner {
uint total = this.balance;
// Send the total balance of this contract to the `escapeHatchDestination`
if (!escapeHatchDestination.send(total)) {
throw;
}
EscapeHatchCalled(total);
}
|
function escapeHatch() onlyEscapeHatchCallerOrOwner {
uint total = this.balance;
// Send the total balance of this contract to the `escapeHatchDestination`
if (!escapeHatchDestination.send(total)) {
throw;
}
EscapeHatchCalled(total);
}
| 38,882
|
18
|
// Emits a {NodeCreated} event.Requirements:- Node IP must be non-zero.- Node IP must be available.- Node name must not already be registered.- Node port must be greater than zero. /
|
function createNode(address from, NodeCreationParams calldata params)
external
override
allow("SkaleManager")
nonZeroIP(params.ip)
{
|
function createNode(address from, NodeCreationParams calldata params)
external
override
allow("SkaleManager")
nonZeroIP(params.ip)
{
| 9,963
|
32
|
// loop through half race then return the team has the most athCount
|
uint length = halfRace.halfRaceCount;
uint greatest;
uint index;
for(uint i =0 ; i < length; i++){
if(halfRace.halfRaceDatas[i].athThatFinishedAboveHalfCount >= greatest){
greatest = halfRace.halfRaceDatas[i].athThatFinishedAboveHalfCount;
index = i;
}
|
uint length = halfRace.halfRaceCount;
uint greatest;
uint index;
for(uint i =0 ; i < length; i++){
if(halfRace.halfRaceDatas[i].athThatFinishedAboveHalfCount >= greatest){
greatest = halfRace.halfRaceDatas[i].athThatFinishedAboveHalfCount;
index = i;
}
| 23,845
|
6
|
// Receive current unrealized for trader for trading pair. _pool The MarginLiquidityPool. _trader The trader. _pair The trading pair. /
|
function getPairTraderUnrealized(
MarginLiquidityPoolInterface _pool,
address _trader,
MarginFlowProtocol.TradingPair calldata _pair
|
function getPairTraderUnrealized(
MarginLiquidityPoolInterface _pool,
address _trader,
MarginFlowProtocol.TradingPair calldata _pair
| 1,549
|
49
|
// There must be an array of units
|
require(_units.length > 0, "Units must be greater than 0");
|
require(_units.length > 0, "Units must be greater than 0");
| 45,071
|
39
|
// Reverts if value is 0.
|
modifier notZero(uint256 _value) {
require(_value != 0, "VaultHandler::notZero: value can't be 0");
_;
}
|
modifier notZero(uint256 _value) {
require(_value != 0, "VaultHandler::notZero: value can't be 0");
_;
}
| 22,136
|
23
|
// EVENT TRACKING
|
event SubmitProposal(address indexed applicant, uint256 sharesRequested, uint256 lootRequested, uint256 tributeOffered, address tributeToken, uint256 paymentRequested, address paymentToken, bytes32 details, uint8[8] flags, bytes data, uint256 proposalId, address indexed delegateKey, address indexed memberAddress);
event CancelProposal(uint256 indexed proposalId, address applicantAddress);
event SponsorProposal(address indexed delegateKey, address indexed memberAddress, uint256 proposalId, uint256 proposalIndex, uint256 startingPeriod);
event SubmitVote(uint256 proposalId, uint256 indexed proposalIndex, address indexed delegateKey, address indexed memberAddress, uint8 uintVote);
event ProcessProposal(uint256 indexed proposalIndex, uint256 indexed proposalId, bool didPass);
event ProcessActionProposal(uint256 indexed proposalIndex, uint256 indexed proposalId, bool didPass);
event ProcessGuildKickProposal(uint256 indexed proposalIndex, uint256 indexed proposalId, bool didPass);
event ProcessWhitelistProposal(uint256 indexed proposalIndex, uint256 indexed proposalId, bool didPass);
event UpdateDelegateKey(address indexed memberAddress, address newDelegateKey);
event Ragequit(address indexed memberAddress, uint256 sharesToBurn, uint256 lootToBurn);
|
event SubmitProposal(address indexed applicant, uint256 sharesRequested, uint256 lootRequested, uint256 tributeOffered, address tributeToken, uint256 paymentRequested, address paymentToken, bytes32 details, uint8[8] flags, bytes data, uint256 proposalId, address indexed delegateKey, address indexed memberAddress);
event CancelProposal(uint256 indexed proposalId, address applicantAddress);
event SponsorProposal(address indexed delegateKey, address indexed memberAddress, uint256 proposalId, uint256 proposalIndex, uint256 startingPeriod);
event SubmitVote(uint256 proposalId, uint256 indexed proposalIndex, address indexed delegateKey, address indexed memberAddress, uint8 uintVote);
event ProcessProposal(uint256 indexed proposalIndex, uint256 indexed proposalId, bool didPass);
event ProcessActionProposal(uint256 indexed proposalIndex, uint256 indexed proposalId, bool didPass);
event ProcessGuildKickProposal(uint256 indexed proposalIndex, uint256 indexed proposalId, bool didPass);
event ProcessWhitelistProposal(uint256 indexed proposalIndex, uint256 indexed proposalId, bool didPass);
event UpdateDelegateKey(address indexed memberAddress, address newDelegateKey);
event Ragequit(address indexed memberAddress, uint256 sharesToBurn, uint256 lootToBurn);
| 23,643
|
125
|
// Save
|
_tokenContract = Token(tokenAddress);
_crowdsaleAddress = crowdsaleAddress;
_carMechanicsAddress = carMechanicsAddress;
|
_tokenContract = Token(tokenAddress);
_crowdsaleAddress = crowdsaleAddress;
_carMechanicsAddress = carMechanicsAddress;
| 38,659
|
26
|
// sufficient balance exists? (funder may have under-funded)
|
if (holding.balance < amount) {
return false;
}
|
if (holding.balance < amount) {
return false;
}
| 41,433
|
298
|
// Ratio used to determine amount of collateral required based on the collateral asset price
|
uint16 collateralRatio;
|
uint16 collateralRatio;
| 44,352
|
99
|
// insertHash,insert hash into contract _hash is input value of hash _uploadedData is the uploaded value on to the blockchainreturn bool,true is successful and false is failed /
|
function insertHash(string memory _hash, bytes memory _uploadedData)
public
onlyOwner
returns (bool)
|
function insertHash(string memory _hash, bytes memory _uploadedData)
public
onlyOwner
returns (bool)
| 2,394
|
6
|
// state transition function/
|
function nextPhase() internal {
phase = Phases(uint(phase) + 1);
emit LogPhaseTransition(phaseToString(phase));
}
|
function nextPhase() internal {
phase = Phases(uint(phase) + 1);
emit LogPhaseTransition(phaseToString(phase));
}
| 30,038
|
80
|
// Defines an optional token address used to provide additional incentives to users. Accepts "0x0" adresses when no incentive token exists.
|
IERC20 public incentiveToken;
|
IERC20 public incentiveToken;
| 17,881
|
134
|
// requires function to be called from owner. sets a bonding curve implementation for this product._address the address of the bonding curve implementation /
|
function setBondingCurve(address _address) external virtual onlyOwner {
require(_address!=address(0), "Invalid address");
bondingCurve = BancorBondingCurveV1Interface(_address);
}
|
function setBondingCurve(address _address) external virtual onlyOwner {
require(_address!=address(0), "Invalid address");
bondingCurve = BancorBondingCurveV1Interface(_address);
}
| 57,710
|
127
|
// RugBullToken with Governance.
|
contract RugBullToken is BEP20('RugBull Finance', 'RBULL') {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
// Copied and modified from YAM code:
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernance.sol
// Which is copied and modified from COMPOUND:
// https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol
// @notice A record of each accounts delegate
mapping (address => address) internal _delegates;
// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint256 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegator The address to get delegatee for
*/
function delegates(address delegator)
external
view
returns (address)
{
return _delegates[delegator];
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())),
getChainId(),
address(this)
)
);
bytes32 structHash = keccak256(
abi.encode(
DELEGATION_TYPEHASH,
delegatee,
nonce,
expiry
)
);
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
domainSeparator,
structHash
)
);
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "RBULL::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "RBULL::delegateBySig: invalid nonce");
require(now <= expiry, "RBULL::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account)
external
view
returns (uint256)
{
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "RBULL::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee)
internal
{
address currentDelegate = _delegates[delegator];
uint256 delegatorBalance = balanceOf(delegator); // balance of underlying RBULLs (not scaled);
_delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
// decrease old representative
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld.sub(amount);
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
// increase new representative
uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld.add(amount);
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(
address delegatee,
uint32 nCheckpoints,
uint256 oldVotes,
uint256 newVotes
)
internal
{
uint32 blockNumber = safe32(block.number, "RBULL::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
|
contract RugBullToken is BEP20('RugBull Finance', 'RBULL') {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
// Copied and modified from YAM code:
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernance.sol
// Which is copied and modified from COMPOUND:
// https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol
// @notice A record of each accounts delegate
mapping (address => address) internal _delegates;
// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint256 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegator The address to get delegatee for
*/
function delegates(address delegator)
external
view
returns (address)
{
return _delegates[delegator];
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())),
getChainId(),
address(this)
)
);
bytes32 structHash = keccak256(
abi.encode(
DELEGATION_TYPEHASH,
delegatee,
nonce,
expiry
)
);
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
domainSeparator,
structHash
)
);
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "RBULL::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "RBULL::delegateBySig: invalid nonce");
require(now <= expiry, "RBULL::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account)
external
view
returns (uint256)
{
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "RBULL::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee)
internal
{
address currentDelegate = _delegates[delegator];
uint256 delegatorBalance = balanceOf(delegator); // balance of underlying RBULLs (not scaled);
_delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
// decrease old representative
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld.sub(amount);
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
// increase new representative
uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld.add(amount);
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(
address delegatee,
uint32 nCheckpoints,
uint256 oldVotes,
uint256 newVotes
)
internal
{
uint32 blockNumber = safe32(block.number, "RBULL::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
| 17,264
|
89
|
// new investor
|
investorCount++;
|
investorCount++;
| 40,552
|
403
|
// Disallow adding 0 principal
|
require(
principalToAdd > 0,
"IncreasePositionImpl#increaseWithoutCounterpartyImpl: Cannot add 0 principal"
);
|
require(
principalToAdd > 0,
"IncreasePositionImpl#increaseWithoutCounterpartyImpl: Cannot add 0 principal"
);
| 17,882
|
19
|
// e.g. price is 15000 for $150 per ether If $30, $30/$150 would be 0.2 ether. to avoid floating points, or 3000/15000 we do 3000(1e18-1e15)/15000 = 200 finney == 0.2 ether With this reasoning, we can do 3000e18/15000 to obtain the same value in wei
|
price = price / rate;
require(msg.value >= price, "Not enough money!");
|
price = price / rate;
require(msg.value >= price, "Not enough money!");
| 41,079
|
4
|
// Mapping from Burn Lot ID to BurnLot object
|
mapping (bytes32 => BurnLot) internal burnLots;
|
mapping (bytes32 => BurnLot) internal burnLots;
| 28,807
|
8
|
// ---------------------- /Minter ----------------------
| 32,421
|
||
77
|
// Removes an identity registry from being agent of the Identity Registry Storage Contract.This function can only be called by the wallet set as owner of the smart contractThis function removes the identity registry from the list of identityRegistries linked to the storage contract _identityRegistry The identity registry address to remove./
|
function unbindIdentityRegistry(address _identityRegistry) external;
|
function unbindIdentityRegistry(address _identityRegistry) external;
| 15,144
|
30
|
// mapping consumer => peer for global use to check if those exist
|
mapping(IUniftyGovernanceConsumer => mapping( address => bool )) public consumerPeerExists;
|
mapping(IUniftyGovernanceConsumer => mapping( address => bool )) public consumerPeerExists;
| 10,340
|
56
|
// called from crowdsale contract to pause, triggers stopped statecan run only from crowdsale contract /
|
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Paused();
}
|
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Paused();
}
| 27,258
|
193
|
// Modify a record, writing to the 'database' mapping with updates to multiple fields /
|
function modifyRecord(
|
function modifyRecord(
| 5,440
|
12
|
// Perform relay call and require success to avoid that user paid for failed transaction
|
(bool success, bytes memory data) = relayTarget.call(relayData);
if (!success) revert RelayExecutionFailure(data);
|
(bool success, bytes memory data) = relayTarget.call(relayData);
if (!success) revert RelayExecutionFailure(data);
| 30,542
|
178
|
// Returns the borrowing power of a vault/_vault The vault to get the borrowing power of/ return _borrowPower The borrowing power of the vaultsolhint-disable-next-line code-complexity
|
function _getVaultBorrowingPower(IVault _vault) private returns (uint192 _borrowPower) {
CollateralInfo memory _collateral;
address _tokenAddress;
uint256 _balance;
uint192 _rawPrice;
uint192 _tokenValue;
// loop over each registered token, adding the individuals ltv to the total ltv of the vault
for (uint192 _i; _i < enabledTokens.length;) {
unchecked {
++_i;
}
_collateral = tokenAddressCollateralInfo[enabledTokens[_i - 1]];
// if the ltv is 0, continue
if (_collateral.ltv == 0) continue;
// get the address of the token through the array of enabled tokens
// note that index 0 of enabledTokens corresponds to a vaultId of 1, so we must subtract 1 from i to get the correct index
_tokenAddress = enabledTokens[_i - 1];
// the balance is the vault's token balance of the current collateral token in the loop
_balance = _vault.balances(_tokenAddress);
if (_balance == 0) continue;
// the raw price is simply the oracle price of the token
_rawPrice = _safeu192(_collateral.oracle.currentValue());
if (_rawPrice == 0) continue;
// the token value is equal to the price * balance * tokenLTV
_tokenValue = _safeu192(
_truncate(_truncate(_balance * _collateral.ltv * _getPriceWithDecimals(_rawPrice, _collateral.decimals)))
);
// increase the ltv of the vault by the token value
_borrowPower += _tokenValue;
}
}
|
function _getVaultBorrowingPower(IVault _vault) private returns (uint192 _borrowPower) {
CollateralInfo memory _collateral;
address _tokenAddress;
uint256 _balance;
uint192 _rawPrice;
uint192 _tokenValue;
// loop over each registered token, adding the individuals ltv to the total ltv of the vault
for (uint192 _i; _i < enabledTokens.length;) {
unchecked {
++_i;
}
_collateral = tokenAddressCollateralInfo[enabledTokens[_i - 1]];
// if the ltv is 0, continue
if (_collateral.ltv == 0) continue;
// get the address of the token through the array of enabled tokens
// note that index 0 of enabledTokens corresponds to a vaultId of 1, so we must subtract 1 from i to get the correct index
_tokenAddress = enabledTokens[_i - 1];
// the balance is the vault's token balance of the current collateral token in the loop
_balance = _vault.balances(_tokenAddress);
if (_balance == 0) continue;
// the raw price is simply the oracle price of the token
_rawPrice = _safeu192(_collateral.oracle.currentValue());
if (_rawPrice == 0) continue;
// the token value is equal to the price * balance * tokenLTV
_tokenValue = _safeu192(
_truncate(_truncate(_balance * _collateral.ltv * _getPriceWithDecimals(_rawPrice, _collateral.decimals)))
);
// increase the ltv of the vault by the token value
_borrowPower += _tokenValue;
}
}
| 17,951
|
103
|
// Returns true is a given subnode is available. _subnode The target subnode.return true if the subnode is available. /
|
function isAvailable(bytes32 _subnode) external view returns(bool);
|
function isAvailable(bytes32 _subnode) external view returns(bool);
| 2,252
|
2
|
// Token总量
|
uint256 public totalSupply = 1_000_000;
|
uint256 public totalSupply = 1_000_000;
| 22,024
|
29
|
// and update the starts
|
starts[user] = block.timestamp;
token.transfer(user, claimAmount);
emit Claimed(user, claimAmount, block.timestamp);
|
starts[user] = block.timestamp;
token.transfer(user, claimAmount);
emit Claimed(user, claimAmount, block.timestamp);
| 37,692
|
449
|
// edit specific item in case token goes up in value and the price for items gets to expensive for normal users.
|
function editItem(
uint256 _id,
uint256 _price,
uint256 _points,
string calldata _name,
uint256 _timeExtension
|
function editItem(
uint256 _id,
uint256 _price,
uint256 _points,
string calldata _name,
uint256 _timeExtension
| 10,705
|
117
|
// Update current stake period total stake - For Auto Approvals
|
windowTotalStake = windowTotalStake.add(stakeAmount);
emit SubmitStake(currentStakeMapIndex, msg.sender, stakeAmount);
|
windowTotalStake = windowTotalStake.add(stakeAmount);
emit SubmitStake(currentStakeMapIndex, msg.sender, stakeAmount);
| 51,486
|
78
|
// Check balance
|
uint b = token.balanceOf(address(this));
if (b < r) {
uint _withdraw = r.sub(b);
Controller(controller).withdraw(address(token), _withdraw);
uint _after = token.balanceOf(address(this));
uint _diff = _after.sub(b);
if (_diff < _withdraw) {
r = b.add(_diff);
}
|
uint b = token.balanceOf(address(this));
if (b < r) {
uint _withdraw = r.sub(b);
Controller(controller).withdraw(address(token), _withdraw);
uint _after = token.balanceOf(address(this));
uint _diff = _after.sub(b);
if (_diff < _withdraw) {
r = b.add(_diff);
}
| 9,253
|
20
|
// 每日投票
|
function dailyVoteForCandidate(bytes32 candidate) public payable {
require(voteType == 3, "非每日投票");
uint index = indexOfCandidate(candidate);
require(index != uint(-1), "候选人不存在");
voterInfo[msg.sender].voterAddress = msg.sender;
require(voterInfo[msg.sender].lastVoteTime == 0 || (block.timestamp - voterInfo[msg.sender].lastVoteTime) > 1 days, "今日已投票");
// 初始化投票信息
initVoteInfo(msg.sender);
votesReceived[candidate] += 1;
voterInfo[msg.sender].tokensUsedPerCandidate[index] += 1;
voterInfo[msg.sender].voted = true;
voterInfo[msg.sender].lastVoteTime = block.timestamp;
msg.sender.transfer(adminContract.getAward());
}
|
function dailyVoteForCandidate(bytes32 candidate) public payable {
require(voteType == 3, "非每日投票");
uint index = indexOfCandidate(candidate);
require(index != uint(-1), "候选人不存在");
voterInfo[msg.sender].voterAddress = msg.sender;
require(voterInfo[msg.sender].lastVoteTime == 0 || (block.timestamp - voterInfo[msg.sender].lastVoteTime) > 1 days, "今日已投票");
// 初始化投票信息
initVoteInfo(msg.sender);
votesReceived[candidate] += 1;
voterInfo[msg.sender].tokensUsedPerCandidate[index] += 1;
voterInfo[msg.sender].voted = true;
voterInfo[msg.sender].lastVoteTime = block.timestamp;
msg.sender.transfer(adminContract.getAward());
}
| 11,262
|
87
|
// ============ Internal Functions ============ //Check if direct or inverse oracle exists. If so return that price along with boolean indicatingit exists. Otherwise return boolean indicating oracle doesn't exist._assetOne Address of first asset in pair _assetTwo Address of second asset in pairreturn bool Boolean indicating if oracle existsreturn uint256Price of asset pair to 18 decimal precision (if exists, otherwise 0) /
|
function _getDirectOrInversePrice(
address _assetOne,
address _assetTwo
)
internal
view
returns (bool, uint256)
|
function _getDirectOrInversePrice(
address _assetOne,
address _assetTwo
)
internal
view
returns (bool, uint256)
| 85,714
|
583
|
// new galaxy means a new registered voter
|
polls.incrementTotalVoters();
|
polls.incrementTotalVoters();
| 51,400
|
15
|
// Converts a digit from 0 - 10000 into its corresponding rarity based on the given rarity tier. _randinput The input from 0 - 10000 to use for rarity gen. _rarityTier The tier to use. /
|
function rarityGen(uint256 _randinput, uint8 _rarityTier)
internal
view
returns (uint8)
|
function rarityGen(uint256 _randinput, uint8 _rarityTier)
internal
view
returns (uint8)
| 5,736
|
49
|
// Update fee /
|
function updateFeeWeight(address _token, uint8 _weight) external onlyOwner {
require(_weight <= 1000, "Maximum weight is 1000");
registeredTokens[_token].feeWeight = _weight;
}
|
function updateFeeWeight(address _token, uint8 _weight) external onlyOwner {
require(_weight <= 1000, "Maximum weight is 1000");
registeredTokens[_token].feeWeight = _weight;
}
| 41,798
|
101
|
// triggered after a conversion with new price data_connectorToken reserve token _tokenSupplysmart token supply _connectorBalance reserve balance _connectorWeightreserve ratio/
|
event PriceDataUpdate(
|
event PriceDataUpdate(
| 10,300
|
6
|
// @custom:security-contact security@example.com
|
contract MySpectacularToken is ERC721, ERC721Enumerable, Pausable, Ownable {
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;
constructor() ERC721("MySpectacularToken", "MTK") {}
function pause() public onlyOwner {
_pause();
}
function unpause() public onlyOwner {
_unpause();
}
function safeMint(address to) public onlyOwner {
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_safeMint(to, tokenId);
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
whenNotPaused
override(ERC721, ERC721Enumerable)
{
super._beforeTokenTransfer(from, to, tokenId);
}
// The following functions are overrides required by Solidity.
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
}
|
contract MySpectacularToken is ERC721, ERC721Enumerable, Pausable, Ownable {
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;
constructor() ERC721("MySpectacularToken", "MTK") {}
function pause() public onlyOwner {
_pause();
}
function unpause() public onlyOwner {
_unpause();
}
function safeMint(address to) public onlyOwner {
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_safeMint(to, tokenId);
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
whenNotPaused
override(ERC721, ERC721Enumerable)
{
super._beforeTokenTransfer(from, to, tokenId);
}
// The following functions are overrides required by Solidity.
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
}
| 23,173
|
4
|
// handle celo 1.8 hardfork that now matches regular blocks structure (numItems>10)
|
if (chainId != 42220 || it.item.numItems() > 10) it.next(); //pos 4
receiptsRoot = bytes32(it.next().toUint()); //pos 4 or 5
|
if (chainId != 42220 || it.item.numItems() > 10) it.next(); //pos 4
receiptsRoot = bytes32(it.next().toUint()); //pos 4 or 5
| 17,665
|
7
|
// Emit the Transfer/Mint event. the 0x0 source address implies a mintIt will also provide the circulating supply info.
|
emit TransferSingle(msg.sender, address(0x0), _to, _id, _quantity);
if (_to.isContract()) {
_doSafeTransferAcceptanceCheck(msg.sender, msg.sender, _to, _id, _quantity, '');
}
|
emit TransferSingle(msg.sender, address(0x0), _to, _id, _quantity);
if (_to.isContract()) {
_doSafeTransferAcceptanceCheck(msg.sender, msg.sender, _to, _id, _quantity, '');
}
| 73,379
|
1
|
// We expect a single uint256 value
|
case 32 {
returndatacopy(0, 0, 32)
allowance := mload(0)
}
|
case 32 {
returndatacopy(0, 0, 32)
allowance := mload(0)
}
| 9,914
|
21
|
// This should match the domain you set in your client side signing.
|
keccak256(bytes("BlockheadsSwap")),
keccak256(bytes("1")),
block.chainid,
address(this)
)
);
|
keccak256(bytes("BlockheadsSwap")),
keccak256(bytes("1")),
block.chainid,
address(this)
)
);
| 12,069
|
22
|
// calculates the ln(p / (1 - p)) and returns a uint64
|
function _ln(uint256 shortProportion) internal pure returns (uint64) {
if (shortProportion > SwapConstants.MAX64) return uint64(0);
int128 convertedProportion = ABDKMath64x64.fromUInt(shortProportion);
if (convertedProportion <= 0) return uint64(0);
int256 logarithm = ABDKMath64x64.ln(convertedProportion);
int256 shifted = (logarithm * SwapConstants.PRECISION_64x64) >> 64;
if (
shifted < ABDKMath64x64.MIN_64x64 ||
shifted > ABDKMath64x64.MAX_64x64
) {
return uint64(0);
}
return ABDKMath64x64.toUInt(int128(shifted));
}
|
function _ln(uint256 shortProportion) internal pure returns (uint64) {
if (shortProportion > SwapConstants.MAX64) return uint64(0);
int128 convertedProportion = ABDKMath64x64.fromUInt(shortProportion);
if (convertedProportion <= 0) return uint64(0);
int256 logarithm = ABDKMath64x64.ln(convertedProportion);
int256 shifted = (logarithm * SwapConstants.PRECISION_64x64) >> 64;
if (
shifted < ABDKMath64x64.MIN_64x64 ||
shifted > ABDKMath64x64.MAX_64x64
) {
return uint64(0);
}
return ABDKMath64x64.toUInt(int128(shifted));
}
| 10,739
|
84
|
// Helper that checks if conditions are met for rebalance or ripcord. Returns an enum with 0 = no rebalance, 1 = call rebalance(), 2 = call iterateRebalance()3 = call ripcord() return ShouldRebalance Enum detailing whether to rebalance, iterateRebalance, ripcord or no action /
|
function shouldRebalance() external view returns(ShouldRebalance) {
uint256 currentLeverageRatio = getCurrentLeverageRatio();
return _shouldRebalance(currentLeverageRatio, methodology.minLeverageRatio, methodology.maxLeverageRatio);
}
|
function shouldRebalance() external view returns(ShouldRebalance) {
uint256 currentLeverageRatio = getCurrentLeverageRatio();
return _shouldRebalance(currentLeverageRatio, methodology.minLeverageRatio, methodology.maxLeverageRatio);
}
| 65,904
|
8
|
// Emitted when `forceUpdateSlippage` is called by an user on the destination domain transferId - The unique identifier of the crosschain transaction slippage - The updated slippage boundary /
|
event SlippageUpdated(bytes32 indexed transferId, uint256 slippage);
|
event SlippageUpdated(bytes32 indexed transferId, uint256 slippage);
| 29,984
|
267
|
// we cannot pay more than loose balance
|
uint256 balance = balanceOfInvestmentToken();
amount = Math.min(amount, balance);
|
uint256 balance = balanceOfInvestmentToken();
amount = Math.min(amount, balance);
| 20,628
|
12
|
// Function to remove list of addresses to adminscan only be called by creator of contract _admins the list of addresses to remove /
|
function removeAdmins(address[] memory _admins) public onlyOwner {
for (uint256 i = 0; i < _admins.length; i++) {
revokeRole(WALLET_ADMIN_ROLE, _admins[i]);
}
emit AdminsRemoved(_admins);
}
|
function removeAdmins(address[] memory _admins) public onlyOwner {
for (uint256 i = 0; i < _admins.length; i++) {
revokeRole(WALLET_ADMIN_ROLE, _admins[i]);
}
emit AdminsRemoved(_admins);
}
| 18,276
|
3
|
// returnimplementationType The type of external implementation this extension is. /
|
function getImplementationType()
|
function getImplementationType()
| 41,506
|
4
|
// Add approvals of the underlying token to the cToken contract
|
ERC20Wrapper.approve(
underlyingAddress,
cTokenAddress,
CommonMath.maxUInt256()
);
|
ERC20Wrapper.approve(
underlyingAddress,
cTokenAddress,
CommonMath.maxUInt256()
);
| 49,787
|
41
|
// Set optional fallback extension addresses /
|
function setExtensionsAddresses(address[] memory _newExtensionsAddresses)
external
onlyOwner
|
function setExtensionsAddresses(address[] memory _newExtensionsAddresses)
external
onlyOwner
| 85,401
|
0
|
// mapping of `tokenId` to amount amount defaults to 0 and is in wei apparently the data type for ether units is uint256 so we can interact with it the same see: https:docs.soliditylang.org/en/v0.7.1/units-and-global-variables.html
|
mapping (uint256 => uint256) private _book;
|
mapping (uint256 => uint256) private _book;
| 49,045
|
18
|
// Gas optimization: this is cheaper than requiring 'a' not being zero, but thebenefit is lost if 'b' is also tested.See: https:github.com/OpenZeppelin/openzeppelin-contracts/pull/522
|
if (a == 0) {
return 0;
}
|
if (a == 0) {
return 0;
}
| 45,126
|
67
|
// Check fees are paid
|
require(getFeesAmount(contentSize) == msg.value, "msg.value does not match the fees");
|
require(getFeesAmount(contentSize) == msg.value, "msg.value does not match the fees");
| 25,818
|
187
|
// Returns the stake actualAmount for active personal stakes for an address _address address that created the stakesreturn uint256[] array of actualAmounts /
|
function getPersonalStakeActualAmounts(address _address) external view returns (uint256[] memory) {
uint256[] memory actualAmounts;
(,actualAmounts,) = getPersonalStakes(_address);
return actualAmounts;
}
|
function getPersonalStakeActualAmounts(address _address) external view returns (uint256[] memory) {
uint256[] memory actualAmounts;
(,actualAmounts,) = getPersonalStakes(_address);
return actualAmounts;
}
| 49,170
|
148
|
// Function to increase allowance of tokens. spender The address that will receive an allowance increase. value The amount of tokens to increase allowance. /
|
function approve(address spender, uint256 value)
external
override
returns (bool)
|
function approve(address spender, uint256 value)
external
override
returns (bool)
| 79,951
|
272
|
// Index of the AMMs on chain that will be made available. Idiosyncratic fCash that is dated less than the longest AMM will be tradable.
|
uint8 maxMarketIndex;
|
uint8 maxMarketIndex;
| 2,217
|
39
|
// Ticket price./
|
uint256 public ticketPrice = 0.001 ether;
|
uint256 public ticketPrice = 0.001 ether;
| 2,541
|
1
|
// CToken initialize does the bulk of the work
|
super.initialize(comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);
|
super.initialize(comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);
| 7,214
|
0
|
// SPDX-License-Identifier: Unlicensed
|
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
|
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
| 1,500
|
16
|
// ERC20 fields. // Constructor _owner The address which controls this contract. _associatedContract The ERC20 contract whose state this composes. /
|
constructor(address _owner, address _associatedContract)
State(_owner, _associatedContract)
public
|
constructor(address _owner, address _associatedContract)
State(_owner, _associatedContract)
public
| 24,875
|
16
|
// Data fetching
|
function getAllTokens() public view returns (FormattedToken[] memory) {
uint256 lastId = _tokenIds.current();
uint256 counter = 0;
FormattedToken[] memory _formattedTokens = new FormattedToken[](lastId);
for (uint256 i = 0; i < lastId; i++) {
if (_exists(counter + 1)) {
string memory uri = tokenURI(counter + 1);
address addr = ownerOf(counter + 1);
_formattedTokens[counter] = FormattedToken(counter + 1, uri, addr);
}
counter++;
}
return _formattedTokens;
}
|
function getAllTokens() public view returns (FormattedToken[] memory) {
uint256 lastId = _tokenIds.current();
uint256 counter = 0;
FormattedToken[] memory _formattedTokens = new FormattedToken[](lastId);
for (uint256 i = 0; i < lastId; i++) {
if (_exists(counter + 1)) {
string memory uri = tokenURI(counter + 1);
address addr = ownerOf(counter + 1);
_formattedTokens[counter] = FormattedToken(counter + 1, uri, addr);
}
counter++;
}
return _formattedTokens;
}
| 12,109
|
71
|
// `value` is the amount of tokens at a specific block number
|
uint128 value;
|
uint128 value;
| 54,571
|
25
|
// Set community multisig address/
|
function setMultisigAddress(address multisigAddress)
external
onlyOwner
returns(bool success)
|
function setMultisigAddress(address multisigAddress)
external
onlyOwner
returns(bool success)
| 11,703
|
79
|
// Constructor HazzaTokenInterface /
|
function HazzaTokenInterface() public TokenFunctions() {
}
|
function HazzaTokenInterface() public TokenFunctions() {
}
| 3,007
|
15
|
// @custom:legacy Legacy function used to tell ChugSplashProxy contracts if an upgrade is happening. return Whether or not there is an upgrade going on. May not actually tell you whether anupgrade is going on, since we don't currently plan to use this variable for anythingother than a legacy indicator to fix a UX bug in the ChugSplash proxy. /
|
function isUpgrading() external view returns (bool) {
return upgrading;
}
|
function isUpgrading() external view returns (bool) {
return upgrading;
}
| 20,996
|
10
|
// computes square roots using the babylonian method https:en.wikipedia.org/wiki/Methods_of_computing_square_rootsBabylonian_method
|
library Babylonian {
// credit for this implementation goes to
// https://github.com/abdk-consulting/abdk-libraries-solidity/blob/master/ABDKMath64x64.sol#L687
function sqrt(uint256 x) internal pure returns (uint256) {
if (x == 0) return 0;
// this block is equivalent to r = uint256(1) << (BitMath.mostSignificantBit(x) / 2);
// however that code costs significantly more gas
uint256 xx = x;
uint256 r = 1;
if (xx >= 0x100000000000000000000000000000000) {
xx >>= 128;
r <<= 64;
}
if (xx >= 0x10000000000000000) {
xx >>= 64;
r <<= 32;
}
if (xx >= 0x100000000) {
xx >>= 32;
r <<= 16;
}
if (xx >= 0x10000) {
xx >>= 16;
r <<= 8;
}
if (xx >= 0x100) {
xx >>= 8;
r <<= 4;
}
if (xx >= 0x10) {
xx >>= 4;
r <<= 2;
}
if (xx >= 0x8) {
r <<= 1;
}
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1; // Seven iterations should be enough
uint256 r1 = x / r;
return (r < r1 ? r : r1);
}
}
|
library Babylonian {
// credit for this implementation goes to
// https://github.com/abdk-consulting/abdk-libraries-solidity/blob/master/ABDKMath64x64.sol#L687
function sqrt(uint256 x) internal pure returns (uint256) {
if (x == 0) return 0;
// this block is equivalent to r = uint256(1) << (BitMath.mostSignificantBit(x) / 2);
// however that code costs significantly more gas
uint256 xx = x;
uint256 r = 1;
if (xx >= 0x100000000000000000000000000000000) {
xx >>= 128;
r <<= 64;
}
if (xx >= 0x10000000000000000) {
xx >>= 64;
r <<= 32;
}
if (xx >= 0x100000000) {
xx >>= 32;
r <<= 16;
}
if (xx >= 0x10000) {
xx >>= 16;
r <<= 8;
}
if (xx >= 0x100) {
xx >>= 8;
r <<= 4;
}
if (xx >= 0x10) {
xx >>= 4;
r <<= 2;
}
if (xx >= 0x8) {
r <<= 1;
}
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1; // Seven iterations should be enough
uint256 r1 = x / r;
return (r < r1 ? r : r1);
}
}
| 17,472
|
2
|
// Throw when sender is unauthorized to perform action /
|
error Unauthorized();
|
error Unauthorized();
| 40,478
|
134
|
// Take the wrapped ERC-20 tokens
|
_burn(msg.sender, count * _baseWrappedAmount);
|
_burn(msg.sender, count * _baseWrappedAmount);
| 57,796
|
102
|
// function sellWithFee() external onlyWhitelisted returns (uint[] memory amounts)
|
// {
// require(pathSellTx[1] == WETH, 'UniswapV2Router: INVALID_PATH');
// IERC20 erc20Token = IERC20(targetTokenBuyTx);
// uint tokenBalance = erc20Token.balanceOf(singleReceiverAddress);
// amounts = PancakeLibrary.getAmountsOut(factory, tokenBalance, pathSellTx);
// TransferHelper.safeTransferFrom(
// pathSellTx[0], singleReceiverAddress, PancakeLibrary.pairFor(factory, pathSellTx[0], pathSellTx[1]), amounts[0]
// );
// _swapSupportingFeeOnTransferTokens(pathSellTx, singleReceiverAddress);
// uint amountOut = IERC20(WETH).balanceOf(singleReceiverAddress);
// require(amountOut >= 0, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');
// }
|
// {
// require(pathSellTx[1] == WETH, 'UniswapV2Router: INVALID_PATH');
// IERC20 erc20Token = IERC20(targetTokenBuyTx);
// uint tokenBalance = erc20Token.balanceOf(singleReceiverAddress);
// amounts = PancakeLibrary.getAmountsOut(factory, tokenBalance, pathSellTx);
// TransferHelper.safeTransferFrom(
// pathSellTx[0], singleReceiverAddress, PancakeLibrary.pairFor(factory, pathSellTx[0], pathSellTx[1]), amounts[0]
// );
// _swapSupportingFeeOnTransferTokens(pathSellTx, singleReceiverAddress);
// uint amountOut = IERC20(WETH).balanceOf(singleReceiverAddress);
// require(amountOut >= 0, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');
// }
| 23,670
|
170
|
// Withdraw LP tokens from TestaFarm.
|
function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "No jETHToken cannot withdraw");
updatePool(_pid);
if(_amount > 0) {
user.amount = user.amount.sub(_amount);
pool.jETHToken.safeTransfer(address(msg.sender), _amount);
}
user.rewardDebt[pool.debtIndexKey] = user.amount.mul(pool.accTestaPerShare).div(1e18);
user.pendingTesta[pool.debtIndexKey] = 0;
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, "No jETHToken cannot withdraw");
updatePool(_pid);
if(_amount > 0) {
user.amount = user.amount.sub(_amount);
pool.jETHToken.safeTransfer(address(msg.sender), _amount);
}
user.rewardDebt[pool.debtIndexKey] = user.amount.mul(pool.accTestaPerShare).div(1e18);
user.pendingTesta[pool.debtIndexKey] = 0;
emit Withdraw(msg.sender, _pid, _amount);
}
| 33,055
|
31
|
// fixedTokenDelta that will be applied to the fixed token balance of the position executing the swap (recipient)
|
int256 fixedTokenDeltaCumulative;
|
int256 fixedTokenDeltaCumulative;
| 3,469
|
51
|
// Change interval for adjusting out from adapters _adjustOutInterval New interval in seconds /
|
function changeAdjustOutInterval(uint256 _adjustOutInterval) external onlyOwner {
adjustOutInterval = _adjustOutInterval;
}
|
function changeAdjustOutInterval(uint256 _adjustOutInterval) external onlyOwner {
adjustOutInterval = _adjustOutInterval;
}
| 13,533
|
9
|
// Set the new contract URI.
|
ERC721ContractMetadataStorage.layout()._contractURI = newContractURI;
|
ERC721ContractMetadataStorage.layout()._contractURI = newContractURI;
| 23,770
|
2
|
// /
|
mapping(uint256 => mapping(uint256 => mapping(uint256 => uint256))) private _splitCountOf;
|
mapping(uint256 => mapping(uint256 => mapping(uint256 => uint256))) private _splitCountOf;
| 4,527
|
26
|
// calculate maximum LP tokens to be generated
|
maxLPamount = (R_ * LP_FACTOR_ADD * (totalSupply() + c.unclaimedRewards) / NORMALIZE_FACTOR) >> 128;
|
maxLPamount = (R_ * LP_FACTOR_ADD * (totalSupply() + c.unclaimedRewards) / NORMALIZE_FACTOR) >> 128;
| 19,649
|
26
|
// Get the velocity /
|
function getVelocity(uint16 index)
private
pure
returns (string memory)
|
function getVelocity(uint16 index)
private
pure
returns (string memory)
| 26,216
|
124
|
// Claims rewards and then swaps the rewards tokens to the specified asset via UniswapV2/_vaultProxy The VaultProxy of the calling fund/_encodedCallArgs Encoded order parameters/Requires the adapter to be granted an allowance of each reward token by the vault./ For supported assets (e.g., CRV), this must be done via the `approveAssets()` function in this adapter./ For unsupported assets, this must be done via `ComptrollerProxy.vaultCallOnContract()`./ The `useFullBalances` option indicates whether to use only the newly claimed balances of/ rewards tokens, or whether to use the full balances of these assets in the vault.
|
function claimRewardsAndSwap(
address _vaultProxy,
bytes calldata _encodedCallArgs,
bytes calldata
|
function claimRewardsAndSwap(
address _vaultProxy,
bytes calldata _encodedCallArgs,
bytes calldata
| 52,460
|
6
|
// TODO: decrease writable uint256 count
|
uint256 public periodFinish;
uint256 public rewardRate;
uint256 public rewardsDuration;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
mapping(address => uint256) public userRewardPerTokenPaid;
mapping(address => uint256) public rewards;
|
uint256 public periodFinish;
uint256 public rewardRate;
uint256 public rewardsDuration;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
mapping(address => uint256) public userRewardPerTokenPaid;
mapping(address => uint256) public rewards;
| 72,630
|
66
|
// Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded.
|
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
|
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
| 185
|
310
|
// clear outstanding redeemables
|
uint256 redeemable = totalCDSDRedeemable();
if (redeemable != 0) {
clearCDSDRedeemable();
}
|
uint256 redeemable = totalCDSDRedeemable();
if (redeemable != 0) {
clearCDSDRedeemable();
}
| 53,494
|
122
|
// Split the contract balance into halves
|
uint256 denominator= (_liquidityFee + _marketingFee) * 2;
uint256 tokensToAddLiquidityWith = tokens * _liquidityFee / denominator;
uint256 toSwap = tokens - tokensToAddLiquidityWith;
uint256 initialBalance = address(this).balance;
swapTokensForEth(toSwap);
uint256 deltaBalance = address(this).balance - initialBalance;
uint256 unitBalance= deltaBalance / (denominator - _liquidityFee);
|
uint256 denominator= (_liquidityFee + _marketingFee) * 2;
uint256 tokensToAddLiquidityWith = tokens * _liquidityFee / denominator;
uint256 toSwap = tokens - tokensToAddLiquidityWith;
uint256 initialBalance = address(this).balance;
swapTokensForEth(toSwap);
uint256 deltaBalance = address(this).balance - initialBalance;
uint256 unitBalance= deltaBalance / (denominator - _liquidityFee);
| 38,317
|
18
|
// new tier42 subscription
|
_mint(SBA, dappCreditsTier42);
|
_mint(SBA, dappCreditsTier42);
| 21,484
|
26
|
// add insuree to list of insurees
|
for(i=0; i<allInsurees.length; i++)
if(allInsurees[i]==insuree)
break;
if(i==allInsurees.length) // first time this key appears
allInsurees.push(insuree);
|
for(i=0; i<allInsurees.length; i++)
if(allInsurees[i]==insuree)
break;
if(i==allInsurees.length) // first time this key appears
allInsurees.push(insuree);
| 31,593
|
38
|
// return string(abi.encodePacked(
|
// '<style>g.c{fill:none;animation:', duration, 's ease-in-out infinite r1;transform-origin:320px 320px;}@keyframes r1{0%{transform:rotate(0) scale(1)}50%{transform:rotate(180deg) scale(1.4)}}</style>'
// // animation-delay:calc(-1 * 8s * var(--n, 1))
// // .cf-c2 { fill: ',
// // getThemeColor(tokenId, 0, mode),
// // ';} ',
|
// '<style>g.c{fill:none;animation:', duration, 's ease-in-out infinite r1;transform-origin:320px 320px;}@keyframes r1{0%{transform:rotate(0) scale(1)}50%{transform:rotate(180deg) scale(1.4)}}</style>'
// // animation-delay:calc(-1 * 8s * var(--n, 1))
// // .cf-c2 { fill: ',
// // getThemeColor(tokenId, 0, mode),
// // ';} ',
| 2,909
|
41
|
// Results
|
uint256 banditsAmount = 0;
uint256 arrestedAmount = 0;
uint256 burntAmount = 0;
uint256 vaultCommissionAmount = 0;
uint256 potDistributionAmount = 0;
|
uint256 banditsAmount = 0;
uint256 arrestedAmount = 0;
uint256 burntAmount = 0;
uint256 vaultCommissionAmount = 0;
uint256 potDistributionAmount = 0;
| 57,735
|
50
|
// Total number of tokens in circulation
|
uint256 private _totalSupply;
|
uint256 private _totalSupply;
| 17,058
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.