@water-cooler-studios/monad-contracts-core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,95 @@
1
+ Business Source License 1.1
2
+
3
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
4
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
5
+
6
+ -----------------------------------------------------------------------------
7
+
8
+ Parameters
9
+
10
+ Licensor: Water Cooler Studios
11
+
12
+ Licensed Work: Kintsu Contracts Core
13
+
14
+ Change Date: 2027-25-12
15
+
16
+ Change License: GNU General Public License v2.0 or later
17
+
18
+ -----------------------------------------------------------------------------
19
+
20
+ Terms
21
+
22
+ The Licensor hereby grants you the right to copy, modify, create derivative
23
+ works, redistribute, and make non-production use of the Licensed Work. The
24
+ Licensor may make an Additional Use Grant, above, permitting limited
25
+ production use.
26
+
27
+ Effective on the Change Date, or the fourth anniversary of the first publicly
28
+ available distribution of a specific version of the Licensed Work under this
29
+ License, whichever comes first, the Licensor hereby grants you rights under
30
+ the terms of the Change License, and the rights granted in the paragraph
31
+ above terminate.
32
+
33
+ If your use of the Licensed Work does not comply with the requirements
34
+ currently in effect as described in this License, you must purchase a
35
+ commercial license from the Licensor, its affiliated entities, or authorized
36
+ resellers, or you must refrain from using the Licensed Work.
37
+
38
+ All copies of the original and modified Licensed Work, and derivative works
39
+ of the Licensed Work, are subject to this License. This License applies
40
+ separately for each version of the Licensed Work and the Change Date may vary
41
+ for each version of the Licensed Work released by Licensor.
42
+
43
+ You must conspicuously display this License on each original or modified copy
44
+ of the Licensed Work. If you receive the Licensed Work in original or
45
+ modified form from a third party, the terms and conditions set forth in this
46
+ License apply to your use of that work.
47
+
48
+ Any use of the Licensed Work in violation of this License will automatically
49
+ terminate your rights under this License for the current and all other
50
+ versions of the Licensed Work.
51
+
52
+ This License does not grant you any right in any trademark or logo of
53
+ Licensor or its affiliates (provided that you may use a trademark or logo of
54
+ Licensor as expressly required by this License).
55
+
56
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
57
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
58
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
59
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
60
+ TITLE.
61
+
62
+ MariaDB hereby grants you permission to use this License’s text to license
63
+ your works, and to refer to it using the trademark "Business Source License",
64
+ as long as you comply with the Covenants of Licensor below.
65
+
66
+ -----------------------------------------------------------------------------
67
+
68
+ Covenants of Licensor
69
+
70
+ In consideration of the right to use this License’s text and the "Business
71
+ Source License" name and trademark, Licensor covenants to MariaDB, and to all
72
+ other recipients of the licensed work to be provided by Licensor:
73
+
74
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
75
+ or a license that is compatible with GPL Version 2.0 or a later version,
76
+ where "compatible" means that software provided under the Change License can
77
+ be included in a program with software provided under GPL Version 2.0 or a
78
+ later version. Licensor may specify additional Change Licenses without
79
+ limitation.
80
+
81
+ 2. To either: (a) specify an additional grant of rights to use that does not
82
+ impose any additional restriction on the right granted in this License, as
83
+ the Additional Use Grant; or (b) insert the text "None".
84
+
85
+ 3. To specify a Change Date.
86
+
87
+ 4. Not to modify this License in any other way.
88
+
89
+ -----------------------------------------------------------------------------
90
+
91
+ Notice
92
+
93
+ The Business Source License (this document, or the "License") is not an Open
94
+ Source license. However, the Licensed Work will eventually be made available
95
+ under an Open Source License, as stated in this License.
package/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # Monad Contracts
2
+
3
+ ### Install Build Tools
4
+
5
+ ```shell
6
+ curl -L https://foundry.paradigm.xyz | bash
7
+ foundryup
8
+ forge soldeer install
9
+ ```
10
+
11
+ ### Build
12
+
13
+ ```shell
14
+ forge build
15
+ ```
16
+
17
+ ### Test
18
+
19
+ ```shell
20
+ forge test
21
+ ```
22
+
23
+ ### Deploy contracts locally
24
+
25
+ - Open new terminal and run
26
+ ```shell
27
+ anvil --code-size-limit 128000
28
+ ```
29
+ - Create `.env` file (if not already present) from [.env.local](.env.local) template
30
+ - Change `.env` file if desired, currently configured with default anvil wallet
31
+ - Deploy in separate terminal window with:
32
+ ```shell
33
+ forge script DeployCore --rpc-url anvil --broadcast
34
+ ```
35
+
36
+ ### Common commands
37
+ ```bash
38
+ cast call $SMON "balanceOf(address)(uint256)" $ME
39
+ cast call $SMON "getAllUserUnlockRequests(address)((uint96,uint96,uint40,uint16)[])" $ME
40
+ cast send $SMON --private-key $PK "deposit(uint96,address)(uint96)" 0 $ME --value "1 ether"
41
+ cast send $SMON --private-key $PK "requestUnlock(uint96,uint96)(uint96)" "1 ether" 0
42
+ cast send $SMON --private-key $PK "redeem(uint256,address)(uint96)" 0 $ME
43
+ cast send $SMON --private-key $PK "submitBatch()"
44
+ cast send $SMON --private-key $PK "sweep(uint64[],uint8)" "[3]" 32
45
+ cast send $SMON --private-key $PK "compound(uint64[])" "[3]"
46
+ ```
47
+
48
+ ### Direct Staking Precompile Interactions
49
+ ```bash
50
+ cast call 0x0000000000000000000000000000000000001000 "getDelegator(uint64,address)(uint256,uint256,uint256,uint256,uint256,uint256,uint256)" 3 $ME
51
+ cast send --private-key $PK 0x0000000000000000000000000000000000001000 "delegate(uint64)(bool)" 3 --value "0.1 ether"
52
+ cast send --private-key $PK 0x0000000000000000000000000000000000001000 "undelegate(uint64,uint256,uint8)(bool)" 3 "0.1 ether" 0
53
+ cast send --private-key $PK 0x0000000000000000000000000000000000001000 "withdraw(uint64,uint8)(bool)" 3 0
54
+ ```