Skip to content

Instantly share code, notes, and snippets.

@staringispolite
Created September 21, 2021 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save staringispolite/ddd524603b49e29a8132dd2f8171c00d to your computer and use it in GitHub Desktop.
Save staringispolite/ddd524603b49e29a8132dd2f8171c00d to your computer and use it in GitHub Desktop.
$MAGI vs $AGLD
> diff magi.txt agld.txt
1c1,2
< ubmitted for verification at Etherscan.io on 2021-09-01
---
> /**
> *Submitted for verification at Etherscan.io on 2021-09-01
810c811
< /// @title Magi Gold for Adventure Cards holders!
---
> /// @title Adventure Gold for Loot holders!
812,816c813,817
< /// @notice This contract mints Magi Gold for Adventure Cards holders and provides
< /// administrative functions to the Adventure Cards DAO. It allows:
< /// * Adventure Cards holders to claim Magi Gold
< /// * A DAO to set seasons for new opportunities to claim Magi Gold
< /// * A DAO to mint Magi Gold for use within the Adventure Cards ecosystem
---
> /// @notice This contract mints Adventure Gold for Loot holders and provides
> /// administrative functions to the Loot DAO. It allows:
> /// * Loot holders to claim Adventure Gold
> /// * A DAO to set seasons for new opportunities to claim Adventure Gold
> /// * A DAO to mint Adventure Gold for use within the Loot ecosystem
818,822c819,823
< contract MagiGold is Context, Ownable, ERC20 {
< // Adventure Cards contract is available at https://etherscan.io/address/0xff9c1b15b16263c61d017ee9f65c50e4ae0113d7
< address public adventureCardsAddress =
< 0x329Fd5E0d9aAd262b13CA07C87d001bec716ED39;
< IERC721Enumerable public adventureCardsContract;
---
> contract AdventureGold is Context, Ownable, ERC20 {
> // Loot contract is available at https://etherscan.io/address/0xff9c1b15b16263c61d017ee9f65c50e4ae0113d7
> address public lootContractAddress =
> 0xFF9C1b15B16263C61d017ee9F65C50e4AE0113D7;
> IERC721Enumerable public lootContract;
824,825c825,826
< // Give out 10,000 Magi Gold for every Adventure Cards Bag that a user holds
< uint256 public magiGoldPerTokenId = 10000 * (10**decimals());
---
> // Give out 10,000 Adventure Gold for every Loot Bag that a user holds
> uint256 public adventureGoldPerTokenId = 10000 * (10**decimals());
827c828
< // tokenIdStart of 1 is based on the following lines in the Adventure Cards contract:
---
> // tokenIdStart of 1 is based on the following lines in the Loot contract:
836c837
< // tokenIdEnd of 8000 is based on the following lines in the Adventure Cards contract:
---
> // tokenIdEnd of 8000 is based on the following lines in the Loot contract:
854,856c855,860
< constructor() Ownable() ERC20("Magi Gold", "MAGI") {
< transferOwnership(0xf5Dc4078205B79E8902fCbccCeFEfEE4Bdb651C3);
< adventureCardsContract = IERC721Enumerable(adventureCardsAddress);
---
> constructor() Ownable() ERC20("Adventure Gold", "AGLD") {
> // Transfer ownership to the Loot DAO
> // Ownable by OpenZeppelin automatically sets owner to msg.sender, but
> // we're going to be using a separate wallet for deployment
> transferOwnership(0xcD814C83198C15A542F9A13FAf84D518d1744ED1);
> lootContract = IERC721Enumerable(lootContractAddress);
859,860c863,864
< /// @notice Claim Magi Gold for a given Adventure Cards ID
< /// @param tokenId The tokenId of the Adventure Cards NFT
---
> /// @notice Claim Adventure Gold for a given Loot ID
> /// @param tokenId The tokenId of the Loot NFT
869c873
< _msgSender() == adventureCardsContract.ownerOf(tokenId),
---
> _msgSender() == lootContract.ownerOf(tokenId),
878,880c882,884
< /// @notice Claim Magi Gold for all tokens owned by the sender
< /// @notice This function will run out of gas if you have too much adventure cards! If
< /// this is a concern, you should use claimRangeForOwner and claim Magi
---
> /// @notice Claim Adventure Gold for all tokens owned by the sender
> /// @notice This function will run out of gas if you have too much loot! If
> /// this is a concern, you should use claimRangeForOwner and claim Adventure
883c887
< uint256 tokenBalanceOwner = adventureCardsContract.balanceOf(_msgSender());
---
> uint256 tokenBalanceOwner = lootContract.balanceOf(_msgSender());
893c897
< adventureCardsContract.tokenOfOwnerByIndex(_msgSender(), i),
---
> lootContract.tokenOfOwnerByIndex(_msgSender(), i),
899c903
< /// @notice Claim Magi Gold for all tokens owned by the sender within a
---
> /// @notice Claim Adventure Gold for all tokens owned by the sender within a
901,902c905,906
< /// @notice This function is useful if you own too much Adventure Cards to claim all at
< /// once or if you want to leave some Adventure Cards unclaimed. If you leave Adventure Cards
---
> /// @notice This function is useful if you own too much Loot to claim all at
> /// once or if you want to leave some Loot unclaimed. If you leave Loot
907c911
< uint256 tokenBalanceOwner = adventureCardsContract.balanceOf(_msgSender());
---
> uint256 tokenBalanceOwner = lootContract.balanceOf(_msgSender());
924c928
< adventureCardsContract.tokenOfOwnerByIndex(_msgSender(), i),
---
> lootContract.tokenOfOwnerByIndex(_msgSender(), i),
930c934
< /// @dev Internal function to mint Adventure Cards upon claiming
---
> /// @dev Internal function to mint Loot upon claiming
940c944
< // Check that Magi Gold have not already been claimed this season
---
> // Check that Adventure Gold have not already been claimed this season
949c953
< // Mark that Magi Gold has been claimed for this season for the
---
> // Mark that Adventure Gold has been claimed for this season for the
955,956c959,960
< // Send Magi Gold to the owner of the token ID
< _mint(tokenOwner, magiGoldPerTokenId);
---
> // Send Adventure Gold to the owner of the token ID
> _mint(tokenOwner, adventureGoldPerTokenId);
959c963
< /// @notice Allows the DAO to mint new tokens for use within the Adventure Cards
---
> /// @notice Allows the DAO to mint new tokens for use within the Loot
961c965
< /// @param amountDisplayValue The amount of Adventure Cards to mint. This should be
---
> /// @param amountDisplayValue The amount of Loot to mint. This should be
963c967
< /// 100 Adventure Cards, you should enter "100" rather than the value of 100 * 10^18.
---
> /// 100 Loot, you should enter "100" rather than the value of 100 * 10^18.
968,971c972,975
< /// @notice Allows the DAO to set a new contract address for Adventure Cards. This is
< /// relevant in the event that Adventure Cards migrates to a new contract.
< /// @param adventureCardsAddress_ The new contract address for Adventure Cards
< function daoSetAdventureCardsAddress(address adventureCardsAddress_)
---
> /// @notice Allows the DAO to set a new contract address for Loot. This is
> /// relevant in the event that Loot migrates to a new contract.
> /// @param lootContractAddress_ The new contract address for Loot
> function daoSetLootContractAddress(address lootContractAddress_)
975,976c979,980
< adventureCardsAddress = adventureCardsAddress_;
< adventureCardsContract = IERC721Enumerable(adventureCardsAddress);
---
> lootContractAddress = lootContractAddress_;
> lootContract = IERC721Enumerable(lootContractAddress);
980c984
< /// Adventure Cards
---
> /// Loot
983,984c987,988
< /// @dev This is relevant in case a future Adventure Cards contract has a different
< /// total supply of Adventure Cards
---
> /// @dev This is relevant in case a future Loot contract has a different
> /// total supply of Loot
993,994c997,998
< /// @notice Allows the DAO to set a season for new Magi Gold claims
< /// @param season_ The season to use for claiming Adventure Cards
---
> /// @notice Allows the DAO to set a season for new Adventure Gold claims
> /// @param season_ The season to use for claiming Loot
999c1003
< /// @notice Allows the DAO to set the amount of Magi Gold that is
---
> /// @notice Allows the DAO to set the amount of Adventure Gold that is
1001c1005
< /// @param magiGoldDisplayValue The amount of Adventure Cards a user can claim.
---
> /// @param adventureGoldDisplayValue The amount of Loot a user can claim.
1003c1007
< /// want to mint 100 Adventure Cards, you should enter "100" rather than the value of
---
> /// want to mint 100 Loot, you should enter "100" rather than the value of
1005c1009
< function daoSetmagiGoldPerTokenId(uint256 magiGoldDisplayValue)
---
> function daoSetAdventureGoldPerTokenId(uint256 adventureGoldDisplayValue)
1009c1013
< magiGoldPerTokenId = magiGoldDisplayValue * (10**decimals());
---
> adventureGoldPerTokenId = adventureGoldDisplayValue * (10**decimals());
1012c1016
< /// @notice Allows the DAO to set the season and Magi Gold per token ID
---
> /// @notice Allows the DAO to set the season and Adventure Gold per token ID
1014,1016c1018,1020
< /// can claim more Magi Gold than others
< /// @param season_ The season to use for claiming adventure cards
< /// @param magiGoldDisplayValue The amount of Adventure Cards a user can claim.
---
> /// can claim more Adventure Gold than others
> /// @param season_ The season to use for claiming loot
> /// @param adventureGoldDisplayValue The amount of Loot a user can claim.
1018c1022
< /// want to mint 100 Adventure Cards, you should enter "100" rather than the value of
---
> /// want to mint 100 Loot, you should enter "100" rather than the value of
1021c1025
< /// magiGold variables directly. It is better practice for security,
---
> /// adventureGold variables directly. It is better practice for security,
1025c1029
< function daoSetSeasonAndmagiGoldPerTokenID(
---
> function daoSetSeasonAndAdventureGoldPerTokenID(
1027c1031
< uint256 magiGoldDisplayValue
---
> uint256 adventureGoldDisplayValue
1030c1034
< daoSetmagiGoldPerTokenId(magiGoldDisplayValue);
---
> daoSetAdventureGoldPerTokenId(adventureGoldDisplayValue);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment