Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
3ccbe6a
removed lending integration and added require
ororopickpocket May 20, 2021
0665b23
updates wrapper proxy migration script
ororopickpocket May 27, 2021
8576095
Merge pull request #29 from DistributedCollective/liquidity-mining
ororopickpocket Aug 23, 2021
a0d2904
prepared addConverter script to also deploy oracle.
ororopickpocket Aug 27, 2021
4c7e6ac
prepared mainnet fish config
ororopickpocket Aug 27, 2021
b5ecddd
merged development
ororopickpocket Aug 27, 2021
4768f0a
upd/.gitignore *.code-workspace
tjcloa Aug 27, 2021
ceb95b0
fix/addConverter.js & upd addFish configs
tjcloa Aug 27, 2021
0dcf1fb
Merge branch 'fish-token' of https://github.com/DistributedCollective…
ororopickpocket Aug 27, 2021
ef19d51
changed add converter script to work with truffle build files
ororopickpocket Aug 27, 2021
04475a9
mend
ororopickpocket Aug 27, 2021
a79851b
upd/added multisig wallet to data files
tjcloa Aug 30, 2021
4418613
upd/replaced mainnet to mainnet2 URL for RPC calls
tjcloa Aug 30, 2021
a5637b2
fix/hh config formatting
tjcloa Aug 30, 2021
f48fedf
fix/multisig wallet, TODOs added to process Oracle
tjcloa Aug 30, 2021
afacba7
upd/fish token cionfigs updates by deployment
tjcloa Aug 30, 2021
6c92f18
enh/added TODO to transfer ownership to multisig
tjcloa Aug 30, 2021
fffb5d8
Support v1 pool converter reserve for ETH_RESERVE_ADDRESS
cwsnt Sep 23, 2021
d9e3cf6
Add protocol fees to the AMM
cwsnt Oct 9, 2021
b3ae82f
Enable protocol fee withdrawal from the AMM
cwsnt Oct 15, 2021
a54e591
Support wrbtc withdrawal
cwsnt Nov 2, 2021
8453163
Fixing based on audit review
cwsnt Nov 19, 2021
0e50546
Move the address settings (WRBTC, SOV, FeesController) into the swap …
cwsnt Nov 19, 2021
46f7603
Enhancement: based on review
cwsnt Nov 22, 2021
fedb46a
added a newline as separator
tjcloa Nov 25, 2021
efe5afc
add BZX testnet config
tjcloa Nov 25, 2021
392c3f3
removed legacy interim non-working addConverter
tjcloa Nov 25, 2021
52f48f8
add deployment script for non-wRBTC based converters
tjcloa Nov 25, 2021
7326baa
fixed token symbol
tjcloa Nov 25, 2021
7f47c8e
Add sovrynSwapNetwork deployment script
cwsnt Nov 25, 2021
1aa1fd1
fixed BRZ decimals
tjcloa Nov 25, 2021
a1e1824
Move settings from swapNetwork to swapSettings
cwsnt Nov 26, 2021
7eaa3ac
Remove unused storage variable
cwsnt Nov 26, 2021
11259a7
Add swap settings deployment script
cwsnt Nov 28, 2021
9fd0403
Add explicit getter for protcol fees held in converter
cwsnt Nov 29, 2021
43c713a
added funding amounts for the testnet
tjcloa Nov 29, 2021
42c2da8
added XUSD/BRZ converter & manual updated
tjcloa Nov 30, 2021
32b9efc
Change protocol fee to use the same resolution as conversion fee
cwsnt Dec 1, 2021
fb532f7
Fix contract size issue by removing struct memory settings
cwsnt Dec 1, 2021
b436abf
Move used scope variable
cwsnt Dec 1, 2021
83fbc59
Sync resrve balance needs to consider the protocol fees held
cwsnt Dec 1, 2021
e12ee68
Add withdraw fees test cases using real converter
cwsnt Dec 2, 2021
59e3c53
Fix the reserve balance check requirement
cwsnt Dec 6, 2021
f85fb5d
mynt configs
tjcloa Dec 14, 2021
12bb9de
post testnet deployment updates
tjcloa Dec 14, 2021
1e81c48
Merge remote-tracking branch 'origin/additional_amm_fees' into mynt-t…
tjcloa Dec 14, 2021
c902c0a
mynt post testnet redeployment update
tjcloa Dec 14, 2021
0d4a10c
add to doc reg pool token in liquidity mining
tjcloa Dec 14, 2021
414a245
Oracle:Add setter for liquidity pool
cwsnt Dec 15, 2021
d3a6ad7
package legacy node version issue fix for CI
tjcloa Dec 15, 2021
7aa04d4
Consider protocol fee calculation from conversion fee only
cwsnt Dec 16, 2021
160a149
Fix based on per review
cwsnt Dec 17, 2021
43c3f61
Merge remote-tracking branch 'origin/additional_amm_fees' into mynt-t…
tjcloa Dec 21, 2021
a633fe1
protect empty pool from init funds frontrunning
tjcloa Dec 21, 2021
59ad759
onlyOwner applied to initial pool funding
tjcloa Dec 23, 2021
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ solidity/build/Test*
/rbtcwrapperproxy/private-key
/rbtcwrapperproxy/build

