修改多签钱包和nft分发合约

This commit is contained in:
zhl 2023-05-11 16:08:27 +08:00
parent 81b4465341
commit b6b309aac2
8 changed files with 11536 additions and 10867 deletions

File diff suppressed because one or more lines are too long

View File

@ -34476,6 +34476,12 @@
"version": "0.8.10+commit.fc410830.Emscripten.clang"
},
"networks": {
"1338": {
"events": {},
"links": {},
"address": "0xD833215cBcc3f914bD1C9ece3EE7BF8B14f841bb",
"transactionHash": "0xbd42a64a4cfcce217f622c2afbe01522fbba731e7c1a12930e40b68ed160e168"
},
"80001": {
"events": {
"0xc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b58": {
@ -34796,10 +34802,16 @@
"links": {},
"address": "0xfeFc3aab779863c1624eE008aba485c53805dCeb",
"transactionHash": "0xad6c81625b8a7c0141144b57ee96a962eb1909b87ff050f3e73c96475a391eae"
},
"421613": {
"events": {},
"links": {},
"address": "0xE68F149daF2F314d9960c08496D8701BC7671850",
"transactionHash": "0x2d0bb97e5bbb23a344336df330f4e4342046f63e9355ffa75b01699c402e279a"
}
},
"schemaVersion": "3.4.11",
"updatedAt": "2023-04-26T07:39:54.120Z",
"updatedAt": "2023-05-11T08:01:34.548Z",
"networkType": "ethereum",
"devdoc": {
"events": {

File diff suppressed because one or more lines are too long

View File

@ -14,6 +14,9 @@ contract NftDistributor is AccessControlEnumerable {
IBEERC721 public nft;
// NFT distributor open status
bool public isOpen = false;
event Minted(
address indexed user,
address indexed nft,
@ -21,6 +24,8 @@ contract NftDistributor is AccessControlEnumerable {
uint256[] nftTIds
);
event OpenStatusChange(bool indexed open);
/**
* @dev Contract constructor.
*
@ -60,6 +65,12 @@ contract NftDistributor is AccessControlEnumerable {
_;
}
function updateOpenStatus(bool _open) external onlyManager {
require(isOpen != _open, "Open status is same");
isOpen = _open;
emit OpenStatusChange(_open);
}
/**
* @dev The mintToUser function mints NFTs to a given user.
*
@ -71,6 +82,7 @@ contract NftDistributor is AccessControlEnumerable {
* @param _user - The address of the user receiving the NFTs
*/
function mintToUser(address _user, uint256 count) external onlyManager {
require(isOpen, "NFT distributor is not open");
// Check that there are enough mintable NFTs
require(count <= getMintableCount(_user), "Mintable count is not enough");
// Get the array of the user's owned NFTs

View File

@ -145,6 +145,16 @@ contract BEBadge is AccessControl, ERC721Enumerable {
_baseTokenURI = baseTokenURI;
}
/**
* @dev one type badge has same tokenURI
*/
function tokenURI(
uint256 tokenId
) public view virtual override returns (string memory) {
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? baseURI : "";
}
/**
* @dev See {IERC165-_beforeTokenTransfer}.
*/

View File

@ -5,36 +5,36 @@ const Distributor = artifacts.require("logic/NftDistributor");
const config = require("../config/config");
module.exports = async function (deployer, network, accounts) {
// await deployer.deploy(Badge, "BE Badge", "Badge", "0");
await deployer.deploy(Badge, "BE Badge", "Badge", "4000");
const badgeInstance = await Badge.deployed();
if (badgeInstance) {
console.log("BEBadge successfully deployed. ");
console.log("address: " + badgeInstance.address);
}
// await badgeInstance.updateBaseURI(config.token.baseTokenURI);
// await deployer.deploy(Coin, "BE test USDT", "USDT");
await badgeInstance.updateBaseURI(config.token.baseTokenURI);
await deployer.deploy(Coin, "BE test USDT", "USDT");
const coinInstance = await Coin.deployed();
// if (coinInstance) {
// console.log("BEUSDT successfully deployed. ");
// console.log("address: " + coinInstance.address);
// }
// await deployer.deploy(
// Wallet,
// 60,
// 1,
// config.admins.proposers,
// config.admins.confirmers,
// config.admins.executors
// );
if (coinInstance) {
console.log("BEUSDT successfully deployed. ");
console.log("address: " + coinInstance.address);
}
await deployer.deploy(
Wallet,
60,
1,
config.admins.proposers,
config.admins.confirmers,
config.admins.executors
);
const walletInstance = await Wallet.deployed();
if (walletInstance) {
console.log("BEMultiSigWallet successfully deployed.");
console.log("address: " + walletInstance.address);
}
// await badgeInstance.setMintRole(walletInstance.address);
// console.log("success add wallet to badge's mint role");
// await coinInstance.setMintRole(walletInstance.address);
// console.log("success add wallet to usdt's mint role");
await badgeInstance.setMintRole(walletInstance.address);
console.log("success add wallet to badge's mint role");
await coinInstance.setMintRole(walletInstance.address);
console.log("success add wallet to usdt's mint role");
await deployer.deploy(
Distributor,

View File

@ -14,6 +14,7 @@
"deploy:bsctest": "truffle migrate --network bsc_testnet --compile-none",
"deploy:kcctest": "truffle migrate --network kcc_testnet --compile-none",
"deploy:polygon_testnet": "truffle migrate --network polygon_testnet --compile-none",
"deploy:arbitrum_testnet": "truffle migrate --network arbitrum_testnet --compile-none",
"update:nft_sample": "npx truffle exec --network lan20 ./init_scripts/update_nft_setting.js",
"mint_presale:dev": "npx truffle exec --network development ./init_scripts/generate_presalebox.js",
"size": "truffle run contract-size"

View File

@ -119,6 +119,24 @@ module.exports = {
production: true,
from: "0x565edA4ef351EB78F03B8AfCb6dCF02E29cAD62e",
},
arbitrum_testnet: {
provider: () =>
new HDWalletProvider({
privateKeys: [kccTestnetKey],
providerOrUrl: `https://arbitrum-goerli.public.blastapi.io`,
pollingInterval: 8000,
}),
gasPrice: 28000000000,
network_id: 421613,
confirmations: 6,
timeoutBlocks: 5000,
networkCheckTimeout: 10000000,
deploymentPollingInterval: 8000,
skipDryRun: true,
production: true,
disableConfirmationListener: true,
from: "0x50A8e60041A206AcaA5F844a1104896224be6F39",
},
kcc_testnet: {
provider: () =>
new HDWalletProvider(kccTestnetKey, `https://rpc-testnet.kcc.network`),