The Fund Redirector is a Sui Move smart contract designed to automatically split and redirect incoming funds between two predefined wallet addresses: SUIonCampus and SUINigeria. Each transaction is split 50/50 between these two recipients, providing a transparent and automated way to manage fund distribution.
- Automatic 50/50 split of any incoming funds
- Support for any coin type on the Sui network
- Transaction tracking and transparency
- Event emission for each redirection
- Public view functions for monitoring total redirected amounts
- SUIonCampus:
0x3f3347074d29f4b73dc07b42ddbf121aaec08832153ec0b497a46a1809d17342 - SUINigeria:
0x7a474eba3c09d6503e5735e701e3162d969317bc48c8b6a52c1f712612b6af2c
-
RedirectTracker
- Shared object that tracks:
- Total amount of funds redirected
- Total number of transactions processed
- Shared object that tracks:
-
FundRedirectEvent
- Emitted after each successful redirection with details:
- Total amount redirected
- Amount sent to SUIonCampus
- Amount sent to SUINigeria
- Timestamp (epoch)
- Emitted after each successful redirection with details:
public entry fun redirect_funds<T>(payment: Coin<T>, tracker: &mut RedirectTracker, ctx: &mut TxContext)- Main function for redirecting funds
- Generic type
Tallows for any coin type - Automatically splits the payment 50/50
- Updates tracking metrics
- Emits redirection event
- Transfers funds to recipient addresses
-
get_total_redirectedpublic fun get_total_redirected(tracker: &RedirectTracker): u64
- Returns the total amount of funds redirected through the contract
-
get_total_transactionspublic fun get_total_transactions(tracker: &RedirectTracker): u64
- Returns the total number of transactions processed
EZERO_AMOUNT(Code: 1): Thrown when attempting to redirect zero funds
// Assuming you have a coin of type 'SUI' and the tracker object
let my_coin = // ... your coin object
let tracker = // ... tracker object reference
// Redirect funds
redirect_funds(my_coin, tracker, ctx);The contract emits FundRedirectEvent for each redirection with the following information:
struct FundRedirectEvent {
amount: u64, // Total amount redirected
suioncampus_amount: u64, // Amount sent to SUIonCampus
suinigeria_amount: u64, // Amount sent to SUINigeria
timestamp: u64 // Epoch timestamp
}- Immutable recipient addresses
- Amount validation checks
- Transparent tracking of all transactions
- Public view functions for monitoring
- The contract splits funds exactly in half, with any remainder going to SUINigeria
- All transactions are permanent and irreversible
- The contract supports any coin type on the Sui network
- Transaction history and amounts are publicly viewable through events and tracker functions