workspace.code-workspace
*.code-workspace
.env
yarn.lock

Expand Down
29 changes: 16 additions & 13 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{
"overrides": [
{
"files": ["*.sol", "*.js"],
"options": {
"printWidth": 150,
"tabWidth": 4,
"useTabs": true,
"singleQuote": false,
"bracketSpacing": true,
"explicitTypes": "always"
}
"overrides": [
{
"files": [
"*.sol",
"*.js"
],
"options": {
"printWidth": 150,
"tabWidth": 4,
"useTabs": true,
"singleQuote": false,
"bracketSpacing": true,
"explicitTypes": "always"
}
]
}
}
]
}
40 changes: 32 additions & 8 deletions ADD-POOLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,48 @@ The configuration file is updated during the process, in order to allow resuming

### Adding LM pools to the testnet and mainnet (only needed if contracts' abi were changed)

1. Before adding pools we need to make sure having updated comipled contracts in [./solidity/build](./solidity/build)
- Change contract folder in script Compile contracts `../../scripts/compile.sh`
- Run from root dir `./scripts/compile.sh`
2. Top up RBTC and WRBTC account with some RBTC to pay for tx and **WRBTC** amount for initial deposit (0.01 usually)
1. Use ```yarn install``` or ```npm install``` from the root to install node modules
2. Before adding pools we need to make sure having updated compiled contracts in [./solidity/build/contracts](./solidity/build/contracts)
- Run from root dir ```truffle compile```
3. Top up deploying account with RBTC to pay tx fees and pair tokens for initial deposit if it is not zero - at least `balance` amounts in config file, e.g. 18 XUSD and 100 BRZ:
```
"reserves": [
{
"symbol": "XUSD",
"weight": "50%",
"balance": "18"
},
{
"symbol": "BRZ",
"weight": "50%",
"balance": "100"
}
]
```
* For WRBTC-paired tokens **WRBTC** amount for initial deposit is usually 0.01

