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

👻 one click trading connector #25

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
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
55 changes: 55 additions & 0 deletions src/connectors/OneClickTrading.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import {ERC20} from "solmate/tokens/ERC20.sol";
import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";
import {BaseConnector} from "../utils/BaseConnector.sol";

interface IEmitter {
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

function emitSwap(address from, address to, uint256 amt, uint256 minReceived, uint256 received) external;
}

interface IExclusiveImpl {
function enableAdditionalAuth(address _user, uint256 _expiry) external;

function disableAdditionalAuth(address user) external;
}

interface IDefaultImpl {
function toggleBeta() external;

function isBeta() external returns(bool);
}

contract OneClickTrading is BaseConnector {
using SafeTransferLib for ERC20;
Copy link
Contributor

Choose a reason for hiding this comment

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

why


struct Data {
Copy link
Contributor

Choose a reason for hiding this comment

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

why

uint256 msgValue;
uint256 initialBal;
uint256 finalBal;
ERC20 toToken;
}

string public constant name = "One-Click-Trading-v1";

function enableAuth(address _user, uint256 _expiry) public payable {
Copy link
Contributor

Choose a reason for hiding this comment

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

add events like normal connector

IExclusiveImpl(address(this)).enableAdditionalAuth(_user, _expiry);
}

function disableAuth(address _user) public payable {
IExclusiveImpl(address(this)).disableAdditionalAuth(_user);
}

function toggleBeta() public payable {
IDefaultImpl(address(this)).toggleBeta();
}

function isBeta() public payable returns (bool){
Copy link
Contributor

Choose a reason for hiding this comment

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

why this

return IDefaultImpl(address(this)).isBeta();
}

event LogSwap(
address indexed from, address indexed to, uint256 amt, uint256 minReceived, bytes data, uint256 setId
);
}