Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Solidity is a contract-oriented, high-level language whose syntax is similar to that of JavaScript and it is designed for writing smart contracts in Ethereum to run on the EVM. Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.
0
votes
2
answers
321
views
Operator == not compatible with types contract IERC20 and address
My goal is to compare my IERC20 contract with my address repaymentCurrency in a require statement:
require(currency == listing.loanDetails.repaymentCurrency, "Error");
However, I keep getting the foll …
0
votes
1
answer
271
views
TypeError: Operator == not compatible with types contract IERC20 and address [duplicate]
My goal is to compare my IERC20 contract with my address repaymentCurrency in a require statement:
require(currency == listing.loanDetails.repaymentCurrency, "Error");
However, I keep getting the foll …
0
votes
1
answer
1k
views
TypeError: Contract "Contract" should be marked as abstract error
Here is my code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; …
1
vote
1
answer
195
views
Keccak256 doesn't return data from mapping
Here is a mapping to loans:
mapping (uint256 => Loan) public loans;
I then use: uint256(keccak256(abi.encode(address(msg.sender), tokenId))); to create a unique loanId from a struct.
function onERC …
1
vote
0
answers
106
views
Parse multiple values from a bytes array
Here is my bytes array: [28,2,1994]
Now, I want to create a function that parses each value and assigns it to its own uint256 variable.
Here is an example:
uint256 day = 28;
uint256 month = 2;
uint256 …
0
votes
1
answer
88
views
Convert $1 DAI value to $1 USD fiat value
The DAI stable coin has 18 decimal places.
How would one compute the math to calculate how many DAI would equal $1 USD (fiat)
In other words, does 500 * 100 ** 18 == $500 USD ?
0
votes
1
answer
68
views
Calculating a percent value reverts to 0
My goal is to calculate a 2% interest rate against a loan denominated in DAI.
uint256 loanAmount = 500 * 10 ** 18 // $500 in USD
function calculateInterest( uint256 _loanAmount) public view returns ( …
0
votes
1
answer
152
views
Large array as constructor arguments fails
My goal is to pass two fairly large arrays to my constructor:
constructor(AggregatorV3Interface _chainlinkFeedAddress, IERC20 _currency, address[] memory _whitelistedAddresses, uint256[] memory _maxPr …
1
vote
1
answer
413
views
Send data along with safeTransferFrom method to onERC721Received function
My goal is to send a loanDuration (e.g, 1 days, 2 days) value to my onERC721Received function when calling the ERC721 safeTransferFrom method.
function onERC721Received(
address,
addr …
1
vote
1
answer
1k
views
Encode strings into bytes and then decode back into strings
My goal is to encode two strings into bytes with this function:
function encode(string memory _address1, string memory _address2) public returns (bytes memory) {
encoded = abi.encodePacked(_a …
3
votes
1
answer
2k
views
Is there a size limit to the amount of data you can return from a view function
Will this array "break" when someone calls the public getter function if there are too many entries?
Here is my code:
ListingLookup[] private allListings;
struct ListingLookup {
address …
1
vote
0
answers
25
views
Send and retrieve two dynamic length values to safeTransferFrom data argument
I'm sending two dynamic length values to the data argument in the safeTransferFrom function via OpenZeppelin ERC721.
See here:
Now, I want to create a function that decodes the two values and assigns …
0
votes
1
answer
1k
views
Retrieve ABI file using a ERC721's contract address
Is there a way to to retrieve a ERC721 contract's ABI programmatically using its contractAddress?
Not sure how to do this