To add converters to an existing swap network, use ```addConverter.js```.
----
4. To add converters to an existing swap network, use ```addConverter.js``` or ```addConverterNoOracle.js```
5. Register (whitelist) v1 converter in the feeSharingProxy: run [addWhitelistedConverterAddress](https://github.com/DistributedCollective/Sovryn-smart-contracts/blob/3e7f280e6e129946f070d4284884470ccf29861c/scripts/contractInteraction/protocol.py#L595) in [Sovryn-smart-contracts repo](https://github.com/DistributedCollective/Sovryn-smart-contracts)
6. Add AMM pool token to liquidity mining in [Sovryn-smart-contracts repo](https://github.com/DistributedCollective/Sovryn-smart-contracts), [script](https://github.com/DistributedCollective/Sovryn-smart-contracts/blob/1ace05926612516913e17a38c4f55816fdb20749/scripts/contractInteraction/liquidity_mining.py#L94)

Example creation v1 pool WRBTC/ETH
### Example creation v1 pool WRBTC/ETH

Note: `data_testnet.json` and `data_mainnet.json` store contracts addresses participating in converter creation.

testnet:

```node addConverter.js ETH addETHs_testnet.json data_testnet.json https://public-node.testnet.rsk.co <private key>```
```node addConverter.js ETH addETHs_testnet.json data_testnet.json https://public-node.testnet.rsk.co <private key>```

for pairs with no WRBTC (with no internal oracle):

```node addConverterNoOracle.js ETH addBRZ_testnet.json data_testnet.json https://public-node.testnet.rsk.co <private key>```

mainnet:

```node addConverter.js ETH addETHs_mainnet.json data_mainnet.json https://mainnet.sovryn.app/rpc <private key>```
```node addConverter.js ETH addETHs_mainnet.json data_mainnet.json https://mainnet2.sovryn.app/rpc <private key>```
or respectively
```node addConverterNoOracle.js ETH addBRZ_testnet.json data_testnet.json https://public-node.testnet.rsk.co <private key>```

```TODO: check if the following is for v2 pools only```

Expand Down
128 changes: 64 additions & 64 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ require("@nomiclabs/hardhat-web3");
require("hardhat-contract-sizer"); //yarn run hardhat size-contracts
require("solidity-coverage"); // $ npx hardhat coverage
require("hardhat-log-remover");
require('hardhat-docgen');
require("hardhat-docgen");

// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
/// this is for use with ethers.js
task("accounts", "Prints the list of accounts", async () => {
const accounts = await ethers.getSigners();
const accounts = await ethers.getSigners();

for (const account of accounts.address) {
const wallet = ethers.Wallet.fromMnemonic("test test test test test test test test test test test junk", "m/44'/60'/0'/0");
for (const account of accounts.address) {
const wallet = ethers.Wallet.fromMnemonic("test test test test test test test test test test test junk", "m/44'/60'/0'/0");

console.log(account);
}
console.log(account);
}
});

/*task("accounts", "Prints accounts", async (_, { web3 }) => {
Expand All @@ -36,61 +36,61 @@ task("accounts", "Prints the list of accounts", async () => {
/**/

module.exports = {
solidity: {
version: "0.4.26",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
contractSizer: {
alphaSort: false,
runOnCompile: false,
disambiguatePaths: false,
},
networks: {
hardhat: {},
rskPublicTestnet: {
url: "https://public-node.testnet.rsk.co/",
accounts: { mnemonic: "brownie", count: 10 },
network_id: 31,
confirmations: 4,
gasMultiplier: 1.25,
//timeout: 20000, // increase if needed; 20000 is the default value
//allowUnlimitedContractSize, //EIP170 contrtact size restriction temporal testnet workaround
},
rskPublicMainnet: {
url: "https://public-node.rsk.co/",
network_id: 30,
//timeout: 20000, // increase if needed; 20000 is the default value
},
rskSovrynTestnet: {
url: "https://testnet.sovryn.app/rpc",
accounts: { mnemonic: "brownie", count: 10 },
network_id: 31,
confirmations: 4,
gasMultiplier: 1.25,
//timeout: 20000, // increase if needed; 20000 is the default value
//allowUnlimitedContractSize, //EIP170 contrtact size restriction temporal testnet workaround
},
rskSovrynMainnet: {
url: "https://mainnet.sovryn.app/rpc",
network_id: 30,
//timeout: 20000, // increase if needed; 20000 is the default value
},
},
paths: {
sources: "./solidity/contracts",
tests: "./solidity/test/",
},
mocha: {
timeout: 800000,
grep: "^(?!.*; using Ganache).*",
},
docgen: {
path: './docs',
clear: true
}
};
solidity: {
version: "0.4.26",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
contractSizer: {
alphaSort: false,
runOnCompile: false,
disambiguatePaths: false,
},
networks: {
hardhat: {},
rskPublicTestnet: {
url: "https://public-node.testnet.rsk.co/",
accounts: { mnemonic: "brownie", count: 10 },
network_id: 31,
confirmations: 4,
gasMultiplier: 1.25,
//timeout: 20000, // increase if needed; 20000 is the default value
//allowUnlimitedContractSize, //EIP170 contrtact size restriction temporal testnet workaround
},
rskPublicMainnet: {
url: "https://public-node.rsk.co/",
network_id: 30,
//timeout: 20000, // increase if needed; 20000 is the default value
},
rskSovrynTestnet: {
url: "https://testnet.sovryn.app/rpc",
accounts: { mnemonic: "brownie", count: 10 },
network_id: 31,
confirmations: 4,
gasMultiplier: 1.25,
//timeout: 20000, // increase if needed; 20000 is the default value
//allowUnlimitedContractSize, //EIP170 contrtact size restriction temporal testnet workaround
},
rskSovrynMainnet: {
url: "https://mainnet2.sovryn.app/rpc",
network_id: 30,
//timeout: 20000, // increase if needed; 20000 is the default value
},
},
paths: {
sources: "./solidity/contracts",
tests: "./solidity/test/",
},
mocha: {
timeout: 800000,
grep: "^(?!.*; using Ganache).*",
},
docgen: {
path: "./docs",
clear: true,
},
};
Loading