-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lockingtoken4reputation.sol : multi token support (#563)
* lockingtoken4reputation.sol : multi token support * use truffle "5.0.0-beta.1"
- Loading branch information
1 parent
dcaed7e
commit b6e6341
Showing
8 changed files
with
126 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
pragma solidity ^0.4.25; | ||
|
||
interface PriceOracleInterface { | ||
|
||
function getPrice(address token) external view returns (uint, uint); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
pragma solidity ^0.4.25; | ||
|
||
import "../schemes/PriceOracleInterface.sol"; | ||
|
||
|
||
contract PriceOracleMock is PriceOracleInterface { | ||
|
||
struct Price { | ||
uint numerator; | ||
uint denominator; | ||
} | ||
// user => amount | ||
mapping (address => Price) public tokenPrices; | ||
|
||
|
||
function getPrice(address token) public view returns (uint, uint) { | ||
Price memory price = tokenPrices[token]; | ||
return (price.numerator, price.denominator); | ||
} | ||
|
||
function setTokenPrice(address token,uint numerator,uint denominator) public { | ||
tokenPrices[token] = Price(numerator,denominator); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.