Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds contract api compatible with sol 0.6 #98

Merged
merged 3 commits into from
Apr 8, 2020
Merged

Conversation

allemanfredi
Copy link
Contributor

As described in the title, This PR adds the contract api compatible with solidity 0.6.

@allemanfredi allemanfredi requested a review from bertani March 17, 2020 18:11
@riccardopersiani riccardopersiani self-requested a review March 18, 2020 10:09
Copy link

@riccardopersiani riccardopersiani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, @allemanfredi could you just have a fast look to my comments?

pragma solidity >= 0.5.0 < 0.7.0; // Incompatible compiler version - please select a compiler within the stated pragma range, or use a different version of the provableAPI!

// Dummy contract only used to emit to end-user they are using wrong solc
abstract contract solcChecker {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why you used abstract keyword here is to move to a more OO paradigm? Or was it forced? Just curious

/* INCOMPATIBLE SOLC: import the following instead: "github.com/oraclize/ethereum-api/oraclizeAPI_0.4.sol" */ function f(bytes calldata x) virtual external;
}

interface ProvableI {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The keyword interface seems much more correct here, did you add it because it wasn’t compiling anymore?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solc 0.6 adds new requirements around explicitly declare interfaces as such. This change is necessary and expected since this is an interface after all (the interface keyword didn't exist when the provableAPI was first written)

@bertani
Copy link
Contributor

bertani commented Mar 18, 2020

Please, @allemanfredi could you just have a fast look to my comments?

I just did, we need to change the version check only.
Other checks are needed on safeMemoryCleaner as the new optimizer doesn't like the use of msize(), I will look into it

if (price > 1 ether + tx.gasprice * 200000) {
return 0; // Unexpectedly high price
}
return provable.query.value(price)(0, _datasource, _arg);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.value(...) is deprecated as of 0.6.4. Might be nice to change this to {value: ...} instead. Same deprecated usage in 15 other places below.

@bertani bertani merged commit 9f34daa into master Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants