Skip to content

Commit 365cf1f

Browse files
committed
Refactored distribution pool. Added bCash contract.
1 parent e3cbaa9 commit 365cf1f

27 files changed

+710
-298
lines changed

.mocharc.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict';
2+
process.env.TS_NODE_FILES = true;
3+
module.exports = {
4+
'allow-uncaught': true,
5+
diff: true,
6+
extension: ['ts'],
7+
recursive: true,
8+
reporter: 'spec',
9+
require: ['ts-node/register', 'hardhat/register'],
10+
slow: 300,
11+
spec: 'test/**/*.test.ts',
12+
timeout: 120000,
13+
ui: 'bdd',
14+
watch: false,
15+
'watch-files': ['src/**/*.sol', 'test/**/*.ts'],
16+
};

.mocharc.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"*.ts"
88
],
99
"options": {
10-
"printWidth": 160,
10+
"printWidth": 200,
1111
"tabWidth": 4,
1212
"useTabs": false,
1313
"bracketSpacing": false,

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 bDollar
3+
Copyright (c) 2021 Midas Protocol
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
# bDollar
1+
# Midas Dollar
22

3-
[![Twitter Follow](https://img.shields.io/twitter/follow/bDollar_Fi?label=Follow)](https://twitter.com/bDollar_Fi)
3+
[![Twitter Follow](https://img.shields.io/twitter/follow/Midas_Dollar_Fi?label=Follow)](https://twitter.com/Midas_Dollar_Fi)
44

5-
bDollar is a lightweight implementation of the [Basis Protocol](basis.io) on Ethereum.
5+
Midas Dollar is a lightweight implementation of the [Basis Protocol](basis.io) on Ethereum.
66

77
## Contract Addresses
88
| Contract | Address |
99
| ------------- | ------------- |
10-
| bDollar (BDO) | [0x190b589cf9Fb8DDEabBFeae36a813FFb2A702454](https://bscscan.com/token/0x190b589cf9Fb8DDEabBFeae36a813FFb2A702454) |
11-
| bDollar Share (sBDO) | [0x0d9319565be7f53CeFE84Ad201Be3f40feAE2740](https://bscscan.com/token/0x0d9319565be7f53CeFE84Ad201Be3f40feAE2740) |
12-
| bDollar Bond (bBDO) | [0x9586b02B09bd68A7cD4aa9167a61B78F43092063](https://bscscan.com/token/0x9586b02B09bd68A7cD4aa9167a61B78F43092063) |
13-
| BdoRewardPool | [0x7A4cFC24841c799832fFF4E5038BBA14c0e73ced](https://bscscan.com/address/0x7A4cFC24841c799832fFF4E5038BBA14c0e73ced#code) |
14-
| ShareRewardPool | [0x948dB1713D4392EC04C86189070557C5A8566766](https://bscscan.com/address/0x948dB1713D4392EC04C86189070557C5A8566766#code) |
15-
| Treasury | [0x15A90e6157a870CD335AF03c6df776d0B1ebf94F](https://bscscan.com/address/0x15A90e6157a870CD335AF03c6df776d0B1ebf94F#code) |
16-
| Boardroom | [0x9D39cd20901c88030032073Fb014AaF79D84d2C5](https://bscscan.com/address/0x9D39cd20901c88030032073Fb014AaF79D84d2C5#code) |
17-
| CommunityFund | [0xeaDa3d1CCBBb1c6B4C40a16D34F64cb0df0225Fd](https://bscscan.com/address/0xeaDa3d1CCBBb1c6B4C40a16D34F64cb0df0225Fd#code) |
18-
| OracleSinglePair | [0xfAB911c54f7CF3ffFdE0482d2267a751D87B5B20](https://bscscan.com/address/0xfAB911c54f7CF3ffFdE0482d2267a751D87B5B20#code) |
19-
| Timelock 24h | [0x92a082Ad5A942140bCC791081F775900d0A514D9](https://bscscan.com/address/0x92a082Ad5A942140bCC791081F775900d0A514D9#code) |
10+
| Midas Dollar (MDO) | [0x35e869B7456462b81cdB5e6e42434bD27f3F788c](https://bscscan.com/token/0x35e869B7456462b81cdB5e6e42434bD27f3F788c) |
11+
| Midas Dollar Share (MDS) | [0x242E46490397ACCa94ED930F2C4EdF16250237fa](https://bscscan.com/token/0x242E46490397ACCa94ED930F2C4EdF16250237fa) |
12+
| Midas Dollar Bond (MDB) | [0xCaD2109CC2816D47a796cB7a0B57988EC7611541](https://bscscan.com/token/0xCaD2109CC2816D47a796cB7a0B57988EC7611541) |
13+
| MdoRewardPool | [0x3C4583375870573897154d8fAf71663e1e017Ef7](https://bscscan.com/address/0x3C4583375870573897154d8fAf71663e1e017Ef7#code) |
14+
| ShareRewardPool | [](https://bscscan.com/address/#code) |
15+
| Treasury | [](https://bscscan.com/address/#code) |
16+
| Boardroom | [](https://bscscan.com/address/#code) |
17+
| CommunityFund | [](https://bscscan.com/address/#code) |
18+
| OracleSinglePair | [](https://bscscan.com/address/#code) |
2019

2120
## Audit
2221
[Sushiswap - by PeckShield](https://github.com/peckshield/publications/blob/master/audit_reports/PeckShield-Audit-Report-SushiSwap-v1.0.pdf)
@@ -29,44 +28,44 @@ bDollar is a lightweight implementation of the [Basis Protocol](basis.io) on Eth
2928

3029
Basis is an algorithmic stablecoin protocol where the money supply is dynamically adjusted to meet changes in money demand.
3130

32-
- When demand is rising, the blockchain will create more bDollar. The expanded supply is designed to bring the Basis price back down.
33-
- When demand is falling, the blockchain will buy back bDollar. The contracted supply is designed to restore Basis price.
34-
- The Basis protocol is designed to expand and contract supply similarly to the way central banks buy and sell fiscal debt to stabilize purchasing power. For this reason, we refer to bDollar as having an algorithmic central bank.
31+
- When demand is rising, the blockchain will create more Midas Dollar. The expanded supply is designed to bring the Basis price back down.
32+
- When demand is falling, the blockchain will buy back Midas Dollar. The contracted supply is designed to restore Basis price.
33+
- The Basis protocol is designed to expand and contract supply similarly to the way central banks buy and sell fiscal debt to stabilize purchasing power. For this reason, we refer to Midas Dollar as having an algorithmic central bank.
3534

3635
Read the [Basis Whitepaper](http://basis.io/basis_whitepaper_en.pdf) for more details into the protocol.
3736

3837
Basis was shut down in 2018, due to regulatory concerns its Bond and Share tokens have security characteristics.
3938

40-
## The bDollar Protocol
39+
## The Midas Dollar Protocol
4140

42-
bDollar differs from the original Basis Project in several meaningful ways:
41+
Midas Dollar differs from the original Basis Project in several meaningful ways:
4342

4443
1. **Rationally simplified** - several core mechanisms of the Basis protocol has been simplified, especially around bond issuance and seigniorage distribution. We've thought deeply about the tradeoffs for these changes, and believe they allow significant gains in UX and contract simplicity, while preserving the intended behavior of the original monetary policy design.
45-
2. **Censorship resistant** - we launch this project anonymously, protected by the guise of characters from the popular SciFi series Rick and Morty. We believe this will allow the project to avoid the censorship of regulators that scuttled the original Basis Protocol, but will also allow bDollar to avoid founder glorification & single points of failure that have plagued so many other projects.
46-
3. **Fairly distributed** - both bDollar Shares and bDollar has zero premine and no investors - community members can earn the initial supply of both assets by helping to contribute to bootstrap liquidity & adoption of bDollar.
44+
2. **Censorship resistant** - we launch this project anonymously, protected by the guise of characters from the popular SciFi series Rick and Morty. We believe this will allow the project to avoid the censorship of regulators that scuttled the original Basis Protocol, but will also allow Midas Dollar to avoid founder glorification & single points of failure that have plagued so many other projects.
45+
3. **Fairly distributed** - both Midas Dollar Shares and Midas Dollar has zero premine and no investors - community members can earn the initial supply of both assets by helping to contribute to bootstrap liquidity & adoption of Midas Dollar.
4746

4847
### A Three-token System
4948

50-
There exists three types of assets in the bDollar system.
49+
There exists three types of assets in the Midas Dollar system.
5150

52-
- **bDollar ($BDO)**: a stablecoin, which the protocol aims to keep value-pegged to 1 US Dollar.
53-
- **bDollar Bonds ($bBDO)**: IOUs issued by the system to buy back bDollar when price($BDO) < $1. Bonds are sold at a meaningful discount to price($BDO), and redeemed at $1 when price($BDO) normalizes to $1.
54-
- **bDollar Shares ($sBDO)**: receives surplus seigniorage (seigniorage left remaining after all the bonds have been redeemed).
51+
- **Midas Dollar ($MDO)**: a stablecoin, which the protocol aims to keep value-pegged to 1 US Dollar.
52+
- **Midas Dollar Bonds ($MDB)**: IOUs issued by the system to buy back Midas Dollar when price($MDO) < $1. Bonds are sold at a meaningful discount to price($MDO), and redeemed at $1 when price($MDO) normalizes to $1.
53+
- **Midas Dollar Shares ($MDS)**: receives surplus seigniorage (seigniorage left remaining after all the bonds have been redeemed).
5554

5655
## Conclusion
5756

58-
bDollar is the latest product of the Bearn.Fi ecosystem as we are strong supporters of algorithmic stablecoins in particular and DeFi in general. However, bDollar is an experiment, and participants should take great caution and learn more about the seigniorage concept to avoid any potential loss.
57+
Midas Dollar is the latest product of the Midas Protocol ecosystem as we are strong supporters of algorithmic stablecoins in particular and DeFi in general. However, Midas Dollar is an experiment, and participants should take great caution and learn more about the seigniorage concept to avoid any potential loss.
5958

6059
#### Community channels:
6160

62-
- Telegram: https://t.me/Bearn_Fi
63-
- Discord: https://discord.gg/j2TRcSHRe3
64-
- Medium: https://medium.com/@bearn.defi
65-
- Twitter: https://twitter.com/BearnFi
66-
- GitHub: https://github.com/bearn-defi/bdollar-smartcontracts
61+
- Telegram: https://t.me/midasprotocolglobal
62+
- Discord: https://discord.gg/eTkKDyVq
63+
- Medium: https://medium.com/midasprotocol
64+
- Twitter: https://twitter.com/MidasDollar
65+
- GitHub: https://github.com/MidasCore/midasdollar-protocol
6766

6867
## Disclaimer
6968

7069
Use at your own risk. This product is perpetually in beta.
7170

72-
_© Copyright 2020, [bDollar.Fi](https://bdollar.fi)_
71+
_© Copyright 2021, [Midas Protocol](https://midasdollar.fi)_

abi/Dollar.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,19 @@
9292
"name": "Transfer",
9393
"type": "event"
9494
},
95+
{
96+
"inputs": [],
97+
"name": "AIRDROP_FUND",
98+
"outputs": [
99+
{
100+
"internalType": "uint256",
101+
"name": "",
102+
"type": "uint256"
103+
}
104+
],
105+
"stateMutability": "view",
106+
"type": "function"
107+
},
95108
{
96109
"inputs": [],
97110
"name": "INITIAL_DISTRIBUTION",

abi/BdoRewardPool.json renamed to abi/MdoRewardPool.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"inputs": [
44
{
55
"internalType": "address",
6-
"name": "_bdo",
6+
"name": "_mdo",
77
"type": "address"
88
},
99
{
@@ -111,7 +111,7 @@
111111
},
112112
{
113113
"inputs": [],
114-
"name": "BLOCKS_PER_WEEK",
114+
"name": "BLOCKS_PER_DAY",
115115
"outputs": [
116116
{
117117
"internalType": "uint256",
@@ -150,19 +150,6 @@
150150
"stateMutability": "nonpayable",
151151
"type": "function"
152152
},
153-
{
154-
"inputs": [],
155-
"name": "bdo",
156-
"outputs": [
157-
{
158-
"internalType": "contract IERC20",
159-
"name": "",
160-
"type": "address"
161-
}
162-
],
163-
"stateMutability": "view",
164-
"type": "function"
165-
},
166153
{
167154
"inputs": [
168155
{
@@ -202,7 +189,7 @@
202189
"type": "uint256"
203190
}
204191
],
205-
"name": "epochBdoPerBlock",
192+
"name": "epochEndBlocks",
206193
"outputs": [
207194
{
208195
"internalType": "uint256",
@@ -221,7 +208,7 @@
221208
"type": "uint256"
222209
}
223210
],
224-
"name": "epochEndBlocks",
211+
"name": "epochMdoPerBlock",
225212
"outputs": [
226213
{
227214
"internalType": "uint256",
@@ -305,6 +292,19 @@
305292
"stateMutability": "nonpayable",
306293
"type": "function"
307294
},
295+
{
296+
"inputs": [],
297+
"name": "mdo",
298+
"outputs": [
299+
{
300+
"internalType": "contract IERC20",
301+
"name": "",
302+
"type": "address"
303+
}
304+
],
305+
"stateMutability": "view",
306+
"type": "function"
307+
},
308308
{
309309
"inputs": [],
310310
"name": "operator",
@@ -331,7 +331,7 @@
331331
"type": "address"
332332
}
333333
],
334-
"name": "pendingBDO",
334+
"name": "pendingMDO",
335335
"outputs": [
336336
{
337337
"internalType": "uint256",
@@ -369,7 +369,7 @@
369369
},
370370
{
371371
"internalType": "uint256",
372-
"name": "accBdoPerShare",
372+
"name": "accMdoPerShare",
373373
"type": "uint256"
374374
},
375375
{
@@ -498,4 +498,4 @@
498498
"stateMutability": "nonpayable",
499499
"type": "function"
500500
}
501-
]
501+
]

abi/Treasury.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@
858858
"type": "uint256"
859859
}
860860
],
861-
"name": "setBDOIP01",
861+
"name": "setMDOIP01",
862862
"outputs": [],
863863
"stateMutability": "nonpayable",
864864
"type": "function"

contracts/Boardroom.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ contract Boardroom is ShareWrapper, ContractGuard {
7474
mapping(address => Boardseat) public directors;
7575
BoardSnapshot[] public boardHistory;
7676

77-
// protocol parameters - https://github.com/bearn-defi/bdollar-smartcontracts/tree/master/docs/ProtocolParameters.md
77+
// protocol parameters - https://github.com/MidasCore/midasdollar-protocol/tree/master/docs/ProtocolParameters.md
7878
uint256 public withdrawLockupEpochs;
7979
uint256 public rewardLockupEpochs;
8080

contracts/Bond.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ contract Bond is ERC20Burnable, Operator {
1010
/**
1111
* @notice Constructs the Basis Bond ERC-20 contract.
1212
*/
13-
constructor() public ERC20("bDollar Bond", "bBDO") {}
13+
constructor() public ERC20("Midas Dollar Bond", "MDB") {}
1414

1515
/**
1616
* @notice Operator mints basis bonds to a recipient

0 commit comments

Comments
 (0)