Skip to content

Instantly share code, notes, and snippets.

@Turupawn
Last active May 12, 2022 21:09
Show Gist options
  • Save Turupawn/82f5f56b14c9eec0e3e16f40f39d770b to your computer and use it in GitHub Desktop.
Save Turupawn/82f5f56b14c9eec0e3e16f40f39d770b to your computer and use it in GitHub Desktop.
Mai Bids
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "subtractedValue",
"type": "uint256"
}
],
"name": "decreaseAllowance",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "addedValue",
"type": "uint256"
}
],
"name": "increaseAllowance",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
]
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
contract MaitrixBids
{
struct BidHistoryLog
{
address sender;
uint amount;
uint timestamp;
}
mapping(uint => mapping(uint => BidHistoryLog)) bidHistory;
uint dummy;
constructor ()
{
}
// Helper
function getCurrentTokenMetadataURL() public pure returns(string memory)
{
return "https://api.funkycrocs.io/5";
}
function getCurrentPriceBid() public pure returns(uint)
{
return 150;
}
function getCurrentHistory(uint offset, uint size) public returns(BidHistoryLog[] memory)
{
BidHistoryLog[] memory currentBidHistory;
currentBidHistory[0].sender = 0x730bF3B67090511A64ABA060FbD2F7903536321E;
currentBidHistory[0].amount = 100;
currentBidHistory[0].timestamp = block.timestamp;
currentBidHistory[1].sender = 0x18747BE67c5886881075136eb678cEADaf808028;
currentBidHistory[1].amount = 110;
currentBidHistory[1].timestamp = block.timestamp + 1 hours;
currentBidHistory[2].sender = 0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1;
currentBidHistory[2].amount = 115;
currentBidHistory[2].timestamp = block.timestamp + 2 hours;
currentBidHistory[3].sender = 0xb6F5414bAb8d5ad8F33E37591C02f7284E974FcB;
currentBidHistory[3].amount = 140;
currentBidHistory[3].timestamp = block.timestamp + 3 hours;
currentBidHistory[4].sender = 0x730bF3B67090511A64ABA060FbD2F7903536321E;
currentBidHistory[4].amount = 150;
currentBidHistory[4].timestamp = block.timestamp + 4 hours;
return currentBidHistory;
}
function bid(uint amount, uint bidId) public
{
dummy = 1;
}
function getClaimableByAddress(address account) public pure returns(uint[] memory)
{
uint[] memory bidIds;
bidIds[0] = 2;
bidIds[1] = 3;
}
function claimAll() public
{
dummy = 1;
}
}
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "bidId",
"type": "uint256"
}
],
"name": "bid",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "claimAll",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "getClaimableByAddress",
"outputs": [
{
"internalType": "uint256[]",
"name": "",
"type": "uint256[]"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "offset",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "size",
"type": "uint256"
}
],
"name": "getCurrentHistory",
"outputs": [
{
"components": [
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
}
],
"internalType": "struct MaitrixBids.BidHistoryLog[]",
"name": "",
"type": "tuple[]"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "getCurrentPriceBid",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "getCurrentTokenMetadataURL",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "pure",
"type": "function"
}
]
@Turupawn
Copy link
Author

MAI (Test): 0x2aF56cb68BE0B92222Ff36e8A1E918E56A758903
MaiBids: 0x603FA2B49F4Ff7808C368aE36e2151242e8A75BC

@Turupawn
Copy link
Author

Screenshot from 2022-05-12 12-35-59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment