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

Consolidate #684

Merged
merged 40 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
2552490
consolidate and add stake command
akremstudy Jun 11, 2023
4c58353
Merge branch 'main' into consolidate
akremstudy Jun 11, 2023
c006101
tox
akremstudy Jun 11, 2023
193f864
update/merge tests
akremstudy Jun 13, 2023
e18243b
Merge branch 'main' into consolidate
akremstudy Jun 13, 2023
0ba3cd1
consolidate more
akremstudy Jun 13, 2023
21b927f
create GasFees object that sets gas fee params
akremstudy Jun 21, 2023
bc26e3f
tox style
akremstudy Jun 21, 2023
7018f4e
update diva_protocol/report.py
akremstudy Jun 21, 2023
b7c1322
Merge branch 'main' into consolidate
akremstudy Jun 21, 2023
6a485e2
Add tests
akremstudy Jun 22, 2023
0df75fc
tox style
akremstudy Jun 22, 2023
bf1604a
Fix test
akremstudy Jun 23, 2023
01b06b0
Add/Fix tests plus add comments
akremstudy Jun 24, 2023
cc3706c
tox style
akremstudy Jun 24, 2023
8839d22
Fix broken tests
akremstudy Jun 24, 2023
e832beb
Add test
akremstudy Jun 26, 2023
5114263
Merge branch 'main' into consolidate
akremstudy Jun 26, 2023
51aceef
Fix diva_protocol/report with new changes
akremstudy Jun 26, 2023
1770957
fix import
akremstudy Jun 26, 2023
080209c
Fix diva test
akremstudy Jun 26, 2023
4816db0
Merge branch 'main' into consolidate
akremstudy Jun 26, 2023
4a03507
Merge branch 'main' into consolidate
akremstudy Jun 29, 2023
d1ccd89
Make suggested changes and add tests
akremstudy Jul 18, 2023
2815b2c
from_key
akremstudy Jul 24, 2023
627385e
tox change
akremstudy Jul 24, 2023
d4182db
fix gas limit from user input
akremstudy Jul 26, 2023
62e0f97
Merge branch 'main' into consolidate
akremstudy Jul 26, 2023
1743b0b
Merge branch 'main' into consolidate
0xSpuddy Jul 27, 2023
4d383a9
merge sweth_source
akremstudy Jul 27, 2023
8325914
Merge branch 'add-sweth-source' into consolidate
akremstudy Jul 27, 2023
283c50c
tox
akremstudy Jul 27, 2023
83a4afc
Merge branch 'add-sweth-source' into consolidate
akremstudy Jul 27, 2023
d334f43
Add comment
akremstudy Jul 27, 2023
e6e22f6
tox
akremstudy Jul 27, 2023
a742074
Merge branch 'main' into consolidate
akremstudy Aug 1, 2023
04eda2d
Add flashbot api for sepolia
akremstudy Aug 1, 2023
699ef79
fix sweth test
akremstudy Aug 1, 2023
76b7769
fix test
akremstudy Aug 2, 2023
fb1ad6e
tox fix
akremstudy Aug 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 115 additions & 21 deletions contracts/SampleReporterContract/SampleFlexReporter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,85 @@ pragma solidity ^0.8.15;

interface IFlex {
function balanceOf(address account) external view returns (uint256);

function allowance(
address _user,
address _spender
) external view returns (uint256);

function approve(address _spender, uint256 _amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

function transfer(
address recipient,
uint256 amount
) external returns (bool);

function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);

function depositStake(uint256 _amount) external;

function requestStakingWithdraw(uint256 _amount) external;

function getCurrentTip(bytes32 _queryId) external view returns (uint256);
function submitValue(bytes32 _queryId, bytes calldata _value, uint256 _nonce, bytes memory _queryData) external;

function submitValue(
bytes32 _queryId,
bytes calldata _value,
uint256 _nonce,
bytes memory _queryData
) external;

function withdrawStake() external;

function stakeAmount() external view returns (uint256);
function getStakerInfo(address _staker) external view returns (uint256, uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256);

function getStakerInfo(
address _staker
)
external
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
);

