Skip to content

Commit 2acd32d

Browse files
authored
Sprint-4 (#109)
Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
1 parent 9117732 commit 2acd32d

File tree

62 files changed

+2734
-2438
lines changed

Some content is hidden

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

62 files changed

+2734
-2438
lines changed

contracts/.env.sample

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# * Accounts and Keys
2+
# Private keys in RAW Format (Not DER)
3+
PRIVATE_KEY_0='exampleprivatekey0'
4+
PRIVATE_KEY_1='exampleprivatekey1'
5+
# Hedera Accounts
6+
ACCOUNT_0='0.0.example0'
7+
ACCOUNT_1='0.0.example1'
8+
9+
# * Hedera Network
10+
NETWORK='hardhat' # 'hardhat' | 'testnet'
11+
12+
# * Deployed Contracts
13+
RESOLVER_PROXY='0.0.example7'
14+
RESOLVER_PROXY_ADMIN='0.0.example8'
15+
RESOLVER_CONTRACT='0.0.example9'
16+
FACTORY_PROXY='0.0.example10'
17+
FACTORY_PROXY_ADMIN='0.0.example11'
18+
FACTORY_CONTRACT='0.0.example12'
19+
ACCESS_CONTROL='0.0.example13'
20+
CAP='0.0.example14'
21+
CONTROL_LIST='0.0.example15'
22+
PAUSE='0.0.example16'
23+
ERC20='0.0.example17'
24+
ERC1410='0.0.example18'
25+
ERC1594='0.0.example19'
26+
ERC1643='0.0.example20'
27+
ERC1644='0.0.example21'
28+
SNAPSHOTS='0.0.example22'
29+
DIAMOND_FACET='0.0.example23'
30+
EQUITY='0.0.example24'
31+
BOND='0.0.example25'
32+
SCHEDULED_SNAPSHOTS='0.0.example26'
33+
CORPORATE_ACTIONS_SECURITY='0.0.example27'
34+
LOCK='0.0.example28'
35+
TRANSFER_AND_LOCK='0.0.example29'

contracts/contracts/layer_2/interfaces/equity/IEquity.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ interface IEquity {
218218
bool informationRight;
219219
bool liquidationRight;
220220
bool subscriptionRight;
221-
bool convertionRight;
221+
bool conversionRight;
222222
bool redemptionRight;
223223
bool putRight;
224224
DividendType dividendRight;

contracts/hardhat.config.d.ts

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

contracts/hardhat.config.js

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

contracts/hardhat.config.ts

Lines changed: 59 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,57 @@
1-
import { HardhatUserConfig, task, types } from 'hardhat/config'
1+
import { HardhatUserConfig } from 'hardhat/config'
22
import '@nomicfoundation/hardhat-toolbox'
33
import 'hardhat-contract-sizer'
4-
import '@hashgraph/sdk'
5-
//import '@hashgraph/hardhat-hethers' // remove comment only when working with Hedera DLT
6-
//import './scripts/hardhatTasks' // remove comment only when deploying in HEdera DLT after compiling
7-
import * as dotenv from 'dotenv'
84
import 'solidity-coverage'
5+
import '@hashgraph/sdk'
6+
import { getEnvVar } from './scripts/utils'
7+
// ! Uncomment the following lines to be able to use tasks AFTER compiling the project
8+
// import './tasks/utils'
9+
// import './tasks/deploy'
10+
// import './tasks/update'
911

10-
dotenv.config()
12+
if (getEnvVar({ name: 'NETWORK', defaultValue: 'hardhat' }) !== 'hardhat') {
13+
require('@hashgraph/hardhat-hethers')
14+
}
1115

12-
task('keccak256', 'Prints the keccak256 hash of a string')
13-
.addPositionalParam(
14-
'input',
15-
'The string to be hashed',
16-
undefined,
17-
types.string
18-
)
19-
.setAction(async ({ input }: { input: string }, hre) => {
20-
const hash = hre.ethers.utils.keccak256(Buffer.from(input, 'utf-8'))
21-
console.log(hash)
22-
})
16+
const HEDERA_ACCOUNTS = [
17+
{
18+
account: getEnvVar({ name: 'ACCOUNT_0', defaultValue: '0.0.0' }),
19+
privateKey: getEnvVar({
20+
name: 'PRIVATE_KEY_0',
21+
defaultValue: '0x0000',
22+
}).replace(/^0x/, ''),
23+
},
24+
{
25+
account: getEnvVar({ name: 'ACCOUNT_1', defaultValue: '0.0.0' }),
26+
privateKey: getEnvVar({
27+
name: 'PRIVATE_KEY_1',
28+
defaultValue: '0x0000',
29+
}).replace(/^0x/, ''),
30+
},
31+
]
32+
33+
// Needed to be able to use the HederaConfig interface
34+
interface ExtendedHardhatUserConfig extends Omit<HardhatUserConfig, 'hedera'> {
35+
hedera?: {
36+
gasLimit: number
37+
networks: {
38+
[key: string]: {
39+
accounts: {
40+
account: string
41+
privateKey: string
42+
}[]
43+
}
44+
}
45+
}
46+
}
2347

24-
const config: HardhatUserConfig = {
48+
let config: ExtendedHardhatUserConfig = {
2549
solidity: {
2650
version: '0.8.18',
2751
settings: {
2852
optimizer: {
2953
enabled: true,
30-
runs: 1000,
54+
runs: 200,
3155
},
3256
},
3357
},
@@ -37,92 +61,28 @@ const config: HardhatUserConfig = {
3761
runOnCompile: true,
3862
strict: true,
3963
},
40-
//defaultNetwork: 'testnet', // remove comment only when working with Hedera DLT
41-
// remove comment only when working with Hedera DLT
42-
/*hedera: {
43-
gasLimit: 300000,
44-
networks: {
45-
testnet: {
46-
accounts: [
47-
{
48-
account:
49-
process.env['TESTNET_HEDERA_OPERATOR_ACCOUNT'] ??
50-
'',
51-
privateKey:
52-
process.env['TESTNET_HEDERA_OPERATOR_PRIVATEKEY'] ??
53-
'',
54-
},
55-
{
56-
account:
57-
process.env[
58-
'TESTNET_HEDERA_OPERATOR_ACCOUNT_ECDSA_1'
59-
] ?? '',
60-
privateKey:
61-
process.env[
62-
'TESTNET_HEDERA_OPERATOR_PRIVATEKEY_ECDSA_1'
63-
] ?? '',
64-
},
65-
{
66-
account:
67-
process.env[
68-
'TESTNET_HEDERA_OPERATOR_ACCOUNT_ECDSA_2'
69-
] ?? '',
70-
privateKey:
71-
process.env[
72-
'TESTNET_HEDERA_OPERATOR_PRIVATEKEY_ECDSA_2'
73-
] ?? '',
74-
},
75-
{
76-
account:
77-
process.env[
78-
'TESTNET_HEDERA_OPERATOR_ACCOUNT_ECDSA_3'
79-
] ?? '',
80-
privateKey:
81-
process.env[
82-
'TESTNET_HEDERA_OPERATOR_PRIVATEKEY_ECDSA_3'
83-
] ?? '',
84-
},
85-
{
86-
account:
87-
process.env[
88-
'TESTNET_HEDERA_OPERATOR_ACCOUNT_ECDSA_4'
89-
] ?? '',
90-
privateKey:
91-
process.env[
92-
'TESTNET_HEDERA_OPERATOR_PRIVATEKEY_ECDSA_4'
93-
] ?? '',
94-
},
95-
{
96-
account:
97-
process.env[
98-
'TESTNET_HEDERA_OPERATOR_ACCOUNT_ECDSA_5'
99-
] ?? '',
100-
privateKey:
101-
process.env[
102-
'TESTNET_HEDERA_OPERATOR_PRIVATEKEY_ECDSA_5'
103-
] ?? '',
104-
},
105-
{
106-
account:
107-
process.env[
108-
'TESTNET_HEDERA_OPERATOR_ACCOUNT_ECDSA_6'
109-
] ?? '',
110-
privateKey:
111-
process.env[
112-
'TESTNET_HEDERA_OPERATOR_PRIVATEKEY_ECDSA_6'
113-
] ?? '',
114-
},
115-
],
116-
},
117-
},
118-
},*/
11964
typechain: {
12065
outDir: './typechain-types',
66+
target: 'ethers-v5',
12167
},
12268
mocha: {
123-
// Extend the timeout to 60 seconds (adjust as needed)
12469
timeout: 3000000,
12570
},
12671
}
72+
// If we are not using the hardhat network, we need to add the Hedera accounts
73+
if (getEnvVar({ name: 'NETWORK', defaultValue: 'hardhat' }) !== 'hardhat') {
74+
config = {
75+
...config,
76+
defaultNetwork: 'testnet',
77+
hedera: {
78+
gasLimit: 300000,
79+
networks: {
80+
testnet: {
81+
accounts: HEDERA_ACCOUNTS,
82+
},
83+
},
84+
},
85+
}
86+
}
12787

12888
export default config

0 commit comments

Comments
 (0)