/
Goo.sol
118 lines (103 loc) · 8.02 KB
/
Goo.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import {ERC20} from "solmate/tokens/ERC20.sol";
/* %#/*********(&,
.#*********************#.
#****./*********************%
%*******************************%
&**********************************,((
@(*,***********************************#&
(*********************#***********************(
,%@/**************#%***%**&***%*******************,
/********************#****#*#******,**************%
,************,#(*****************(#/&(*,*,*********#
**************(%%(&************#@%(///************(
./**************,*./##****************************#*%
#**&**************************************************&@@@@@&@&%#((./.
(*******************@&%&@@@. / % &********(@/,****,,,*,,,****,,*,**********,*,
&******************# / * / / .. %/****(******************,**&***********./
/%(*******************&***./# #.#%% ., ., ##&&@****#***********************************.
*#(*,**************************(***(///.* * # # . %*****(/*************************************&
*(***********************************.//****& # # (#&((%@*,*&(******(%************./@#* *%&%(/&*************(
#,**************************************,&******&..*#&(*****,,,,/******************************** (/******,**,**,
%*****************************************.//**************#************************************** .(***********#
(*************************./************************************************************************ @**************
,**********&@@@&&%# &,**********************************************************************@ ./*,%*,********./
*********** .************@(*************(&#///////////////.//#&%/*****************&*,, &************%
(**********. .%********************(&./////////////////////////////(%****************** *(**&,&##*
#**********(, &,*./***************%(///////////////////////////////////*&****************
(************% %,*****************&///////////////////////////////////////*(***************.
.(***************( #******************&//////////////////////////////////////////****************
.&*************%*./ .*******************%/////////////////////////////////////////****************##
.*************%*% (********************#(///////////////////////////////////(#*****************&**,***,.
#***./,***% #**********************,%%*./////////////////////////*(@*******************(/****./********,((
@@, &**@*****************************./(%@&%%((((((%&&%(*********************************&,**********.
. .#,,*****./&/*****************************************************************************************
%,******************************************************************************************************#
%*******@*****************************************************./#%%,...((, .,********************(
,*******************************@&(**./%&%* .,//(//////////, ,************./
/**************************&* ////*(///////// ***(*********%
(*********************(# ..///////////(//( .***********./
#******************% *..,,,(//////////(//(*.//, %***************&
%***************** ////////&&&&&&&&%#(//(&@&#(#@@ &*********************#
#****************. ,//(//////(@@%%%%%///////****& &************************(
.**&***(************./ .@.,(///(/(.//(***((*(//*****@/& ,*************************./
&********************# .(#(@#//(****(//(*****(/(&(..&( ./*********************(#.
#/***********************./ /,,./*((#%@(%&%(((((((#%&&&/(#(#@(
#*,***********************,*& .%@@@&#, ///(/*
(*************************% ..(/,./(,.,*
/#/*./(%&(.*/
/// @title Goo Token (GOO)
/// @author FrankieIsLost <frankie@paradigm.xyz>
/// @author transmissions11 <t11s@paradigm.xyz>
/// @notice Goo is the in-game token for ArtGobblers. It's a standard ERC20
/// token that can be burned and minted by the gobblers and pages contract.
contract Goo is ERC20("Goo", "GOO", 18) {
/*//////////////////////////////////////////////////////////////
ADDRESSES
//////////////////////////////////////////////////////////////*/
/// @notice The address of the Art Gobblers contract.
address public immutable artGobblers;
/// @notice The address of the Pages contract.
address public immutable pages;
/*//////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
error Unauthorized();
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
/// @notice Sets the addresses of relevant contracts.
/// @param _artGobblers Address of the ArtGobblers contract.
/// @param _pages Address of the Pages contract.
constructor(address _artGobblers, address _pages) {
artGobblers = _artGobblers;
pages = _pages;
}
/*//////////////////////////////////////////////////////////////
MINT/BURN LOGIC
//////////////////////////////////////////////////////////////*/
/// @notice Requires caller address to match user address.
modifier only(address user) {
if (msg.sender != user) revert Unauthorized();
_;
}
/// @notice Mint any amount of goo to a user. Can only be called by ArtGobblers.
/// @param to The address of the user to mint goo to.
/// @param amount The amount of goo to mint.
function mintForGobblers(address to, uint256 amount) external only(artGobblers) {
_mint(to, amount);
}
/// @notice Burn any amount of goo from a user. Can only be called by ArtGobblers.
/// @param from The address of the user to burn goo from.
/// @param amount The amount of goo to burn.
function burnForGobblers(address from, uint256 amount) external only(artGobblers) {
_burn(from, amount);
}
/// @notice Burn any amount of goo from a user. Can only be called by Pages.
/// @param from The address of the user to burn goo from.
/// @param amount The amount of goo to burn.
function burnForPages(address from, uint256 amount) external only(pages) {
_burn(from, amount);
}
}