function getNewValueCountbyQueryId(
bytes32 _queryId
) external view returns (uint256);
}

contract SampleFlexReporter {
IFlex public oracle;
IFlex public autopay;
IFlex public token;
address public owner;
uint256 public profitThreshold;//inTRB

constructor(address _oracle, address _autopay, address _token, uint256 _profitThreshold){
uint256 public profitThreshold; //inTRB

constructor(
address _oracle,
address _autopay,
address _token,
uint256 _profitThreshold
) {
oracle = IFlex(_oracle);
autopay = IFlex(_autopay);
token = IFlex(_token);
owner = msg.sender;
profitThreshold = _profitThreshold;
}

modifier onlyOwner {
modifier onlyOwner() {
require(msg.sender == owner, "Only owner can call this function.");
_;
}
Expand All @@ -40,43 +90,87 @@ contract SampleFlexReporter {
owner = _newOwner;
}

function depositStake(uint256 _amount) onlyOwner external{
function depositStake(uint256 _amount) external onlyOwner {
oracle.depositStake(_amount);
}

function requestStakingWithdraw(uint256 _amount) external onlyOwner {
oracle.requestStakingWithdraw(_amount);
}

function submitValue(bytes32 _queryId, bytes memory _value, uint256 _nonce, bytes memory _queryData) onlyOwner external{
function submitValue(
bytes32 _queryId,
bytes memory _value,
uint256 _nonce,
bytes memory _queryData
) external onlyOwner {
uint256 _reward;
_reward = autopay.getCurrentTip(_queryId);
require(_reward > profitThreshold, "profit threshold not met");
oracle.submitValue(_queryId,_value,_nonce,_queryData);
oracle.submitValue(_queryId, _value, _nonce, _queryData);
}

function submitValueBypass(
bytes32 _queryId,
bytes memory _value,
uint256 _nonce,
bytes memory _queryData
) external onlyOwner {
oracle.submitValue(_queryId, _value, _nonce, _queryData);
}

function submitValueBypass(bytes32 _queryId, bytes memory _value, uint256 _nonce, bytes memory _queryData) onlyOwner external{
oracle.submitValue(_queryId,_value,_nonce,_queryData);
function transfer(address _to, uint256 _amount) external onlyOwner {
token.transfer(_to, _amount);
}

function transfer(address _to, uint256 _amount) external onlyOwner{
token.transfer(_to,_amount);
function balanceOf(address account) external view returns (uint256) {
return token.balanceOf(address(this));
}

function approve(uint256 _amount) external onlyOwner{
token.approve(address(oracle), _amount);
function allowance(
address owner,
address spender
) external view returns (uint256) {
return token.allowance(address(this), address(oracle));
}

function withdrawStake() onlyOwner external{
function approve(address spender, uint256 amount) external onlyOwner {
token.approve(address(oracle), amount);
}

function withdrawStake() external onlyOwner {
oracle.withdrawStake();
}

function getStakeAmount() external view returns (uint256){
function getStakeAmount() external view returns (uint256) {
return oracle.stakeAmount();
}

function getStakerInfo(address _stakerAddress) external view returns (uint256, uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256){
return oracle.getStakerInfo(_stakerAddress);
function getStakerInfo(
address _stakerAddress
)
external
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
return oracle.getStakerInfo(address(this));
}

function getNewValueCountbyQueryId(
bytes32 _queryId
) external view returns (uint256) {
return oracle.getNewValueCountbyQueryId(_queryId);
}

receive() external payable {}
}
63 changes: 0 additions & 63 deletions contracts/SampleReporterContract/SampleXReporter.sol

This file was deleted.

13 changes: 0 additions & 13 deletions contracts/TellorX/TellorXMasterMock.sol

This file was deleted.

60 changes: 0 additions & 60 deletions contracts/TellorX/TellorXOracleMock.sol

This file was deleted.

Loading
Loading