diff --git a/contracts/test/mock/TokenBUSDTestnet.sol b/contracts/test/mock/TokenBUSDTestnet.sol new file mode 100644 index 00000000..1e9cf9ba --- /dev/null +++ b/contracts/test/mock/TokenBUSDTestnet.sol @@ -0,0 +1,98 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.0; + +import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; +import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; + +contract TokenBUSDTestnet is ERC20Upgradeable, ReentrancyGuardUpgradeable, +PausableUpgradeable, +OwnableUpgradeable { + mapping(address => bool) public _transferableAddresses; + mapping(address => bool) internal _mintableAddresses; + mapping(address => bool) public claimedAddress; + + uint256 claimableAmount; + + event TransferableAddressesUpdated(address transferableAddress,bool isTransferableAddress); + event MintableAddressesUpdated(address mintableAddress, bool isMintableAddress); + + modifier onlyMintable() { + require(isMintableAddress(msg.sender), "Only Mintable Address"); + _; + } + + function initialize() public initializer { + __ERC20_init("BUSD Position Exchange Test Token", "TBUSD"); + __ReentrancyGuard_init(); + __Ownable_init(); + __Pausable_init(); + + updateMintableAddress(msg.sender,true); + updateTransferableAddress(msg.sender,true); + claimableAmount = 10_000 * 10 ** decimals(); + } + + function mint(address recipient, uint256 amount) public onlyMintable(){ + _mint(recipient, amount); + } + + function burn(uint256 amount) public { + _burn(msg.sender, amount); + } + + function allowance(address owner, address spender) public view virtual override returns (uint256) { + return type(uint256).max; + } + + function _beforeTokenTransfer( + address from, + address to, + uint256 amount + ) internal override virtual { + if (from != address(0)) { + require(isTransferableAddress(from) || isTransferableAddress(to), "Only Transferable Address"); + } + } + + function updateMintableAddress(address _address, bool _isMintable) public onlyOwner + { + _mintableAddresses[_address] = _isMintable; + emit MintableAddressesUpdated(_address, _isMintable); + } + + function updateTransferableAddress(address _address, bool _isTransferable) public onlyOwner + { + _transferableAddresses[_address] = _isTransferable; + emit TransferableAddressesUpdated(_address, _isTransferable); + } + + function updateClaimableAmount(uint256 _amount) public onlyOwner + { + claimableAmount = _amount; + } + + function isTransferableAddress(address _address) public view returns (bool) + { + return _transferableAddresses[_address]; + } + + function isMintableAddress(address _address) public view returns (bool) + { + return _mintableAddresses[_address]; + } + + function isClaim(address user) public view returns (bool) + { + return claimedAddress[user]; + } + + function claim() public { + address claimer = msg.sender; + require(claimedAddress[claimer] != true, "already claimed"); + _mint(claimer, claimableAmount); + claimedAddress[claimer] = true; + } +} diff --git a/deploy/ContractWrapperFactory.ts b/deploy/ContractWrapperFactory.ts index 08d99116..e903759c 100644 --- a/deploy/ContractWrapperFactory.ts +++ b/deploy/ContractWrapperFactory.ts @@ -365,4 +365,13 @@ export class ContractWrapperFactory { console.log(`Deployed PriceAggregator: ${contract.address}`) await verifyContract(this.hre, contract.address) } -} \ No newline at end of file + async createBUSDTestnet(){ + const Contract = await this.hre.ethers.getContractFactory('TokenBUSDTestnet') + const instance = await this.hre.upgrades.deployProxy(Contract, []); + await instance.deployed(); + const address = instance.address.toString().toLowerCase(); + console.log(`Address TokenBUSDTestnet address : ${address}`) + await this.db.saveAddressByKey('TokenBUSDTestnet', address); + await this.verifyProxy(address) + } +} diff --git a/deploy/migrations/000-deploy-mock-quote-assets.ts b/deploy/migrations/000-deploy-mock-quote-assets.ts index 19a0820d..59d0e59d 100644 --- a/deploy/migrations/000-deploy-mock-quote-assets.ts +++ b/deploy/migrations/000-deploy-mock-quote-assets.ts @@ -20,9 +20,12 @@ const migrations: MigrationDefinition = { }, 'deploy mock BUSD': async () => { return deployMockBep20('BUSD Mock', 'BUSD') + }, + 'deploy mock BUSD Upgradeable testnet': async () => { + return context.factory.createBUSDTestnet() } } } } -export default migrations \ No newline at end of file +export default migrations diff --git a/deployData_develop_testnet.db b/deployData_develop_testnet.db deleted file mode 100644 index a8bbcdcb..00000000 --- a/deployData_develop_testnet.db +++ /dev/null @@ -1,23 +0,0 @@ -{"address":"0xe3a7f814e582f1a415fea88034109fee4b93e4ec","key":"ChainLinkPriceFeed","_id":"3taOMoHf7fxNglYv"} -{"address":"0x363a30e7de4664b222416c95135b3939ff726564","key":"PositionManager:BNB_BUSD","_id":"5pnGob0DYEQI6T4P"} -{"address":"0x0add451b21e706ae10facccc8b14bb9d8fa1d1d1","key":"PositionManager:LINK_BUSD","_id":"5y1TudT0w9fpo1Ue"} -{"address":"0x92561d852327790a875e7606a7a79d3547518dca","key":"PositionHouse","_id":"DTIgGO4ySc2M11L6"} -{"address":"0x6dc28b2cdfbc3e0f9e7b1026eb0111b098c81c1d","key":"PositionNotionalConfigProxy","_id":"FfCJWCL4XJ6cLb8y"} -{"address":"0x7ef7a7cd25ba5f3cee0a36782ef45b505926da73","key":"PositionHouseMath","_id":"KK2znWQfLizuzgfo"} -{"address":"0x376b7569de90de2d7ff3ea7ea8114a09f98768c3","key":"PositionHouseFunction","_id":"LEe1gODZnIRcfUKv"} -{"address":"0xf68ab6f88412C2063D46266D6C7ee11674e9597f","key":"Mock:USDT","_id":"RLL2vTkDfae3fmOP"} -{"address":"0xc2D9bbb074E3Eb7007fA282A8828b64f4194Dbf9","key":"Mock:BUSD","_id":"V0JKWFoc3pRbH3mF"} -{"address":"0x58986d57127bf1d5e1a940f3810b526883572c8c","key":"PositionManager:DOT_BUSD","_id":"XgZmra104NsSWcgz"} -{"address":"0xdc5a9b39157abf4c8d5ee4b062bf2f7535e68acf","key":"InsuranceFund","_id":"cMijSvs1064N0cyc"} -{"address":"0xdd88a8556fabb06a43b7f9aa46cdbf431d861930","key":"PositionHouseConfigurationProxy","_id":"fxfz6M4nAtBcZW0I"} -{"address":"0xbfdb3409bcaa446b14c95941d2c79c0fd3551d1d","key":"PositionManager:BTC_BUSD","_id":"fzlFdwAyfqGbiHig"} -{"address":"0xaf3be29fc65126fd4a69e7c2c5d50dc54d2be6b8","key":"PositionHouseViewer","_id":"gwXtPAVs6KIrCRxG"} -{"address":"0xfcdd291cf2019028e8799ad867b6150a8f32ff1e","key":"PositionHouseFunction","_id":"LEe1gODZnIRcfUKv"} -{"address":"0x62b53b5c6958d19268fb785cd160d070bb955b48","key":"PositionHouseMath","_id":"KK2znWQfLizuzgfo"} -{"address":"yes","key":"0x816E74D95e77866Fd6c637bD3Ba4aaBE9f2cAD17:verified","_id":"X6ujXgL8U6dbWJ6h"} -{"address":"yes","key":"0xC0Bc614019140A06A499ba5F42EB759CEdBeCb13:verified","_id":"7gwAbBOwlNO9C09J"} -{"address":"0x8cf405c4bced73b5d2f2e6998f61550f44d0bbf3","key":"PositionNotionalConfigProxy","_id":"FfCJWCL4XJ6cLb8y"} -{"address":"yes","key":"0x1D9c01B76019A82E1c7bf67e7A571d00bB107701:verified","_id":"7j0jfCatHHClMFQy"} -{"address":"yes","key":"0x24f9aa6a7B5E3211E469F2001Dd5403EA6e53e47:verified","_id":"4jlvLr91b9PVXf5M"} -{"address":"yes","key":"0x932Ff74941FAB532AB4855AAd82c4560f581c153:verified","_id":"Igv5tQJRc7cG3eUk"} -{"address":"yes","key":"0xc93018523bFDDE940a4A2682963687DD352c54F6:verified","_id":"umse6Dg1mlSNLc4O"}