Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
37ff447
temp save
clean-423 May 31, 2022
45883ea
term swap version, just need to reduce term swap size
clean-423 May 31, 2022
a374c87
optimizer reduce size
clean-423 May 31, 2022
3d0342d
temp check
clean-423 Jun 2, 2022
90cf562
check
clean-423 Jun 2, 2022
60191d1
contract resizing
clean-423 Jun 2, 2022
49af6cc
minor
clean-423 Jun 2, 2022
2ea72bc
minor
clean-423 Jun 2, 2022
af01983
minor
clean-423 Jun 2, 2022
2b64152
minor
clean-423 Jun 2, 2022
2b466d5
clean-423 Jun 11, 2022
1879abd
deploy contracts
clean-423 Jun 11, 2022
9ccf1fa
clean-423 Jun 11, 2022
fae56e1
set protocol feeTo
clean-423 Jun 13, 2022
32f04e6
test DAO orders
clean-423 Jun 15, 2022
f6ca111
twamm state and order proceeds
clean-423 Jun 15, 2022
55c7bd8
factory override
clean-423 Jun 15, 2022
622ff03
minor
clean-423 Jun 15, 2022
7711135
minor
clean-423 Jun 16, 2022
5452234
init
clean-423 Jul 25, 2022
6116a71
resize to work with deployment
clean-423 Jul 25, 2022
22c441f
checked successfully after deployment
clean-423 Jul 25, 2022
115fcf9
code cleaning
clean-423 Jul 25, 2022
1c5df23
save before merge
clean-423 Jul 25, 2022
6b477bb
Merge branch 'main_for_Apex' of github.com:PulsarSwap/TWAMM-Contracts…
clean-423 Jul 25, 2022
94b1965
updated the code and deployed successfully
clean-423 Jul 25, 2022
e7313b9
finish the sample code
clean-423 Jul 26, 2022
ef56374
finish the sample code
clean-423 Jul 26, 2022
727efa4
minor
clean-423 Jul 26, 2022
f356f00
confirmed
clean-423 Jul 26, 2022
0c34d23
minor
clean-423 Jul 26, 2022
e37dda3
Merge branch 'main_for_Apex' of https://github.com/PulsarSwap/TWAMM-C…
clean-423 Jul 26, 2022
5f5817e
minor
clean-423 Jul 26, 2022
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
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,3 @@ npx hardhat compile
# Test contracts with hardhat
npx hardhat test
```

## Contract Address

**Mainnet**

`Factory:`

`TWAMM:`

**Ropsten**

`Factory:`

`TWAMM:`
60 changes: 24 additions & 36 deletions contracts/Factory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

pragma solidity ^0.8.9;

// import "hardhat/console.sol";
import "./interfaces/IFactory.sol";
import "./Pair.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
Expand All @@ -11,25 +10,25 @@ contract Factory is IFactory, Initializable {
mapping(address => mapping(address => address)) public override getPair;
address[] public override allPairs;

uint32 public override feeArg;
address public override feeTo;
address public override feeToSetter;
address private twammTheOnlyCaller;

constructor(address _feeToSetter) {
feeToSetter = _feeToSetter;
}
address public override twammAdd;
address public override twammInstantSwapAdd;
address public override twammTermSwapAdd;
address public override twammLiquidityAdd;

function allPairsLength() external view override returns (uint256) {
return allPairs.length;
}

function initialize(address twammAdd) external override initializer {
twammTheOnlyCaller = twammAdd;
}

function returnTwammAddress() external view override returns (address) {
return twammTheOnlyCaller;
function initialize(
address _twammAdd,
address _twammInstantSwapAdd,
address _twammTermSwapAdd,
address _twammLiquidityAdd
) external override initializer {
twammAdd = _twammAdd;
twammInstantSwapAdd = _twammInstantSwapAdd;
twammTermSwapAdd = _twammTermSwapAdd;
twammLiquidityAdd = _twammLiquidityAdd;
}

function createPair(address token0, address token1)
Expand All @@ -38,13 +37,10 @@ contract Factory is IFactory, Initializable {
returns (address pair)
{
require(
msg.sender == twammTheOnlyCaller,
msg.sender == twammAdd,
"Invalid User, Only TWAMM Can Create Pair"
);
require(
twammTheOnlyCaller != address(0),
"Factory Not Initialized By TWAMM Yet"
);
require(twammAdd != address(0), "Factory Not Initialized By TWAMM Yet");

require(token0 != token1, "Factory: Identical Addresses");

Expand All @@ -58,7 +54,14 @@ contract Factory is IFactory, Initializable {
bytes memory bytecode = type(Pair).creationCode;
bytes memory bytecodeArg = abi.encodePacked(
bytecode,
abi.encode(tokenA, tokenB, twammTheOnlyCaller)
abi.encode(
tokenA,
tokenB,
twammAdd,
twammInstantSwapAdd,
twammTermSwapAdd,
twammLiquidityAdd
)
);
bytes32 salt = keccak256(abi.encodePacked(tokenA, tokenB));
assembly {
Expand All @@ -70,19 +73,4 @@ contract Factory is IFactory, Initializable {
allPairs.push(pair);
emit PairCreated(tokenA, tokenB, pair, allPairs.length);
}

function setFeeArg(uint32 _feeArg) external override {
require(msg.sender == feeToSetter, "Factory: Forbidden");
feeArg = _feeArg;
}

function setFeeTo(address _feeTo) external override {
require(msg.sender == feeToSetter, "Factory: Forbidden");
feeTo = _feeTo;
}

function setFeeToSetter(address _feeToSetter) external override {
require(msg.sender == feeToSetter, "Factory: Forbidden");
feeToSetter = _feeToSetter;
}
}
Loading