From a27b685e621f5ca28acb0bd65e4cbc33aeaf88ea Mon Sep 17 00:00:00 2001 From: ssubik Date: Mon, 1 May 2023 19:09:57 +0545 Subject: [PATCH 01/10] adding more scripts for setting up lock positions --- .../create-fixed-lock-on-behalf-of-user.js | 14 +- ...fixed-locks-on-behalf-of-multiple-users.js | 131 ++++++++++++++++++ ...eate-two-fixed-lock-on-behalf-of-users.js} | 35 ++--- .../helpers/submitAndExecuteTransaction.js | 2 +- 4 files changed, 154 insertions(+), 28 deletions(-) create mode 100644 scripts/units/create-fixed-locks-on-behalf-of-multiple-users.js rename scripts/units/{setup_council_stakes.js => create-two-fixed-lock-on-behalf-of-users.js} (69%) diff --git a/scripts/units/create-fixed-lock-on-behalf-of-user.js b/scripts/units/create-fixed-lock-on-behalf-of-user.js index 0e9c2ab..23386dd 100644 --- a/scripts/units/create-fixed-lock-on-behalf-of-user.js +++ b/scripts/units/create-fixed-lock-on-behalf-of-user.js @@ -11,10 +11,12 @@ const addressesConfig = require(`../../config/config.${env}`) const LOCK_PERIOD = 365 * 24 * 60 * 60; //SET AS NEEDED // NOT MAX UINT for security as its not good to approve max for Multisig + // this is how much to stake for one council . Right now 10KK const T_TO_STAKE = web3.utils.toWei('10000000', 'ether'); +const T_TO_APPROVE = web3.utils.toWei('10000000', 'ether'); -const ACCOUNT_TO_STAKE_FOR = addressesConfig.COUNCIL_1; +const ACCOUNT_TO_STAKE_FOR = "0x9a337088801B30a3eB715937BCDE27A34BC62841"; const rawdata = fs.readFileSync(constants.PATH_TO_ADDRESSES); const addresses = JSON.parse(rawdata); @@ -67,16 +69,16 @@ module.exports = async function(deployer) { const stakingService = await IStaking.at(addresses.staking); await txnHelper.submitAndExecute( - _encodeApproveFunction(stakingService.address,T_TO_STAKE), + _encodeApproveFunction(stakingService.address,T_TO_APPROVE), addresses.fthmToken, "ApproveFathomTxn" ) - - const LockPositionForStaker = [_createLockParamObject(T_TO_STAKE,LOCK_PERIOD,ACCOUNT_TO_STAKE_FOR)] + const lockPositionForUser = _createLockParamObject(T_TO_STAKE,LOCK_PERIOD,ACCOUNT_TO_STAKE_FOR) + const allLockPositions = [lockPositionForUser] await txnHelper.submitAndExecute( - _encodeCreateLocksForCouncils(LockPositionForStaker), + _encodeCreateLocksForCouncils(allLockPositions), stakingService.address, - "createLocksForCouncilTxn" + "createLocksForUserTxn" ) } \ No newline at end of file diff --git a/scripts/units/create-fixed-locks-on-behalf-of-multiple-users.js b/scripts/units/create-fixed-locks-on-behalf-of-multiple-users.js new file mode 100644 index 0000000..f2a893e --- /dev/null +++ b/scripts/units/create-fixed-locks-on-behalf-of-multiple-users.js @@ -0,0 +1,131 @@ +//NOTE: This script can be run only once for each deployment as making COUNCIL_STAKES is only possible once +const fs = require('fs'); + +const constants = require('./helpers/constants') +const txnHelper = require('./helpers/submitAndExecuteTransaction') +const IStaking = artifacts.require('./dao/staking/interfaces/IStaking.sol'); + +const env = process.env.NODE_ENV || 'dev'; +const addressesConfig = require(`../../config/config.${env}`) + +const LOCK_PERIOD = 365 * 24 * 60 * 60; +//SET AS NEEDED +// this needs to be sum of all the stakes. Right now 10KK * 3. +// NOT MAX UINT for security as its not good to approve max for Multisig +// This needs to be sum of all the staking position +const T_TOTAL_TO_APPROVE = web3.utils.toWei('10000000', 'ether'); +// this is how much to stake for each council +const T_TO_STAKE_USER_1 = web3.utils.toWei('1000000', 'ether'); //set as needed +const T_TO_STAKE_USER_2 = web3.utils.toWei('1000000', 'ether'); //set as needed +const T_TO_STAKE_USER_3 = web3.utils.toWei('1000000', 'ether'); //set as needed +const T_TO_STAKE_USER_4 = web3.utils.toWei('1000000', 'ether'); //set as needed +const T_TO_STAKE_USER_5 = web3.utils.toWei('1000000', 'ether'); //set as needed +const T_TO_STAKE_USER_6 = web3.utils.toWei('1000000', 'ether'); //set as needed +const T_TO_STAKE_USER_7 = web3.utils.toWei('1000000', 'ether'); //set as needed +const T_TO_STAKE_USER_8 = web3.utils.toWei('1000000', 'ether'); //set as needed +const T_TO_STAKE_USER_9 = web3.utils.toWei('1000000', 'ether'); //set as needed +const T_TO_STAKE_USER_10 = web3.utils.toWei('1000000', 'ether'); //set as needed + + +// const USER_1 = addressesConfig.COUNCIL_1; //better to hardcode this +// const USER_2 = addressesConfig.COUNCIL_2; //better to hardcode this +// const USER_3 = addressesConfig.COUNCIL_3; //better to hardcode this + +const USER_1 = "0x9a337088801B30a3eB715937BCDE27A34BC62841" +const USER_2 = "0xAD2c9625Fe6c88fcAf3E0D488543d51528d4a30D" +const USER_3 = "0x078D6d3e5b547D766e90078902ecC4C5AEf7a960" +const USER_4 = "0xa639856772F31f530AC0727Ec0f478a294aCfB21" +const USER_5 = "0x6f45f117f58A65AeE2F7F1aC53a22bAcC3d22ca0" +const USER_6 = "0x4db5B862AcD756D243dFD8168a14918681D6EDB4" +const USER_7 = "0xe8C7A3BCF6932E958dE77111CCfe853B1D7Cc7c5" +const USER_8 = "0xDd0A499401f710496f7663e97778AF364242cB3d" +const USER_9 = "0x5b5fC32Eb3e243A542684bCC09713Fb5f6f5E914" +const USER_10 = "0x35b176582819F2b5e70640624876927968904822" + +const rawdata = fs.readFileSync(constants.PATH_TO_ADDRESSES); +const addresses = JSON.parse(rawdata); + +const _createLockParamObject = ( + _amount, + _lockPeriod, + _account) => { + return { + amount: _amount, + lockPeriod: _lockPeriod, + account: _account + } +} +const _encodeApproveFunction = (_account, _amount) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'approve', + type: 'function', + inputs: [{ + type: 'address', + name: 'spender' + },{ + type: 'uint256', + name: 'amount' + }] + }, [_account, _amount]); + + return toRet; +} + +const _encodeCreateLocksForCouncils = (_createLockParam) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name:'createFixedLocksOnBehalfOfUserByAdmin', + type:'function', + inputs: [{ + type: 'tuple[]', + name: 'lockPositions', + components: [ + {"type":"uint256", "name":"amount"}, + {"type":"uint256", "name":"lockPeriod"}, + {"type":"address", "name":"account"} + ] + } + ] + },[_createLockParam]) + return toRet +} + +module.exports = async function(deployer) { + const stakingService = await IStaking.at(addresses.staking); + + + await txnHelper.submitAndExecute( + _encodeApproveFunction(stakingService.address,T_TOTAL_TO_APPROVE), + addresses.fthmToken, + "ApproveFathomTxn" + ) + + const LockPositionForUser1 = _createLockParamObject(T_TO_STAKE_USER_1,LOCK_PERIOD,USER_1) + const LockPositionForUser2 = _createLockParamObject(T_TO_STAKE_USER_2,LOCK_PERIOD,USER_2) + const LockPositionForUser3 = _createLockParamObject(T_TO_STAKE_USER_3,LOCK_PERIOD,USER_3) + const LockPositionForUser4 = _createLockParamObject(T_TO_STAKE_USER_4,LOCK_PERIOD,USER_4) + const LockPositionForUser5 = _createLockParamObject(T_TO_STAKE_USER_5,LOCK_PERIOD,USER_5) + const LockPositionForUser6 = _createLockParamObject(T_TO_STAKE_USER_6,LOCK_PERIOD,USER_6) + const LockPositionForUser7 = _createLockParamObject(T_TO_STAKE_USER_7,LOCK_PERIOD,USER_7) + const LockPositionForUser8 = _createLockParamObject(T_TO_STAKE_USER_8,LOCK_PERIOD,USER_8) + const LockPositionForUser9 = _createLockParamObject(T_TO_STAKE_USER_9,LOCK_PERIOD,USER_9) + const LockPositionForUser10 = _createLockParamObject(T_TO_STAKE_USER_10,LOCK_PERIOD,USER_10) + + const allLockPositions = [ + LockPositionForUser1, + LockPositionForUser2, + LockPositionForUser3, + LockPositionForUser4, + LockPositionForUser5, + LockPositionForUser6, + LockPositionForUser7, + LockPositionForUser8, + LockPositionForUser9, + LockPositionForUser10 + ] + + await txnHelper.submitAndExecute( + _encodeCreateLocksForCouncils(allLockPositions), + stakingService.address, + "createMultipleLocksForUsers" + ) +} \ No newline at end of file diff --git a/scripts/units/setup_council_stakes.js b/scripts/units/create-two-fixed-lock-on-behalf-of-users.js similarity index 69% rename from scripts/units/setup_council_stakes.js rename to scripts/units/create-two-fixed-lock-on-behalf-of-users.js index 13c9e3b..2bbf79c 100644 --- a/scripts/units/setup_council_stakes.js +++ b/scripts/units/create-two-fixed-lock-on-behalf-of-users.js @@ -8,18 +8,18 @@ const IStaking = artifacts.require('./dao/staking/interfaces/IStaking.sol'); const env = process.env.NODE_ENV || 'dev'; const addressesConfig = require(`../../config/config.${env}`) - const LOCK_PERIOD = 365 * 24 * 60 * 60; //SET AS NEEDED -// this needs to be sum of all the stakes. Right now 10KK * 3. // NOT MAX UINT for security as its not good to approve max for Multisig -const T_TOTAL_TO_APPROVE = web3.utils.toWei('30000000', 'ether'); + // this is how much to stake for one council . Right now 10KK -const T_TO_STAKE = web3.utils.toWei('10000000', 'ether'); +const T_TO_STAKE_USER_1 = web3.utils.toWei('1000000', 'ether'); //set as needed +const T_TO_STAKE_USER_2 = web3.utils.toWei('1000000', 'ether'); //set as needed -const COUNCIL_1 = addressesConfig.COUNCIL_1; -const COUNCIL_2 = addressesConfig.COUNCIL_2; -const COUNCIL_3 = addressesConfig.COUNCIL_3; +const T_TO_APPROVE = web3.utils.toWei('20000000', 'ether'); + +const USER_1 = "0x9a337088801B30a3eB715937BCDE27A34BC62841"; +const USER_2 = "0xAD2c9625Fe6c88fcAf3E0D488543d51528d4a30D"; const rawdata = fs.readFileSync(constants.PATH_TO_ADDRESSES); const addresses = JSON.parse(rawdata); @@ -71,26 +71,19 @@ const _encodeCreateLocksForCouncils = (_createLockParam) => { module.exports = async function(deployer) { const stakingService = await IStaking.at(addresses.staking); - await txnHelper.submitAndExecute( - _encodeApproveFunction(stakingService.address,T_TOTAL_TO_APPROVE), + _encodeApproveFunction(stakingService.address,T_TO_APPROVE), addresses.fthmToken, "ApproveFathomTxn" ) - - const LockPositionForCouncil_1 = _createLockParamObject(T_TO_STAKE,LOCK_PERIOD,COUNCIL_1) - const LockPositionForCouncil_2 = _createLockParamObject(T_TO_STAKE,LOCK_PERIOD,COUNCIL_2) - const LockPositionForCouncil_3 = _createLockParamObject(T_TO_STAKE,LOCK_PERIOD,COUNCIL_3) + const LockPositionForUser1 = _createLockParamObject(T_TO_STAKE_USER_1,LOCK_PERIOD,USER_1) + const LockPositionForUser2 = _createLockParamObject(T_TO_STAKE_USER_2,LOCK_PERIOD,USER_2) + + const allLockPositions = [LockPositionForUser1,LockPositionForUser2] - const LockParamObjectForAllCouncils = [ - LockPositionForCouncil_1, - LockPositionForCouncil_2, - LockPositionForCouncil_3 - ] - await txnHelper.submitAndExecute( - _encodeCreateLocksForCouncils(LockParamObjectForAllCouncils), + _encodeCreateLocksForCouncils(allLockPositions), stakingService.address, - "createLocksForCouncilTxn" + "createLocksForUserTxn" ) } \ No newline at end of file diff --git a/scripts/units/helpers/submitAndExecuteTransaction.js b/scripts/units/helpers/submitAndExecuteTransaction.js index 3186c10..f9c1201 100644 --- a/scripts/units/helpers/submitAndExecuteTransaction.js +++ b/scripts/units/helpers/submitAndExecuteTransaction.js @@ -38,7 +38,7 @@ async function submitAndExecute(encodedFunction, targetAddress, TransactionName, targetAddress, ETH_AMOUNT==0?constants.EMPTY_BYTES:ETH_AMOUNT, encodedFunction - ,0,{gas:8000000} + ,0,{gas:20000000} ) if (!resultSubmitTransaction) { console.log(`Transaction failed to submit for ${TransactionName}`); From e31bd347aaf36051eb284985e720567177320001 Mon Sep 17 00:00:00 2001 From: ssubik Date: Wed, 3 May 2023 13:26:54 +0545 Subject: [PATCH 02/10] working on scripts --- .../set-debt-ceiling.js | 4 +- .../fathom-stablecoin/stablecoin.js | 38 ++++++++++++ .../stablecoin/stableswap/deposit-token.js | 59 ++++++++++++++++++- 3 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 scripts/units/stablecoin/fathom-stablecoin/stablecoin.js diff --git a/scripts/units/stablecoin/collateral-pool-config/set-debt-ceiling.js b/scripts/units/stablecoin/collateral-pool-config/set-debt-ceiling.js index 9f3aff9..6017796 100644 --- a/scripts/units/stablecoin/collateral-pool-config/set-debt-ceiling.js +++ b/scripts/units/stablecoin/collateral-pool-config/set-debt-ceiling.js @@ -3,8 +3,8 @@ const txnHelper = require('../../helpers/submitAndExecuteTransaction') const constants = require('../../helpers/constants') const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) -const COLLATERAL_POOL_ID = '' -const DEBT_CEILING = '' +const COLLATERAL_POOL_ID = '0x5844430000000000000000000000000000000000000000000000000000000000' +const DEBT_CEILING = web3.utils.toWei('3999999999999999986441897348723255952923416883888128','wei') const COLLATERAL_POOL_CONFIG_ADDRESS =addressesConfig.COLLATERAL_POOL_CONFIG_ADDRESS const _encodeSetDebtCeiling = (_collateralPoolId, _debtCeiling) => { let toRet = web3.eth.abi.encodeFunctionCall({ diff --git a/scripts/units/stablecoin/fathom-stablecoin/stablecoin.js b/scripts/units/stablecoin/fathom-stablecoin/stablecoin.js new file mode 100644 index 0000000..836f430 --- /dev/null +++ b/scripts/units/stablecoin/fathom-stablecoin/stablecoin.js @@ -0,0 +1,38 @@ +const fs = require('fs'); + + +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) + +const STABLECOIN_ADDRESS = "0xa585BF9418C6Aca0a46d308Cea3b2EC85046C88F" + +const _encodeRenameFunction = (_name, _symbol) => { + let toInitializeMainStream = web3.eth.abi.encodeFunctionCall({ + name: 'rename', + type: 'function', + inputs: [{ + type: 'string', + name: '_name' + }, + { + type: 'string', + name: '_symbol' + }] + }, ["Subik", "Ji"]); + + return toInitializeMainStream +} + + +module.exports = async function(deployer) { + await txnHelper.submitAndExecute( + _encodeRenameFunction( + "Subik", + "Ji" + ), + STABLECOIN_ADDRESS, + "stablecoinUpdateRename" + ) +} \ No newline at end of file diff --git a/scripts/units/stablecoin/stableswap/deposit-token.js b/scripts/units/stablecoin/stableswap/deposit-token.js index ea64188..a39d4f9 100644 --- a/scripts/units/stablecoin/stableswap/deposit-token.js +++ b/scripts/units/stablecoin/stableswap/deposit-token.js @@ -1 +1,58 @@ -//TODO \ No newline at end of file + +const constants = require('../../helpers/constants') +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) + +const STABLE_SWAP_ADDRESS = addressesConfig.STABLE_SWAP_ADDRESS +const TokenAddress = addressesConfig.USD_ADDRESS +//const STABLE_SWAP_ADDRESS = ""; +const TokenDepositAmount = web3.utils.toWei('10000','ether') +// const USDAddress = "" +// const FXDAddress = "" +const _encodeApproveFunction = (_account, _amount) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'approve', + type: 'function', + inputs: [{ + type: 'address', + name: 'spender' + },{ + type: 'uint256', + name: 'amount' + }] + }, [_account, _amount]); + + return toRet; +} + +const _encodeDepositFunction = (_token, _amount) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'depositToken', + type: 'function', + inputs: [{ + type: 'address', + name: '_token' + },{ + type: 'uint256', + name: '_amount' + }] + }, [_token, _amount]); + + return toRet; +} + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeApproveFunction(STABLE_SWAP_ADDRESS,TokenDepositAmount), + TokenAddress, + "ApproveStableSwapToken" + ) + + await txnHelper.submitAndExecute( + _encodeDepositFunction(TokenAddress,TokenDepositAmount), + STABLE_SWAP_ADDRESS, + "DepositToStableswap" + ) +} From c2ac488b8a1a93a409328b2eb4b4bfc269e94647 Mon Sep 17 00:00:00 2001 From: ssubik Date: Tue, 16 May 2023 11:28:57 +0545 Subject: [PATCH 03/10] adding few more stablecoin scripts --- .../set-liquidation-ratio.js | 2 +- .../set-position-debt-ceiling.js | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 scripts/units/stablecoin/collateral-pool-config/set-position-debt-ceiling.js diff --git a/scripts/units/stablecoin/collateral-pool-config/set-liquidation-ratio.js b/scripts/units/stablecoin/collateral-pool-config/set-liquidation-ratio.js index 3b12f87..4f36427 100644 --- a/scripts/units/stablecoin/collateral-pool-config/set-liquidation-ratio.js +++ b/scripts/units/stablecoin/collateral-pool-config/set-liquidation-ratio.js @@ -24,7 +24,7 @@ const _encodeSetLiquidationRatio = (_collateralPoolId, _data) => { module.exports = async function(deployer) { await txnHelper.submitAndExecute( - _encodeSetDebtFloor(COLLATERAL_POOL_ID,DATA), + _encodeSetLiquidationRatio(COLLATERAL_POOL_ID,DATA), COLLATERAL_POOL_CONFIG_ADDRESS, "setLiquidationRatio" ) diff --git a/scripts/units/stablecoin/collateral-pool-config/set-position-debt-ceiling.js b/scripts/units/stablecoin/collateral-pool-config/set-position-debt-ceiling.js new file mode 100644 index 0000000..8fde8a1 --- /dev/null +++ b/scripts/units/stablecoin/collateral-pool-config/set-position-debt-ceiling.js @@ -0,0 +1,32 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) +const COLLATERAL_POOL_ID = addressesConfig.collateralPoolId +const positionDebtCeiling = web3.utils.toWei('','wei')// this needs to be set in terms of wei to avoid confusion of ray, rad and wei +const COLLATERAL_POOL_CONFIG_ADDRESS = addressesConfig.COLLATERAL_POOL_CONFIG_ADDRESS + +const _encodeSetPositionDebtCeiling = (_collateralPoolId, _positionDebtCeiling) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'setPositionDebtCeiling', + type: 'function', + inputs: [{ + type: 'bytes32', + name: '_collateralPoolId' + },{ + type: 'uint256', + name: '_positionDebtCeiling' + }] + }, [_collateralPoolId,_positionDebtCeiling]); + + return toRet; +} + +module.exports = async function(deployer) { + await txnHelper.submitAndExecute( + _encodeSetPositionDebtCeiling(COLLATERAL_POOL_ID,positionDebtCeiling), + COLLATERAL_POOL_CONFIG_ADDRESS, + "setPositionDebtCeiling" + ) +} \ No newline at end of file From 39f481081cddc6ce02ec1b8b49ca0275908eb038 Mon Sep 17 00:00:00 2001 From: ssubik Date: Thu, 25 May 2023 12:43:13 +0545 Subject: [PATCH 04/10] working on scripts --- scripts/units/create_pool_dex.js | 12 ++++----- scripts/units/remove-liqudiity-dex.js | 23 ++++++++--------- scripts/units/transfer-tokens-fathom.js | 34 +++++++++++++++++++++++++ scripts/units/transfer-tokens.js | 16 +++++------- 4 files changed, 57 insertions(+), 28 deletions(-) create mode 100644 scripts/units/transfer-tokens-fathom.js diff --git a/scripts/units/create_pool_dex.js b/scripts/units/create_pool_dex.js index f5d914d..97e00e5 100644 --- a/scripts/units/create_pool_dex.js +++ b/scripts/units/create_pool_dex.js @@ -13,13 +13,13 @@ const env = process.env.NODE_ENV || 'dev'; const addressesConfig = require(`../../config/config.${env}`) -const Token_A_Address = "0xf31146956Cb3be9EFD6Cfd665Cb4Cb5Aeeb5cA3e" //FTHM -const Token_B_Address = "0x0Cc79883b6FF52B857bDA7D5Df9214eE0bb28839" //WXDC +const Token_A_Address = "0xa96792e0745B7E676a96148124A0caaF265733C8" //FTHM +const Token_B_Address = "0xf31146956Cb3be9EFD6Cfd665Cb4Cb5Aeeb5cA3e" //FXD // SET AS Necessary -const Amount_A_Desired = web3.utils.toWei('100000', 'ether') -const Amount_B_Desired = web3.utils.toWei('100000', 'ether') -const Amount_A_Minimum = web3.utils.toWei('100000', 'ether') -const Amount_B_Minimum = web3.utils.toWei('100000', 'ether') +const Amount_A_Desired = web3.utils.toWei('99999', 'ether') +const Amount_B_Desired = web3.utils.toWei('99999', 'ether') +const Amount_A_Minimum = web3.utils.toWei('99999', 'ether') +const Amount_B_Minimum = web3.utils.toWei('99999', 'ether') // const Amount_A_Desired = web3.utils.toWei('250000', 'ether') // const Amount_B_Desired = web3.utils.toWei('9347335', 'ether') diff --git a/scripts/units/remove-liqudiity-dex.js b/scripts/units/remove-liqudiity-dex.js index 277d184..d5fc766 100644 --- a/scripts/units/remove-liqudiity-dex.js +++ b/scripts/units/remove-liqudiity-dex.js @@ -15,8 +15,8 @@ const env = process.env.NODE_ENV || 'dev'; const addressesConfig = require(`../../config/config.${env}`); const { default: BigNumber } = require('bignumber.js'); -const Token_A_Address = "0xD033b52657F3580092914e1976715e0cbC622855" //USD -const Token_B_Address = "0x603B972D894bF754B63103ECB4b70b024096451D" //WXDC +const Token_A_Address = addressesConfig.FXD_ADDRESS //USD +const Token_B_Address = addresses.fthmToken //WXDC // SET AS Necessary const LIQUIDITY = web3.utils.toWei('99999.999999999999999', 'ether') @@ -106,7 +106,6 @@ module.exports = async function(deployer) { const uniswapFactory = await IUniswapFactory.at(addressesConfig.DEX_FACTORY_ADDRESS) const pairAddress = await uniswapFactory.getPair(Token_A_Address, Token_B_Address) const pairToken = await IUniswapV2Pair.at(pairAddress) - const balance = (await pairToken.balanceOf(multiSigWallet.address)).toString() const reserves = await pairToken.getReserves(); const token0 = await pairToken.token0(); @@ -120,15 +119,15 @@ module.exports = async function(deployer) { const minAmountA = new BigNumber(amountADesired - amountADesired * SLIPPAGE) const minAmountB = new BigNumber(amountBDesired - amountBDesired * SLIPPAGE) - // await txnHelper.submitAndExecute( - // _encodeApproveFunction( - // addressesConfig.DEX_ROUTER_ADDRESS, - // balance - // ) - // ,pairAddress, - // "ApproveTxn", - // 0 - // ) + await txnHelper.submitAndExecute( + _encodeApproveFunction( + addressesConfig.DEX_ROUTER_ADDRESS, + balance + ) + ,pairAddress, + "ApproveTxn", + 0 + ) await txnHelper.submitAndExecute( _encodeRemoveLiquidity( diff --git a/scripts/units/transfer-tokens-fathom.js b/scripts/units/transfer-tokens-fathom.js new file mode 100644 index 0000000..cf74dfb --- /dev/null +++ b/scripts/units/transfer-tokens-fathom.js @@ -0,0 +1,34 @@ +const fs = require('fs'); + +const constants = require('./helpers/constants') +const T_TO_TRANSFER_PLACEHOLDER = web3.utils.toWei('10000000','ether') //SET AS NEEDED +const TRANSFER_TO_ACCOUNT_PLACEHOLDER = "0x0Eb7DEE6e18Cce8fE839E986502d95d47dC0ADa3" //SET AS NEEDED +const txnHelper = require('./helpers/submitAndExecuteTransaction') +const rawdata = fs.readFileSync(constants.PATH_TO_ADDRESSES); +const addresses = JSON.parse(rawdata); +const _encodeTransferFunction = (_account, t_to_stake) => { + + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'transfer', + type: 'function', + inputs: [{ + type: 'address', + name: 'to' + },{ + type: 'uint256', + name: 'amount' + }] + }, [_account, t_to_stake]); + + return toRet; +} + +module.exports = async function(deployer) { + const FATHOM_TOKEN_ADDRESS = addresses.fthmToken; + + await txnHelper.submitAndExecute( + _encodeTransferFunction(TRANSFER_TO_ACCOUNT_PLACEHOLDER, T_TO_TRANSFER_PLACEHOLDER), + FATHOM_TOKEN_ADDRESS, + "transferFathomTokenFromMultisig" + ) +} \ No newline at end of file diff --git a/scripts/units/transfer-tokens.js b/scripts/units/transfer-tokens.js index 9330734..b9d6547 100644 --- a/scripts/units/transfer-tokens.js +++ b/scripts/units/transfer-tokens.js @@ -1,11 +1,7 @@ -const fs = require('fs'); - -const constants = require('./helpers/constants') -const T_TO_TRANSFER_PLACEHOLDER = web3.utils.toWei('1000','ether') //SET AS NEEDED -const TRANSFER_TO_ACCOUNT_PLACEHOLDER = "0xFFdc66881bC4A375a542CB0f416EF371fF4D8C3f" //SET AS NEEDED +const T_TO_TRANSFER_PLACEHOLDER = web3.utils.toWei('99999.99','ether') //SET AS NEEDED +const TRANSFER_TO_ACCOUNT_PLACEHOLDER = "0x9a337088801B30a3eB715937BCDE27A34BC62841" //SET AS NEEDED const txnHelper = require('./helpers/submitAndExecuteTransaction') -const rawdata = fs.readFileSync(constants.PATH_TO_ADDRESSES); -const addresses = JSON.parse(rawdata); +const TOKEN_ADDRESS = "0xf31146956Cb3be9EFD6Cfd665Cb4Cb5Aeeb5cA3e"; const _encodeTransferFunction = (_account, t_to_stake) => { let toRet = web3.eth.abi.encodeFunctionCall({ @@ -24,11 +20,11 @@ const _encodeTransferFunction = (_account, t_to_stake) => { } module.exports = async function(deployer) { - const FATHOM_TOKEN_ADDRESS = addresses.fthmToken; + await txnHelper.submitAndExecute( _encodeTransferFunction(TRANSFER_TO_ACCOUNT_PLACEHOLDER, T_TO_TRANSFER_PLACEHOLDER), - FATHOM_TOKEN_ADDRESS, - "transferFathomTokenFromMultisig" + TOKEN_ADDRESS, + "transfer Token from multisig" ) } \ No newline at end of file From c89993359c75638c766bf51bd94bbddb691896ab Mon Sep 17 00:00:00 2001 From: ssubik Date: Tue, 25 Jul 2023 11:52:19 +0545 Subject: [PATCH 05/10] adding multiple scripts for the Stablecoin/DEX/Staking ecosystem --- contracts/dao/test/dex/IUniswapV2Factory.sol | 3 ++ contracts/dao/test/dex/IUniswapV2Pair.sol | 3 ++ coralX-scenarios.js | 7 +++ package.json | 8 +++ .../test/1_deploy_test_contracts.js | 4 +- scripts/migrations/test/6_init_main_stream.js | 7 ++- .../test/9_staking_position_setup.js | 53 +++++++++++++++++++ scripts/units/create_pool_dex_xdc.js | 8 +-- scripts/units/helpers/constants.js | 7 ++- .../helpers/submitAndExecuteTransaction.js | 6 ++- .../collateral-token-adapter-whitelist.js | 29 ++++++++++ .../withdraw-collateral-token-adapter.js | 35 ++++++++++++ .../adapter/withdraw-stablecoin-adapter.js | 36 +++++++++++++ .../book-keeper/allowlist-bookkeeper.js | 2 +- .../set-access-collateral-config.js | 30 +++++++++++ .../book-keeper/set-collateral-pool-config.js | 30 +++++++++++ .../book-keeper/set-total-debt-ceiling.js | 30 +++++++++++ .../set-debt-ceiling.js | 4 +- .../delay-price-feed-pause.js | 5 +- .../set-pool-id.js | 31 +++++++++++ .../fathom-stablecoin/stablecoin.js | 38 ------------- .../position-manager/set-bookkeeper.js | 31 +++++++++++ .../stablecoin/price-oracle/set-bookkeeper.js | 30 +++++++++++ .../proxy-wallet-registry/add-to-whitelist.js | 30 +++++++++++ .../remove-from-whitelist.js | 30 +++++++++++ .../set-decentralized-mode.js | 30 +++++++++++ .../stability-fee-pause.js | 2 +- .../stableswap/remove-from-whitelist.js | 29 ++++++++++ .../stableswap/set-is-decentralized-state.js | 28 ++++++++++ .../withdraw-collateral-surplus.js | 3 +- scripts/units/transfer-ownership.js | 32 +++++++++++ 31 files changed, 564 insertions(+), 57 deletions(-) create mode 100644 scripts/migrations/test/9_staking_position_setup.js create mode 100644 scripts/units/stablecoin/adapter/collateral-token-adapter-whitelist.js create mode 100644 scripts/units/stablecoin/adapter/withdraw-collateral-token-adapter.js create mode 100644 scripts/units/stablecoin/adapter/withdraw-stablecoin-adapter.js create mode 100644 scripts/units/stablecoin/book-keeper/set-access-collateral-config.js create mode 100644 scripts/units/stablecoin/book-keeper/set-collateral-pool-config.js create mode 100644 scripts/units/stablecoin/book-keeper/set-total-debt-ceiling.js create mode 100644 scripts/units/stablecoin/delay-fathom-oracle-price-feed/set-pool-id.js delete mode 100644 scripts/units/stablecoin/fathom-stablecoin/stablecoin.js create mode 100644 scripts/units/stablecoin/position-manager/set-bookkeeper.js create mode 100644 scripts/units/stablecoin/price-oracle/set-bookkeeper.js create mode 100644 scripts/units/stablecoin/proxy-wallet-registry/add-to-whitelist.js create mode 100644 scripts/units/stablecoin/proxy-wallet-registry/remove-from-whitelist.js create mode 100644 scripts/units/stablecoin/proxy-wallet-registry/set-decentralized-mode.js create mode 100644 scripts/units/stablecoin/stableswap/remove-from-whitelist.js create mode 100644 scripts/units/stablecoin/stableswap/set-is-decentralized-state.js create mode 100644 scripts/units/transfer-ownership.js diff --git a/contracts/dao/test/dex/IUniswapV2Factory.sol b/contracts/dao/test/dex/IUniswapV2Factory.sol index 0fb3c72..20515a6 100644 --- a/contracts/dao/test/dex/IUniswapV2Factory.sol +++ b/contracts/dao/test/dex/IUniswapV2Factory.sol @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Original Copyright Uniswap +// Copyright Fathom 2022 pragma solidity >=0.6.2; interface IUniswapV2Factory { diff --git a/contracts/dao/test/dex/IUniswapV2Pair.sol b/contracts/dao/test/dex/IUniswapV2Pair.sol index 63b3a11..9895563 100644 --- a/contracts/dao/test/dex/IUniswapV2Pair.sol +++ b/contracts/dao/test/dex/IUniswapV2Pair.sol @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Original Copyright Uniswap +// Copyright Fathom 2022 pragma solidity >=0.5.0; interface IUniswapV2Pair { diff --git a/coralX-scenarios.js b/coralX-scenarios.js index 91734f2..d65ddba 100644 --- a/coralX-scenarios.js +++ b/coralX-scenarios.js @@ -22,6 +22,13 @@ module.exports = { ['execute', '--path', 'scripts/migrations/save-address/3_save_address_prod.js', '--network', 'xdc'] ], + deployApothemStakingPosition: [ + ['execute', '--path', 'scripts/migrations/deploy-staking-position', '--network', 'apothem'], + ], + + deployXDCtakingPosition: [ + ['execute', '--path', 'scripts/migrations/deploy-staking-position', '--network', 'xdc'] + ], deployUpgradedStakingContractApothem: [ ['execute', '--path', 'scripts/migrations/deploy-new-staking-package', '--network', 'apothem'], ], diff --git a/package.json b/package.json index 5eb70a2..70c2d3c 100644 --- a/package.json +++ b/package.json @@ -7,16 +7,24 @@ "test-with-timeout": "coralX test --params TIMEOUT=100000", "test-skip-compile": "coralX test skip_compile true", "test-use-snapshot": "coralX test skip_compile true use_snapshot true", + "compile": "npm run prettier && npm run lint && coralX compile", "prettier": "prettier --write 'contracts/**/*.sol'", "lint": "solhint 'contracts/**/*.sol'", "pre-release": "npm run prettier && npm run lint && npm run test-with-timeout", + "migrate-reset": "coralX scenario --run migrateAndConfigureForTests", "migrate-reset-sepolia": "rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deploySepolia", "migrate-reset-apothem-dev": "export NODE_ENV=dev && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployApothem", "migrate-reset-apothem-demo": "export NODE_ENV=demo && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployApothem", "migrate-reset-apothem-qa": "export NODE_ENV=qa && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployApothem", "migrate-reset-xdc": "export NODE_ENV=prod && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployXDC", + + "migrate-reset-staking-position-apothem-dev": "export NODE_ENV=dev && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployApothemStakingPosition", + "migrate-reset-staking-position-apothem-qa": "export NODE_ENV=qa && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployApothemStakingPosition", + "migrate-reset-staking-position-apothem-demo": "export NODE_ENV=demo && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployApothemStakingPosition", + "migrate-reset-staking-position-xdc": "export NODE_ENV=prod && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployXDCtakingPosition", + "migrate-reset-staking-upgrade-apothem-dev": "export NODE_ENV=dev && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployUpgradedStakingContractApothem", "migrate-reset-staking-upgrade-apothem-demo": "export NODE_ENV=demo && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployUpgradedStakingContractApothem", "migrate-reset-staking-upgrade-apothem-qa": "export NODE_ENV=qa && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployUpgradedStakingContractApothem", diff --git a/scripts/migrations/test/1_deploy_test_contracts.js b/scripts/migrations/test/1_deploy_test_contracts.js index 9739237..4078925 100644 --- a/scripts/migrations/test/1_deploy_test_contracts.js +++ b/scripts/migrations/test/1_deploy_test_contracts.js @@ -23,8 +23,8 @@ module.exports = async function(deployer) { let promises = [ deployer.deploy(Box, { gas: 12000000 }), deployer.deploy(ERC20Factory, { gas: 12000000 }), - deployer.deploy(ERC20TokenReward1, "Reward2 Tokens", "R2T", web3.utils.toWei("1000000","ether"), accounts[0], { gas: 3600000 }), - deployer.deploy(ERC20TokenReward2, "Reward2 Tokens", "R3T", web3.utils.toWei("1000000","ether"), accounts[0], { gas: 3600000 }),deployer.deploy( + deployer.deploy(ERC20TokenReward1, "Reward2 Tokens", "R2T", web3.utils.toWei("100000000","ether"), accounts[0], { gas: 3600000 }), + deployer.deploy(ERC20TokenReward2, "Reward2 Tokens", "R3T", web3.utils.toWei("100000000","ether"), accounts[0], { gas: 3600000 }),deployer.deploy( TokenTimelock, MainToken.address, accounts[0], // beneficiary diff --git a/scripts/migrations/test/6_init_main_stream.js b/scripts/migrations/test/6_init_main_stream.js index 7040e8d..8d9f88b 100644 --- a/scripts/migrations/test/6_init_main_stream.js +++ b/scripts/migrations/test/6_init_main_stream.js @@ -57,17 +57,16 @@ const _encodeInitMainStreamFunction = (_owner, _scheduleTimes, _scheduleRewards, const tau = 2; module.exports = async function(deployer) { - const startTime = await _getTimeStamp() + 3 * 24 * 60 * 60; - const oneYear = 31556926; + const oneMonth = 2628288; const scheduleTimes = [ startTime, - startTime + 4 * oneYear, + startTime + 48 * oneMonth ]; const scheduleRewards = [ web3.utils.toWei('200000000', 'ether'), - web3.utils.toWei("0", 'ether') + web3.utils.toWei('0', 'ether') ]; diff --git a/scripts/migrations/test/9_staking_position_setup.js b/scripts/migrations/test/9_staking_position_setup.js new file mode 100644 index 0000000..535b2f7 --- /dev/null +++ b/scripts/migrations/test/9_staking_position_setup.js @@ -0,0 +1,53 @@ +const StakingPositionFactory = artifacts.require("./dao/staking/staking-position/StakingPositionFactory.sol"); +const MultiSigWallet = artifacts.require("./dao/treasury/MultiSigWallet.sol"); +const StakingProxy = artifacts.require('./common/proxy/StakingProxy.sol') +const MainToken = artifacts.require("./dao/tokens/MainToken.sol"); +const StakingPositionFactoryProxyAdmin = artifacts.require("./dao/staking/staking-position/proxy/StakingPositionFactoryProxyAdmin.sol") +const StakingPositionFactoryProxy = artifacts.require("./dao/staking/staking-position/proxy/StakingPositionFactoryProxy.sol") +const VMainToken = artifacts.require('./dao/tokens/VMainToken.sol'); + +module.exports = async function(deployer) { + + await deployer.deploy( + StakingPositionFactoryProxyAdmin, {gas: 8000000} + ) + + let toInitialize = web3.eth.abi.encodeFunctionCall({ + name: 'initialize', + type: 'function', + inputs: [{ + type: 'address', + name: '_admin' + }, + { + type: 'address', + name: '_stakingContract' + }, + { + type: 'address', + name: '_mainToken' + }, + { + type: 'address', + name: '_voteToken' + }, + { + type: 'address', + name: '_proxyAdmin' + } + ] + }, [ + MultiSigWallet.address, + StakingProxy.address, + MainToken.address, + VMainToken.address, + StakingPositionFactoryProxyAdmin.address + ]) + + await deployer.deploy( + StakingPositionFactoryProxy, + StakingPositionFactory.address, + StakingPositionFactoryProxyAdmin.address, + toInitialize, + {gas:8000000}); +} \ No newline at end of file diff --git a/scripts/units/create_pool_dex_xdc.js b/scripts/units/create_pool_dex_xdc.js index da68d72..78957d3 100644 --- a/scripts/units/create_pool_dex_xdc.js +++ b/scripts/units/create_pool_dex_xdc.js @@ -9,10 +9,10 @@ const env = process.env.NODE_ENV || 'dev'; const addressesConfig = require(`../../config/config.${env}`) const TOKEN_ADDRESS = addresses.fthmToken //FTHM address -const AMOUNT_TOKEN_DESIRED = web3.utils.toWei('2', 'ether') -const AMOUNT_TOKEN_MIN = web3.utils.toWei('0', 'ether') -const AMOUNT_TOKEN_ETH = web3.utils.toWei('3', 'ether') -const AMOUNT_ETH_MIN = web3.utils.toWei('1', 'ether') +const AMOUNT_TOKEN_DESIRED = web3.utils.toWei('2.144', 'ether') +const AMOUNT_TOKEN_MIN = web3.utils.toWei('2.144', 'ether') +const AMOUNT_TOKEN_ETH = web3.utils.toWei('50', 'ether') +const AMOUNT_ETH_MIN = web3.utils.toWei('50', 'ether') //const DEX_ROUTER_ADDRESS = "0x05b0e01DD9737a3c0993de6F57B93253a6C3Ba95"//old router const DEX_ROUTER_ADDRESS = addressesConfig.DEX_ROUTER_ADDRESS diff --git a/scripts/units/helpers/constants.js b/scripts/units/helpers/constants.js index 583af10..48b749f 100644 --- a/scripts/units/helpers/constants.js +++ b/scripts/units/helpers/constants.js @@ -1,12 +1,13 @@ const SUBMIT_TRANSACTION_EVENT = "SubmitTransaction(uint256,address,address,uint256,bytes)"; const EMPTY_BYTES = '0x0000000000000000000000000000000000000000000000000000000000000000'; - +const NULL_ADDRESS = '0x0000000000000000000000000000000000000000' // Update the PATH_TO_ADDRESSES based on the NODE_ENV environment variable const env = process.env.NODE_ENV || 'dev'; const PATH_TO_ADDRESSES = `../../addresses.${env}.json`; const PATH_TO_ADDRESSES_FOR_DEX_FOLDER = `../../../config/config.${env}` const PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER = `../../../../config/config.${env}` const PATH_TO_NEWLY_GENERATED_TRANSACTION_INDEX = `./config/newly-generated-transaction-index.${env}.json`; +const PATH_TO_ADDRESSES_FOR_STAKING_POSITION_FOLDER = `../../../addresses.staking-position.${env}.json`; module.exports = { SUBMIT_TRANSACTION_EVENT, @@ -14,5 +15,7 @@ module.exports = { PATH_TO_ADDRESSES, PATH_TO_NEWLY_GENERATED_TRANSACTION_INDEX, PATH_TO_ADDRESSES_FOR_DEX_FOLDER, - PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER + PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER, + PATH_TO_ADDRESSES_FOR_STAKING_POSITION_FOLDER, + NULL_ADDRESS } diff --git a/scripts/units/helpers/submitAndExecuteTransaction.js b/scripts/units/helpers/submitAndExecuteTransaction.js index f9c1201..ba32dce 100644 --- a/scripts/units/helpers/submitAndExecuteTransaction.js +++ b/scripts/units/helpers/submitAndExecuteTransaction.js @@ -27,7 +27,8 @@ const createTransactionObject = (TransactionName, tx, resultSubmitTransaction, r }; return transactionObject; } - +//@note: We can use this to generate encoded function as required +//@note: To do it comment out this line: await _submitExecuteAndSaveTransaction(); async function submitAndExecute(encodedFunction, targetAddress, TransactionName, ETH_AMOUNT=0, shouldExecute = true) { const MULTISIG_WALLET_ADDRESS = addresses.multiSigWallet; @@ -66,6 +67,7 @@ async function submitAndExecute(encodedFunction, targetAddress, TransactionName, console.log(`Transaction executed successfully for ${TransactionName}. TxHash: ${resultExecuteTransaction.transactionHash}`); } } + console.log(`encoded function for the transaction --${TransactionName} is: ${encodedFunction}`) return createTransactionObject(TransactionName, tx, resultSubmitTransaction, resultConfirmTransaction, resultExecuteTransaction); } @@ -79,7 +81,9 @@ async function submitAndExecute(encodedFunction, targetAddress, TransactionName, transactionObject.confirmationTransactionHash, transactionObject.executeTransactionHash) } + console.log(`encoded function for the transaction --${TransactionName} is: ${encodedFunction}`) + //@note: comment out this line: await _submitExecuteAndSaveTransaction(); to only have console of the encodings await _submitExecuteAndSaveTransaction(); } diff --git a/scripts/units/stablecoin/adapter/collateral-token-adapter-whitelist.js b/scripts/units/stablecoin/adapter/collateral-token-adapter-whitelist.js new file mode 100644 index 0000000..4ed26b1 --- /dev/null +++ b/scripts/units/stablecoin/adapter/collateral-token-adapter-whitelist.js @@ -0,0 +1,29 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) +const COLLATERAL_TOKEN_ADAPTER_ADDRESS =addressesConfig.COLLATERAL_TOKEN_ADAPTER_ADDRESS +const toBeWhitelisted = "" +const _encodeAddToWhitelist = (toBeWhitelisted) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'whitelist', + type: 'function', + inputs: [{ + type: 'address', + name: 'toBeWhitelisted' + }] + }, [toBeWhitelisted]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeAddToWhitelist(toBeWhitelisted), + COLLATERAL_TOKEN_ADAPTER_ADDRESS, + "WhitelistCollateralTokenAdapter" + ) +} diff --git a/scripts/units/stablecoin/adapter/withdraw-collateral-token-adapter.js b/scripts/units/stablecoin/adapter/withdraw-collateral-token-adapter.js new file mode 100644 index 0000000..e807b63 --- /dev/null +++ b/scripts/units/stablecoin/adapter/withdraw-collateral-token-adapter.js @@ -0,0 +1,35 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) +const COLLATERAL_TOKEN_ADAPTER_ADDRESS =addressesConfig.COLLATERAL_TOKEN_ADAPTER_ADDRESS +const _amount = web3.utils.toWei("100000","wei") +const _usr = "" +const _encodeWithdraw = (_usr, _amount) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'withdraw', + type: 'function', + inputs: [{ + type: 'address', + name: '_usr' + }, { + type: 'uint256', + name: '_amount' + },{ + type: 'bytes' + }] + }, [_usr,_amount]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeWithdraw(_usr,_amount), + COLLATERAL_TOKEN_ADAPTER_ADDRESS, + "WithdrawCollateralTokenAdapter" + ) +} diff --git a/scripts/units/stablecoin/adapter/withdraw-stablecoin-adapter.js b/scripts/units/stablecoin/adapter/withdraw-stablecoin-adapter.js new file mode 100644 index 0000000..92fc2d3 --- /dev/null +++ b/scripts/units/stablecoin/adapter/withdraw-stablecoin-adapter.js @@ -0,0 +1,36 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) +const BOOK_KEEPER_ADDRESS =addressesConfig.BOOK_KEEPER_ADDRESS +const STABLE_COIN_ADAPTER_ADDRESS =addressesConfig.STABLE_COIN_ADAPTER_ADDRESS +const wad = web3.utils.toWei("100000","wei") +const usr = "" +const _encodeWithdraw = (usr, wad) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'withdraw', + type: 'function', + inputs: [{ + type: 'address', + name: 'usr' + }, { + type: 'uint256', + name: 'wad' + },{ + type: 'bytes' + }] + }, [usr,wad]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeWithdraw(usr,wad), + STABLE_COIN_ADAPTER_ADDRESS, + "WithdrawStablecoinAdapter" + ) +} diff --git a/scripts/units/stablecoin/book-keeper/allowlist-bookkeeper.js b/scripts/units/stablecoin/book-keeper/allowlist-bookkeeper.js index fffa4e6..565292a 100644 --- a/scripts/units/stablecoin/book-keeper/allowlist-bookkeeper.js +++ b/scripts/units/stablecoin/book-keeper/allowlist-bookkeeper.js @@ -27,4 +27,4 @@ module.exports = async function(deployer) { BOOK_KEEPER_ADDRESS, "setAllowlistedAddressBookkeeper" ) -} \ No newline at end of file +} diff --git a/scripts/units/stablecoin/book-keeper/set-access-collateral-config.js b/scripts/units/stablecoin/book-keeper/set-access-collateral-config.js new file mode 100644 index 0000000..369dc18 --- /dev/null +++ b/scripts/units/stablecoin/book-keeper/set-access-collateral-config.js @@ -0,0 +1,30 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) + +const BOOK_KEEPER_ADDRESS =addressesConfig.BOOK_KEEPER_ADDRESS +const AccessControlConfig = "" +const _encodeSetAccessControlConfig = (_accessControlConfig) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'setAccessControlConfig', + type: 'function', + inputs: [{ + type: 'address', + name: '_accessControlConfig' + }] + }, [_accessControlConfig]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeSetAccessControlConfig(AccessControlConfig), + BOOK_KEEPER_ADDRESS, + "setAccessControlConfig" + ) +} diff --git a/scripts/units/stablecoin/book-keeper/set-collateral-pool-config.js b/scripts/units/stablecoin/book-keeper/set-collateral-pool-config.js new file mode 100644 index 0000000..68e0d85 --- /dev/null +++ b/scripts/units/stablecoin/book-keeper/set-collateral-pool-config.js @@ -0,0 +1,30 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) + +const BOOK_KEEPER_ADDRESS =addressesConfig.BOOK_KEEPER_ADDRESS +const CollateralPoolConfig = "" +const _encodeSetCollateralPoolConfig = (_collateralPoolConfig) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'setCollateralPoolConfig', + type: 'function', + inputs: [{ + type: 'address', + name: '_collateralPoolConfig' + }] + }, [_collateralPoolConfig]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeSetCollateralPoolConfig(CollateralPoolConfig), + BOOK_KEEPER_ADDRESS, + "setCollateralPoolConfig" + ) +} \ No newline at end of file diff --git a/scripts/units/stablecoin/book-keeper/set-total-debt-ceiling.js b/scripts/units/stablecoin/book-keeper/set-total-debt-ceiling.js new file mode 100644 index 0000000..f2730e4 --- /dev/null +++ b/scripts/units/stablecoin/book-keeper/set-total-debt-ceiling.js @@ -0,0 +1,30 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) + +const BOOK_KEEPER_ADDRESS =addressesConfig.BOOK_KEEPER_ADDRESS +const TOTAL_DEBT_CEILING = web3.utils.toWei("1000000000000000000000000000","wei") +const _encodeSetTotalDebtCeiling = (totalDebtCeiling) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'setTotalDebtCeiling', + type: 'function', + inputs: [{ + type: 'uint256', + name: '_totalDebtCeiling' + }] + }, [totalDebtCeiling]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeSetTotalDebtCeiling(TOTAL_DEBT_CEILING), + BOOK_KEEPER_ADDRESS, + "setTotalDebtCeiling" + ) +} diff --git a/scripts/units/stablecoin/collateral-pool-config/set-debt-ceiling.js b/scripts/units/stablecoin/collateral-pool-config/set-debt-ceiling.js index 6017796..9f3aff9 100644 --- a/scripts/units/stablecoin/collateral-pool-config/set-debt-ceiling.js +++ b/scripts/units/stablecoin/collateral-pool-config/set-debt-ceiling.js @@ -3,8 +3,8 @@ const txnHelper = require('../../helpers/submitAndExecuteTransaction') const constants = require('../../helpers/constants') const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) -const COLLATERAL_POOL_ID = '0x5844430000000000000000000000000000000000000000000000000000000000' -const DEBT_CEILING = web3.utils.toWei('3999999999999999986441897348723255952923416883888128','wei') +const COLLATERAL_POOL_ID = '' +const DEBT_CEILING = '' const COLLATERAL_POOL_CONFIG_ADDRESS =addressesConfig.COLLATERAL_POOL_CONFIG_ADDRESS const _encodeSetDebtCeiling = (_collateralPoolId, _debtCeiling) => { let toRet = web3.eth.abi.encodeFunctionCall({ diff --git a/scripts/units/stablecoin/delay-fathom-oracle-price-feed/delay-price-feed-pause.js b/scripts/units/stablecoin/delay-fathom-oracle-price-feed/delay-price-feed-pause.js index 1fe9287..e9d0fbe 100644 --- a/scripts/units/stablecoin/delay-fathom-oracle-price-feed/delay-price-feed-pause.js +++ b/scripts/units/stablecoin/delay-fathom-oracle-price-feed/delay-price-feed-pause.js @@ -23,4 +23,7 @@ module.exports = async function(deployer) { DELAY_FATHOM_ORACLE_PRICE_FEED_ADDRESS, "pausePriceFeed" ) -} \ No newline at end of file +} + +//TODO: +//PRICE PLUGIN, FEED \ No newline at end of file diff --git a/scripts/units/stablecoin/delay-fathom-oracle-price-feed/set-pool-id.js b/scripts/units/stablecoin/delay-fathom-oracle-price-feed/set-pool-id.js new file mode 100644 index 0000000..a634380 --- /dev/null +++ b/scripts/units/stablecoin/delay-fathom-oracle-price-feed/set-pool-id.js @@ -0,0 +1,31 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) + +const POOL_ID = '' +const DELAY_FATHOM_ORACLE_PRICE_FEED_ADDRESS =addressesConfig.DELAY_FATHOM_ORACLE_PRICE_FEED_ADDRESS + +const _encodeSetPoolId = (_poolId) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'setPoolId', + type: 'function', + inputs: [{ + type: 'bytes32', + name: '_poolId' + }] + }, [_poolId]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeSetPoolId(POOL_ID), + DELAY_FATHOM_ORACLE_PRICE_FEED_ADDRESS, + "setPoolId" + ) +} \ No newline at end of file diff --git a/scripts/units/stablecoin/fathom-stablecoin/stablecoin.js b/scripts/units/stablecoin/fathom-stablecoin/stablecoin.js deleted file mode 100644 index 836f430..0000000 --- a/scripts/units/stablecoin/fathom-stablecoin/stablecoin.js +++ /dev/null @@ -1,38 +0,0 @@ -const fs = require('fs'); - - -const txnHelper = require('../../helpers/submitAndExecuteTransaction') - -const constants = require('../../helpers/constants') -const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) - -const STABLECOIN_ADDRESS = "0xa585BF9418C6Aca0a46d308Cea3b2EC85046C88F" - -const _encodeRenameFunction = (_name, _symbol) => { - let toInitializeMainStream = web3.eth.abi.encodeFunctionCall({ - name: 'rename', - type: 'function', - inputs: [{ - type: 'string', - name: '_name' - }, - { - type: 'string', - name: '_symbol' - }] - }, ["Subik", "Ji"]); - - return toInitializeMainStream -} - - -module.exports = async function(deployer) { - await txnHelper.submitAndExecute( - _encodeRenameFunction( - "Subik", - "Ji" - ), - STABLECOIN_ADDRESS, - "stablecoinUpdateRename" - ) -} \ No newline at end of file diff --git a/scripts/units/stablecoin/position-manager/set-bookkeeper.js b/scripts/units/stablecoin/position-manager/set-bookkeeper.js new file mode 100644 index 0000000..0b5bf27 --- /dev/null +++ b/scripts/units/stablecoin/position-manager/set-bookkeeper.js @@ -0,0 +1,31 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) + +const BOOKKEEPER = "" +const POSITION_MANAGER_ADDRESS =addressesConfig.POSITION_MANAGER_ADDRESS + +const _encodeSetBookkeeper = (_bookkeeper) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'setBookKeeper', + type: 'function', + inputs: [{ + type: 'address', + name: '_bookkeeper' + }] + }, [_bookkeeper]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeSetBookkeeper(BOOKKEEPER), + POSITION_MANAGER_ADDRESS, + "setBookeeper-Position-manager" + ) +} \ No newline at end of file diff --git a/scripts/units/stablecoin/price-oracle/set-bookkeeper.js b/scripts/units/stablecoin/price-oracle/set-bookkeeper.js new file mode 100644 index 0000000..6327e67 --- /dev/null +++ b/scripts/units/stablecoin/price-oracle/set-bookkeeper.js @@ -0,0 +1,30 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) + +const PRICE_ORACLE_ADDRESS =addressesConfig.PRICE_ORACLE_ADDRESS +const BOOKKEEPER = '' +const _encodeSetPrice = (_bookkeeper) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'setBookKeeper', + type: 'function', + inputs: [{ + type: 'address', + name: '_bookKeeper' + }] + }, [_bookkeeper]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeSetPrice(BOOKKEEPER), + PRICE_ORACLE_ADDRESS, + "set-bookkeeper-PriceOracle" + ) +} \ No newline at end of file diff --git a/scripts/units/stablecoin/proxy-wallet-registry/add-to-whitelist.js b/scripts/units/stablecoin/proxy-wallet-registry/add-to-whitelist.js new file mode 100644 index 0000000..b20de0a --- /dev/null +++ b/scripts/units/stablecoin/proxy-wallet-registry/add-to-whitelist.js @@ -0,0 +1,30 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) + +const PROXY_WALLET_REGISTRY_ADDRESS =addressesConfig.PROXY_WALLET_REGISTRY_ADDRESS +const WHITELIST_ADDRESS = "" +const _encodeAddToWhitelist = (_usr) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'addToWhitelist', + type: 'function', + inputs: [{ + type: 'address', + name: '_usr' + }] + }, [_usr]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeAddToWhitelist(WHITELIST_ADDRESS), + PROXY_WALLET_REGISTRY_ADDRESS, + "set whitelist-proxy-wallet-registry" + ) +} \ No newline at end of file diff --git a/scripts/units/stablecoin/proxy-wallet-registry/remove-from-whitelist.js b/scripts/units/stablecoin/proxy-wallet-registry/remove-from-whitelist.js new file mode 100644 index 0000000..5b492bb --- /dev/null +++ b/scripts/units/stablecoin/proxy-wallet-registry/remove-from-whitelist.js @@ -0,0 +1,30 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) + +const PROXY_WALLET_REGISTRY_ADDRESS =addressesConfig.PROXY_WALLET_REGISTRY_ADDRESS +const WHITELIST_ADDRESS = "" +const _encodeRemoveFromWhitelist = (_usr) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'removeFromWhitelist', + type: 'function', + inputs: [{ + type: 'address', + name: '_usr' + }] + }, [_usr]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeRemoveFromWhitelist(WHITELIST_ADDRESS), + PROXY_WALLET_REGISTRY_ADDRESS, + "remove whitelist-proxy-wallet-registry" + ) +} \ No newline at end of file diff --git a/scripts/units/stablecoin/proxy-wallet-registry/set-decentralized-mode.js b/scripts/units/stablecoin/proxy-wallet-registry/set-decentralized-mode.js new file mode 100644 index 0000000..2a046f4 --- /dev/null +++ b/scripts/units/stablecoin/proxy-wallet-registry/set-decentralized-mode.js @@ -0,0 +1,30 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) + +const PROXY_WALLET_REGISTRY_ADDRESS =addressesConfig.PROXY_WALLET_REGISTRY_ADDRESS +const isOn = true +const _encodeSetIsDecentralizedState = (isOn) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'setDecentralizedMode', + type: 'function', + inputs: [{ + type: 'bool', + name: 'isOn' + }] + }, [isOn]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeSetIsDecentralizedState(isOn), + PROXY_WALLET_REGISTRY_ADDRESS, + "set-decentralized-mode" + ) +} \ No newline at end of file diff --git a/scripts/units/stablecoin/stability-fee-collector/stability-fee-pause.js b/scripts/units/stablecoin/stability-fee-collector/stability-fee-pause.js index b22ace7..feae48a 100644 --- a/scripts/units/stablecoin/stability-fee-collector/stability-fee-pause.js +++ b/scripts/units/stablecoin/stability-fee-collector/stability-fee-pause.js @@ -23,4 +23,4 @@ module.exports = async function(deployer) { STABILITY_FEE_COLLECTOR_ADDRESS, "pauseStabilityFeeCollector" ) -} \ No newline at end of file +} diff --git a/scripts/units/stablecoin/stableswap/remove-from-whitelist.js b/scripts/units/stablecoin/stableswap/remove-from-whitelist.js new file mode 100644 index 0000000..ebb09a3 --- /dev/null +++ b/scripts/units/stablecoin/stableswap/remove-from-whitelist.js @@ -0,0 +1,29 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) + +const whitelistAddress = "0x2B3691065A78F5fb02E9BF54A197b95da2B26AF7" +const STABLE_SWAP_ADDRESS =addressesConfig.STABLE_SWAP_ADDRESS + +const _encodeRemoveFromWhitelist = (_whitelistAddress) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'addToWhitelist', + type: 'function', + inputs: [{ + type: 'address', + name: '_user' + }] + }, [_whitelistAddress]); + + return toRet; +} + +module.exports = async function(deployer) { + await txnHelper.submitAndExecute( + _encodeRemoveFromWhitelist(whitelistAddress), + STABLE_SWAP_ADDRESS, + "Remove-from-whitelist-Stableswap" + ) +} \ No newline at end of file diff --git a/scripts/units/stablecoin/stableswap/set-is-decentralized-state.js b/scripts/units/stablecoin/stableswap/set-is-decentralized-state.js new file mode 100644 index 0000000..66cf87c --- /dev/null +++ b/scripts/units/stablecoin/stableswap/set-is-decentralized-state.js @@ -0,0 +1,28 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) +const isDecentralizedState = true +const STABLE_SWAP_ADDRESS = addressesConfig.STABLE_SWAP_ADDRESS + +const _encodeSetIsDecentralizedState = (_isDecentralizedState) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'setIsDecentralizedState', + type: 'function', + inputs: [{ + type: 'bool', + name: '_isDecentralizedState' + }] + }, [_isDecentralizedState]); + + return toRet; +} + +module.exports = async function(deployer) { + await txnHelper.submitAndExecute( + _encodeSetIsDecentralizedState(isDecentralizedState), + STABLE_SWAP_ADDRESS, + "set Is Decentralized State" + ) +} \ No newline at end of file diff --git a/scripts/units/stablecoin/system-debt-engine/withdraw-collateral-surplus.js b/scripts/units/stablecoin/system-debt-engine/withdraw-collateral-surplus.js index bbae61f..54174ec 100644 --- a/scripts/units/stablecoin/system-debt-engine/withdraw-collateral-surplus.js +++ b/scripts/units/stablecoin/system-debt-engine/withdraw-collateral-surplus.js @@ -9,9 +9,10 @@ const COLLATERAL_POOL_ID = '' const ADAPTER = '' const TO = '' const AMOUNT = web3.utils.toWei('1','ether'); + const _encodeWithdrawCollateralSurplus = (_collateralPoolId,_adapter,_to,_amount) => { let toRet = web3.eth.abi.encodeFunctionCall({ - name: 'setBookKeeper', + name: 'withdrawCollateralSurplus', type: 'function', inputs: [{ type: 'bytes32', diff --git a/scripts/units/transfer-ownership.js b/scripts/units/transfer-ownership.js new file mode 100644 index 0000000..083f376 --- /dev/null +++ b/scripts/units/transfer-ownership.js @@ -0,0 +1,32 @@ +const fs = require('fs'); +const constants = require('./helpers/constants') + + +const txnHelper = require('./helpers/submitAndExecuteTransaction') + +//RIGHT NOW SETUP FOR STAKING +const PROXY_ADMIN = "0xB7a8f3A8178B21499b56d9d054119821953d2C3f"//SET AS NECESSARY +const newOwner = ""//SET AS NECESSARY +const _encodeTransferOwnership = (newOwner) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'transferOwnership', + type: 'function', + inputs: [{ + type: 'address', + name: 'newOwner' + }] + }, [newOwner]); + + return toRet; +} + + +module.exports = async function(deployer) { + await txnHelper.submitAndExecute( + _encodeTransferOwnership( + newOwner + ), + PROXY_ADMIN, + "transferOwnership" + ) +} \ No newline at end of file From 57c70f14689352547a52224a7beae09d6ed853a4 Mon Sep 17 00:00:00 2001 From: ssubik Date: Tue, 25 Jul 2023 13:40:45 +0545 Subject: [PATCH 06/10] multisig-scripts for wrapper --- coralX-scenarios.js | 7 --- package.json | 5 -- .../test/9_staking_position_setup.js | 53 ---------------- scripts/units/helpers/create-config-QA.js | 1 + scripts/units/helpers/create-config-demo.js | 1 + scripts/units/helpers/create-config-dev.js | 1 + scripts/units/helpers/create-config-prod.js | 1 + .../add-to-whitelist.js} | 18 +++--- .../stableswap-wrapper/deposit-token.js | 62 +++++++++++++++++++ .../stableswap-wrapper/emergency-withdraw.js | 26 ++++++++ .../remove-from-whitelist.js | 29 +++++++++ .../set-is-decentralized-state.js | 28 +++++++++ .../stableswap-wrapper-pause.js | 26 ++++++++ .../stableswap-wrapper-unpause.js | 26 ++++++++ 14 files changed, 210 insertions(+), 74 deletions(-) delete mode 100644 scripts/migrations/test/9_staking_position_setup.js rename scripts/units/stablecoin/{stableswap/withdraw-fees.js => stableswap-wrapper/add-to-whitelist.js} (53%) create mode 100644 scripts/units/stablecoin/stableswap-wrapper/deposit-token.js create mode 100644 scripts/units/stablecoin/stableswap-wrapper/emergency-withdraw.js create mode 100644 scripts/units/stablecoin/stableswap-wrapper/remove-from-whitelist.js create mode 100644 scripts/units/stablecoin/stableswap-wrapper/set-is-decentralized-state.js create mode 100644 scripts/units/stablecoin/stableswap-wrapper/stableswap-wrapper-pause.js create mode 100644 scripts/units/stablecoin/stableswap-wrapper/stableswap-wrapper-unpause.js diff --git a/coralX-scenarios.js b/coralX-scenarios.js index d65ddba..91734f2 100644 --- a/coralX-scenarios.js +++ b/coralX-scenarios.js @@ -22,13 +22,6 @@ module.exports = { ['execute', '--path', 'scripts/migrations/save-address/3_save_address_prod.js', '--network', 'xdc'] ], - deployApothemStakingPosition: [ - ['execute', '--path', 'scripts/migrations/deploy-staking-position', '--network', 'apothem'], - ], - - deployXDCtakingPosition: [ - ['execute', '--path', 'scripts/migrations/deploy-staking-position', '--network', 'xdc'] - ], deployUpgradedStakingContractApothem: [ ['execute', '--path', 'scripts/migrations/deploy-new-staking-package', '--network', 'apothem'], ], diff --git a/package.json b/package.json index 70c2d3c..ff5d0ff 100644 --- a/package.json +++ b/package.json @@ -20,11 +20,6 @@ "migrate-reset-apothem-qa": "export NODE_ENV=qa && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployApothem", "migrate-reset-xdc": "export NODE_ENV=prod && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployXDC", - "migrate-reset-staking-position-apothem-dev": "export NODE_ENV=dev && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployApothemStakingPosition", - "migrate-reset-staking-position-apothem-qa": "export NODE_ENV=qa && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployApothemStakingPosition", - "migrate-reset-staking-position-apothem-demo": "export NODE_ENV=demo && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployApothemStakingPosition", - "migrate-reset-staking-position-xdc": "export NODE_ENV=prod && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployXDCtakingPosition", - "migrate-reset-staking-upgrade-apothem-dev": "export NODE_ENV=dev && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployUpgradedStakingContractApothem", "migrate-reset-staking-upgrade-apothem-demo": "export NODE_ENV=demo && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployUpgradedStakingContractApothem", "migrate-reset-staking-upgrade-apothem-qa": "export NODE_ENV=qa && rm -rf build/contracts && rm -rf build/job-logs && coralX compile && coralX scenario --run deployUpgradedStakingContractApothem", diff --git a/scripts/migrations/test/9_staking_position_setup.js b/scripts/migrations/test/9_staking_position_setup.js deleted file mode 100644 index 535b2f7..0000000 --- a/scripts/migrations/test/9_staking_position_setup.js +++ /dev/null @@ -1,53 +0,0 @@ -const StakingPositionFactory = artifacts.require("./dao/staking/staking-position/StakingPositionFactory.sol"); -const MultiSigWallet = artifacts.require("./dao/treasury/MultiSigWallet.sol"); -const StakingProxy = artifacts.require('./common/proxy/StakingProxy.sol') -const MainToken = artifacts.require("./dao/tokens/MainToken.sol"); -const StakingPositionFactoryProxyAdmin = artifacts.require("./dao/staking/staking-position/proxy/StakingPositionFactoryProxyAdmin.sol") -const StakingPositionFactoryProxy = artifacts.require("./dao/staking/staking-position/proxy/StakingPositionFactoryProxy.sol") -const VMainToken = artifacts.require('./dao/tokens/VMainToken.sol'); - -module.exports = async function(deployer) { - - await deployer.deploy( - StakingPositionFactoryProxyAdmin, {gas: 8000000} - ) - - let toInitialize = web3.eth.abi.encodeFunctionCall({ - name: 'initialize', - type: 'function', - inputs: [{ - type: 'address', - name: '_admin' - }, - { - type: 'address', - name: '_stakingContract' - }, - { - type: 'address', - name: '_mainToken' - }, - { - type: 'address', - name: '_voteToken' - }, - { - type: 'address', - name: '_proxyAdmin' - } - ] - }, [ - MultiSigWallet.address, - StakingProxy.address, - MainToken.address, - VMainToken.address, - StakingPositionFactoryProxyAdmin.address - ]) - - await deployer.deploy( - StakingPositionFactoryProxy, - StakingPositionFactory.address, - StakingPositionFactoryProxyAdmin.address, - toInitialize, - {gas:8000000}); -} \ No newline at end of file diff --git a/scripts/units/helpers/create-config-QA.js b/scripts/units/helpers/create-config-QA.js index b71b199..ead7266 100644 --- a/scripts/units/helpers/create-config-QA.js +++ b/scripts/units/helpers/create-config-QA.js @@ -33,6 +33,7 @@ else COLLATERAL_POOL_CONFIG_ADDRESS: "", DEX_FACTORY_ADDRESS: "", WETH_ADDRESS: "", + STABLE_SWAP_WRAPPER_ADDRESS:"", COUNCIL_1:"", COUNCIL_2:"", COUNCIL_3:"" diff --git a/scripts/units/helpers/create-config-demo.js b/scripts/units/helpers/create-config-demo.js index 3797ef9..80fbca0 100644 --- a/scripts/units/helpers/create-config-demo.js +++ b/scripts/units/helpers/create-config-demo.js @@ -33,6 +33,7 @@ else COLLATERAL_POOL_CONFIG_ADDRESS: "", DEX_FACTORY_ADDRESS: "", WETH_ADDRESS: "", + STABLE_SWAP_WRAPPER_ADDRESS:"", COUNCIL_1:"", COUNCIL_2:"", COUNCIL_3:"" diff --git a/scripts/units/helpers/create-config-dev.js b/scripts/units/helpers/create-config-dev.js index aaf4333..7627854 100644 --- a/scripts/units/helpers/create-config-dev.js +++ b/scripts/units/helpers/create-config-dev.js @@ -34,6 +34,7 @@ else COLLATERAL_POOL_CONFIG_ADDRESS: "", DEX_FACTORY_ADDRESS: "", WETH_ADDRESS: "", + STABLE_SWAP_WRAPPER_ADDRESS:"", COUNCIL_1:"", COUNCIL_2:"", COUNCIL_3:"" diff --git a/scripts/units/helpers/create-config-prod.js b/scripts/units/helpers/create-config-prod.js index 4346941..0bcc2d6 100644 --- a/scripts/units/helpers/create-config-prod.js +++ b/scripts/units/helpers/create-config-prod.js @@ -33,6 +33,7 @@ else COLLATERAL_POOL_CONFIG_ADDRESS: "", DEX_FACTORY_ADDRESS: "", WETH_ADDRESS: "", + STABLE_SWAP_WRAPPER_ADDRESS:"", COUNCIL_1:"", COUNCIL_2:"", COUNCIL_3:"" diff --git a/scripts/units/stablecoin/stableswap/withdraw-fees.js b/scripts/units/stablecoin/stableswap-wrapper/add-to-whitelist.js similarity index 53% rename from scripts/units/stablecoin/stableswap/withdraw-fees.js rename to scripts/units/stablecoin/stableswap-wrapper/add-to-whitelist.js index 0e414b9..8d3260d 100644 --- a/scripts/units/stablecoin/stableswap/withdraw-fees.js +++ b/scripts/units/stablecoin/stableswap-wrapper/add-to-whitelist.js @@ -4,26 +4,26 @@ const txnHelper = require('../../helpers/submitAndExecuteTransaction') const constants = require('../../helpers/constants') const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) -const _destination = "" -const STABLE_SWAP_ADDRESS =addressesConfig.STABLE_SWAP_ADDRESS +const whitelistAddress = "0x2B3691065A78F5fb02E9BF54A197b95da2B26AF7" +const STABLE_SWAP_WRAPPER_ADDRESS =addressesConfig.STABLE_SWAP_WRAPPER_ADDRESS -const _encodeWithdrawFees = (_destination) => { +const _encodeAddToWhitelist = (_whitelistAddress) => { let toRet = web3.eth.abi.encodeFunctionCall({ - name: 'withdrawFees', + name: 'addToWhitelist', type: 'function', inputs: [{ type: 'address', - name: '_destination' + name: '_user' }] - }, [_destination]); + }, [_whitelistAddress]); return toRet; } module.exports = async function(deployer) { await txnHelper.submitAndExecute( - _encodeWithdrawFees(_destination), - STABLE_SWAP_ADDRESS, - "StableswapWithdrawFees" + _encodeAddToWhitelist(whitelistAddress), + STABLE_SWAP_WRAPPER_ADDRESS, + "Add-To-Whitelist-Stableswap-wrapper" ) } \ No newline at end of file diff --git a/scripts/units/stablecoin/stableswap-wrapper/deposit-token.js b/scripts/units/stablecoin/stableswap-wrapper/deposit-token.js new file mode 100644 index 0000000..6cd626d --- /dev/null +++ b/scripts/units/stablecoin/stableswap-wrapper/deposit-token.js @@ -0,0 +1,62 @@ + +const constants = require('../../helpers/constants') +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) + +const STABLE_SWAP_WRAPPER_ADDRESS = addressesConfig.STABLE_SWAP_WRAPPER_ADDRESS +const TokenAddress = addressesConfig.USD_ADDRESS +const FXDAddress = addressesConfig.FXD_ADDRESS +//const STABLE_SWAP_WRAPPER_ADDRESS = ""; +const TokenDepositAmount = web3.utils.toWei('10000','ether') +// const USDAddress = "" +// const FXDAddress = "" +const _encodeApproveFunction = (_account, _amount) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'approve', + type: 'function', + inputs: [{ + type: 'address', + name: 'spender' + },{ + type: 'uint256', + name: 'amount' + }] + }, [_account, _amount]); + + return toRet; +} + +const _encodeDepositFunction = (_amount) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'depositTokens', + type: 'function', + inputs: [{ + type: 'uint256', + name: '_amount' + }] + }, [_amount]); + + return toRet; +} + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeApproveFunction(STABLE_SWAP_WRAPPER_ADDRESS,TokenDepositAmount), + TokenAddress, + "ApproveStableSwapWrapperToken" + ) + + await txnHelper.submitAndExecute( + _encodeApproveFunction(STABLE_SWAP_WRAPPER_ADDRESS,TokenDepositAmount), + FXDAddress, + "ApproveStableSwapWrapperToken" + ) + + await txnHelper.submitAndExecute( + _encodeDepositFunction(TokenDepositAmount), + STABLE_SWAP_WRAPPER_ADDRESS, + "DepositToStableswapWrapper" + ) +} diff --git a/scripts/units/stablecoin/stableswap-wrapper/emergency-withdraw.js b/scripts/units/stablecoin/stableswap-wrapper/emergency-withdraw.js new file mode 100644 index 0000000..8205d86 --- /dev/null +++ b/scripts/units/stablecoin/stableswap-wrapper/emergency-withdraw.js @@ -0,0 +1,26 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) + +const ACCOUNT_DESTINATION = "" +const STABLE_SWAP_WRAPPER_ADDRESS =addressesConfig.STABLE_SWAP_WRAPPER_ADDRESS + +const _encodeEmergencyWithdraw = (_destination) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'emergencyWithdraw', + type: 'function', + inputs: [] + }, []); + + return toRet; +} + +module.exports = async function(deployer) { + await txnHelper.submitAndExecute( + _encodeEmergencyWithdraw(), + STABLE_SWAP_WRAPPER_ADDRESS, + "StableswapWrapperEmergencyWithdraw" + ) +} \ No newline at end of file diff --git a/scripts/units/stablecoin/stableswap-wrapper/remove-from-whitelist.js b/scripts/units/stablecoin/stableswap-wrapper/remove-from-whitelist.js new file mode 100644 index 0000000..e2f7c4a --- /dev/null +++ b/scripts/units/stablecoin/stableswap-wrapper/remove-from-whitelist.js @@ -0,0 +1,29 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) + +const whitelistAddress = "0x2B3691065A78F5fb02E9BF54A197b95da2B26AF7" +const STABLE_SWAP_WRAPPER_ADDRESS =addressesConfig.STABLE_SWAP_WRAPPER_ADDRESS + +const _encodeRemoveFromWhitelist = (_whitelistAddress) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'removeFromWhitelist', + type: 'function', + inputs: [{ + type: 'address', + name: '_user' + }] + }, [_whitelistAddress]); + + return toRet; +} + +module.exports = async function(deployer) { + await txnHelper.submitAndExecute( + _encodeRemoveFromWhitelist(whitelistAddress), + STABLE_SWAP_WRAPPER_ADDRESS, + "Remove-from-whitelist-Stableswap-Wrapper" + ) +} \ No newline at end of file diff --git a/scripts/units/stablecoin/stableswap-wrapper/set-is-decentralized-state.js b/scripts/units/stablecoin/stableswap-wrapper/set-is-decentralized-state.js new file mode 100644 index 0000000..88b6856 --- /dev/null +++ b/scripts/units/stablecoin/stableswap-wrapper/set-is-decentralized-state.js @@ -0,0 +1,28 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) +const isDecentralizedState = true +const STABLE_SWAP_WRAPPER_ADDRESS = addressesConfig.STABLE_SWAP_WRAPPER_ADDRESS + +const _encodeSetIsDecentralizedState = (_isDecentralizedState) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'setIsDecentralizedState', + type: 'function', + inputs: [{ + type: 'bool', + name: '_isDecentralizedState' + }] + }, [_isDecentralizedState]); + + return toRet; +} + +module.exports = async function(deployer) { + await txnHelper.submitAndExecute( + _encodeSetIsDecentralizedState(isDecentralizedState), + STABLE_SWAP_WRAPPER_ADDRESS, + "set Is Decentralized State-wrapper" + ) +} \ No newline at end of file diff --git a/scripts/units/stablecoin/stableswap-wrapper/stableswap-wrapper-pause.js b/scripts/units/stablecoin/stableswap-wrapper/stableswap-wrapper-pause.js new file mode 100644 index 0000000..5856e78 --- /dev/null +++ b/scripts/units/stablecoin/stableswap-wrapper/stableswap-wrapper-pause.js @@ -0,0 +1,26 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) + +const STABLE_SWAP_WRAPPER_ADDRESS =addressesConfig.STABLE_SWAP_WRAPPER_ADDRESS + +const _encodePause = () => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'pause', + type: 'function', + inputs: [] + }, []); + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodePause(), + STABLE_SWAP_WRAPPER_ADDRESS, + "pauseStableSwapWrapper" + ) +} \ No newline at end of file diff --git a/scripts/units/stablecoin/stableswap-wrapper/stableswap-wrapper-unpause.js b/scripts/units/stablecoin/stableswap-wrapper/stableswap-wrapper-unpause.js new file mode 100644 index 0000000..7d78d37 --- /dev/null +++ b/scripts/units/stablecoin/stableswap-wrapper/stableswap-wrapper-unpause.js @@ -0,0 +1,26 @@ +const fs = require('fs'); +const txnHelper = require('../../helpers/submitAndExecuteTransaction') + +const constants = require('../../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) + +const STABLE_SWAP_WRAPPER_ADDRESS =addressesConfig.STABLE_SWAP_WRAPPER_ADDRESS + +const _encodeUnpause = () => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'unpause', + type: 'function', + inputs: [] + }, []); + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeUnpause(), + STABLE_SWAP_WRAPPER_ADDRESS, + "pauseStableSwapWrapper" + ) +} \ No newline at end of file From 4dc01429f388cf49f0e807ba5487ab30de79f373 Mon Sep 17 00:00:00 2001 From: ssubik Date: Tue, 25 Jul 2023 16:27:20 +0545 Subject: [PATCH 07/10] cage-cooldown-added for showstopper --- .../stablecoin/showstopper/cage-showstopper.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/units/stablecoin/showstopper/cage-showstopper.js b/scripts/units/stablecoin/showstopper/cage-showstopper.js index 6e974e9..0a0f757 100644 --- a/scripts/units/stablecoin/showstopper/cage-showstopper.js +++ b/scripts/units/stablecoin/showstopper/cage-showstopper.js @@ -6,12 +6,13 @@ const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDE const SHOW_STOPPER_ADDRESS =addressesConfig.SHOW_STOPPER_ADDRESS -const _encodeCage = () => { +const CAGE_COOL_DOWN = 100; +const _encodeCage = (_cageCoolDown) => { let toRet = web3.eth.abi.encodeFunctionCall({ name: 'cage', - type: 'function', - inputs: [] - }, []); + type: '_cageCoolDown', + inputs: [_cageCoolDown] + }, [_cageCoolDown]); return toRet; } @@ -19,8 +20,11 @@ const _encodeCage = () => { module.exports = async function(deployer) { await txnHelper.submitAndExecute( - _encodeCage(), + _encodeCage(CAGE_COOL_DOWN), SHOW_STOPPER_ADDRESS, "cageShowStopper" ) -} \ No newline at end of file +} + + +//function cage(uint256 _cageCoolDown) external onlyOwner { From 05b592d715eb705e240b4e3744705e21c6180551 Mon Sep 17 00:00:00 2001 From: ssubik Date: Tue, 25 Jul 2023 16:55:27 +0545 Subject: [PATCH 08/10] working on multisig scripts for staking --- scripts/units/helpers/create-config-QA.js | 2 ++ scripts/units/helpers/create-config-demo.js | 2 ++ scripts/units/helpers/create-config-dev.js | 2 ++ scripts/units/helpers/create-config-prod.js | 2 ++ .../showstopper/cage-showstopper.js | 2 +- .../staking/staking-max-lock-position.js | 32 +++++++++++++++++ .../staking/staking-set-min-lock-period.js | 31 ++++++++++++++++ .../staking/staking-set-treausury-address.js | 32 +++++++++++++++++ scripts/units/staking/staking-update-vault.js | 31 ++++++++++++++++ .../units/staking/staking-withdraw-penalty.js | 28 +++++++++++++++ .../staking/vault-add-supported-token.js | 31 ++++++++++++++++ scripts/units/staking/vault-migrate.js | 32 +++++++++++++++++ .../staking/vault-remove-supported-token.js | 31 ++++++++++++++++ .../vault-withdraw-extra-supported-token.js | 31 ++++++++++++++++ .../vault-withdraw-extra-unsupported-token.js | 36 +++++++++++++++++++ 15 files changed, 324 insertions(+), 1 deletion(-) create mode 100644 scripts/units/staking/staking-max-lock-position.js create mode 100644 scripts/units/staking/staking-set-min-lock-period.js create mode 100644 scripts/units/staking/staking-set-treausury-address.js create mode 100644 scripts/units/staking/staking-update-vault.js create mode 100644 scripts/units/staking/staking-withdraw-penalty.js create mode 100644 scripts/units/staking/vault-add-supported-token.js create mode 100644 scripts/units/staking/vault-migrate.js create mode 100644 scripts/units/staking/vault-remove-supported-token.js create mode 100644 scripts/units/staking/vault-withdraw-extra-supported-token.js create mode 100644 scripts/units/staking/vault-withdraw-extra-unsupported-token.js diff --git a/scripts/units/helpers/create-config-QA.js b/scripts/units/helpers/create-config-QA.js index ead7266..509c01d 100644 --- a/scripts/units/helpers/create-config-QA.js +++ b/scripts/units/helpers/create-config-QA.js @@ -34,6 +34,8 @@ else DEX_FACTORY_ADDRESS: "", WETH_ADDRESS: "", STABLE_SWAP_WRAPPER_ADDRESS:"", + STAKING_ADDRESS:"", + VAULT_ADDRESS:"", COUNCIL_1:"", COUNCIL_2:"", COUNCIL_3:"" diff --git a/scripts/units/helpers/create-config-demo.js b/scripts/units/helpers/create-config-demo.js index 80fbca0..9dcc29b 100644 --- a/scripts/units/helpers/create-config-demo.js +++ b/scripts/units/helpers/create-config-demo.js @@ -34,6 +34,8 @@ else DEX_FACTORY_ADDRESS: "", WETH_ADDRESS: "", STABLE_SWAP_WRAPPER_ADDRESS:"", + STAKING_ADDRESS:"", + VAULT_ADDRESS:"", COUNCIL_1:"", COUNCIL_2:"", COUNCIL_3:"" diff --git a/scripts/units/helpers/create-config-dev.js b/scripts/units/helpers/create-config-dev.js index 7627854..6523ca5 100644 --- a/scripts/units/helpers/create-config-dev.js +++ b/scripts/units/helpers/create-config-dev.js @@ -35,6 +35,8 @@ else DEX_FACTORY_ADDRESS: "", WETH_ADDRESS: "", STABLE_SWAP_WRAPPER_ADDRESS:"", + STAKING_ADDRESS:"", + VAULT_ADDRESS:"", COUNCIL_1:"", COUNCIL_2:"", COUNCIL_3:"" diff --git a/scripts/units/helpers/create-config-prod.js b/scripts/units/helpers/create-config-prod.js index 0bcc2d6..66ada6e 100644 --- a/scripts/units/helpers/create-config-prod.js +++ b/scripts/units/helpers/create-config-prod.js @@ -34,6 +34,8 @@ else DEX_FACTORY_ADDRESS: "", WETH_ADDRESS: "", STABLE_SWAP_WRAPPER_ADDRESS:"", + STAKING_ADDRESS:"", + VAULT_ADDRESS:"", COUNCIL_1:"", COUNCIL_2:"", COUNCIL_3:"" diff --git a/scripts/units/stablecoin/showstopper/cage-showstopper.js b/scripts/units/stablecoin/showstopper/cage-showstopper.js index 0a0f757..f54d8bf 100644 --- a/scripts/units/stablecoin/showstopper/cage-showstopper.js +++ b/scripts/units/stablecoin/showstopper/cage-showstopper.js @@ -4,7 +4,7 @@ const txnHelper = require('../../helpers/submitAndExecuteTransaction') const constants = require('../../helpers/constants') const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) -const SHOW_STOPPER_ADDRESS =addressesConfig.SHOW_STOPPER_ADDRESS +const SHOW_STOPPER_ADDRESS = addressesConfig.SHOW_STOPPER_ADDRESS const CAGE_COOL_DOWN = 100; const _encodeCage = (_cageCoolDown) => { diff --git a/scripts/units/staking/staking-max-lock-position.js b/scripts/units/staking/staking-max-lock-position.js new file mode 100644 index 0000000..2af33c3 --- /dev/null +++ b/scripts/units/staking/staking-max-lock-position.js @@ -0,0 +1,32 @@ +const fs = require('fs'); +const txnHelper = require('../helpers/submitAndExecuteTransaction') + +const constants = require('../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_DEX_FOLDER) +const FEE_TO_SETTER = "" +const STAKING_ADDRESS = addressesConfig.STAKING_ADDRESS +const VAULT = "" +const MAX_LOCK_POSITIONS = 10 + +const _encodeSetMaxLockPositions = (newMaxLockPositions) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'setMaxLockPositions', + type: 'function', + inputs: [{ + type: 'uint256', + name: 'newMaxLockPositions' + }] + }, [newMaxLockPositions]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeSetMaxLockPositions(MAX_LOCK_POSITIONS), + STAKING_ADDRESS, + "max lock positions" + ) +} \ No newline at end of file diff --git a/scripts/units/staking/staking-set-min-lock-period.js b/scripts/units/staking/staking-set-min-lock-period.js new file mode 100644 index 0000000..bbf2703 --- /dev/null +++ b/scripts/units/staking/staking-set-min-lock-period.js @@ -0,0 +1,31 @@ +const fs = require('fs'); +const txnHelper = require('../helpers/submitAndExecuteTransaction') + +const constants = require('../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_DEX_FOLDER) +const FEE_TO_SETTER = "" +const STAKING_ADDRESS = addresses.STAKING_ADDRESS +const MIN_LOCK_PERIOD = 100 + +const _encodeSetMinLockPeriod = (_minLockPeriod) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'setMinimumLockPeriod', + type: 'function', + inputs: [{ + type: 'uint256', + name: '_minLockPeriod' + }] + }, [_minLockPeriod]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeSetMinLockPeriod(MIN_LOCK_PERIOD), + STAKING_ADDRESS, + "set min lock period" + ) +} \ No newline at end of file diff --git a/scripts/units/staking/staking-set-treausury-address.js b/scripts/units/staking/staking-set-treausury-address.js new file mode 100644 index 0000000..1b221b3 --- /dev/null +++ b/scripts/units/staking/staking-set-treausury-address.js @@ -0,0 +1,32 @@ +const fs = require('fs'); +const txnHelper = require('../helpers/submitAndExecuteTransaction') + +const constants = require('../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_DEX_FOLDER) +const FEE_TO_SETTER = "" +const STAKING_ADDRESS = addressesConfig.STAKING_ADDRESS +const VAULT = "" +const TREASURY_ADDRESS = "" + +const _encodeSetTreausuryAddress = (newTreasury) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'setTreasuryAddress', + type: 'function', + inputs: [{ + type: 'address', + name: 'newTreasury' + }] + }, [newTreasury]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeSetTreausuryAddress(TREASURY_ADDRESS), + STAKING_ADDRESS, + "set treasury address" + ) +} \ No newline at end of file diff --git a/scripts/units/staking/staking-update-vault.js b/scripts/units/staking/staking-update-vault.js new file mode 100644 index 0000000..189f9ad --- /dev/null +++ b/scripts/units/staking/staking-update-vault.js @@ -0,0 +1,31 @@ +const fs = require('fs'); +const txnHelper = require('../helpers/submitAndExecuteTransaction') + +const constants = require('../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_DEX_FOLDER) +const FEE_TO_SETTER = "" +const STAKING_ADDRESS = addressesConfig.STAKING_ADDRESS +const VAULT = "" + +const _encodeUpdateVault = (_vault) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'updateVault', + type: 'function', + inputs: [{ + type: 'address', + name: '_vault' + }] + }, [_vault]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeUpdateVault(VAULT), + STAKING_ADDRESS, + "update vault address" + ) +} \ No newline at end of file diff --git a/scripts/units/staking/staking-withdraw-penalty.js b/scripts/units/staking/staking-withdraw-penalty.js new file mode 100644 index 0000000..48c466b --- /dev/null +++ b/scripts/units/staking/staking-withdraw-penalty.js @@ -0,0 +1,28 @@ +const fs = require('fs'); +const txnHelper = require('../helpers/submitAndExecuteTransaction') + +const constants = require('../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_DEX_FOLDER) +const FEE_TO_SETTER = "" +const STAKING_ADDRESS = addressesConfig.STAKING_ADDRESS +const VAULT = "" + +const _encodeWithdrawPenalty = () => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'withdrawPenalty', + type: 'function', + inputs: [] + }, []); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeWithdrawPenalty(), + STAKING_ADDRESS, + "withdraw penalty" + ) +} \ No newline at end of file diff --git a/scripts/units/staking/vault-add-supported-token.js b/scripts/units/staking/vault-add-supported-token.js new file mode 100644 index 0000000..119917d --- /dev/null +++ b/scripts/units/staking/vault-add-supported-token.js @@ -0,0 +1,31 @@ +const fs = require('fs'); +const txnHelper = require('../helpers/submitAndExecuteTransaction') + +const constants = require('../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_DEX_FOLDER) +const FEE_TO_SETTER = "" +const STAKING_ADDRESS = addressesConfig.STAKING_ADDRESS +const TOKEN_ADDRESS = "" + +const _encodeAddSupportedToken = (_token) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'addSupportedToken', + type: 'function', + inputs: [{ + type: 'address', + name: '_token' + }] + }, [_token]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeAddSupportedToken(TOKEN_ADDRESS), + STAKING_ADDRESS, + "add-supported-token" + ) +} \ No newline at end of file diff --git a/scripts/units/staking/vault-migrate.js b/scripts/units/staking/vault-migrate.js new file mode 100644 index 0000000..4023d26 --- /dev/null +++ b/scripts/units/staking/vault-migrate.js @@ -0,0 +1,32 @@ +const fs = require('fs'); +const txnHelper = require('../helpers/submitAndExecuteTransaction') + +const constants = require('../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_DEX_FOLDER) +const FEE_TO_SETTER = "" +const STAKING_ADDRESS = addressesConfig.STAKING_ADDRESS +const WITHDRAW_TO = "" +const NEW_VAULT_PACKAGE = "" +const _encodeMigrate = (newVaultPackage) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'migrate', + type: 'function', + inputs: [ + { + type: 'address', + name: 'newVaultPackage' + }] + }, [newVaultPackage]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeMigrate(NEW_VAULT_PACKAGE), + STAKING_ADDRESS, + "migrate-vault-package" + ) +} \ No newline at end of file diff --git a/scripts/units/staking/vault-remove-supported-token.js b/scripts/units/staking/vault-remove-supported-token.js new file mode 100644 index 0000000..752c5f7 --- /dev/null +++ b/scripts/units/staking/vault-remove-supported-token.js @@ -0,0 +1,31 @@ +const fs = require('fs'); +const txnHelper = require('../helpers/submitAndExecuteTransaction') + +const constants = require('../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_DEX_FOLDER) +const FEE_TO_SETTER = "" +const STAKING_ADDRESS = addressesConfig.STAKING_ADDRESS +const TOKEN_ADDRESS = "" + +const _encodeRemoveSupportedToken = (_token) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'removeSupportedToken', + type: 'function', + inputs: [{ + type: 'address', + name: '_token' + }] + }, [_token]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeRemoveSupportedToken(TOKEN_ADDRESS), + STAKING_ADDRESS, + "remove-supported-token" + ) +} \ No newline at end of file diff --git a/scripts/units/staking/vault-withdraw-extra-supported-token.js b/scripts/units/staking/vault-withdraw-extra-supported-token.js new file mode 100644 index 0000000..2b678d1 --- /dev/null +++ b/scripts/units/staking/vault-withdraw-extra-supported-token.js @@ -0,0 +1,31 @@ +const fs = require('fs'); +const txnHelper = require('../helpers/submitAndExecuteTransaction') + +const constants = require('../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_DEX_FOLDER) +const FEE_TO_SETTER = "" +const STAKING_ADDRESS = addressesConfig.STAKING_ADDRESS +const WITHDRAW_TO = "" + +const _encodeWithdrawExtraSupportedToken = (withdrawTo) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'withdrawExtraSupportedTokens', + type: 'function', + inputs: [{ + type: 'address', + name: '_withdrawTo' + }] + }, [withdrawTo]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeWithdrawExtraSupportedToken(WITHDRAW_TO), + STAKING_ADDRESS, + "remove-supported-token" + ) +} \ No newline at end of file diff --git a/scripts/units/staking/vault-withdraw-extra-unsupported-token.js b/scripts/units/staking/vault-withdraw-extra-unsupported-token.js new file mode 100644 index 0000000..43680ab --- /dev/null +++ b/scripts/units/staking/vault-withdraw-extra-unsupported-token.js @@ -0,0 +1,36 @@ +const fs = require('fs'); +const txnHelper = require('../helpers/submitAndExecuteTransaction') + +const constants = require('../helpers/constants') +const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_DEX_FOLDER) +const FEE_TO_SETTER = "" +const STAKING_ADDRESS = addressesConfig.STAKING_ADDRESS +const WITHDRAW_TO = "" +const TOKEN = "" +const _encodeWithdrawExtraSupportedToken = (token, withdrawTo) => { + let toRet = web3.eth.abi.encodeFunctionCall({ + name: 'withdrawExtraUnsupportedToken', + type: 'function', + inputs: [ + { + type: 'address', + name: '_token' + }, + { + type: 'address', + name: '_withdrawTo' + }] + }, [token, withdrawTo]); + + return toRet; +} + + +module.exports = async function(deployer) { + + await txnHelper.submitAndExecute( + _encodeWithdrawExtraSupportedToken(TOKEN, WITHDRAW_TO), + STAKING_ADDRESS, + "withdraw-extra-unsupported-token" + ) +} \ No newline at end of file From 87647861abc229ad27b2dea15abe878bdfe7f659 Mon Sep 17 00:00:00 2001 From: ssubik Date: Wed, 26 Jul 2023 11:58:23 +0545 Subject: [PATCH 09/10] refining multisig scripts for staking and vault --- .../units/stablecoin/stableswap-wrapper/add-to-whitelist.js | 2 +- scripts/units/staking/staking-set-min-lock-period.js | 4 ++-- scripts/units/staking/vault-add-supported-token.js | 4 ++-- scripts/units/staking/vault-migrate.js | 4 ++-- scripts/units/staking/vault-remove-supported-token.js | 4 ++-- scripts/units/staking/vault-withdraw-extra-supported-token.js | 4 ++-- .../units/staking/vault-withdraw-extra-unsupported-token.js | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/units/stablecoin/stableswap-wrapper/add-to-whitelist.js b/scripts/units/stablecoin/stableswap-wrapper/add-to-whitelist.js index 8d3260d..fae2477 100644 --- a/scripts/units/stablecoin/stableswap-wrapper/add-to-whitelist.js +++ b/scripts/units/stablecoin/stableswap-wrapper/add-to-whitelist.js @@ -4,7 +4,7 @@ const txnHelper = require('../../helpers/submitAndExecuteTransaction') const constants = require('../../helpers/constants') const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_STABLECOIN_FOLDER) -const whitelistAddress = "0x2B3691065A78F5fb02E9BF54A197b95da2B26AF7" +const whitelistAddress = "0xE82C380C6Ca0306C61454569e84e020d68B063EF" const STABLE_SWAP_WRAPPER_ADDRESS =addressesConfig.STABLE_SWAP_WRAPPER_ADDRESS const _encodeAddToWhitelist = (_whitelistAddress) => { diff --git a/scripts/units/staking/staking-set-min-lock-period.js b/scripts/units/staking/staking-set-min-lock-period.js index bbf2703..427a908 100644 --- a/scripts/units/staking/staking-set-min-lock-period.js +++ b/scripts/units/staking/staking-set-min-lock-period.js @@ -4,8 +4,8 @@ const txnHelper = require('../helpers/submitAndExecuteTransaction') const constants = require('../helpers/constants') const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_DEX_FOLDER) const FEE_TO_SETTER = "" -const STAKING_ADDRESS = addresses.STAKING_ADDRESS -const MIN_LOCK_PERIOD = 100 +const STAKING_ADDRESS = addressesConfig.STAKING_ADDRESS +const MIN_LOCK_PERIOD = 86400/2 const _encodeSetMinLockPeriod = (_minLockPeriod) => { let toRet = web3.eth.abi.encodeFunctionCall({ diff --git a/scripts/units/staking/vault-add-supported-token.js b/scripts/units/staking/vault-add-supported-token.js index 119917d..61fadcd 100644 --- a/scripts/units/staking/vault-add-supported-token.js +++ b/scripts/units/staking/vault-add-supported-token.js @@ -4,7 +4,7 @@ const txnHelper = require('../helpers/submitAndExecuteTransaction') const constants = require('../helpers/constants') const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_DEX_FOLDER) const FEE_TO_SETTER = "" -const STAKING_ADDRESS = addressesConfig.STAKING_ADDRESS +const VAULT_ADDRESS = addressesConfig.VAULT_ADDRESS const TOKEN_ADDRESS = "" const _encodeAddSupportedToken = (_token) => { @@ -25,7 +25,7 @@ module.exports = async function(deployer) { await txnHelper.submitAndExecute( _encodeAddSupportedToken(TOKEN_ADDRESS), - STAKING_ADDRESS, + VAULT_ADDRESS, "add-supported-token" ) } \ No newline at end of file diff --git a/scripts/units/staking/vault-migrate.js b/scripts/units/staking/vault-migrate.js index 4023d26..a9da181 100644 --- a/scripts/units/staking/vault-migrate.js +++ b/scripts/units/staking/vault-migrate.js @@ -4,7 +4,7 @@ const txnHelper = require('../helpers/submitAndExecuteTransaction') const constants = require('../helpers/constants') const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_DEX_FOLDER) const FEE_TO_SETTER = "" -const STAKING_ADDRESS = addressesConfig.STAKING_ADDRESS +const VAULT_ADDRESS = addressesConfig.VAULT_ADDRESS const WITHDRAW_TO = "" const NEW_VAULT_PACKAGE = "" const _encodeMigrate = (newVaultPackage) => { @@ -26,7 +26,7 @@ module.exports = async function(deployer) { await txnHelper.submitAndExecute( _encodeMigrate(NEW_VAULT_PACKAGE), - STAKING_ADDRESS, + VAULT_ADDRESS, "migrate-vault-package" ) } \ No newline at end of file diff --git a/scripts/units/staking/vault-remove-supported-token.js b/scripts/units/staking/vault-remove-supported-token.js index 752c5f7..71ba77e 100644 --- a/scripts/units/staking/vault-remove-supported-token.js +++ b/scripts/units/staking/vault-remove-supported-token.js @@ -4,7 +4,7 @@ const txnHelper = require('../helpers/submitAndExecuteTransaction') const constants = require('../helpers/constants') const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_DEX_FOLDER) const FEE_TO_SETTER = "" -const STAKING_ADDRESS = addressesConfig.STAKING_ADDRESS +const VAULT_ADDRESS = addressesConfig.VAULT_ADDRESS const TOKEN_ADDRESS = "" const _encodeRemoveSupportedToken = (_token) => { @@ -25,7 +25,7 @@ module.exports = async function(deployer) { await txnHelper.submitAndExecute( _encodeRemoveSupportedToken(TOKEN_ADDRESS), - STAKING_ADDRESS, + VAULT_ADDRESS, "remove-supported-token" ) } \ No newline at end of file diff --git a/scripts/units/staking/vault-withdraw-extra-supported-token.js b/scripts/units/staking/vault-withdraw-extra-supported-token.js index 2b678d1..27afa5b 100644 --- a/scripts/units/staking/vault-withdraw-extra-supported-token.js +++ b/scripts/units/staking/vault-withdraw-extra-supported-token.js @@ -4,7 +4,7 @@ const txnHelper = require('../helpers/submitAndExecuteTransaction') const constants = require('../helpers/constants') const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_DEX_FOLDER) const FEE_TO_SETTER = "" -const STAKING_ADDRESS = addressesConfig.STAKING_ADDRESS +const VAULT_ADDRESS = addressesConfig.VAULT_ADDRESS const WITHDRAW_TO = "" const _encodeWithdrawExtraSupportedToken = (withdrawTo) => { @@ -25,7 +25,7 @@ module.exports = async function(deployer) { await txnHelper.submitAndExecute( _encodeWithdrawExtraSupportedToken(WITHDRAW_TO), - STAKING_ADDRESS, + VAULT_ADDRESS, "remove-supported-token" ) } \ No newline at end of file diff --git a/scripts/units/staking/vault-withdraw-extra-unsupported-token.js b/scripts/units/staking/vault-withdraw-extra-unsupported-token.js index 43680ab..c1aa23c 100644 --- a/scripts/units/staking/vault-withdraw-extra-unsupported-token.js +++ b/scripts/units/staking/vault-withdraw-extra-unsupported-token.js @@ -4,7 +4,7 @@ const txnHelper = require('../helpers/submitAndExecuteTransaction') const constants = require('../helpers/constants') const addressesConfig = require(constants.PATH_TO_ADDRESSES_FOR_DEX_FOLDER) const FEE_TO_SETTER = "" -const STAKING_ADDRESS = addressesConfig.STAKING_ADDRESS +const VAULT_ADDRESS = addressesConfig.VAULT_ADDRESS const WITHDRAW_TO = "" const TOKEN = "" const _encodeWithdrawExtraSupportedToken = (token, withdrawTo) => { @@ -30,7 +30,7 @@ module.exports = async function(deployer) { await txnHelper.submitAndExecute( _encodeWithdrawExtraSupportedToken(TOKEN, WITHDRAW_TO), - STAKING_ADDRESS, + VAULT_ADDRESS, "withdraw-extra-unsupported-token" ) } \ No newline at end of file From 2deaa25e2181362edd601ae11c2d0b6a3b9522b5 Mon Sep 17 00:00:00 2001 From: ssubik Date: Fri, 28 Jul 2023 17:06:24 +0545 Subject: [PATCH 10/10] changed scripts to have only one console log of encoded function --- scripts/units/create_pool_dex.js | 12 ++++++------ scripts/units/helpers/submitAndExecuteTransaction.js | 1 - scripts/units/transfer-tokens-fathom.js | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/scripts/units/create_pool_dex.js b/scripts/units/create_pool_dex.js index 97e00e5..7a1b01e 100644 --- a/scripts/units/create_pool_dex.js +++ b/scripts/units/create_pool_dex.js @@ -13,13 +13,13 @@ const env = process.env.NODE_ENV || 'dev'; const addressesConfig = require(`../../config/config.${env}`) -const Token_A_Address = "0xa96792e0745B7E676a96148124A0caaF265733C8" //FTHM -const Token_B_Address = "0xf31146956Cb3be9EFD6Cfd665Cb4Cb5Aeeb5cA3e" //FXD +const Token_A_Address = "0xDf29cB40Cb92a1b8E8337F542E3846E185DefF96" //FTHM +const Token_B_Address = "0x916D9BFa4480418bE7b653f4808106709a38b4fc" //FXD // SET AS Necessary -const Amount_A_Desired = web3.utils.toWei('99999', 'ether') -const Amount_B_Desired = web3.utils.toWei('99999', 'ether') -const Amount_A_Minimum = web3.utils.toWei('99999', 'ether') -const Amount_B_Minimum = web3.utils.toWei('99999', 'ether') +const Amount_A_Desired = web3.utils.toWei('100000', 'ether') +const Amount_B_Desired = web3.utils.toWei('100000', 'ether') +const Amount_A_Minimum = web3.utils.toWei('100000', 'ether') +const Amount_B_Minimum = web3.utils.toWei('100000', 'ether') // const Amount_A_Desired = web3.utils.toWei('250000', 'ether') // const Amount_B_Desired = web3.utils.toWei('9347335', 'ether') diff --git a/scripts/units/helpers/submitAndExecuteTransaction.js b/scripts/units/helpers/submitAndExecuteTransaction.js index ba32dce..251b25e 100644 --- a/scripts/units/helpers/submitAndExecuteTransaction.js +++ b/scripts/units/helpers/submitAndExecuteTransaction.js @@ -67,7 +67,6 @@ async function submitAndExecute(encodedFunction, targetAddress, TransactionName, console.log(`Transaction executed successfully for ${TransactionName}. TxHash: ${resultExecuteTransaction.transactionHash}`); } } - console.log(`encoded function for the transaction --${TransactionName} is: ${encodedFunction}`) return createTransactionObject(TransactionName, tx, resultSubmitTransaction, resultConfirmTransaction, resultExecuteTransaction); } diff --git a/scripts/units/transfer-tokens-fathom.js b/scripts/units/transfer-tokens-fathom.js index cf74dfb..86c6f0d 100644 --- a/scripts/units/transfer-tokens-fathom.js +++ b/scripts/units/transfer-tokens-fathom.js @@ -1,7 +1,7 @@ const fs = require('fs'); const constants = require('./helpers/constants') -const T_TO_TRANSFER_PLACEHOLDER = web3.utils.toWei('10000000','ether') //SET AS NEEDED +const T_TO_TRANSFER_PLACEHOLDER = web3.utils.toWei('1000000','ether') //SET AS NEEDED const TRANSFER_TO_ACCOUNT_PLACEHOLDER = "0x0Eb7DEE6e18Cce8fE839E986502d95d47dC0ADa3" //SET AS NEEDED const txnHelper = require('./helpers/submitAndExecuteTransaction') const rawdata = fs.readFileSync(constants.PATH_TO_ADDRESSES);