From e76b8084352901eb0a3f8729cb8107c45cb372b8 Mon Sep 17 00:00:00 2001 From: Nicholas Addison Date: Sat, 7 Aug 2021 13:54:17 +1000 Subject: [PATCH] Added BSC and Polygon network support --- README.md | 2 +- examples/README.md | 21 +- examples/bscCryptoBlades.svg | 1497 ++++++++++++++++++++++++++++++++++ examples/polygonMusd.svg | 1111 +++++++++++++++++++++++++ lib/etherscanParser.d.ts | 2 +- lib/etherscanParser.js | 18 +- lib/sol2uml.js | 2 +- package-lock.json | 2 +- package.json | 2 +- src/ts/etherscanParser.ts | 16 +- src/ts/sol2uml.ts | 2 +- 11 files changed, 2666 insertions(+), 9 deletions(-) create mode 100644 examples/bscCryptoBlades.svg create mode 100644 examples/polygonMusd.svg diff --git a/README.md b/README.md index e22b1e29..ebbc296f 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Options: -o, --outputFileName output file name -d, --depthLimit number of sub folders that will be recursively searched for Solidity files. Default -1 is unlimited (default: -1) -i, --ignoreFilesOrFolders comma separated list of files or folders to ignore - -n, --network mainnet, ropsten, kovan, rinkeby or goerli (default: "mainnet") + -n, --network mainnet, polygon, bsc, ropsten, kovan, rinkeby or goerli (default: "mainnet") -a, --hideAttributes hide class and interface attributes -p, --hideOperators hide class and interface operators/functions -e, --hideEnums hide enum types diff --git a/examples/README.md b/examples/README.md index 3a464d27..f312e0e8 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,6 +1,7 @@ # Example UML Diagrams ## Crypto Kitties + ![CryptoKitties](./cryptoKitties.svg) Generated from running ``` @@ -9,16 +10,34 @@ sol2uml 0x06012c8cf97BEaD5deAe237070F9587f8E7A266d This uses the verified Solidity code loaded to Etherscan https://etherscan.io/address/0x06012c8cf97BEaD5deAe237070F9587f8E7A266d#code ## Open Zeppelin ERC20 Tokens + ![Open Zeppelin ERC20](./OpenZeppelinERC20.svg) Generated from version [2.3.0 contracts/token/ERC20](https://github.com/OpenZeppelin/openzeppelin-solidity/tree/v2.3.0/contracts/token/ERC20) ## Open Zeppelin Base Contract + ![Open Zeppelin Base Contract](./OzToken.svg) Generated from version [2.5.1 contracts](https://github.com/OpenZeppelin/openzeppelin-solidity/tree/v2.5.1/contracts) with -```base +``` sol2uml -b OzToken ``` +## mStable mUSD on Polygon + +![Polygon mUSD](./polygonMusd.svg) +Generated from running +``` +sol2uml -n polygon 0xcA9cf48aD534f1efA2B0f6923457F2953df86e0b +``` + +## Crypto Blades on BSC + +![BSC Crypto Blades](./bscCryptoBlades.svg) +Generated from running +``` +sol2uml -n bsc 0xB07c1C479b2Fdeb9f9B2d02300C13b328BF86d65 +``` + ## Open Zeppelin All ![Open Zeppelin ERC20](./OpenZeppelinAll.svg) Generated from version [2.5.1 contracts](https://github.com/OpenZeppelin/openzeppelin-solidity/tree/v2.5.1/contracts) diff --git a/examples/bscCryptoBlades.svg b/examples/bscCryptoBlades.svg new file mode 100644 index 00000000..8983029a --- /dev/null +++ b/examples/bscCryptoBlades.svg @@ -0,0 +1,1497 @@ + + + + + + +UmlClassDiagram + + + +0 + +Blacksmith + +Public: +   GAME: bytes32 +   SHIELD_SKILL_FEE: uint256 +   weapons: Weapons +   randoms: IRandoms +   tickets: mapping(address=>uint32) +   shields: Shields +   game: CryptoBlades + +External: +    migrateRandoms(_newRandoms: IRandoms) +    migrateTo_61c10da(_shields: Shields, _game: CryptoBlades) +    spendTicket(_num: uint32) +    giveTicket(_player: address, _num: uint32) +Public: +    <<modifier>> onlyGame() +    initialize(_weapons: Weapons, _randoms: IRandoms) +    purchaseShield() + + + +3 + +CryptoBlades + +Private: +   _rewardsClaimTaxTimerStart: mapping(address=>uint256) +Public: +   GAME_ADMIN: bytes32 +   REWARDS_CLAIM_TAX_MAX: int128 +   REWARDS_CLAIM_TAX_DURATION: uint256 +   characters: Characters +   weapons: Weapons +   skillToken: IERC20 +   priceOracleSkillPerUsd: IPriceOracle +   randoms: IRandoms +   characterLimit: uint +   staminaCostFight: uint8 +   mintCharacterFee: int128 +   refillStaminaFee: int128 +   fightRewardBaseline: int128 +   fightRewardGasOffset: int128 +   mintWeaponFee: int128 +   reforgeWeaponFee: int128 +   nonce: uint256 +   lastBlockNumberCalled: mapping(address=>uint256) +   fightXpGain: uint256 +   tokenRewards: mapping(address=>uint256) +   xpRewards: mapping(uint256=>uint256) +   oneFrac: int128 +   fightTraitBonus: int128 +   inGameOnlyFunds: mapping(address=>uint256) +   totalInGameOnlyFunds: uint256 +   promos: Promos +   stakeFromGameImpl: IStakeFromGame +   durabilityCostFight: uint8 +   burnWeaponFee: int128 +   reforgeWeaponWithDustFee: int128 +   blacksmith: Blacksmith + +Private: +    isUnlikely(pp: uint24, ep: uint24): bool +    performFight(char: uint256, wep: uint256, playerFightPower: uint24, traitsCWE: uint24, targetPower: uint24, fightMultiplier: uint8) +    getTargetsInternal(playerPower: uint24, staminaTimestamp: uint64, currentHour: uint256): uint32[] +Internal: +    _verifyFight(basePowerLevel: uint24, weaponMultTarget: int128, weaponBonusPower: uint24, timestamp: uint64, target: uint32) +    getTokenGainForFight(monsterPower: uint24, fightMultiplier: uint8): int128 +    getXpGainForFight(playerPower: uint24, monsterPower: uint24): uint16 +    getPlayerPowerRoll(playerFightPower: uint24, traitsCWE: uint24, seed: uint256): uint24 +    getMonsterPowerRoll(monsterPower: uint24, seed: uint256): uint24 +    _onlyNonContract() +    _restricted() +    _oncePerBlock(user: address) +    _isWeaponOwner(weapon: uint256) +    _isWeaponsOwner(weaponArray: uint256[]) +    _isCharacterOwner(character: uint256) +    _requestPayFromPlayer(usdAmount: int128) +    _payContractTokenOnly(playerAddress: address, convertedAmount: uint256) +    _payContract(playerAddress: address, usdAmount: int128) +    _payContractConverted(playerAddress: address, convertedAmount: uint256) +    _payPlayer(playerAddress: address, baseAmount: int128) +    _payPlayerConverted(playerAddress: address, convertedAmount: uint256) +    _approveContractCharacterFor(characterID: uint256, playerAddress: address) +    _approveContractWeaponFor(weaponID: uint256, playerAddress: address) +    _giveInGameOnlyFundsFromContractBalance(to: address, skillAmount: uint256) +    _getRewardsClaimTax(playerAddress: address): int128 +    _startRewardsClaimTaxTimer(playerAddress: address) +External: +    migrateTo_23b3a8b(_stakeFromGame: IStakeFromGame) +    migrateTo_801f279() +    migrateTo_60872c8(_blacksmith: Blacksmith) +    fight(char: uint256, wep: uint256, target: uint32, fightMultiplier: uint8) +    migrateRandoms(_newRandoms: IRandoms) +    giveInGameOnlyFunds(to: address, skillAmount: uint256) +    giveInGameOnlyFundsFromContractBalance(to: address, skillAmount: uint256) +    stakeUnclaimedRewards() +Public: +    <<event>> FightOutcome(owner: address, character: uint256, weapon: uint256, target: uint32, playerRoll: uint24, enemyRoll: uint24, xpGain: uint16, skillGain: uint256) +    <<event>> InGameOnlyFundsGiven(to: address, skillAmount: uint256) +    <<modifier>> fightModifierChecks(char: uint256, wep: uint256) +    <<modifier>> onlyNonContract() +    <<modifier>> restricted() +    <<modifier>> oncePerBlock(user: address) +    <<modifier>> isWeaponOwner(weapon: uint256) +    <<modifier>> isWeaponsOwner(weaponArray: uint256[]) +    <<modifier>> isCharacterOwner(character: uint256) +    <<modifier>> isTargetValid(character: uint256, weapon: uint256, target: uint32) +    <<modifier>> requestPayFromPlayer(usdAmount: int128) +    initialize(_skillToken: IERC20, _characters: Characters, _weapons: Weapons, _priceOracleSkillPerUsd: IPriceOracle, _randoms: IRandoms) +    migrateTo_ef994e2(_promos: Promos) +    recoverSkill(amount: uint256) +    getSkillToSubtract(_inGameOnlyFunds: uint256, _tokenRewards: uint256, _skillNeeded: uint256): (fromInGameOnlyFunds: uint256, fromTokenRewards: uint256, fromUserWallet: uint256) +    getSkillNeededFromUserWallet(playerAddress: address, skillNeeded: uint256): (skillNeededFromUserWallet: uint256) +    getMyCharacters(): uint256[] +    getMyWeapons(): uint256[] +    unpackFightData(playerData: uint96): (charTrait: uint8, basePowerLevel: uint24, timestamp: uint64) +    verifyFight(playerBasePower: uint24, wepMultiplier: int128, wepBonusPower: uint24, staminaTimestamp: uint64, hour: uint256, target: uint32) +    spendTicket(num: uint32) +    getMonsterPower(target: uint32): uint24 +    getPlayerPower(basePower: uint24, weaponMultiplier: int128, bonusPower: uint24): uint24 +    getPlayerTraitBonusAgainst(traitsCWE: uint24): int128 +    getTargets(char: uint256, wep: uint256): uint32[] +    isTraitEffectiveAgainst(attacker: uint8, defender: uint8): bool +    mintCharacter() +    mintWeaponN(num: uint32) +    mintWeapon() +    burnWeapon(burnID: uint256) +    burnWeapons(burnIDs: uint256[]) +    reforgeWeapon(reforgeID: uint256, burnID: uint256) +    reforgeWeaponWithDust(reforgeID: uint256, amountLB: uint8, amount4B: uint8, amount5B: uint8) +    payContract(playerAddress: address, usdAmount: int128) +    payContractConverted(playerAddress: address, convertedAmount: uint256) +    payPlayer(playerAddress: address, baseAmount: int128) +    payPlayerConverted(playerAddress: address, convertedAmount: uint256) +    approveContractCharacterFor(characterID: uint256, playerAddress: address) +    approveContractWeaponFor(weaponID: uint256, playerAddress: address) +    payContractTokenOnly(playerAddress: address, convertedAmount: uint256) +    setCharacterMintValue(cents: uint256) +    setFightRewardBaselineValue(tenthcents: uint256) +    setFightRewardGasOffsetValue(cents: uint256) +    setWeaponMintValue(cents: uint256) +    setBurnWeaponValue(cents: uint256) +    setReforgeWeaponValue(cents: uint256) +    setReforgeWeaponWithDustValue(cents: uint256) +    setStaminaCostFight(points: uint8) +    setDurabilityCostFight(points: uint8) +    setFightXpGain(average: uint256) +    setCharacterLimit(max: uint256) +    usdToSkill(usdAmount: int128): uint256 +    getCurrentHour(): uint256 +    claimTokenRewards() +    claimXpRewards() +    getTokenRewards(): uint256 +    getXpRewards(char: uint256): uint256 +    getTokenRewardsFor(wallet: address): uint256 +    getTotalSkillOwnedBy(wallet: address): uint256 +    getOwnRewardsClaimTax(): int128 + + + +0->3 + + + + + +5 + +<<Interface>> +IRandoms + + + +External: +     getRandomSeed(user: address): (seed: uint256) + + + +0->5 + + + + + +9 + +Shields + +Private: +   tokens: Shield[] +   cosmetics: ShieldCosmetics[] +   lastMintedBlock: uint256 +   firstMintedOfLastBlock: uint256 +Public: +   GAME_ADMIN: bytes32 +   shieldBaseMultiplier: int128 +   defenseMultPerPointBasic: int128 +   defenseMultPerPointDEF: int128 +   defenseMultPerPointMatching: int128 +   durabilityTimestamp: mapping(uint256=>uint64) +   maxDurability: uint256 +   secondsPerDurability: uint256 + +Private: +    getStatRolls(stars: uint256, seed: uint256): (uint16, uint16, uint16) +Internal: +    _restricted() +    _noFreshLookup(id: uint256) +    getStats(id: uint256): (_properties: uint16, _stat1: uint16, _stat2: uint16, _stat3: uint16) +    _get(id: uint256): (_properties: uint16, _stat1: uint16, _stat2: uint16, _stat3: uint16) +External: +    mintForPurchase(buyer: address) +Public: +    <<event>> NewShield(shield: uint256, minter: address) +    <<modifier>> restricted() +    <<modifier>> noFreshLookup(id: uint256) +    initialize() +    get(id: uint256): (_properties: uint16, _stat1: uint16, _stat2: uint16, _stat3: uint16) +    getOwned(): uint256[] +    getOwnedBy(owner: address): uint256[] +    mint(minter: address, seed: uint256): uint256 +    mintShieldWithStars(minter: address, stars: uint256, seed: uint256): uint256 +    performMintShield(minter: address, properties: uint16, stat1: uint16, stat2: uint16, stat3: uint16, cosmeticSeed: uint256): uint256 +    getRandomProperties(stars: uint256, seed: uint256): uint16 +    getRandomStat(minRoll: uint16, maxRoll: uint16, seed: uint256, seed2: uint256): uint16 +    getRandomCosmetic(seed: uint256, seed2: uint256, limit: uint8): uint8 +    getStatMinRoll(stars: uint256): uint16 +    getStatMaxRoll(stars: uint256): uint16 +    getStatCount(stars: uint256): uint8 +    getProperties(id: uint256): uint16 +    getStars(id: uint256): uint8 +    getStarsFromProperties(properties: uint16): uint8 +    getTrait(id: uint256): uint8 +    getTraitFromProperties(properties: uint16): uint8 +    getStatPattern(id: uint256): uint8 +    getStatPatternFromProperties(properties: uint16): uint8 +    getStat1Trait(statPattern: uint8): uint8 +    getStat2Trait(statPattern: uint8): uint8 +    getStat3Trait(statPattern: uint8): uint8 +    getStat1(id: uint256): uint16 +    getStat2(id: uint256): uint16 +    getStat3(id: uint256): uint16 +    getDefenseMultiplier(id: uint256): int128 +    getDefenseMultiplierForTrait(properties: uint16, stat1: uint16, stat2: uint16, stat3: uint16, trait: uint8): int128 +    getFightData(id: uint256, charTrait: uint8): (int128, int128, uint24, uint8) +    getFightDataAndDrainDurability(id: uint256, charTrait: uint8, drainAmount: uint8): (int128, int128, uint24, uint8) +    drainDurability(id: uint256, amount: uint8) +    getDurabilityTimestamp(id: uint256): uint64 +    setDurabilityTimestamp(id: uint256, timestamp: uint64) +    getDurabilityPoints(id: uint256): uint8 +    getDurabilityPointsFromTimestamp(timestamp: uint64): uint8 +    isDurabilityFull(id: uint256): bool +    getDurabilityMaxWait(): uint64 + + + +0->9 + + + + + +11 + +Weapons + +Private: +   tokens: Weapon[] +   cosmetics: WeaponCosmetics[] +   lastMintedBlock: uint256 +   firstMintedOfLastBlock: uint256 +Public: +   GAME_ADMIN: bytes32 +   RECEIVE_DOES_NOT_SET_TRANSFER_TIMESTAMP: bytes32 +   burnPoints: mapping(uint256=>WeaponBurnPoints) +   burnPointMultiplier: uint +   lowStarBurnPowerPerPoint: uint +   fourStarBurnPowerPerPoint: uint +   fiveStarBurnPowerPerPoint: uint +   oneFrac: int128 +   powerMultPerPointBasic: int128 +   powerMultPerPointPWR: int128 +   powerMultPerPointMatching: int128 +   lastTransferTimestamp: mapping(uint256=>uint256) +   durabilityTimestamp: mapping(uint256=>uint64) +   maxDurability: uint256 +   secondsPerDurability: uint256 +   burnDust: mapping(address=>uint256) + +Private: +    getStatRolls(stars: uint256, seed: uint256): (uint16, uint16, uint16) +    _applyBurnPoints(reforgeID: uint256, amountLB: uint8, amount4B: uint8, amount5B: uint8) +    levelUp(id: uint256, seed: uint256) +Internal: +    _restricted() +    _noFreshLookup(id: uint256) +    getStats(id: uint256): (_properties: uint16, _stat1: uint16, _stat2: uint16, _stat3: uint16, _level: uint8) +    getCosmetics(id: uint256): (_blade: uint8, _crossguard: uint8, _grip: uint8, _pommel: uint8) +    _get(id: uint256): (_properties: uint16, _stat1: uint16, _stat2: uint16, _stat3: uint16, _level: uint8, _blade: uint8, _crossguard: uint8, _grip: uint8, _pommel: uint8, _burnPoints: uint24, _bonusPower: uint24) +    _setDustSupplies(playerAddress: address, amountLB: uint32, amount4B: uint32, amount5B: uint32) +    _decrementDustSuppliesCheck(playerAddress: address, amountLB: uint32, amount4B: uint32, amount5B: uint32) +    _decrementDustSupplies(playerAddress: address, amountLB: uint32, amount4B: uint32, amount5B: uint32) +    _incrementDustSuppliesCheck(playerAddress: address, amountLB: uint32, amount4B: uint32, amount5B: uint32) +    _incrementDustSupplies(playerAddress: address, amountLB: uint32, amount4B: uint32, amount5B: uint32) +Public: +    <<event>> Burned(owner: address, burned: uint256) +    <<event>> NewWeapon(weapon: uint256, minter: address) +    <<event>> Reforged(owner: address, reforged: uint256, burned: uint256, lowPoints: uint8, fourPoints: uint8, fivePoints: uint8) +    <<event>> ReforgedWithDust(owner: address, reforged: uint256, lowDust: uint8, fourDust: uint8, fiveDust: uint8, lowPoints: uint8, fourPoints: uint8, fivePoints: uint8) +    <<modifier>> restricted() +    <<modifier>> noFreshLookup(id: uint256) +    initialize() +    migrateTo_e55d8c5() +    migrateTo_aa9da90() +    migrateTo_951a020() +    get(id: uint256): (_properties: uint16, _stat1: uint16, _stat2: uint16, _stat3: uint16, _level: uint8, _blade: uint8, _crossguard: uint8, _grip: uint8, _pommel: uint8, _burnPoints: uint24, _bonusPower: uint24) +    mint(minter: address, seed: uint256): uint256 +    mintWeaponWithStars(minter: address, stars: uint256, seed: uint256): uint256 +    performMintWeapon(minter: address, properties: uint16, stat1: uint16, stat2: uint16, stat3: uint16, cosmeticSeed: uint256): uint256 +    getRandomProperties(stars: uint256, seed: uint256): uint16 +    getRandomStat(minRoll: uint16, maxRoll: uint16, seed: uint256, seed2: uint256): uint16 +    getRandomCosmetic(seed: uint256, seed2: uint256, limit: uint8): uint8 +    getStatMinRoll(stars: uint256): uint16 +    getStatMaxRoll(stars: uint256): uint16 +    getStatCount(stars: uint256): uint8 +    getProperties(id: uint256): uint16 +    getStars(id: uint256): uint8 +    getStarsFromProperties(properties: uint16): uint8 +    getTrait(id: uint256): uint8 +    getTraitFromProperties(properties: uint16): uint8 +    getStatPattern(id: uint256): uint8 +    getStatPatternFromProperties(properties: uint16): uint8 +    getStat1Trait(statPattern: uint8): uint8 +    getStat2Trait(statPattern: uint8): uint8 +    getStat3Trait(statPattern: uint8): uint8 +    getLevel(id: uint256): uint8 +    getStat1(id: uint256): uint16 +    getStat2(id: uint256): uint16 +    getStat3(id: uint256): uint16 +    getPowerMultiplier(id: uint256): int128 +    getPowerMultiplierForTrait(properties: uint16, stat1: uint16, stat2: uint16, stat3: uint16, trait: uint8): int128 +    getDustSupplies(playerAddress: address): uint32[] +    _calculateBurnValues(burnID: uint256): uint8[] +    burn(burnID: uint256) +    reforge(reforgeID: uint256, burnID: uint256) +    reforgeWithDust(reforgeID: uint256, amountLB: uint8, amount4B: uint8, amount5B: uint8) +    getBonusPower(id: uint256): uint24 +    getBonusPowerForFight(id: uint256, level: uint8): uint24 +    getFightData(id: uint256, charTrait: uint8): (int128, int128, uint24, uint8) +    getFightDataAndDrainDurability(id: uint256, charTrait: uint8, drainAmount: uint8): (int128, int128, uint24, uint8) +    drainDurability(id: uint256, amount: uint8) +    setBurnPointMultiplier(multiplier: uint256) +    setLowStarBurnPowerPerPoint(powerPerBurnPoint: uint256) +    setFourStarBurnPowerPerPoint(powerPerBurnPoint: uint256) +    setFiveStarBurnPowerPerPoint(powerPerBurnPoint: uint256) +    getDurabilityTimestamp(id: uint256): uint64 +    setDurabilityTimestamp(id: uint256, timestamp: uint64) +    getDurabilityPoints(id: uint256): uint8 +    getDurabilityPointsFromTimestamp(timestamp: uint64): uint8 +    isDurabilityFull(id: uint256): bool +    getDurabilityMaxWait(): uint64 + + + +0->11 + + + + + +1 + +Promos + +Public: +   GAME_ADMIN: bytes32 +   bits: mapping(address=>uint256) +   BIT_FIRST_CHARACTER: uint256 +   BIT_FOUNDER_SHIELD: uint256 +   firstCharacterPromoInGameOnlyFundsGivenInUsd: int128 + +External: +    migrateTo_f73df27() +    firstCharacterPromoInGameOnlyFundsGivenInUsdAsCents(): uint256 +    setFirstCharacterPromoInGameOnlyFundsGivenInUsdAsCents(_usdCents: uint256) +    setFirstCharacterPromoInGameOnlyFundsGivenInUsdAsRational(_numerator: uint256, _denominator: uint256) +Public: +    <<modifier>> restricted() +    initialize() +    setBit(user: address, bit: uint256) +    unsetBit(user: address, bit: uint256) +    getBit(user: address, bit: uint256): bool + + + +2 + +Characters + +Private: +   tokens: Character[] +   cosmetics: CharacterCosmetics[] +   experienceTable: uint256[] +   lastMintedBlock: uint256 +   firstMintedOfLastBlock: uint256 +Public: +   GAME_ADMIN: bytes32 +   NO_OWNED_LIMIT: bytes32 +   RECEIVE_DOES_NOT_SET_TRANSFER_TIMESTAMP: bytes32 +   TRANSFER_COOLDOWN: uint256 +   maxStamina: uint256 +   secondsPerStamina: uint256 +   lastTransferTimestamp: mapping(uint256=>uint256) +   promos: Promos +   characterLimit: uint256 + +Private: +    getRandomCosmetic(seed: uint256, seed2: uint256, limit: uint16): uint16 +Internal: +    _restricted() +    _noFreshLookup(id: uint256) +    _beforeTokenTransfer(from: address, to: address, tokenId: uint256) +External: +    migrateTo_b627f23() +Public: +    <<event>> NewCharacter(character: uint256, minter: address) +    <<event>> LevelUp(owner: address, character: uint256, level: uint16) +    <<modifier>> restricted() +    <<modifier>> noFreshLookup(id: uint256) +    initialize() +    migrateTo_1ee400a() +    migrateTo_951a020() +    migrateTo_ef994e2(_promos: Promos) +    transferCooldownEnd(tokenId: uint256): uint256 +    transferCooldownLeft(tokenId: uint256): uint256 +    get(id: uint256): (uint16, uint8, uint8, uint64, uint16, uint16, uint16, uint16, uint16, uint16) +    mint(minter: address, seed: uint256) +    getLevel(id: uint256): uint8 +    getRequiredXpForNextLevel(currentLevel: uint8): uint16 +    getPower(id: uint256): uint24 +    getPowerAtLevel(level: uint8): uint24 +    getTrait(id: uint256): uint8 +    getXp(id: uint256): uint32 +    gainXp(id: uint256, xp: uint16) +    getStaminaTimestamp(id: uint256): uint64 +    setStaminaTimestamp(id: uint256, timestamp: uint64) +    getStaminaPoints(id: uint256): uint8 +    getStaminaPointsFromTimestamp(timestamp: uint64): uint8 +    isStaminaFull(id: uint256): bool +    getStaminaMaxWait(): uint64 +    getFightDataAndDrainStamina(id: uint256, amount: uint8): uint96 +    setCharacterLimit(max: uint256) + + + +2->1 + + + + + +7 + +<<Interface>> +ITransferCooldownable + + + +External: +     lastTransferTimestamp(tokenId: uint256): uint256 +     transferCooldownEnd(tokenId: uint256): uint256 +     transferCooldownLeft(tokenId: uint256): uint256 + + + +2->7 + + + + + +8 + +<<Library>> +TransferCooldownableInterfaceId + + + +Internal: +    interfaceId(): bytes4 + + + +2->8 + + + + + +10 + +<<Library>> +RandomUtil + + + +Internal: +    randomSeededMinMax(min: uint, max: uint, seed: uint): uint +    combineSeeds(seed1: uint, seed2: uint): uint +    combineSeeds(seeds: uint[]): uint +    plusMinus10PercentSeeded(num: uint256, seed: uint256): uint256 +    uint2str(_i: uint): (_uintAsString: string) + + + +2->10 + + + + + +2struct0 + +<<struct>> +Character + +xp: uint16 +level: uint8 +trait: uint8 +staminaTimestamp: uint64 + + + +2struct0->2 + + + + + +2struct1 + +<<struct>> +CharacterCosmetics + +version: uint8 +seed: uint256 + + + +2struct1->2 + + + + + +3->0 + + + + + +3->1 + + + + + +3->2 + + + + + +4 + +<<Interface>> +IPriceOracle + + + +External: +     currentPrice(): (price: uint256) +     setCurrentPrice(price: uint256) +Public: +    <<event>> CurrentPriceUpdated(price: uint256) + + + +3->4 + + + + + +3->5 + + + + + +6 + +<<Interface>> +IStakeFromGame + + + +External: +     stakeFromGame(player: address, amount: uint256) + + + +3->6 + + + + + +3->10 + + + + + +3->11 + + + + + +8->7 + + + + + +9->10 + + + + + +9struct0 + +<<struct>> +Shield + +properties: uint16 +stat1: uint16 +stat2: uint16 +stat3: uint16 + + + +9struct0->9 + + + + + +9struct1 + +<<struct>> +ShieldCosmetics + +version: uint8 +seed: uint256 + + + +9struct1->9 + + + + + +11->10 + + + + + +11struct0 + +<<struct>> +Weapon + +properties: uint16 +stat1: uint16 +stat2: uint16 +stat3: uint16 +level: uint8 + + + +11struct0->11 + + + + + +11struct1 + +<<struct>> +WeaponBurnPoints + +lowStarBurnPoints: uint8 +fourStarBurnPoints: uint8 +fiveStarBurnPoints: uint8 + + + +11struct1->11 + + + + + +11struct2 + +<<struct>> +WeaponCosmetics + +version: uint8 +seed: uint256 + + + +11struct2->11 + + + + + +12 + +<<Abstract>> +AccessControlUpgradeable + +Private: +   _roles: mapping(bytes32=>RoleData) +   __gap: uint256[] +Public: +   DEFAULT_ADMIN_ROLE: bytes32 + +Private: +    _grantRole(role: bytes32, account: address) +    _revokeRole(role: bytes32, account: address) +Internal: +    __AccessControl_init() +    __AccessControl_init_unchained() +    _setupRole(role: bytes32, account: address) +    _setRoleAdmin(role: bytes32, adminRole: bytes32) +Public: +    <<event>> RoleAdminChanged(role: bytes32, previousAdminRole: bytes32, newAdminRole: bytes32) +    <<event>> RoleGranted(role: bytes32, account: address, sender: address) +    <<event>> RoleRevoked(role: bytes32, account: address, sender: address) +    hasRole(role: bytes32, account: address): bool +    getRoleMemberCount(role: bytes32): uint256 +    getRoleMember(role: bytes32, index: uint256): address +    getRoleAdmin(role: bytes32): bytes32 +    grantRole(role: bytes32, account: address) +    revokeRole(role: bytes32, account: address) +    renounceRole(role: bytes32, account: address) + + + +16 + +<<Abstract>> +Initializable + +Private: +   _initialized: bool +   _initializing: bool + +Private: +    _isConstructor(): bool +Public: +    <<modifier>> initializer() + + + +12->16 + + + + + +22 + +<<Library>> +AddressUpgradeable + + + +Private: +    _verifyCallResult(success: bool, returndata: bytes, errorMessage: string): bytes +Internal: +    isContract(account: address): bool +    sendValue(recipient: address, amount: uint256) +    functionCall(target: address, data: bytes): bytes +    functionCall(target: address, data: bytes, errorMessage: string): bytes +    functionCallWithValue(target: address, data: bytes, value: uint256): bytes +    functionCallWithValue(target: address, data: bytes, value: uint256, errorMessage: string): bytes +    functionStaticCall(target: address, data: bytes): bytes +    functionStaticCall(target: address, data: bytes, errorMessage: string): bytes + + + +12->22 + + + + + +23 + +<<Abstract>> +ContextUpgradeable + +Private: +   __gap: uint256[] + +Internal: +    __Context_init() +    __Context_init_unchained() +    _msgSender(): (payable: address) +    _msgData(): bytes + + + +12->23 + + + + + +25 + +<<Library>> +EnumerableSetUpgradeable + + + +Private: +    _add(set: Set, value: bytes32): bool +    _remove(set: Set, value: bytes32): bool +    _contains(set: Set, value: bytes32): bool +    _length(set: Set): uint256 +    _at(set: Set, index: uint256): bytes32 +Internal: +    add(set: Bytes32Set, value: bytes32): bool +    remove(set: Bytes32Set, value: bytes32): bool +    contains(set: Bytes32Set, value: bytes32): bool +    length(set: Bytes32Set): uint256 +    at(set: Bytes32Set, index: uint256): bytes32 +    add(set: AddressSet, value: address): bool +    remove(set: AddressSet, value: address): bool +    contains(set: AddressSet, value: address): bool +    length(set: AddressSet): uint256 +    at(set: AddressSet, index: uint256): address +    add(set: UintSet, value: uint256): bool +    remove(set: UintSet, value: uint256): bool +    contains(set: UintSet, value: uint256): bool +    length(set: UintSet): uint256 +    at(set: UintSet, index: uint256): uint256 + + + +12->25 + + + + + +12struct0 + +<<struct>> +RoleData + +members: EnumerableSetUpgradeable.AddressSet +adminRole: bytes32 + + + +12struct0->12 + + + + + +13 + +<<Abstract>> +ERC165Upgradeable + +Private: +   _INTERFACE_ID_ERC165: bytes4 +   _supportedInterfaces: mapping(bytes4=>bool) +   __gap: uint256[] + +Internal: +    __ERC165_init() +    __ERC165_init_unchained() +    _registerInterface(interfaceId: bytes4) +Public: +    supportsInterface(interfaceId: bytes4): bool + + + +14 + +<<Interface>> +IERC165Upgradeable + + + +External: +     supportsInterface(interfaceId: bytes4): bool + + + +13->14 + + + + + +13->16 + + + + + +15 + +<<Library>> +SafeMathUpgradeable + + + +Internal: +    tryAdd(a: uint256, b: uint256): (bool, uint256) +    trySub(a: uint256, b: uint256): (bool, uint256) +    tryMul(a: uint256, b: uint256): (bool, uint256) +    tryDiv(a: uint256, b: uint256): (bool, uint256) +    tryMod(a: uint256, b: uint256): (bool, uint256) +    add(a: uint256, b: uint256): uint256 +    sub(a: uint256, b: uint256): uint256 +    mul(a: uint256, b: uint256): uint256 +    div(a: uint256, b: uint256): uint256 +    mod(a: uint256, b: uint256): uint256 +    sub(a: uint256, b: uint256, errorMessage: string): uint256 +    div(a: uint256, b: uint256, errorMessage: string): uint256 +    mod(a: uint256, b: uint256, errorMessage: string): uint256 + + + +16->22 + + + + + +17 + +ERC721Upgradeable + +Private: +   _ERC721_RECEIVED: bytes4 +   _holderTokens: mapping(address=>EnumerableSetUpgradeable.UintSet) +   _tokenOwners: EnumerableMapUpgradeable.UintToAddressMap +   _tokenApprovals: mapping(uint256=>address) +   _operatorApprovals: mapping(address=>mapping(address=>bool)) +   _name: string +   _symbol: string +   _tokenURIs: mapping(uint256=>string) +   _baseURI: string +   _INTERFACE_ID_ERC721: bytes4 +   _INTERFACE_ID_ERC721_METADATA: bytes4 +   _INTERFACE_ID_ERC721_ENUMERABLE: bytes4 +   __gap: uint256[] + +Private: +    _checkOnERC721Received(from: address, to: address, tokenId: uint256, _data: bytes): bool +Internal: +    __ERC721_init(name_: string, symbol_: string) +    __ERC721_init_unchained(name_: string, symbol_: string) +    _safeTransfer(from: address, to: address, tokenId: uint256, _data: bytes) +    _exists(tokenId: uint256): bool +    _isApprovedOrOwner(spender: address, tokenId: uint256): bool +    _safeMint(to: address, tokenId: uint256) +    _safeMint(to: address, tokenId: uint256, _data: bytes) +    _mint(to: address, tokenId: uint256) +    _burn(tokenId: uint256) +    _transfer(from: address, to: address, tokenId: uint256) +    _setTokenURI(tokenId: uint256, _tokenURI: string) +    _setBaseURI(baseURI_: string) +    _approve(to: address, tokenId: uint256) +    _beforeTokenTransfer(from: address, to: address, tokenId: uint256) +Public: +    balanceOf(owner: address): uint256 +    ownerOf(tokenId: uint256): address +    name(): string +    symbol(): string +    tokenURI(tokenId: uint256): string +    baseURI(): string +    tokenOfOwnerByIndex(owner: address, index: uint256): uint256 +    totalSupply(): uint256 +    tokenByIndex(index: uint256): uint256 +    approve(to: address, tokenId: uint256) +    getApproved(tokenId: uint256): address +    setApprovalForAll(operator: address, approved: bool) +    isApprovedForAll(owner: address, operator: address): bool +    transferFrom(from: address, to: address, tokenId: uint256) +    safeTransferFrom(from: address, to: address, tokenId: uint256) +    safeTransferFrom(from: address, to: address, tokenId: uint256, _data: bytes) + + + +17->13 + + + + + +17->15 + + + + + +17->16 + + + + + +17->17 + + + + + +18 + +<<Interface>> +IERC721EnumerableUpgradeable + + + +External: +     totalSupply(): uint256 +     tokenOfOwnerByIndex(owner: address, index: uint256): (tokenId: uint256) +     tokenByIndex(index: uint256): uint256 + + + +17->18 + + + + + +19 + +<<Interface>> +IERC721MetadataUpgradeable + + + +External: +     name(): string +     symbol(): string +     tokenURI(tokenId: uint256): string + + + +17->19 + + + + + +20 + +<<Interface>> +IERC721ReceiverUpgradeable + + + +External: +     onERC721Received(operator: address, from: address, tokenId: uint256, data: bytes): bytes4 + + + +17->20 + + + + + +21 + +<<Interface>> +IERC721Upgradeable + + + +External: +     balanceOf(owner: address): (balance: uint256) +     ownerOf(tokenId: uint256): (owner: address) +     safeTransferFrom(from: address, to: address, tokenId: uint256) +     transferFrom(from: address, to: address, tokenId: uint256) +     approve(to: address, tokenId: uint256) +     getApproved(tokenId: uint256): (operator: address) +     setApprovalForAll(operator: address, _approved: bool) +     isApprovedForAll(owner: address, operator: address): bool +     safeTransferFrom(from: address, to: address, tokenId: uint256, data: bytes) +Public: +    <<event>> Transfer(from: address, to: address, tokenId: uint256) +    <<event>> Approval(owner: address, approved: address, tokenId: uint256) +    <<event>> ApprovalForAll(owner: address, operator: address, approved: bool) + + + +17->21 + + + + + +17->22 + + + + + +17->23 + + + + + +24 + +<<Library>> +EnumerableMapUpgradeable + + + +Private: +    _set(map: Map, key: bytes32, value: bytes32): bool +    _remove(map: Map, key: bytes32): bool +    _contains(map: Map, key: bytes32): bool +    _length(map: Map): uint256 +    _at(map: Map, index: uint256): (bytes32, bytes32) +    _tryGet(map: Map, key: bytes32): (bool, bytes32) +    _get(map: Map, key: bytes32): bytes32 +    _get(map: Map, key: bytes32, errorMessage: string): bytes32 +Internal: +    set(map: UintToAddressMap, key: uint256, value: address): bool +    remove(map: UintToAddressMap, key: uint256): bool +    contains(map: UintToAddressMap, key: uint256): bool +    length(map: UintToAddressMap): uint256 +    at(map: UintToAddressMap, index: uint256): (uint256, address) +    tryGet(map: UintToAddressMap, key: uint256): (bool, address) +    get(map: UintToAddressMap, key: uint256): address +    get(map: UintToAddressMap, key: uint256, errorMessage: string): address + + + +17->24 + + + + + +17->25 + + + + + +26 + +<<Library>> +StringsUpgradeable + + + +Internal: +    toString(value: uint256): string + + + +17->26 + + + + + +18->21 + + + + + +19->21 + + + + + +21->14 + + + + + +23->16 + + + + + +24struct0 + +<<struct>> +MapEntry + +_key: bytes32 +_value: bytes32 + + + +24struct0->24 + + + + + +24struct1 + +<<struct>> +Map + +_entries: MapEntry[] +_indexes: mapping(bytes32=>uint256) + + + +24struct1->24 + + + + + +24struct2 + +<<struct>> +UintToAddressMap + +_inner: Map + + + +24struct2->24 + + + + + +25struct0 + +<<struct>> +Set + +_values: bytes32[] +_indexes: mapping(bytes32=>uint256) + + + +25struct0->25 + + + + + +25struct1 + +<<struct>> +Bytes32Set + +_inner: Set + + + +25struct1->25 + + + + + +25struct2 + +<<struct>> +AddressSet + +_inner: Set + + + +25struct2->25 + + + + + +25struct3 + +<<struct>> +UintSet + +_inner: Set + + + +25struct3->25 + + + + + +27 + +<<Library>> +SafeMath + + + +Internal: +    tryAdd(a: uint256, b: uint256): (bool, uint256) +    trySub(a: uint256, b: uint256): (bool, uint256) +    tryMul(a: uint256, b: uint256): (bool, uint256) +    tryDiv(a: uint256, b: uint256): (bool, uint256) +    tryMod(a: uint256, b: uint256): (bool, uint256) +    add(a: uint256, b: uint256): uint256 +    sub(a: uint256, b: uint256): uint256 +    mul(a: uint256, b: uint256): uint256 +    div(a: uint256, b: uint256): uint256 +    mod(a: uint256, b: uint256): uint256 +    sub(a: uint256, b: uint256, errorMessage: string): uint256 +    div(a: uint256, b: uint256, errorMessage: string): uint256 +    mod(a: uint256, b: uint256, errorMessage: string): uint256 + + + +28 + +<<Interface>> +IERC20 + + + +External: +     totalSupply(): uint256 +     balanceOf(account: address): uint256 +     transfer(recipient: address, amount: uint256): bool +     allowance(owner: address, spender: address): uint256 +     approve(spender: address, amount: uint256): bool +     transferFrom(sender: address, recipient: address, amount: uint256): bool +Public: +    <<event>> Transfer(from: address, to: address, value: uint256) +    <<event>> Approval(owner: address, spender: address, value: uint256) + + + +29 + +<<Library>> +SafeERC20 + + + +Private: +    _callOptionalReturn(token: IERC20, data: bytes) +Internal: +    safeTransfer(token: IERC20, to: address, value: uint256) +    safeTransferFrom(token: IERC20, from: address, to: address, value: uint256) +    safeApprove(token: IERC20, spender: address, value: uint256) +    safeIncreaseAllowance(token: IERC20, spender: address, value: uint256) +    safeDecreaseAllowance(token: IERC20, spender: address, value: uint256) + + + +29->27 + + + + + +29->28 + + + + + +30 + +<<Library>> +Address + + + +Private: +    _verifyCallResult(success: bool, returndata: bytes, errorMessage: string): bytes +Internal: +    isContract(account: address): bool +    sendValue(recipient: address, amount: uint256) +    functionCall(target: address, data: bytes): bytes +    functionCall(target: address, data: bytes, errorMessage: string): bytes +    functionCallWithValue(target: address, data: bytes, value: uint256): bytes +    functionCallWithValue(target: address, data: bytes, value: uint256, errorMessage: string): bytes +    functionStaticCall(target: address, data: bytes): bytes +    functionStaticCall(target: address, data: bytes, errorMessage: string): bytes +    functionDelegateCall(target: address, data: bytes): bytes +    functionDelegateCall(target: address, data: bytes, errorMessage: string): bytes + + + +29->30 + + + + + +31 + +<<Library>> +ABDKMath64x64 + +Private: +   MIN_64x64: int128 +   MAX_64x64: int128 + +Private: +    divuu(x: uint256, y: uint256): uint128 +    powu(x: uint256, y: uint256): uint256 +    sqrtu(x: uint256): uint128 +Internal: +    fromInt(x: int256): int128 +    toInt(x: int128): int64 +    fromUInt(x: uint256): int128 +    toUInt(x: int128): uint64 +    from128x128(x: int256): int128 +    to128x128(x: int128): int256 +    add(x: int128, y: int128): int128 +    sub(x: int128, y: int128): int128 +    mul(x: int128, y: int128): int128 +    muli(x: int128, y: int256): int256 +    mulu(x: int128, y: uint256): uint256 +    div(x: int128, y: int128): int128 +    divi(x: int256, y: int256): int128 +    divu(x: uint256, y: uint256): int128 +    neg(x: int128): int128 +    abs(x: int128): int128 +    inv(x: int128): int128 +    avg(x: int128, y: int128): int128 +    gavg(x: int128, y: int128): int128 +    pow(x: int128, y: uint256): int128 +    sqrt(x: int128): int128 +    log_2(x: int128): int128 +    ln(x: int128): int128 +    exp_2(x: int128): int128 +    exp(x: int128): int128 + + + diff --git a/examples/polygonMusd.svg b/examples/polygonMusd.svg new file mode 100644 index 00000000..1d7113ea --- /dev/null +++ b/examples/polygonMusd.svg @@ -0,0 +1,1111 @@ + + + + + + +UmlClassDiagram + + + +0 + +Initializable + +Private: +   initialized: bool +   initializing: bool +   ______gap: uint256[] + +Private: +    isConstructor(): bool +Public: +    <<modifier>> initializer() + + + +1 + +<<Abstract>> +Context + + + +Internal: +    _msgSender(): (payable: address) +    _msgData(): bytes + + + +2 + +<<Interface>> +IERC20 + + + +External: +     totalSupply(): uint256 +     balanceOf(account: address): uint256 +     transfer(recipient: address, amount: uint256): bool +     allowance(owner: address, spender: address): uint256 +     approve(spender: address, amount: uint256): bool +     transferFrom(sender: address, recipient: address, amount: uint256): bool +Public: +    <<event>> Transfer(from: address, to: address, value: uint256) +    <<event>> Approval(owner: address, spender: address, value: uint256) + + + +3 + +ERC205 + +Private: +   _balances: mapping(address=>uint256) +   _allowances: mapping(address=>mapping(address=>uint256)) +   _totalSupply: uint256 + +Internal: +    _transfer(sender: address, recipient: address, amount: uint256) +    _mint(account: address, amount: uint256) +    _burn(account: address, amount: uint256) +    _approve(owner: address, spender: address, amount: uint256) +Public: +    totalSupply(): uint256 +    balanceOf(account: address): uint256 +    transfer(recipient: address, amount: uint256): bool +    allowance(owner: address, spender: address): uint256 +    approve(spender: address, amount: uint256): bool +    transferFrom(sender: address, recipient: address, amount: uint256): bool +    increaseAllowance(spender: address, addedValue: uint256): bool +    decreaseAllowance(spender: address, subtractedValue: uint256): bool + + + +3->1 + + + + + +3->2 + + + + + +4 + +<<Abstract>> +InitializableERC20Detailed + +Private: +   _name: string +   _symbol: string +   _decimals: uint8 + +Internal: +    _initialize(nameArg: string, symbolArg: string, decimalsArg: uint8) +Public: +    name(): string +    symbol(): string +    decimals(): uint8 + + + +4->2 + + + + + +5 + +<<Abstract>> +InitializableToken + + + +Internal: +    _initialize(_nameArg: string, _symbolArg: string) + + + +5->3 + + + + + +5->4 + + + + + +6 + +ModuleKeys + +Internal: +   KEY_GOVERNANCE: bytes32 +   KEY_STAKING: bytes32 +   KEY_PROXY_ADMIN: bytes32 +   KEY_ORACLE_HUB: bytes32 +   KEY_MANAGER: bytes32 +   KEY_RECOLLATERALISER: bytes32 +   KEY_META_TOKEN: bytes32 +   KEY_SAVINGS_MANAGER: bytes32 +   KEY_LIQUIDATOR: bytes32 +   KEY_INTEREST_VALIDATOR: bytes32 + + + + + +7 + +<<Interface>> +INexus + + + +External: +     governor(): address +     getModule(key: bytes32): address +     proposeModule(_key: bytes32, _addr: address) +     cancelProposedModule(_key: bytes32) +     acceptProposedModule(_key: bytes32) +     acceptProposedModules(_keys: bytes32[]) +     requestLockModule(_key: bytes32) +     cancelLockModule(_key: bytes32) +     lockModule(_key: bytes32) + + + +8 + +<<Abstract>> +ImmutableModule + +Public: +   nexus: INexus + +Internal: +    _onlyGovernor() +    _governor(): address +    _governance(): address +    _savingsManager(): address +    _recollateraliser(): address +    _liquidator(): address +    _proxyAdmin(): address +Public: +    <<modifier>> onlyGovernor() +    <<modifier>> onlyGovernance() +    constructor(_nexus: address) + + + +8->6 + + + + + +8->7 + + + + + +9 + +InitializableReentrancyGuard + +Private: +   _notEntered: bool + +Internal: +    _initializeReentrancyGuard() +Public: +    <<modifier>> nonReentrant() + + + +10 + +<<Struct>> +BassetPersonal + +addr: address +integrator: address +hasTxFee: bool +status: BassetStatus + + + + + +13 + +<<Enum>> +BassetStatus + +Default: 0 +Normal: 1 +BrokenBelowPeg: 2 +BrokenAbovePeg: 3 +Blacklisted: 4 +Liquidating: 5 +Liquidated: 6 +Failed: 7 + + + + + +10->13 + + + + + +11 + +<<Struct>> +BassetData + +ratio: uint128 +vaultBalance: uint128 + + + + + +12 + +<<Abstract>> +IMasset + + + +External: +    <<abstract>> mint(_input: address, _inputQuantity: uint256, _minOutputQuantity: uint256, _recipient: address): (mintOutput: uint256) +    <<abstract>> mintMulti(_inputs: address[], _inputQuantities: uint256[], _minOutputQuantity: uint256, _recipient: address): (mintOutput: uint256) +    <<abstract>> getMintOutput(_input: address, _inputQuantity: uint256): (mintOutput: uint256) +    <<abstract>> getMintMultiOutput(_inputs: address[], _inputQuantities: uint256[]): (mintOutput: uint256) +    <<abstract>> swap(_input: address, _output: address, _inputQuantity: uint256, _minOutputQuantity: uint256, _recipient: address): (swapOutput: uint256) +    <<abstract>> getSwapOutput(_input: address, _output: address, _inputQuantity: uint256): (swapOutput: uint256) +    <<abstract>> redeem(_output: address, _mAssetQuantity: uint256, _minOutputQuantity: uint256, _recipient: address): (outputQuantity: uint256) +    <<abstract>> redeemMasset(_mAssetQuantity: uint256, _minOutputQuantities: uint256[], _recipient: address): (outputQuantities: uint256[]) +    <<abstract>> redeemExactBassets(_outputs: address[], _outputQuantities: uint256[], _maxMassetQuantity: uint256, _recipient: address): (mAssetRedeemed: uint256) +    <<abstract>> getRedeemOutput(_output: address, _mAssetQuantity: uint256): (bAssetOutput: uint256) +    <<abstract>> getRedeemExactBassetsOutput(_outputs: address[], _outputQuantities: uint256[]): (mAssetAmount: uint256) +    <<abstract>> getBasket(): (bool, bool) +    <<abstract>> getBasset(_token: address): (personal: BassetPersonal, data: BassetData) +    <<abstract>> getBassets(): (personal: BassetPersonal[], data: BassetData[]) +    <<abstract>> bAssetIndexes(address): uint8 +    <<abstract>> getPrice(): (price: uint256, k: uint256) +    <<abstract>> collectInterest(): (swapFeesGained: uint256, newSupply: uint256) +    <<abstract>> collectPlatformInterest(): (mintAmount: uint256, newSupply: uint256) +    <<abstract>> setCacheSize(_cacheSize: uint256) +    <<abstract>> setFees(_swapFee: uint256, _redemptionFee: uint256) +    <<abstract>> setTransferFeesFlag(_bAsset: address, _flag: bool) +    <<abstract>> migrateBassets(_bAssets: address[], _newIntegration: address) + + + +12->10 + + + + + +12->11 + + + + + +14 + +<<Struct>> +BasketState + +undergoingRecol: bool +failed: bool + + + + + +15 + +<<Struct>> +FeederConfig + +supply: uint256 +a: uint256 +limits: WeightLimits + + + + + +18 + +<<Struct>> +WeightLimits + +min: uint128 +max: uint128 + + + + + +15->18 + + + + + +16 + +<<Struct>> +InvariantConfig + +supply: uint256 +a: uint256 +limits: WeightLimits +recolFee: uint256 + + + + + +16->18 + + + + + +17 + +<<Struct>> +BasicConfig + +a: uint256 +limits: WeightLimits + + + + + +17->18 + + + + + +19 + +<<Struct>> +AmpData + +initialA: uint64 +targetA: uint64 +rampStartTime: uint64 +rampEndTime: uint64 + + + + + +20 + +<<Struct>> +FeederData + +swapFee: uint256 +redemptionFee: uint256 +govFee: uint256 +pendingFees: uint256 +cacheSize: uint256 +bAssetPersonal: BassetPersonal[] +bAssetData: BassetData[] +ampData: AmpData +weightLimits: WeightLimits + + + + + +20->18 + + + + + +20->19 + + + + + +21 + +<<Struct>> +MassetData + +swapFee: uint256 +redemptionFee: uint256 +cacheSize: uint256 +surplus: uint256 +bAssetPersonal: BassetPersonal[] +bAssetData: BassetData[] +basket: BasketState +ampData: AmpData +weightLimits: WeightLimits + + + + + +21->14 + + + + + +21->18 + + + + + +21->19 + + + + + +22 + +<<Struct>> +AssetData + +idx: uint8 +amt: uint256 +personal: BassetPersonal + + + + + +22->10 + + + + + +23 + +<<Struct>> +Asset + +idx: uint8 +addr: address +exists: bool + + + + + +24 + +<<Library>> +SafeCast + + + +Internal: +    toUint128(value: uint256): uint128 +    toUint64(value: uint256): uint64 +    toUint32(value: uint256): uint32 +    toUint16(value: uint256): uint16 +    toUint8(value: uint256): uint8 +    toUint256(value: int256): uint256 +    toInt128(value: int256): int128 +    toInt64(value: int256): int64 +    toInt32(value: int256): int32 +    toInt16(value: int256): int16 +    toInt8(value: int256): int8 +    toInt256(value: uint256): int256 + + + +25 + +<<Library>> +StableMath + +Private: +   FULL_SCALE: uint256 +   RATIO_SCALE: uint256 + +Internal: +    getFullScale(): uint256 +    getRatioScale(): uint256 +    scaleInteger(x: uint256): uint256 +    mulTruncate(x: uint256, y: uint256): uint256 +    mulTruncateScale(x: uint256, y: uint256, scale: uint256): uint256 +    mulTruncateCeil(x: uint256, y: uint256): uint256 +    divPrecisely(x: uint256, y: uint256): uint256 +    mulRatioTruncate(x: uint256, ratio: uint256): (c: uint256) +    mulRatioTruncateCeil(x: uint256, ratio: uint256): uint256 +    divRatioPrecisely(x: uint256, ratio: uint256): (c: uint256) +    min(x: uint256, y: uint256): uint256 +    max(x: uint256, y: uint256): uint256 +    clamp(x: uint256, upperBound: uint256): uint256 + + + +26 + +<<Interface>> +IPlatformIntegration + + + +External: +     deposit(_bAsset: address, _amount: uint256, isTokenFeeCharged: bool): (quantityDeposited: uint256) +     withdraw(_receiver: address, _bAsset: address, _amount: uint256, _hasTxFee: bool) +     withdraw(_receiver: address, _bAsset: address, _amount: uint256, _totalAmount: uint256, _hasTxFee: bool) +     withdrawRaw(_receiver: address, _bAsset: address, _amount: uint256) +     checkBalance(_bAsset: address): (balance: uint256) +     bAssetToPToken(_bAsset: address): (pToken: address) + + + +27 + +<<Library>> +Root + + + +Internal: +    sqrt(x: uint256): (y: uint256) + + + +28 + +<<Library>> +Address + + + +Private: +    _verifyCallResult(success: bool, returndata: bytes, errorMessage: string): bytes +Internal: +    isContract(account: address): bool +    sendValue(recipient: address, amount: uint256) +    functionCall(target: address, data: bytes): bytes +    functionCall(target: address, data: bytes, errorMessage: string): bytes +    functionCallWithValue(target: address, data: bytes, value: uint256): bytes +    functionCallWithValue(target: address, data: bytes, value: uint256, errorMessage: string): bytes +    functionStaticCall(target: address, data: bytes): bytes +    functionStaticCall(target: address, data: bytes, errorMessage: string): bytes +    functionDelegateCall(target: address, data: bytes): bytes +    functionDelegateCall(target: address, data: bytes, errorMessage: string): bytes + + + +29 + +<<Library>> +SafeERC20 + + + +Private: +    _callOptionalReturn(token: IERC20, data: bytes) +Internal: +    safeTransfer(token: IERC20, to: address, value: uint256) +    safeTransferFrom(token: IERC20, from: address, to: address, value: uint256) +    safeApprove(token: IERC20, spender: address, value: uint256) +    safeIncreaseAllowance(token: IERC20, spender: address, value: uint256) +    safeDecreaseAllowance(token: IERC20, spender: address, value: uint256) + + + +29->2 + + + + + +29->28 + + + + + +30 + +<<Library>> +MassetHelpers + + + +Internal: +    transferReturnBalance(_sender: address, _recipient: address, _bAsset: address, _qty: uint256): (receivedQty: uint256, recipientBalance: uint256) +    safeInfiniteApprove(_asset: address, _spender: address) + + + +30->2 + + + + + +30->29 + + + + + +31 + +<<Library>> +MassetLogic + +Internal: +   A_PRECISION: uint256 + +Internal: +    _getDeducted(_bData: BassetData[], _config: InvariantConfig, _input: uint256, _redemptionFee: uint256): (deductedInput: uint256, scaledFee: uint256) +    _depositTokens(_bAsset: BassetPersonal, _bAssetRatio: uint256, _quantity: uint256, _maxCache: uint256): (quantityDeposited: uint256) +    _withdrawTokens(_quantity: uint256, _personal: BassetPersonal, _data: BassetData, _recipient: address, _maxCache: uint256) +    _getCacheDetails(_data: MassetData, _supply: uint256): (maxCache: uint256) +    _getSwapFee(_k0: uint256, _k1: uint256, _feeRate: uint256, _config: InvariantConfig): (k2: uint256, scaledSwapFee: uint256) +    _getFee(_grossMassetQuantity: uint256, _config: InvariantConfig, _feeRate: uint256, _k0: uint256): (redemption: uint256, scaledFee: uint256) +    _computeMintOutput(_x: uint256[], _sum: uint256, _k: uint256, _config: InvariantConfig): (mintAmount: uint256) +    _getReserves(_bAssets: BassetData[]): (x: uint256[], sum: uint256) +    _inBounds(_x: uint256[], _sum: uint256, _limits: WeightLimits): (inBounds: bool) +    _invariant(_x: uint256[], _sum: uint256, _a: uint256): (k: uint256) +    _hasConverged(_k: uint256, _kPrev: uint256): bool +    _solveInvariant(_x: uint256[], _a: uint256, _idx: uint8, _targetK: uint256): (y: uint256) +External: +    mint(_data: MassetData, _config: InvariantConfig, _input: Asset, _inputQuantity: uint256, _minOutputQuantity: uint256): (mintOutput: uint256) +    mintMulti(_data: MassetData, _config: InvariantConfig, _indices: uint8[], _inputQuantities: uint256[], _minOutputQuantity: uint256): (mintOutput: uint256) +    swap(_data: MassetData, _config: InvariantConfig, _input: Asset, _output: Asset, _inputQuantity: uint256, _minOutputQuantity: uint256, _recipient: address): (swapOutput: uint256, scaledFee: uint256) +    redeem(_data: MassetData, _config: InvariantConfig, _output: Asset, _inputQuantity: uint256, _minOutputQuantity: uint256, _recipient: address): (bAssetQuantity: uint256, scaledFee: uint256) +    redeemProportionately(_data: MassetData, _config: InvariantConfig, _inputQuantity: uint256, _minOutputQuantities: uint256[], _recipient: address): (scaledFee: uint256, outputs: address[], outputQuantities: uint256[]) +    redeemExactBassets(_data: MassetData, _config: InvariantConfig, _indices: uint8[], _outputQuantities: uint256[], _maxMassetQuantity: uint256, _recipient: address): (mAssetQuantity: uint256, fee: uint256) +Public: +    computeMint(_bAssets: BassetData[], _i: uint8, _rawInput: uint256, _config: InvariantConfig): (mintAmount: uint256) +    computeMintMulti(_bAssets: BassetData[], _indices: uint8[], _rawInputs: uint256[], _config: InvariantConfig): (mintAmount: uint256) +    computeSwap(_bAssets: BassetData[], _i: uint8, _o: uint8, _rawInput: uint256, _feeRate: uint256, _config: InvariantConfig): (bAssetOutputQuantity: uint256, scaledSwapFee: uint256) +    computeRedeem(_bAssets: BassetData[], _o: uint8, _grossMassetQuantity: uint256, _config: InvariantConfig, _feeRate: uint256): (rawOutputUnits: uint256, scaledFee: uint256) +    computeRedeemExact(_bAssets: BassetData[], _indices: uint8[], _rawOutputs: uint256[], _config: InvariantConfig, _feeRate: uint256): (grossMasset: uint256, fee: uint256) +    computePrice(_bAssets: BassetData[], _config: InvariantConfig): (price: uint256, k: uint256) + + + +31->2 + + + + + +31->10 + + + + + +31->11 + + + + + +31->16 + + + + + +31->18 + + + + + +31->21 + + + + + +31->23 + + + + + +31->24 + + + + + +31->25 + + + + + +31->26 + + + + + +31->27 + + + + + +31->29 + + + + + +31->30 + + + + + +32 + +<<Abstract>> +IInvariantValidator + + + +External: +    <<abstract>> computeMint(_bAssets: BassetData[], _i: uint8, _rawInput: uint256, _config: InvariantConfig): uint256 +    <<abstract>> computeMintMulti(_bAssets: BassetData[], _indices: uint8[], _rawInputs: uint256[], _config: InvariantConfig): uint256 +    <<abstract>> computeSwap(_bAssets: BassetData[], _i: uint8, _o: uint8, _rawInput: uint256, _feeRate: uint256, _config: InvariantConfig): (uint256, uint256) +    <<abstract>> computeRedeem(_bAssets: BassetData[], _i: uint8, _mAssetQuantity: uint256, _config: InvariantConfig): uint256 +    <<abstract>> computeRedeemExact(_bAssets: BassetData[], _indices: uint8[], _rawOutputs: uint256[], _config: InvariantConfig): uint256 +Public: +    <<abstract>> computePrice(_bAssets: BassetData[], _config: InvariantConfig): (price: uint256, k: uint256) + + + +32->16 + + + + + +33 + +<<Interface>> +IBasicToken + + + +External: +     decimals(): uint8 + + + +34 + +<<Library>> +MassetManager + +Private: +   MIN_RAMP_TIME: uint256 +   MAX_A: uint256 + +Internal: +    _getAssetIndex(_bAssetPersonal: BassetPersonal[], _bAssetIndexes: mapping(address=>uint8), _asset: address): (idx: uint8) +External: +    addBasset(_bAssetPersonal: BassetPersonal[], _bAssetData: BassetData[], _bAssetIndexes: mapping(address=>uint8), _bAsset: address, _integration: address, _mm: uint256, _hasTxFee: bool) +    collectPlatformInterest(_bAssetPersonal: BassetPersonal[], _bAssetData: BassetData[]): (indices: uint8[], rawGains: uint256[]) +    setTransferFeesFlag(_bAssetPersonal: BassetPersonal[], _bAssetIndexes: mapping(address=>uint8), _bAsset: address, _flag: bool) +    migrateBassets(_bAssetPersonal: BassetPersonal[], _bAssetIndexes: mapping(address=>uint8), _bAssets: address[], _newIntegration: address) +    handlePegLoss(_basket: BasketState, _bAssetPersonal: BassetPersonal[], _bAssetIndexes: mapping(address=>uint8), _bAsset: address, _belowPeg: bool) +    negateIsolation(_basket: BasketState, _bAssetPersonal: BassetPersonal[], _bAssetIndexes: mapping(address=>uint8), _bAsset: address) +    startRampA(_ampData: AmpData, _targetA: uint256, _rampEndTime: uint256, _currentA: uint256, _precision: uint256) +    stopRampA(_ampData: AmpData, _currentA: uint256) +Public: +    <<event>> BassetsMigrated(bAssets: address[], newIntegrator: address) +    <<event>> TransferFeeEnabled(bAsset: address, enabled: bool) +    <<event>> BassetAdded(bAsset: address, integrator: address) +    <<event>> BassetStatusChanged(bAsset: address, status: BassetStatus) +    <<event>> BasketStatusChanged() +    <<event>> StartRampA(currentA: uint256, targetA: uint256, startTime: uint256, rampEndTime: uint256) +    <<event>> StopRampA(currentA: uint256, time: uint256) + + + +34->2 + + + + + +34->10 + + + + + +34->11 + + + + + +34->13 + + + + + +34->14 + + + + + +34->19 + + + + + +34->24 + + + + + +34->25 + + + + + +34->26 + + + + + +34->29 + + + + + +34->33 + + + + + +35 + +Masset + +Private: +   MAX_FEE: uint256 +   A_PRECISION: uint256 +   RECOL_FEE: uint256 +Public: +   bAssetIndexes: mapping(address=>uint8) +   data: MassetData + +Internal: +    _isSavingsManager() +    _isHealthy() +    _noRecol() +    _getAsset(_asset: address): (asset: Asset) +    _getAssets(_bAssets: address[]): (indexes: uint8[]) +    _getConfig(): InvariantConfig +    _getA(): uint256 +External: +    mint(_input: address, _inputQuantity: uint256, _minOutputQuantity: uint256, _recipient: address): (mintOutput: uint256) +    mintMulti(_inputs: address[], _inputQuantities: uint256[], _minOutputQuantity: uint256, _recipient: address): (mintOutput: uint256) +    getMintOutput(_input: address, _inputQuantity: uint256): (mintOutput: uint256) +    getMintMultiOutput(_inputs: address[], _inputQuantities: uint256[]): (mintOutput: uint256) +    swap(_input: address, _output: address, _inputQuantity: uint256, _minOutputQuantity: uint256, _recipient: address): (swapOutput: uint256) +    getSwapOutput(_input: address, _output: address, _inputQuantity: uint256): (swapOutput: uint256) +    redeem(_output: address, _mAssetQuantity: uint256, _minOutputQuantity: uint256, _recipient: address): (outputQuantity: uint256) +    redeemMasset(_mAssetQuantity: uint256, _minOutputQuantities: uint256[], _recipient: address): (outputQuantities: uint256[]) +    redeemExactBassets(_outputs: address[], _outputQuantities: uint256[], _maxMassetQuantity: uint256, _recipient: address): (mAssetQuantity: uint256) +    getRedeemOutput(_output: address, _mAssetQuantity: uint256): (bAssetOutput: uint256) +    getRedeemExactBassetsOutput(_outputs: address[], _outputQuantities: uint256[]): (mAssetQuantity: uint256) +    getBasket(): (bool, bool) +    getBassets(): (personal: BassetPersonal[], bData: BassetData[]) +    getBasset(_bAsset: address): (personal: BassetPersonal, bData: BassetData) +    getConfig(): (config: InvariantConfig) +    getPrice(): (price: uint256, k: uint256) +    collectInterest(): (mintAmount: uint256, newSupply: uint256) +    collectPlatformInterest(): (mintAmount: uint256, newSupply: uint256) +    setCacheSize(_cacheSize: uint256) +    setFees(_swapFee: uint256, _redemptionFee: uint256) +    setWeightLimits(_min: uint128, _max: uint128) +    setTransferFeesFlag(_bAsset: address, _flag: bool) +    migrateBassets(_bAssets: address[], _newIntegration: address) +    handlePegLoss(_bAsset: address, _belowPeg: bool) +    negateIsolation(_bAsset: address) +    startRampA(_targetA: uint256, _rampEndTime: uint256) +    stopRampA() +    mintDeficit(): (mintAmount: uint256) +    burnSurplus(): (burnAmount: uint256) +Public: +    <<event>> Minted(minter: address, recipient: address, mAssetQuantity: uint256, input: address, inputQuantity: uint256) +    <<event>> MintedMulti(minter: address, recipient: address, mAssetQuantity: uint256, inputs: address[], inputQuantities: uint256[]) +    <<event>> Swapped(swapper: address, input: address, output: address, outputAmount: uint256, scaledFee: uint256, recipient: address) +    <<event>> Redeemed(redeemer: address, recipient: address, mAssetQuantity: uint256, output: address, outputQuantity: uint256, scaledFee: uint256) +    <<event>> RedeemedMulti(redeemer: address, recipient: address, mAssetQuantity: uint256, outputs: address[], outputQuantity: uint256[], scaledFee: uint256) +    <<event>> CacheSizeChanged(cacheSize: uint256) +    <<event>> FeesChanged(swapFee: uint256, redemptionFee: uint256) +    <<event>> WeightLimitsChanged(min: uint128, max: uint128) +    <<event>> ForgeValidatorChanged(forgeValidator: address) +    <<event>> DeficitMinted(amt: uint256) +    <<event>> SurplusBurned(creditor: address, amt: uint256) +    <<modifier>> onlySavingsManager() +    <<modifier>> whenHealthy() +    <<modifier>> whenNoRecol() +    constructor(_nexus: address, _recolFee: uint256) +    initialize(_nameArg: string, _symbolArg: string, _bAssets: BassetPersonal[], _config: BasicConfig) + + + +35->0 + + + + + +35->5 + + + + + +35->8 + + + + + +35->9 + + + + + +35->10 + + + + + +35->11 + + + + + +35->12 + + + + + +35->14 + + + + + +35->16 + + + + + +35->17 + + + + + +35->18 + + + + + +35->19 + + + + + +35->21 + + + + + +35->23 + + + + + +35->24 + + + + + +35->25 + + + + + +35->31 + + + + + +35->34 + + + + + diff --git a/lib/etherscanParser.d.ts b/lib/etherscanParser.d.ts index 2b0cd7d9..2ffb0171 100644 --- a/lib/etherscanParser.d.ts +++ b/lib/etherscanParser.d.ts @@ -1,6 +1,6 @@ import { ASTNode } from '@solidity-parser/parser/dist/src/ast-types'; import { UmlClass } from './umlClass'; -declare const networks: readonly ["mainnet", "ropsten", "kovan", "rinkeby", "goerli"]; +declare const networks: readonly ["mainnet", "ropsten", "kovan", "rinkeby", "goerli", "polygon", "bsc"]; declare type Network = typeof networks[number]; export declare class EtherscanParser { protected apikey: string; diff --git a/lib/etherscanParser.js b/lib/etherscanParser.js index 275d469f..8b802b0a 100644 --- a/lib/etherscanParser.js +++ b/lib/etherscanParser.js @@ -8,7 +8,15 @@ const axios_1 = __importDefault(require("axios")); const parser_1 = require("@solidity-parser/parser"); const verror_1 = require("verror"); const parser_2 = require("./parser"); -const networks = ['mainnet', 'ropsten', 'kovan', 'rinkeby', 'goerli']; +const networks = [ + 'mainnet', + 'ropsten', + 'kovan', + 'rinkeby', + 'goerli', + 'polygon', + 'bsc', +]; class EtherscanParser { constructor(apikey = 'ZAD4UI2RCXCQTP38EXS3UY2MPHFU5H9KB1', network = 'mainnet') { this.apikey = apikey; @@ -19,6 +27,14 @@ class EtherscanParser { else if (network === 'mainnet') { this.url = 'https://api.etherscan.io/api'; } + else if (network === 'polygon') { + this.url = 'https://api.polygonscan.com/api'; + this.apikey = 'AMHGNTV5A7XYGX2M781JB3RC1DZFVRWQEB'; + } + else if (network === 'bsc') { + this.url = 'https://api.bscscan.com/api'; + this.apikey = 'APYH49FXVY9UA3KTDI6F4WP3KPIC86NITN'; + } else { this.url = `https://api-${network}.etherscan.io/api`; } diff --git a/lib/sol2uml.js b/lib/sol2uml.js index 5a98cd5a..8719e224 100755 --- a/lib/sol2uml.js +++ b/lib/sol2uml.js @@ -25,7 +25,7 @@ If an Ethereum address with a 0x prefix is passed, the verified source code from .option('-o, --outputFileName ', 'output file name') .option('-d, --depthLimit ', 'number of sub folders that will be recursively searched for Solidity files. Default -1 is unlimited', '-1') .option('-i, --ignoreFilesOrFolders ', 'comma separated list of files or folders to ignore') - .option('-n, --network ', 'mainnet, ropsten, kovan, rinkeby or goerli', 'mainnet') + .option('-n, --network ', 'mainnet, polygon, bsc, ropsten, kovan, rinkeby or goerli', 'mainnet') .option('-a, --hideAttributes', 'hide class and interface attributes') .option('-p, --hideOperators', 'hide class and interface operators/functions') .option('-e, --hideEnums', 'hide enum types') diff --git a/package-lock.json b/package-lock.json index 3c3148ea..d78e274e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "sol2uml", - "version": "1.1.28", + "version": "1.1.29", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index da3086cc..020000f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sol2uml", - "version": "1.1.28", + "version": "1.1.29", "description": "Unified Modeling Language (UML) class diagram generator for Solidity contracts", "main": "./lib/index.js", "types": "./lib/index.d.ts", diff --git a/src/ts/etherscanParser.ts b/src/ts/etherscanParser.ts index 66777a04..ee9a5b2d 100644 --- a/src/ts/etherscanParser.ts +++ b/src/ts/etherscanParser.ts @@ -6,7 +6,15 @@ import { VError } from 'verror' import { convertNodeToUmlClass } from './parser' import { UmlClass } from './umlClass' -const networks = ['mainnet', 'ropsten', 'kovan', 'rinkeby', 'goerli'] +const networks = [ + 'mainnet', + 'ropsten', + 'kovan', + 'rinkeby', + 'goerli', + 'polygon', + 'bsc', +] type Network = typeof networks[number] export class EtherscanParser { @@ -22,6 +30,12 @@ export class EtherscanParser { ) } else if (network === 'mainnet') { this.url = 'https://api.etherscan.io/api' + } else if (network === 'polygon') { + this.url = 'https://api.polygonscan.com/api' + this.apikey = 'AMHGNTV5A7XYGX2M781JB3RC1DZFVRWQEB' + } else if (network === 'bsc') { + this.url = 'https://api.bscscan.com/api' + this.apikey = 'APYH49FXVY9UA3KTDI6F4WP3KPIC86NITN' } else { this.url = `https://api-${network}.etherscan.io/api` } diff --git a/src/ts/sol2uml.ts b/src/ts/sol2uml.ts index 2db70aed..76087878 100644 --- a/src/ts/sol2uml.ts +++ b/src/ts/sol2uml.ts @@ -46,7 +46,7 @@ If an Ethereum address with a 0x prefix is passed, the verified source code from ) .option( '-n, --network ', - 'mainnet, ropsten, kovan, rinkeby or goerli', + 'mainnet, polygon, bsc, ropsten, kovan, rinkeby or goerli', 'mainnet' ) .option('-a, --hideAttributes', 'hide class and interface attributes')