-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8fe26c
commit 18e801a
Showing
27 changed files
with
304 additions
and
828 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,7 @@ typechain | |
cache | ||
artifacts | ||
contracts/hardhat-dependency-compiler | ||
ignition/deployments | ||
|
||
.env.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const { buildModule } = require("@nomicfoundation/hardhat-ignition/modules"); | ||
const { PREAPPROVEDWITHDRAWER, WITHDRAWER } = require("../../lib/roles") | ||
const MCP = require("./MCP") | ||
|
||
module.exports = buildModule("DistributorAggregator", (m) => { | ||
const { accessManager } = m.useModule(MCP); | ||
|
||
const aggregator = m.contract("DistributorAggregator", [accessManager]) | ||
m.call(accessManager, "grantRole", [PREAPPROVEDWITHDRAWER, aggregator, 0]) | ||
m.call(accessManager, "setTargetFunctionRole",[ | ||
aggregator, | ||
[ | ||
ethers.id('withdraw(address[])').substring(0, 10) | ||
], | ||
WITHDRAWER | ||
]) | ||
|
||
return { aggregator }; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const { buildModule } = require("@nomicfoundation/hardhat-ignition/modules"); | ||
const { OWNER } = require("../../lib/roles") | ||
|
||
module.exports = buildModule("MCP", (m) => { | ||
let owner = m.getAccount(0) | ||
const accessManager = m.contract("AccessManager", [owner]); | ||
m.call(accessManager, "grantRole", [OWNER, owner, 0]) | ||
|
||
return { accessManager }; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const { buildModule } = require("@nomicfoundation/hardhat-ignition/modules"); | ||
const aggregatorModule = require("./DistributorAggregator") | ||
const fs = require("fs") | ||
const path = require("node:path"); | ||
|
||
let distributorModules = [] | ||
fs.readdirSync(`${__dirname}/distributors`).forEach((file) => { | ||
const importPath = "./distributors/" + path.basename(file, '.js') | ||
distributorModules.push(require(importPath)) | ||
}) | ||
|
||
module.exports = buildModule("Retok", (m) => { | ||
|
||
let distributors = [] | ||
for(let i=0; i< distributorModules.length; i++) { | ||
let distributorModule = distributorModules[i] | ||
let distributor = m.useModule(distributorModule) | ||
distributors.push(distributor) | ||
} | ||
|
||
m.useModule(aggregatorModule) | ||
|
||
return { distributors } | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const MCP = require("../MCP") | ||
const { buildTokenModule } = require("../../../lib/buildTokenModule") | ||
module.exports = buildTokenModule('USD Retok', 'USDRT', MCP) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const MCP = require("../MCP") | ||
const RTKFR = require("../tokens/TokenFrance") | ||
const USDRT = require("../coins/CoinUSD") | ||
|
||
const { buildDistributorModule } = require("../../../lib/buildDistributorModule") | ||
module.exports = buildDistributorModule('RTKFR', MCP, RTKFR, USDRT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const MCP = require("../MCP") | ||
const RTKIL = require("../tokens/TokenIsrael") | ||
const USDRT = require("../coins/CoinUSD") | ||
|
||
const { buildDistributorModule } = require("../../../lib/buildDistributorModule") | ||
module.exports = buildDistributorModule('RTKIL', MCP, RTKIL, USDRT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const MCP = require("../MCP") | ||
const RTKCH = require("../tokens/TokenSwitzerland") | ||
const USDRT = require("../coins/CoinUSD") | ||
|
||
const { buildDistributorModule } = require("../../../lib/buildDistributorModule") | ||
module.exports = buildDistributorModule('RTKCH', MCP, RTKCH, USDRT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const MCP = require("../MCP") | ||
const USDRT = require("../coins/CoinUSD") | ||
|
||
const { buildDistributorModule } = require("../../../lib/buildDistributorModule") | ||
module.exports = buildDistributorModule('USDRT', MCP, USDRT, USDRT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const MCP = require("../MCP") | ||
const { buildTokenModule } = require("../../../lib/buildTokenModule") | ||
module.exports = buildTokenModule('Retok France', 'RTKFR', MCP) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const MCP = require("../MCP") | ||
const { buildTokenModule } = require("../../../lib/buildTokenModule") | ||
module.exports = buildTokenModule('Retok Israel', 'RTKIL', MCP) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const MCP = require("../MCP") | ||
const { buildTokenModule } = require("../../../lib/buildTokenModule") | ||
module.exports = buildTokenModule('Retok Switzerland', 'RTKCH', MCP) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"Distributor_RTKFR": { | ||
"previousAddress": "0x701226c3eF10fADfB121FD11155181F06921F442" | ||
}, | ||
"Distributor_RTKCH": { | ||
"previousAddress": "0x64c262DE674779eB55B78f630B7c291c5ce150dc" | ||
}, | ||
"Distributor_RTKIL": { | ||
"previousAddress": "0x329dF41F2c3964b15c06B18E211749522b60ed62" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"Distributor_RTKFR": { | ||
"previousAddress": "0xCaE31bE9c35Ec291623B4647031d5616D48c4463" | ||
}, | ||
"Distributor_RTKCH": { | ||
"previousAddress": "0x142D1f208d6840ee30B6381F21759790411cfeD2" | ||
}, | ||
"Distributor_RTKIL": { | ||
"previousAddress": "0xCd54Aa34cfBFEBa74F4817984414ACA13803F6F4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const { buildModule } = require("@nomicfoundation/hardhat-ignition/modules"); | ||
const { OWNER } = require("./roles") | ||
|
||
const buildDistributorModule = (symbol, mcpModule, tokenModule, coinModule) => { | ||
return buildModule(`Distributor_${symbol}`, (m) => { | ||
const { accessManager } = m.useModule(mcpModule) | ||
const { token } = m.useModule(tokenModule) | ||
const { token: coin } = m.useModule(coinModule) | ||
const previousAddress = m.getParameter("previousAddress", ethers.ZeroAddress) | ||
|
||
const distributor = m.contract("Distributor", [accessManager, token, coin, previousAddress]) | ||
|
||
// Add methods to accessManager | ||
m.call(accessManager, "setTargetFunctionRole", | ||
[ | ||
distributor, | ||
[ | ||
ethers.id('burn(address,uint256,uint8)').substring(0, 10), | ||
ethers.id('mintTo(address,uint256,uint8)').substring(0, 10) | ||
], | ||
OWNER | ||
] | ||
) | ||
return { distributor } | ||
}) | ||
} | ||
|
||
module.exports = { buildDistributorModule: buildDistributorModule } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const { buildModule } = require("@nomicfoundation/hardhat-ignition/modules"); | ||
const { OWNER } = require("./roles") | ||
|
||
const buildTokenModule = (name, symbol, mcp) => { | ||
return buildModule(symbol, (m) => { | ||
const { accessManager } = m.useModule(mcp); | ||
const token = m.contract("SnapshotToken", [name, symbol, accessManager]); | ||
|
||
// Add methods to accessManager | ||
m.call(accessManager, "setTargetFunctionRole", | ||
[ | ||
token, | ||
[ | ||
ethers.id('burn(address,uint256,uint8)').substring(0, 10), | ||
ethers.id('mintTo(address,uint256,uint8)').substring(0, 10) | ||
], | ||
OWNER | ||
] | ||
) | ||
return { token } | ||
}) | ||
} | ||
|
||
module.exports = { buildTokenModule: buildTokenModule } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
OWNER: 10n, | ||
WITHDRAWER: 20n, | ||
PREAPPROVEDWITHDRAWER: 30n, | ||
SNAPSHOOTER: 40n | ||
} |
Oops, something went wrong.