Skip to content

Commit 9a59e79

Browse files
committed
1 parent c0537ec commit 9a59e79

File tree

218 files changed

+93021
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

218 files changed

+93021
-1
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.sol linguist-language=Solidity

.gitignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
node_modules
2+
3+
# Buidler files
4+
cache
5+
artifacts
6+
build
7+
8+
# Test codegen
9+
codegen
10+
11+
# Secrets
12+
secretsManager.js
13+
14+
# rescript
15+
.merlin
16+
.bsb.lock
17+
lib
18+
19+
coverage.json
20+
21+
coverage-all
22+
coverage-unit
23+
coverage-integration
24+
25+
abis
26+
ast
27+
28+
# No need to keep javascript files in contract tests
29+
test/**/*.js
30+
31+
test/library/contracts/*
32+
!test/library/contracts/.gitkeep
33+
test/library/smock/*
34+
!test/library/smock/.gitkeep
35+
36+
contracts/testing/generated/*
37+
38+
contract-docs
39+
40+
deployments/*
41+
!deployments/mumbai
42+
!deployments/polygon
43+
44+
deploymentSummary.json

.prettierrc.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
overrides:
2+
- files: "*.sol"
3+
options:
4+
printWidth: 100
5+
tabWidth: 2
6+
explicitTypes: "always"
7+
compiler: "0.8.3"

.solcover.js

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
let coverageReportOutputDirectory = "coverage-all"
2+
3+
let extraFilesToIgnore = []
4+
5+
let isUnitTests =
6+
!!process.env.DONT_RUN_INTEGRATION_TESTS && process.env.DONT_RUN_INTEGRATION_TESTS.toUpperCase() == "TRUE"
7+
let isIntegrationTests =
8+
!!process.env.DONT_RUN_UNIT_TESTS && process.env.DONT_RUN_UNIT_TESTS.toUpperCase() == "TRUE"
9+
if (isUnitTests) {
10+
coverageReportOutputDirectory = "coverage-unit"
11+
extraFilesToIgnore = [
12+
"FloatToken.sol",
13+
"SyntheticToken.sol",
14+
"TokenFactory.sol",
15+
"Treasury_v0.sol",
16+
]
17+
} else if (isIntegrationTests) {
18+
coverageReportOutputDirectory = "coverage-integration"
19+
} else if (!isUnitTests && !isIntegrationTests) { // if it is neither then it is both (wierd logic but it works)
20+
// Don't do anything in this case
21+
} else {
22+
throw Error("Invalid config, don't set both 'DONT_RUN_INTEGRATION_TESTS' and 'DONT_RUN_UNIT_TESTS' to true")
23+
}
24+
25+
module.exports = {
26+
skipFiles: [
27+
"FloatCapital_v0.sol",
28+
"Treasury_v0.sol",
29+
"AlphaTestFLT.sol",
30+
"StakingStrategy.sol",
31+
"StrategyToken.sol",
32+
"SyntheticTokenUpgradeable.sol",
33+
"TreasuryAlpha.sol",
34+
"YieldManagerAave.sol",
35+
36+
"deployment/UUPSProxy.sol",
37+
38+
"interfaces/IFloatToken.sol",
39+
"interfaces/ILongShort.sol",
40+
"interfaces/IOracleManager.sol",
41+
"interfaces/IStaker.sol",
42+
"interfaces/ISyntheticToken.sol",
43+
"interfaces/ITokenFactory.sol",
44+
"interfaces/IYieldManager.sol",
45+
"interfaces/aave/DataTypes.sol",
46+
"interfaces/aave/ILendingPool.sol",
47+
"interfaces/aave/ILendingPoolAddressesProvider.sol",
48+
49+
"mocks/BandOracleMock.sol",
50+
"mocks/Dai.sol",
51+
"mocks/MockERC20.sol",
52+
"mocks/OracleManagerMock.sol",
53+
"mocks/YieldManagerMock.sol",
54+
"mocks/AggregatorV3Mock.sol",
55+
"mocks/ERC20Mock.sol",
56+
"mocks/LendingPoolAaveMock.sol",
57+
"mocks/LendingPoolAddressesProviderMock.sol",
58+
"mocks/LendingPoolAddressesProvider.sol",
59+
60+
"oracles/OracleManagerChainlink.sol",
61+
"oracles/OracleManagerEthKillerChainlink.sol",
62+
"oracles/OracleManagerEthKillerChainlinkTestnet.sol",
63+
"oracles/OracleManagerEthVsBtc.sol",
64+
"oracles/OracleManagerFlippening_V0.sol",
65+
"oracles/OracleManagerChainlinkTestnet.sol",
66+
"oracles/OracleManagerFlipp3ning.sol",
67+
68+
"testing/StakerInternalStateSetters.sol",
69+
"testing/LongShortInternalStateSetters.sol",
70+
71+
"testing/generated/LongShortForInternalMocking.sol",
72+
"testing/generated/StakerForInternalMocking.sol",
73+
"testing/generated/LongShortMockable.sol",
74+
"testing/generated/StakerMockable.sol",
75+
].concat(extraFilesToIgnore),
76+
istanbulFolder: coverageReportOutputDirectory,
77+
configureYulOptimizer: true
78+
};
79+

.solhint.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "solhint:default"
3+
}

LICENSE.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
Business Source License 1.1
2+
3+
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
4+
"Business Source License" is a trademark of MariaDB Corporation Ab.
5+
6+
-----------------------------------------------------------------------------
7+
8+
Parameters
9+
10+
Licensor: Float Capital
11+
12+
Licensed Work: Float Capital
13+
The Licensed Work is (c) 2021 Float Capital
14+
15+
Additional Use Grant: Any uses listed and defined at
16+
https://docs.float.capital/docs
17+
18+
Change Date: The earlier of 2024-06-01 or a date specified at
19+
https://docs.float.capital/docs
20+
21+
Change License: GNU General Public License v2.0 or later
22+
23+
-----------------------------------------------------------------------------
24+
25+
Terms
26+
27+
The Licensor hereby grants you the right to copy, modify, create derivative
28+
works, redistribute, and make non-production use of the Licensed Work. The
29+
Licensor may make an Additional Use Grant, above, permitting limited
30+
production use.
31+
32+
Effective on the Change Date, or the fourth anniversary of the first publicly
33+
available distribution of a specific version of the Licensed Work under this
34+
License, whichever comes first, the Licensor hereby grants you rights under
35+
the terms of the Change License, and the rights granted in the paragraph
36+
above terminate.
37+
38+
If your use of the Licensed Work does not comply with the requirements
39+
currently in effect as described in this License, you must purchase a
40+
commercial license from the Licensor, its affiliated entities, or authorized
41+
resellers, or you must refrain from using the Licensed Work.
42+
43+
All copies of the original and modified Licensed Work, and derivative works
44+
of the Licensed Work, are subject to this License. This License applies
45+
separately for each version of the Licensed Work and the Change Date may vary
46+
for each version of the Licensed Work released by Licensor.
47+
48+
You must conspicuously display this License on each original or modified copy
49+
of the Licensed Work. If you receive the Licensed Work in original or
50+
modified form from a third party, the terms and conditions set forth in this
51+
License apply to your use of that work.
52+
53+
Any use of the Licensed Work in violation of this License will automatically
54+
terminate your rights under this License for the current and all other
55+
versions of the Licensed Work.
56+
57+
This License does not grant you any right in any trademark or logo of
58+
Licensor or its affiliates (provided that you may use a trademark or logo of
59+
Licensor as expressly required by this License).
60+
61+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
62+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
63+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
64+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
65+
TITLE.
66+
67+
MariaDB hereby grants you permission to use this License’s text to license
68+
your works, and to refer to it using the trademark "Business Source License",
69+
as long as you comply with the Covenants of Licensor below.
70+
71+
-----------------------------------------------------------------------------
72+
73+
Covenants of Licensor
74+
75+
In consideration of the right to use this License’s text and the "Business
76+
Source License" name and trademark, Licensor covenants to MariaDB, and to all
77+
other recipients of the licensed work to be provided by Licensor:
78+
79+
1. To specify as the Change License the GPL Version 2.0 or any later version,
80+
or a license that is compatible with GPL Version 2.0 or a later version,
81+
where "compatible" means that software provided under the Change License can
82+
be included in a program with software provided under GPL Version 2.0 or a
83+
later version. Licensor may specify additional Change Licenses without
84+
limitation.
85+
86+
2. To either: (a) specify an additional grant of rights to use that does not
87+
impose any additional restriction on the right granted in this License, as
88+
the Additional Use Grant; or (b) insert the text "None".
89+
90+
3. To specify a Change Date.
91+
92+
4. Not to modify this License in any other way.
93+
94+
-----------------------------------------------------------------------------
95+
96+
Notice
97+
98+
The Business Source License (this document, or the "License") is not an Open
99+
Source license. However, the Licensed Work will eventually be made available
100+
under an Open Source License, as stated in this License.

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,45 @@
1-
# contracts
1+
## General
2+
3+
## Testing
4+
5+
the current javascript test are going to be refactored into rescript a some point
6+
7+
## Commands
8+
9+
format the solidity code:
10+
11+
```bash
12+
yarn format-contracts
13+
```
14+
15+
lint the solidity code:
16+
17+
```bash
18+
yarn lint-contracts
19+
```
20+
21+
## Network forking
22+
23+
It is sometimes useful to fork the network to test deployments that rely on other contracts etc before running those deployments on production networks. Note, network forking has only been tested with alchemy RPC API endpoints, but others may work too.
24+
25+
To use this feature run `HARDHAT_FORK=<network name> yarn deploy`. So for example to run this on mumbai run `HARDHAT_FORK="mumbai" yarn deploy`.
26+
27+
You can test that this is working correctly by validating some data from the blockchain such as the blocknumber or a token balance.
28+
29+
eg you could use code like below.:
30+
31+
```javascript
32+
let pTokenBalance = await paymentToken.balanceOf(accounts[2].address);
33+
console.log(
34+
"The paymentToken balance is",
35+
accounts[2].address,
36+
pTokenBalance.toString()
37+
);
38+
39+
let blockNumber = await accounts[0].provider.getBlockNumber();
40+
console.log("The balance is", blockNumber.toString());
41+
```
42+
43+
## Troubleshooting
44+
45+
Please add your known troubles ;)

bsconfig.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "float-contracts",
3+
"namespace": false,
4+
"bs-dependencies": [],
5+
"ppx-flags": [
6+
"bs-let/ppx"
7+
],
8+
"sources": [
9+
{
10+
"dir": "test",
11+
"subdirs": true
12+
},
13+
{
14+
"dir": "deployTests",
15+
"subdirs": true
16+
}
17+
],
18+
"package-specs": {
19+
"module": "commonjs",
20+
"in-source": true
21+
},
22+
"warnings": {
23+
"error": "+101+8"
24+
},
25+
"bsc-flags": [
26+
"-open Belt"
27+
]
28+
}

0 commit comments

Comments
 (0)