From 88adf4641270de6b5173a848717e59b3a52356f6 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 15 Jan 2025 22:23:57 +0000 Subject: [PATCH] package-graphql-poller: update package data --- .../bcs.json | 160 ++++++++++++ .../bytecode_modules/staking.mv | Bin 0 -> 3258 bytes .../decompiled_modules/staking.move | 235 ++++++++++++++++++ .../metadata.json | 8 + 4 files changed, 403 insertions(+) create mode 100644 packages/mainnet/0x41/c34f3ad3ffb2a7de5d113334b2606c6067dd5379541fd1691023a4802dab3b/bcs.json create mode 100644 packages/mainnet/0x41/c34f3ad3ffb2a7de5d113334b2606c6067dd5379541fd1691023a4802dab3b/bytecode_modules/staking.mv create mode 100644 packages/mainnet/0x41/c34f3ad3ffb2a7de5d113334b2606c6067dd5379541fd1691023a4802dab3b/decompiled_modules/staking.move create mode 100644 packages/mainnet/0x41/c34f3ad3ffb2a7de5d113334b2606c6067dd5379541fd1691023a4802dab3b/metadata.json diff --git a/packages/mainnet/0x41/c34f3ad3ffb2a7de5d113334b2606c6067dd5379541fd1691023a4802dab3b/bcs.json b/packages/mainnet/0x41/c34f3ad3ffb2a7de5d113334b2606c6067dd5379541fd1691023a4802dab3b/bcs.json new file mode 100644 index 00000000000..60fff5dcb9c --- /dev/null +++ b/packages/mainnet/0x41/c34f3ad3ffb2a7de5d113334b2606c6067dd5379541fd1691023a4802dab3b/bcs.json @@ -0,0 +1,160 @@ +{ + "dataType": "package", + "id": "0x41c34f3ad3ffb2a7de5d113334b2606c6067dd5379541fd1691023a4802dab3b", + "version": 2, + "moduleMap": { + "staking": "oRzrCwYAAAANAQAUAhQ+A1KuAQSAAiwFrALDAgfvBIIGCPEKYAbRC1QKpQxhC4YNBgyMDZ0LDakYIA7JGDIAMQE+AhECFQIWAhkCHAInAjwCPQAGAgAABwwBAAEACAwBAAEADAQBAAEABAcAAAEHAAEKBwACAAQBAAEDAggABAMMAQABBwUHAAcLBAAJCQIAACIAAQEAABcCAQIAAAAPAwEBAAAwBAECAAA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Cgc2CxUKATcQFAsIFwoBNhAVCgc3CxQKATcNFAoBNw4UEQsKBzYMFQsHNhELAgsEOBILBjgTCgEuOAMKATcSFAoBNxAUCgE3ExQKATcUFAoBNwgUCwE3ChQSBTgLAgUBBAArUwsANwAUBwAhBAcFDwsBAQsDAQsCAQcDJwoDLhEcDAUKAQsCOA8KATcJCgU4EQQcBSILAQELAwEHBScKATYJCgU4EAwGCgY3CxQKBjcMFAoBNw0UCgE3DhQRCgoGNw8UFgwECgE2FQsENAsDOBQLBTgVCgY3CxQKATcNFAsBNw4UEQsKBjYMFTIAAAAAAAAAAAAAAAAAAAAACwY2DxUCBgEEAAEQCwIuERwHASEEBwULCwABBwInCwELADYWFQIHAAAALUUKAREPBugDAAAAAAAAGjUMAwoDCgA3FxQlBBELAAELAQECCgA3BhQyAAAAAAAAAAAAAAAAAAAAACEEHgsBAQsDCwA2FxUCCgA3GBQKADcGFAoANwMUCgA3BRQKADcWFAoANxcUCwERCAwCCgA3GBQKAiEEPAsAAQILAgoANhgVCwMLADYXFQIIAAAALRsLBQsGEQ8G6AMAAAAAAAAaNQsCEQkMBwsDCgcYDAgLBzIAAAAAAAAAAAAAAAAAAAAAIQQTCwACCwALCAsEGAsBGhYCCQAAAC0YCgEKAiUECQsBCwAXDAQFFgoACgImBBAyAAAAAAAAAAAAAAAAAAAAAAwDBRQLAgsAFwwDCwMMBAsEAgoAAAABCAsACwIYCwMaCwEXAgsAAAABBgsACwEYCwIaAgECAgICAwIGAgUCBAIBAgoCAAMAAwECCAIJAwMDAgIHABABEAIQAxAEEAUQBhAHEAMTCBMHEwkQChALEwwTDRAGEw4QAhMFEwQTARMMEA8QCxAA" + }, + "typeOriginTable": [ + { + "module_name": "staking", + "datatype_name": "STAKING", + "package": "0xa1d539afbc36f742a0f4a557c1c84eeead8952313e29a1e456f58433e9e61042" + }, + { + "module_name": "staking", + "datatype_name": "Staking", + "package": "0xa1d539afbc36f742a0f4a557c1c84eeead8952313e29a1e456f58433e9e61042" + }, + { + "module_name": "staking", + "datatype_name": "StakingPool", + "package": "0xa1d539afbc36f742a0f4a557c1c84eeead8952313e29a1e456f58433e9e61042" + }, + { + "module_name": "staking", + "datatype_name": "UserStake", + "package": "0xa1d539afbc36f742a0f4a557c1c84eeead8952313e29a1e456f58433e9e61042" + }, + { + "module_name": "staking", + "datatype_name": "CreateStakingEvent", + "package": "0xa1d539afbc36f742a0f4a557c1c84eeead8952313e29a1e456f58433e9e61042" + }, + { + "module_name": "staking", + "datatype_name": "ChangeStakingPoolEvent", + "package": "0xa1d539afbc36f742a0f4a557c1c84eeead8952313e29a1e456f58433e9e61042" + } + ], + "linkageTable": { + "0x0000000000000000000000000000000000000000000000000000000000000001": { + "upgraded_id": "0x0000000000000000000000000000000000000000000000000000000000000001", + "upgraded_version": 13 + }, + "0x0000000000000000000000000000000000000000000000000000000000000002": { + "upgraded_id": "0x0000000000000000000000000000000000000000000000000000000000000002", + "upgraded_version": 30 + } + }, + "functionMap": { + "staking": { + "add_reward_pool": { + "visibility": "PUBLIC", + "is_entry": true, + "params": [ + "&mut 0xa1d539afbc36f742a0f4a557c1c84eeead8952313e29a1e456f58433e9e61042::staking::StakingPool<$0>", + "0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<$0>", + "&mut 0x0000000000000000000000000000000000000000000000000000000000000002::tx_context::TxContext" + ], + "return": null + }, + "cal_acc_token_per_share": { + "visibility": "PRIVATE", + "is_entry": false, + "params": [ + "u128", + "u128", + "u128", + "u128", + "u128", + "u128", + "&0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock" + ], + "return": null + }, + "cal_pending_reward": { + "visibility": "PRIVATE", + "is_entry": false, + "params": [ + "u128", + "u128", + "u128", + "u128" + ], + "return": null + }, + "create_staking_pool": { + "visibility": "PUBLIC", + "is_entry": true, + "params": [ + "&mut 0xa1d539afbc36f742a0f4a557c1c84eeead8952313e29a1e456f58433e9e61042::staking::Staking<$0>", + "0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<$1>", + "u128", + "u128", + "&mut 0x0000000000000000000000000000000000000000000000000000000000000002::tx_context::TxContext" + ], + "return": null + }, + "get_multiplier": { + "visibility": "PRIVATE", + "is_entry": false, + "params": [ + "u128", + "u128", + "u128" + ], + "return": null + }, + "init_module": { + "visibility": "PUBLIC", + "is_entry": true, + "params": [ + "&mut 0x0000000000000000000000000000000000000000000000000000000000000002::tx_context::TxContext" + ], + "return": null + }, + "reward_debt": { + "visibility": "PRIVATE", + "is_entry": false, + "params": [ + "u128", + "u128", + "u128" + ], + "return": null + }, + "stake_suai": { + "visibility": "PUBLIC", + "is_entry": true, + "params": [ + "&mut 0xa1d539afbc36f742a0f4a557c1c84eeead8952313e29a1e456f58433e9e61042::staking::Staking<$0>", + "&mut 0xa1d539afbc36f742a0f4a557c1c84eeead8952313e29a1e456f58433e9e61042::staking::StakingPool<$1>", + "0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<$0>", + "&0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock", + "&mut 0x0000000000000000000000000000000000000000000000000000000000000002::tx_context::TxContext" + ], + "return": null + }, + "update_pool": { + "visibility": "PRIVATE", + "is_entry": false, + "params": [ + "&mut 0xa1d539afbc36f742a0f4a557c1c84eeead8952313e29a1e456f58433e9e61042::staking::StakingPool<$0>", + "&0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock" + ], + "return": null + }, + "update_precision_factor": { + "visibility": "PUBLIC", + "is_entry": true, + "params": [ + "&mut 0xa1d539afbc36f742a0f4a557c1c84eeead8952313e29a1e456f58433e9e61042::staking::StakingPool<$0>", + "u128", + "&mut 0x0000000000000000000000000000000000000000000000000000000000000002::tx_context::TxContext" + ], + "return": null + } + } + } +} \ No newline at end of file diff --git a/packages/mainnet/0x41/c34f3ad3ffb2a7de5d113334b2606c6067dd5379541fd1691023a4802dab3b/bytecode_modules/staking.mv b/packages/mainnet/0x41/c34f3ad3ffb2a7de5d113334b2606c6067dd5379541fd1691023a4802dab3b/bytecode_modules/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GxLs@JBUicQvu^W2B1^uWj*cV^>yXNJD0)8lky?8fm~)gN5A4 zP!Iy)>JVa(mt3k*4=Q!2LI-QKMFK-x0Fh=ffQAOpumB=KJr3w*s23(-O}w-hOoO&$ z(BPpV6qZ)_Orkfg832WA|QK9EL+SxL}vDs@ZE)3AP z0l2ByrW(|>D*>tnMz*xmt2L{{iYiL3u$X}rw!FZ=0QbBmAaz4Zx$R1i_%g=nxxn5G zDWDB&@@(VVCa?`?V>2ieW}xs>@BB}N7l(149VjTmI$P$a%59JwWCbk+q%1YL7Oo>%c(=xVcsWaU@j$YC+3o z5O~wD=i#(Kf?=~H+Z13=;3OC=AcbR^7y&{M0Wo6FkYiN@_OI7!68MTm&s^2`@#{e0 z>Z7f8aE8@wErDtWLvj3YuCkNGWdUF9rsZ_(oh)u=aeIp^+Ok+1f~~`MP{|>y>?Lqa z42*l7CRB;SfwI9YLDdkCg=0wFapBWR%Z{szJeKJy^9>>f8D&_<;BE`Pw!l$GV@=L5 z$3UuWm%-6MnyfSL*nF4r0Cpcp)KHfh22sJsy#kMfZ&cHUHF=ZhY~?J zVKC4HQA9CO#Gz2~K~)cmxJNzaaZh;CqrUQ`?|9lXzUx;!;a8!^bD#OxcfFctJoI0G CO~r)( literal 0 HcmV?d00001 diff --git a/packages/mainnet/0x41/c34f3ad3ffb2a7de5d113334b2606c6067dd5379541fd1691023a4802dab3b/decompiled_modules/staking.move b/packages/mainnet/0x41/c34f3ad3ffb2a7de5d113334b2606c6067dd5379541fd1691023a4802dab3b/decompiled_modules/staking.move new file mode 100644 index 00000000000..1a72bfbc28e --- /dev/null +++ b/packages/mainnet/0x41/c34f3ad3ffb2a7de5d113334b2606c6067dd5379541fd1691023a4802dab3b/decompiled_modules/staking.move @@ -0,0 +1,235 @@ +module 0xa1d539afbc36f742a0f4a557c1c84eeead8952313e29a1e456f58433e9e61042::staking { + struct STAKING has drop { + dummy_field: bool, + } + + struct Staking has store, key { + id: 0x2::object::UID, + admin: address, + version: u64, + } + + struct StakingPool has store, key { + id: 0x2::object::UID, + total_suai_stake: u128, + total_reward_token: 0x2::balance::Balance, + total_reward: u128, + reward_per_second: u128, + start_time: u128, + end_time: u128, + last_reward_time: u128, + acc_token_per_share: u128, + precision_factor: u128, + total_user: u64, + } + + struct UserStake has store { + suai_stake: u128, + reward_debt: u128, + suai: 0x2::balance::Balance, + pending_reward: u128, + } + + struct CreateStakingEvent has copy, drop, store { + pid: 0x2::object::ID, + token_address: 0x1::type_name::TypeName, + start_time: u128, + end_time: u128, + sender: address, + total_reward: u128, + reward_per_second: u128, + } + + struct ChangeStakingPoolEvent has copy, drop, store { + pid: 0x2::object::ID, + total_reward: u128, + total_suai_stake: u128, + reward_per_second: u128, + start_time: u128, + end_time: u128, + total_user: u64, + } + + public entry fun add_reward_pool(arg0: &mut StakingPool, arg1: 0x2::coin::Coin, arg2: &mut 0x2::tx_context::TxContext) { + 0x2::balance::join(&mut arg0.total_reward_token, 0x2::coin::into_balance(arg1)); + arg0.total_reward = arg0.total_reward + (0x2::coin::value(&arg1) as u128); + arg0.reward_per_second = arg0.total_reward / (arg0.end_time - arg0.start_time); + let v0 = ChangeStakingPoolEvent{ + pid : 0x2::object::id>(arg0), + total_reward : arg0.total_reward, + total_suai_stake : arg0.total_suai_stake, + reward_per_second : arg0.reward_per_second, + start_time : arg0.start_time, + end_time : arg0.end_time, + total_user : arg0.total_user, + }; + 0x2::event::emit(v0); + } + + fun cal_acc_token_per_share(arg0: u128, arg1: u128, arg2: u128, arg3: u128, arg4: u128, arg5: u128, arg6: &0x2::clock::Clock) : u128 { + let v0 = get_multiplier(arg5, ((0x2::clock::timestamp_ms(arg6) / 1000) as u128), arg2); + if (v0 == 0) { + return arg0 + }; + arg0 + arg3 * v0 * arg4 / arg1 + } + + fun cal_pending_reward(arg0: u128, arg1: u128, arg2: u128, arg3: u128) : u128 { + arg0 * arg2 / arg3 - arg1 + } + + public entry fun create_staking_pool(arg0: &mut Staking, arg1: 0x2::coin::Coin, arg2: u128, arg3: u128, arg4: &mut 0x2::tx_context::TxContext) { + let v0 = 0x2::tx_context::sender(arg4); + assert!(v0 == @0xf2db7827e4f6ea694f3f1526a7d61b802bdd8fddc176ac86a37db250703090fc, 2); + assert!(arg0.version == 1, 3); + let v1 = (0x2::coin::value(&arg1) as u128); + let v2 = StakingPool{ + id : 0x2::object::new(arg4), + total_suai_stake : 0, + total_reward_token : 0x2::coin::into_balance(arg1), + total_reward : v1, + reward_per_second : v1 / (arg3 - arg2), + start_time : arg2, + end_time : arg3, + last_reward_time : arg2, + acc_token_per_share : 0, + precision_factor : 1, + total_user : 0, + }; + let v3 = CreateStakingEvent{ + pid : 0x2::object::id>(&v2), + token_address : 0x1::type_name::get(), + start_time : arg2, + end_time : arg3, + sender : v0, + total_reward : v1, + reward_per_second : v1 / (arg3 - arg2), + }; + 0x2::event::emit(v3); + 0x2::transfer::share_object>(v2); + } + + fun get_multiplier(arg0: u128, arg1: u128, arg2: u128) : u128 { + if (arg1 <= arg2) { + arg1 - arg0 + } else if (arg0 >= arg2) { + 0 + } else { + arg2 - arg0 + } + } + + public entry fun init_module(arg0: &mut 0x2::tx_context::TxContext) { + assert!(0x2::tx_context::sender(arg0) == @0xf2db7827e4f6ea694f3f1526a7d61b802bdd8fddc176ac86a37db250703090fc, 2); + let v0 = Staking{ + id : 0x2::object::new(arg0), + admin : @0xf2db7827e4f6ea694f3f1526a7d61b802bdd8fddc176ac86a37db250703090fc, + version : 1, + }; + 0x2::transfer::share_object>(v0); + } + + fun reward_debt(arg0: u128, arg1: u128, arg2: u128) : u128 { + arg0 * arg1 / arg2 + } + + public entry fun stake_suai(arg0: &mut Staking, arg1: &mut StakingPool, arg2: 0x2::coin::Coin, arg3: &0x2::clock::Clock, arg4: &mut 0x2::tx_context::TxContext) { + assert!(arg0.version == 1, 3); + let v0 = 0x2::tx_context::sender(arg4); + assert!(arg1.end_time > ((0x2::clock::timestamp_ms(arg3) / 1000) as u128), 4); + if (!0x2::dynamic_field::exists_
(&arg1.id, v0)) { + let v1 = UserStake{ + suai_stake : 0, + reward_debt : 0, + suai : 0x2::balance::zero(), + pending_reward : 0, + }; + 0x2::dynamic_field::add>(&mut arg1.id, v0, v1); + arg1.total_user = arg1.total_user + 1; + }; + update_pool(arg1, arg3); + let v2 = 0x2::dynamic_field::borrow_mut>(&mut arg1.id, v0); + if (v2.suai_stake > 0) { + v2.pending_reward = v2.pending_reward + cal_pending_reward(v2.suai_stake, v2.reward_debt, arg1.acc_token_per_share, arg1.precision_factor); + }; + let v3 = (0x2::coin::value(&arg2) as u128); + v2.suai_stake = v2.suai_stake + v3; + arg1.total_suai_stake = arg1.total_suai_stake + v3; + 0x2::balance::join(&mut v2.suai, 0x2::coin::into_balance(arg2)); + v2.reward_debt = reward_debt(v2.suai_stake, arg1.acc_token_per_share, arg1.precision_factor); + let v4 = ChangeStakingPoolEvent{ + pid : 0x2::object::id>(arg1), + total_reward : arg1.total_reward, + total_suai_stake : arg1.total_suai_stake, + reward_per_second : arg1.reward_per_second, + start_time : arg1.start_time, + end_time : arg1.end_time, + total_user : arg1.total_user, + }; + 0x2::event::emit(v4); + } + + fun update_pool(arg0: &mut StakingPool, arg1: &0x2::clock::Clock) { + let v0 = ((0x2::clock::timestamp_ms(arg1) / 1000) as u128); + if (v0 <= arg0.last_reward_time) { + return + }; + if (arg0.total_suai_stake == 0) { + arg0.last_reward_time = v0; + return + }; + let v1 = cal_acc_token_per_share(arg0.acc_token_per_share, arg0.total_suai_stake, arg0.end_time, arg0.reward_per_second, arg0.precision_factor, arg0.last_reward_time, arg1); + if (arg0.acc_token_per_share == v1) { + return + }; + arg0.acc_token_per_share = v1; + arg0.last_reward_time = v0; + } + + public entry fun update_precision_factor(arg0: &mut StakingPool, arg1: u128, arg2: &mut 0x2::tx_context::TxContext) { + assert!(0x2::tx_context::sender(arg2) == @0xf2db7827e4f6ea694f3f1526a7d61b802bdd8fddc176ac86a37db250703090fc, 2); + arg0.precision_factor = arg1; + } + + public entry fun withdraw_reward(arg0: &mut Staking, arg1: &mut StakingPool, arg2: &0x2::clock::Clock, arg3: &mut 0x2::tx_context::TxContext) { + assert!(arg0.version == 1, 3); + let v0 = 0x2::tx_context::sender(arg3); + update_pool(arg1, arg2); + assert!(0x2::dynamic_field::exists_with_type>(&arg1.id, v0), 5); + let v1 = 0x2::dynamic_field::borrow_mut>(&mut arg1.id, v0); + 0x2::transfer::public_transfer<0x2::coin::Coin>(0x2::coin::take(&mut arg1.total_reward_token, ((cal_pending_reward(v1.suai_stake, v1.reward_debt, arg1.acc_token_per_share, arg1.precision_factor) + v1.pending_reward) as u64), arg3), v0); + v1.reward_debt = reward_debt(v1.suai_stake, arg1.acc_token_per_share, arg1.precision_factor); + v1.pending_reward = 0; + } + + public entry fun withdraw_suai(arg0: &mut Staking, arg1: &mut StakingPool, arg2: u64, arg3: &0x2::clock::Clock, arg4: &mut 0x2::tx_context::TxContext) { + assert!(arg0.version == 1, 3); + let v0 = 0x2::tx_context::sender(arg4); + update_pool(arg1, arg3); + assert!(0x2::dynamic_field::exists_with_type>(&arg1.id, v0), 5); + let v1 = 0x2::dynamic_field::borrow_mut>(&mut arg1.id, v0); + let v2 = (arg2 as u128); + assert!(v1.suai_stake >= v2, 1); + let v3 = cal_pending_reward(v1.suai_stake, v1.reward_debt, arg1.acc_token_per_share, arg1.precision_factor); + if (v3 > 0) { + v1.pending_reward = v1.pending_reward + v3; + }; + v1.suai_stake = v1.suai_stake - v2; + arg1.total_suai_stake = arg1.total_suai_stake - v2; + v1.reward_debt = reward_debt(v1.suai_stake, arg1.acc_token_per_share, arg1.precision_factor); + 0x2::transfer::public_transfer<0x2::coin::Coin>(0x2::coin::take(&mut v1.suai, arg2, arg4), v0); + let v4 = ChangeStakingPoolEvent{ + pid : 0x2::object::id>(arg1), + total_reward : arg1.total_reward, + total_suai_stake : arg1.total_suai_stake, + reward_per_second : arg1.reward_per_second, + start_time : arg1.start_time, + end_time : arg1.end_time, + total_user : arg1.total_user, + }; + 0x2::event::emit(v4); + } + + // decompiled from Move bytecode v6 +} + diff --git a/packages/mainnet/0x41/c34f3ad3ffb2a7de5d113334b2606c6067dd5379541fd1691023a4802dab3b/metadata.json b/packages/mainnet/0x41/c34f3ad3ffb2a7de5d113334b2606c6067dd5379541fd1691023a4802dab3b/metadata.json new file mode 100644 index 00000000000..9df3d09b056 --- /dev/null +++ b/packages/mainnet/0x41/c34f3ad3ffb2a7de5d113334b2606c6067dd5379541fd1691023a4802dab3b/metadata.json @@ -0,0 +1,8 @@ +{ + "id": "0x41c34f3ad3ffb2a7de5d113334b2606c6067dd5379541fd1691023a4802dab3b", + "originalPackageId": "0xa1d539afbc36f742a0f4a557c1c84eeead8952313e29a1e456f58433e9e61042", + "version": 2, + "sender": "0xf2db7827e4f6ea694f3f1526a7d61b802bdd8fddc176ac86a37db250703090fc", + "transactionDigest": "4xpw4HBa3YQssomkYEaSiMeKFAmWH1MfoJZvoHWo7e6v", + "checkpoint": 101939080 +} \ No newline at end of file